like2d 2.0.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,7 +12,7 @@ Like2D is a thin, performant wrapper around the browser's Canvas and Web Audio A
12
12
  - **Stateless Graphics:** No more `ctx.save()` and `ctx.restore()` for colors and transforms.
13
13
  - **Fire-and-forget Assets:** Synchronous handles for images and audio that load in the background.
14
14
  - **Unified Input:** Normalized keyboard, mouse, and gamepad support with action mapping.
15
- - **Scaling Modes:** Built-in support for "fixed" resolution with pixel-perfect stretching.
15
+ - **Scaling Modes:** Built-in support for "pixel" resolution with pixel-perfect scaling.
16
16
  - **Flexible Patterns:** Use Love2D-style global callbacks or class-based scenes.
17
17
 
18
18
  ## Installation
@@ -33,7 +33,7 @@ Ideal for small games, jams, or prototyping.
33
33
  import { love, graphics, input } from 'like2d/callback';
34
34
 
35
35
  love.load = () => {
36
- love.setScaling({ mode: 'fixed', size: [800, 600] });
36
+ love.setMode({ pixelResolution: [800, 600] });
37
37
  input.map('jump', ['Space', 'ButtonBottom']);
38
38
  };
39
39
 
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+ <svg width="300mm" height="105mm" version="1.1" viewBox="0 0 300 105" xmlns="http://www.w3.org/2000/svg">
4
+ <rect x="10" y="11.23" width="280" height="83.544" fill="#e48080" stroke="#000" stroke-linejoin="round" stroke-width="2"/>
5
+ <g fill="none" stroke="#000" stroke-linejoin="round">
6
+ <rect x="97.484" y="11.23" width="52.516" height="46.237"/>
7
+ <rect x="150" y="11.23" width="35.011" height="46.237"/>
8
+ <rect x="185.01" y="11.23" width="52.516" height="46.237"/>
9
+ <rect x="237.53" y="11.23" width="52.516" height="46.237"/>
10
+ </g>
11
+ <g>
12
+ <rect x="132.49" y="11.23" width="17.505" height="27.461"/>
13
+ <rect x="150" y="29.302" width="8.7527" height="18.776"/>
14
+ <rect x="176.26" y="29.302" width="8.7527" height="18.776"/>
15
+ </g>
16
+ <rect x="150" y="11.23" width="17.505" height="8.6845" fill="none" stroke="#000" stroke-linejoin="round"/>
17
+ <rect x="167.51" y="11.23" width="17.505" height="8.6845" fill="none" stroke="#000" stroke-linejoin="round"/>
18
+ <g>
19
+ <path d="m237.53 38.691-17.505-9.3882 17.505-18.073z"/>
20
+ <rect x="202.88" y="48.079" width="16.772" height="9.3882"/>
21
+ <rect x="272.54" y="20.266" width="16.772" height="9.3882"/>
22
+ <rect x="272.54" y="38.691" width="16.772" height="9.3882"/>
23
+ <path d="m202.52 29.302 0.36685-18.073h17.139z"/>
24
+ </g>
25
+ <path d="m64.078 1.0042-33.375 33.375-0.01743 0.0174a23.612 23.612 0 0 0 0 33.392 23.612 23.612 0 0 0 30.012 2.8022 23.612 23.612 0 0 1 7e-3 0.57034 23.612 23.612 0 0 1-23.612 23.612h53.97a23.612 23.612 0 0 1-23.611-23.612 23.612 23.612 0 0 1 7e-3 -0.57034 23.612 23.612 0 0 0 30.012-2.8029 23.612 23.612 0 0 0-6.88e-4 -33.392z" fill="#80c3e4" stroke="#000" stroke-linejoin="round"/>
26
+ <g fill="none" stroke="#000" stroke-width=".5">
27
+ <circle transform="rotate(135)" cx="-20.988" cy="-93.243" r="23.612"/>
28
+ <circle transform="rotate(135)" cx="2.6238" cy="-69.632" r="23.612"/>
29
+ <circle cx="91.062" cy="71.161" r="23.612"/>
30
+ <circle cx="37.093" cy="71.161" r="23.612"/>
31
+ </g>
32
+ </svg>
@@ -25,7 +25,7 @@
25
25
  inkscape:document-units="mm"
26
26
  showgrid="false"
27
27
  inkscape:zoom="0.86565679"
28
- inkscape:cx="542.94035"
28
+ inkscape:cx="542.36275"
29
29
  inkscape:cy="116.09682"
30
30
  inkscape:window-width="1864"
31
31
  inkscape:window-height="1163"
@@ -60,73 +60,73 @@
60
60
  width="280"
61
61
  height="83.543648"
62
62
  x="10.000002"
63
- y="14.404639" />
63
+ y="11.229642" />
64
64
  <rect
65
65
  style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
66
66
  id="rect7"
67
67
  width="52.516361"
68
68
  height="46.237232"
69
69
  x="97.483658"
70
- y="14.404639" />
70
+ y="11.229642" />
71
71
  <rect
72
72
  style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.999998;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
73
73
  id="rect7-0"
74
74
  width="35.010902"
75
75
  height="46.237232"
76
76
  x="150"
77
- y="14.404639" />
77
+ y="11.229642" />
78
78
  <rect
79
79
  style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
80
80
  id="rect7-0-4"
81
81
  width="52.516361"
82
82
  height="46.237232"
83
83
  x="185.01091"
84
- y="14.404639" />
84
+ y="11.229642" />
85
85
  <rect
86
86
  style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
87
87
  id="rect7-9"
88
88
  width="52.516361"
89
89
  height="46.237232"
90
90
  x="237.52722"
91
- y="14.404639" />
91
+ y="11.229642" />
92
92
  <rect
93
93
  style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
94
94
  id="rect8"
95
95
  width="17.505455"
96
96
  height="27.460892"
97
97
  x="132.49457"
98
- y="14.404639" />
98
+ y="11.229642" />
99
99
  <rect
100
100
  style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
101
101
  id="rect9"
102
102
  width="8.7527285"
103
103
  height="18.776356"
104
104
  x="150"
105
- y="32.477341" />
105
+ y="29.302338" />
106
106
  <rect
107
107
  style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
108
108
  id="rect9-0"
109
109
  width="8.7527285"
110
110
  height="18.776356"
111
111
  x="176.25818"
112
- y="32.47736" />
112
+ y="29.302357" />
113
113
  <rect
114
114
  style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.999998;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
115
115
  id="rect11"
116
116
  width="17.505453"
117
117
  height="8.6845322"
118
118
  x="150"
119
- y="14.404639" />
119
+ y="11.229642" />
120
120
  <rect
121
121
  style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.999998;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
122
122
  id="rect11-4"
123
123
  width="17.505453"
124
124
  height="8.6845322"
125
125
  x="167.50545"
126
- y="14.404639" />
126
+ y="11.229642" />
127
127
  <path
128
128
  style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.999998;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
129
- d="m 237.52727,41.865535 -17.50544,-9.388181 v 0 l 17.50544,-18.072708 z"
129
+ d="m 237.52727,38.690533 -17.50544,-9.388181 v 0 l 17.50544,-18.072708 z"
130
130
  id="path11"
131
131
  sodipodi:nodetypes="ccccc" />
132
132
  <rect
@@ -135,54 +135,54 @@
135
135
  width="16.771759"
136
136
  height="9.388155"
137
137
  x="202.88322"
138
- y="51.253693" />
138
+ y="48.07869" />
139
139
  <rect
140
140
  style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.999998;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
141
141
  id="rect12-9-9"
142
142
  width="16.771759"
143
143
  height="9.388155"
144
144
  x="272.53812"
145
- y="23.44101" />
145
+ y="20.266006" />
146
146
  <rect
147
147
  style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.999998;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
148
148
  id="rect12-9-9-9"
149
149
  width="16.771759"
150
150
  height="9.388155"
151
151
  x="272.53812"
152
- y="41.865543" />
152
+ y="38.69054" />
153
153
  <path
154
154
  style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.999998;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
155
- d="m 202.51637,32.477354 0.36685,-18.072708 h 17.13859 z"
155
+ d="m 202.51637,29.302352 0.36685,-18.072708 h 17.13859 z"
156
156
  id="path12" />
157
157
  <path
158
158
  id="rect3"
159
159
  style="fill:#80c3e4;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
160
- d="m 64.077715,4.179157 -33.374839,33.374834 -0.01743,0.0174 a 23.611767,23.611767 0 0 0 0,33.392271 23.611767,23.611767 0 0 0 30.012041,2.802217 23.611767,23.611767 0 0 1 0.007,0.570339 23.611767,23.611767 0 0 1 -23.612067,23.612061 h 53.96995 a 23.611767,23.611767 0 0 1 -23.611369,-23.612061 23.611767,23.611767 0 0 1 0.007,-0.570339 23.611767,23.611767 0 0 0 30.012033,-2.802919 23.611767,23.611767 0 0 0 -6.88e-4,-33.392257 z" />
160
+ d="m 64.077715,1.0041568 -33.374839,33.3748322 -0.01743,0.0174 a 23.611767,23.611767 0 0 0 0,33.392271 23.611767,23.611767 0 0 0 30.012041,2.802217 23.611767,23.611767 0 0 1 0.007,0.570339 23.611767,23.611767 0 0 1 -23.612067,23.612061 h 53.96995 a 23.611767,23.611767 0 0 1 -23.611369,-23.612061 23.611767,23.611767 0 0 1 0.007,-0.570339 23.611767,23.611767 0 0 0 30.012033,-2.802919 23.611767,23.611767 0 0 0 -6.88e-4,-33.392257 z" />
161
161
  <circle
162
162
  style="fill:none;stroke:#000000;stroke-width:0.5;stroke-dasharray:none;stroke-opacity:1"
163
163
  id="path1"
164
- cx="-18.742947"
165
- cy="-95.488525"
164
+ cx="-20.988014"
165
+ cy="-93.243469"
166
166
  r="23.611769"
167
167
  transform="rotate(135)" />
168
168
  <circle
169
169
  style="fill:none;stroke:#000000;stroke-width:0.5;stroke-dasharray:none;stroke-opacity:1"
170
170
  id="path1-8"
171
- cx="4.8688235"
172
- cy="-71.87674"
171
+ cx="2.6237588"
172
+ cy="-69.631683"
173
173
  r="23.611769"
174
174
  transform="rotate(135)" />
175
175
  <circle
176
176
  style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-dasharray:none;stroke-opacity:1"
177
177
  id="path1-8-2"
178
178
  cx="91.062447"
179
- cy="74.336197"
179
+ cy="71.161194"
180
180
  r="23.611767" />
181
181
  <circle
182
182
  style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-dasharray:none;stroke-opacity:1"
183
183
  id="path1-8-2-3"
184
184
  cx="37.092701"
185
- cy="74.336197"
185
+ cy="71.161194"
186
186
  r="23.611767" />
187
187
  </g>
188
188
  </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "like2d",
3
- "version": "2.0.1",
3
+ "version": "2.2.0",
4
4
  "description": "A web-native game framework inspired by Love2D",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -26,13 +26,6 @@
26
26
  "README.md",
27
27
  "LICENSE"
28
28
  ],
29
- "scripts": {
30
- "build": "tsc && cp src/gamecontrollerdb.txt dist/",
31
- "typecheck": "tsc --noEmit",
32
- "lint": "echo 'No linting configured'",
33
- "clean": "rm -rf dist",
34
- "test": "vitest run"
35
- },
36
29
  "keywords": [
37
30
  "game",
38
31
  "framework",
@@ -46,5 +39,12 @@
46
39
  "license": "MIT",
47
40
  "devDependencies": {
48
41
  "typescript": "^5.9.3"
42
+ },
43
+ "scripts": {
44
+ "build": "tsc && cp src/gamecontrollerdb.txt dist/",
45
+ "typecheck": "tsc --noEmit",
46
+ "lint": "echo 'No linting configured'",
47
+ "clean": "rm -rf dist",
48
+ "test": "vitest run"
49
49
  }
50
- }
50
+ }