like2d 2.7.0 → 2.7.4
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 +50 -88
- package/dist/gamecontrollerdb.txt +2 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,8 +1,35 @@
|
|
|
1
1
|
# LÏKE2D
|
|
2
2
|
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
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>
|
|
6
33
|
|
|
7
34
|
A web-native 2D game framework inspired by [LÖVE](https://love2d.org/), built for simplicity and the modern web.
|
|
8
35
|
|
|
@@ -36,11 +63,7 @@ pnpm add like2d
|
|
|
36
63
|
|
|
37
64
|
[Like2D Starter Template](https://github.com/44100hertz/Like2D-starter)
|
|
38
65
|
|
|
39
|
-
## Usage
|
|
40
|
-
|
|
41
|
-
### Callback Pattern (Love2D-style)
|
|
42
|
-
|
|
43
|
-
Ideal for small games, jams, or prototyping.
|
|
66
|
+
## Usage Example
|
|
44
67
|
|
|
45
68
|
```typescript
|
|
46
69
|
import { createLike } from 'like2d';
|
|
@@ -67,91 +90,30 @@ like.draw = () => {
|
|
|
67
90
|
await like.start();
|
|
68
91
|
```
|
|
69
92
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
Ideal for larger projects with menus, levels, and explicit state management.
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
import { type Scene, StartupScene } from 'like2d';
|
|
76
|
-
import type { Like } from 'like2d';
|
|
77
|
-
|
|
78
|
-
class MyScene implements Scene {
|
|
79
|
-
load(like: Like) {
|
|
80
|
-
console.log('Scene loaded!');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
update(like: Like, dt: number) {
|
|
84
|
-
// update logic
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
draw(like: Like) {
|
|
88
|
-
like.gfx.clear([0.1, 0.1, 0.1, 1]);
|
|
89
|
-
like.gfx.print('white', 'Hello Like2D!', [20, 20]);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const like = createLike(document.body);
|
|
94
|
-
like.setScene(new StartupScene(new MyScene()));
|
|
95
|
-
await like.start();
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## Module Overview
|
|
93
|
+
## For Love2D Developers
|
|
99
94
|
|
|
100
|
-
|
|
95
|
+
LIKE's API is not the same as LOVE, but similar in spirit. Notable differences:
|
|
96
|
+
- Graphics have less state, there is no setColor getColor etc.
|
|
97
|
+
- Our APIs are, in general, a bit different. You'll have to learn some.
|
|
98
|
+
- You manage your own state; like is not global, but you can share it around for similar results. This allows multiple LIKE instances per webpage.
|
|
99
|
+
- We use Vector2 and Rect tuples (as in `[number, number]`) instead of loose coordinates.
|
|
100
|
+
- Theres an actions system -- `input.map` / `actionpressed` and `actionreleased` callbacks.
|
|
101
|
+
- Some things are missing either due to browser limitations or smaller scope.
|
|
101
102
|
|
|
102
|
-
|
|
103
|
-
import {
|
|
104
|
-
createLike, // Main entry point
|
|
105
|
-
type Scene, // Scene interface
|
|
106
|
-
StartupScene, // Built-in startup/loading scene
|
|
107
|
-
Vec2, Rect, // Math utilities
|
|
108
|
-
type Like // Core type
|
|
109
|
-
} from 'like2d';
|
|
110
|
-
```
|
|
103
|
+
## Feedback welcome
|
|
111
104
|
|
|
112
|
-
|
|
105
|
+
Before you report a bug:
|
|
106
|
+
1. Make sure you're on the latest release.
|
|
107
|
+
2. If the issue exists already, just comment on that one.
|
|
108
|
+
3. See if it happens in other web browsers.
|
|
113
109
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
class MyScene implements Scene {
|
|
121
|
-
load(like: Like) {
|
|
122
|
-
console.log('Scene loaded!');
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
update(like: Like, dt: number) {
|
|
126
|
-
// update logic
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
draw(like: Like) {
|
|
130
|
-
like.gfx.clear([0.1, 0.1, 0.1, 1]);
|
|
131
|
-
like.gfx.print('white', 'Hello Like2D!', [20, 20]);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const like = createLike(document.body);
|
|
136
|
-
like.setScene(new StartupScene(new MyScene()));
|
|
137
|
-
await like.start();
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## Module Overview
|
|
141
|
-
|
|
142
|
-
Everything imports from `'like2d'`:
|
|
143
|
-
|
|
144
|
-
```typescript
|
|
145
|
-
import {
|
|
146
|
-
createLike, // Main entry point
|
|
147
|
-
type Scene, // Scene interface
|
|
148
|
-
StartupScene, // Built-in startup/loading scene
|
|
149
|
-
Vec2, Rect, // Math utilities
|
|
150
|
-
type Like // Core type
|
|
151
|
-
} from 'like2d';
|
|
152
|
-
```
|
|
110
|
+
Before you request a feature:
|
|
111
|
+
1. ask: Would it make sense as a core feature, or should it be an external library?
|
|
112
|
+
2. See if the feature exists already.
|
|
113
|
+
3. Think about the demand for it overall. Make your case why game developers want it.
|
|
114
|
+
4. Consider just making a PR yourself, or sending a prompt/spec that an AI can hack on.
|
|
153
115
|
|
|
154
|
-
|
|
116
|
+
[Then, put your feedback on GitHub.](https://github.com/44100hertz/Like2D/issues)
|
|
155
117
|
|
|
156
118
|
## License
|
|
157
119
|
|
|
@@ -927,6 +927,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
|
|
927
927
|
03000000050b00000045000031000000,ASUS Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,
|
|
928
928
|
03000000050b00000579000000010000,ASUS ROG Kunai 3,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b14,leftshoulder:b6,leftstick:b15,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b42,paddle1:b9,paddle2:b11,rightshoulder:b7,rightstick:b16,righttrigger:a4,rightx:a2,righty:a3,start:b13,x:b3,y:b4,platform:Mac OS X,
|
|
929
929
|
03000000050b00000679000000010000,ASUS ROG Kunai 3,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b14,leftshoulder:b6,leftstick:b15,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b23,rightshoulder:b7,rightstick:b16,righttrigger:a4,rightx:a2,righty:a3,start:b13,x:b3,y:b4,platform:Mac OS X,
|
|
930
|
+
030000006a0e00001140000001000000,Atari CX Wireless Controller,a:b0,leftx:a0,lefty:a1,platform:Mac OS X,
|
|
930
931
|
03000000503200000110000045010000,Atari VCS Classic,a:b0,b:b1,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b3,start:b2,platform:Mac OS X,
|
|
931
932
|
03000000503200000110000047010000,Atari VCS Classic Controller,a:b0,b:b1,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b3,start:b2,platform:Mac OS X,
|
|
932
933
|
03000000503200000210000047010000,Atari VCS Modern Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a2,righty:a3,start:b8,x:b2,y:b3,platform:Mac OS X,
|
|
@@ -1273,6 +1274,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
|
|
1273
1274
|
05000000050b00000045000040000000,ASUS Gamepad,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b10,x:b2,y:b3,platform:Linux,
|
|
1274
1275
|
03000000050b00000579000011010000,ASUS ROG Kunai 3,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b36,paddle1:b52,paddle2:b53,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
|
1275
1276
|
05000000050b00000679000000010000,ASUS ROG Kunai 3,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b21,paddle1:b22,paddle2:b23,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
|
1277
|
+
030000006a0e00001140000010010000,Atari CX Wireless Controller,a:b0,leftx:a0,lefty:a1,platform:Linux,
|
|
1276
1278
|
03000000503200000110000000000000,Atari VCS Classic Controller,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,platform:Linux,
|
|
1277
1279
|
03000000503200000110000011010000,Atari VCS Classic Controller,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,platform:Linux,
|
|
1278
1280
|
05000000503200000110000000000000,Atari VCS Classic Controller,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,platform:Linux,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "like2d",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.4",
|
|
4
4
|
"description": "A web-native game framework inspired by Love2D",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
],
|
|
37
37
|
"author": "",
|
|
38
38
|
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://github.com/44100hertz/Like2D"
|
|
42
|
+
},
|
|
39
43
|
"devDependencies": {
|
|
40
44
|
"typescript": "^5.9.3"
|
|
41
45
|
}
|