like2d 2.12.0 → 2.12.1
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 +3 -3
- package/dist/graphics/graphics.d.ts +3 -3
- package/dist/graphics/graphics.js +3 -3
- package/dist/graphics/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -2
- package/dist/input/gamepad.d.ts +1 -1
- package/dist/input/gamepad.js +1 -1
- package/dist/input/mouse.d.ts +7 -7
- package/dist/input/mouse.js +7 -7
- package/dist/like.d.ts +14 -7
- package/dist/math/rect.d.ts +1 -0
- package/dist/math/rect.js +1 -0
- package/dist/math/vector2.d.ts +3 -0
- package/dist/math/vector2.js +3 -0
- package/dist/scene.d.ts +5 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ To try Like2D quickly, use this starter with
|
|
|
70
70
|
hot reloading and a basic webpage.
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
|
-
npx degit
|
|
73
|
+
npx degit likeOrg/Like2D/examples/starter my-game
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
## Usage Example
|
|
@@ -144,9 +144,9 @@ LIKE's API is not the same as LOVE, but similar in spirit. Notable differences:
|
|
|
144
144
|
|
|
145
145
|
[JSR](https://jsr.io/@like2d/like)
|
|
146
146
|
|
|
147
|
-
[GitHub](https://github.com/
|
|
147
|
+
[GitHub](https://github.com/likeOrg/Like2D)
|
|
148
148
|
|
|
149
|
-
[Full Documentation](https://
|
|
149
|
+
[Full Documentation](https://likeorg.github.io/Like2D/api/documents/README.html)
|
|
150
150
|
|
|
151
151
|
## License
|
|
152
152
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* # Graphics Module
|
|
6
6
|
*
|
|
7
7
|
* A wrapper around browser Canvas.
|
|
8
|
-
* In standard usage `like.gfx` gives a {@link
|
|
8
|
+
* In standard usage `like.gfx` gives a {@link Graphics} object with a canvas already on it.
|
|
9
9
|
* So, you can for example call `like.gfx.rectangle('fill', 'green', [10, 10, 30, 30])`
|
|
10
10
|
*
|
|
11
11
|
* ## State Isolation
|
|
@@ -114,7 +114,7 @@ export declare class Graphics {
|
|
|
114
114
|
* @param mode Fill or line.
|
|
115
115
|
* @param color Fill or stroke color.
|
|
116
116
|
* @param position Center position.
|
|
117
|
-
* @param
|
|
117
|
+
* @param radius
|
|
118
118
|
* @param props Optional arc, center, and stroke properties. Center is true by default.
|
|
119
119
|
*/
|
|
120
120
|
circle(mode: DrawMode, color: Color, position: Vector2, radius: number, props?: ShapeProps & {
|
|
@@ -217,7 +217,7 @@ export declare class Graphics {
|
|
|
217
217
|
*
|
|
218
218
|
* Outside, it stays the same.
|
|
219
219
|
*
|
|
220
|
-
* @param
|
|
220
|
+
* @param context The context to call when drawing.
|
|
221
221
|
* @param callback Functions that will be called while drawing to the target.
|
|
222
222
|
*/
|
|
223
223
|
withRenderTarget(context: CanvasRenderingContext2D, callback: () => void): void;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* # Graphics Module
|
|
6
6
|
*
|
|
7
7
|
* A wrapper around browser Canvas.
|
|
8
|
-
* In standard usage `like.gfx` gives a {@link
|
|
8
|
+
* In standard usage `like.gfx` gives a {@link Graphics} object with a canvas already on it.
|
|
9
9
|
* So, you can for example call `like.gfx.rectangle('fill', 'green', [10, 10, 30, 30])`
|
|
10
10
|
*
|
|
11
11
|
* ## State Isolation
|
|
@@ -148,7 +148,7 @@ export class Graphics {
|
|
|
148
148
|
* @param mode Fill or line.
|
|
149
149
|
* @param color Fill or stroke color.
|
|
150
150
|
* @param position Center position.
|
|
151
|
-
* @param
|
|
151
|
+
* @param radius
|
|
152
152
|
* @param props Optional arc, center, and stroke properties. Center is true by default.
|
|
153
153
|
*/
|
|
154
154
|
circle(mode, color, position, radius, props) {
|
|
@@ -373,7 +373,7 @@ export class Graphics {
|
|
|
373
373
|
*
|
|
374
374
|
* Outside, it stays the same.
|
|
375
375
|
*
|
|
376
|
-
* @param
|
|
376
|
+
* @param context The context to call when drawing.
|
|
377
377
|
* @param callback Functions that will be called while drawing to the target.
|
|
378
378
|
*/
|
|
379
379
|
withRenderTarget(context, callback) {
|
package/dist/graphics/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
export type { Graphics } from "./graphics";
|
|
6
6
|
export type { Canvas } from "./canvas";
|
|
7
7
|
export type { ImageHandle } from './image';
|
|
8
|
-
export type { Color, DrawMode, ShapeProps, DrawProps, PrintProps, } from "./graphics";
|
|
8
|
+
export type { Color, DrawMode, ShapeProps, DrawProps, PrintProps, TransformProps, } from "./graphics";
|
|
9
9
|
export type { CanvasSize, CanvasModeOptions, } from "./canvas";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
*/
|
|
5
5
|
import type { Like } from './like';
|
|
6
|
-
export type { Like, TopLevelEventHandler, Callbacks, Callback } from './like';
|
|
6
|
+
export type { Like, LikeBase, TopLevelEventHandler, Callbacks, Callback } from './like';
|
|
7
7
|
export type { LikeEvent, EventType, EventMap, LikeCanvasElement, Dispatcher, LikeCanvasEventMap, LikeKeyboardEvent } from './events';
|
|
8
8
|
export type { Scene } from './scene';
|
|
9
9
|
export type { EngineProps } from './engine';
|
package/dist/index.js
CHANGED
package/dist/input/gamepad.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type GamepadTarget = number | "any";
|
|
|
12
12
|
*
|
|
13
13
|
* If you're planning on supporting gamepads, please include a
|
|
14
14
|
* way to generate {@link GamepadMapping} and set it with {@link Gamepad.setMapping}.
|
|
15
|
-
* Perhaps trigger it on {@link index.EventMap.gamepadconnected} events.
|
|
15
|
+
* Perhaps trigger it on {@link index.EventMap.gamepadconnected | gamepadconnected} events.
|
|
16
16
|
*
|
|
17
17
|
* If you don't want to make your own, take a look at {@link prefab-scenes.MapGamepad}
|
|
18
18
|
*
|
package/dist/input/gamepad.js
CHANGED
|
@@ -7,7 +7,7 @@ import { defaultMapping, fullButtonName, getSdlMapping, mapStick, standardButton
|
|
|
7
7
|
*
|
|
8
8
|
* If you're planning on supporting gamepads, please include a
|
|
9
9
|
* way to generate {@link GamepadMapping} and set it with {@link Gamepad.setMapping}.
|
|
10
|
-
* Perhaps trigger it on {@link index.EventMap.gamepadconnected} events.
|
|
10
|
+
* Perhaps trigger it on {@link index.EventMap.gamepadconnected | gamepadconnected} events.
|
|
11
11
|
*
|
|
12
12
|
* If you don't want to make your own, take a look at {@link prefab-scenes.MapGamepad}
|
|
13
13
|
*
|
package/dist/input/mouse.d.ts
CHANGED
|
@@ -98,13 +98,13 @@ export declare class Mouse {
|
|
|
98
98
|
* Avoid binding the `ESC` key in captured mode. This will exit the capture and
|
|
99
99
|
* reset mode to default.
|
|
100
100
|
*
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
* ### Note on `pos` vs `delta`
|
|
102
|
+
* Event {@link index.EventMap.mousemoved} passes both `pos` and `delta` args.
|
|
103
|
+
*
|
|
104
|
+
* Though the emulated cursor in locked mode
|
|
105
|
+
* (locked mode doesn't natively track absolute position)
|
|
106
|
+
* may be stuck on canvas edges, the `delta` field always
|
|
107
|
+
* represents mouse movement, even against edges.
|
|
108
108
|
*/
|
|
109
109
|
setMode(mode: MouseSetMode): void;
|
|
110
110
|
getMode(): MouseMode;
|
package/dist/input/mouse.js
CHANGED
|
@@ -200,13 +200,13 @@ export class Mouse {
|
|
|
200
200
|
* Avoid binding the `ESC` key in captured mode. This will exit the capture and
|
|
201
201
|
* reset mode to default.
|
|
202
202
|
*
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
203
|
+
* ### Note on `pos` vs `delta`
|
|
204
|
+
* Event {@link index.EventMap.mousemoved} passes both `pos` and `delta` args.
|
|
205
|
+
*
|
|
206
|
+
* Though the emulated cursor in locked mode
|
|
207
|
+
* (locked mode doesn't natively track absolute position)
|
|
208
|
+
* may be stuck on canvas edges, the `delta` field always
|
|
209
|
+
* represents mouse movement, even against edges.
|
|
210
210
|
*/
|
|
211
211
|
setMode(mode) {
|
|
212
212
|
this.lockPointer(mode.lock);
|
package/dist/like.d.ts
CHANGED
|
@@ -17,12 +17,11 @@ export type Callbacks = {
|
|
|
17
17
|
[K in EventType]?: Callback<K>;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
* The main
|
|
21
|
-
*
|
|
22
|
-
* This is the interface returned by {@link createLike}.
|
|
20
|
+
* The main modules and builtins of `like`, aside from {@link EventMap | optional callbacks}.
|
|
21
|
+
* @interface
|
|
23
22
|
*/
|
|
24
|
-
export type
|
|
25
|
-
/** Handle a pool of
|
|
23
|
+
export type LikeBase = {
|
|
24
|
+
/** Handle a pool of audio sources with global volume control and more. */
|
|
26
25
|
readonly audio: Audio;
|
|
27
26
|
/** Misc. time functions, including sleeping the game. ZZZ */
|
|
28
27
|
readonly timer: Timer;
|
|
@@ -76,7 +75,7 @@ export type Like = Callbacks & {
|
|
|
76
75
|
*
|
|
77
76
|
* Equivalent to `popScene` + `pushScene`.
|
|
78
77
|
*
|
|
79
|
-
|
|
78
|
+
* Use {@link index.Like | popScene} to clear away the current scene,
|
|
80
79
|
* and to possibly revert to callback mode.
|
|
81
80
|
*/
|
|
82
81
|
setScene(scene: Scene): void;
|
|
@@ -91,7 +90,7 @@ export type Like = Callbacks & {
|
|
|
91
90
|
* LIKE's runtime is built around calling handleEvent.
|
|
92
91
|
*
|
|
93
92
|
* This function recieves all events. If set to undefined,
|
|
94
|
-
|
|
93
|
+
* {@link index.Like | Like.callOwnHandlers} is the default behavior.
|
|
95
94
|
*
|
|
96
95
|
* Otherwise, you can really customize LIKE by setting this
|
|
97
96
|
* to a custom handler.
|
|
@@ -108,4 +107,12 @@ export type Like = Callbacks & {
|
|
|
108
107
|
*/
|
|
109
108
|
callOwnHandlers(event: LikeEvent): void;
|
|
110
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* The main Like instance.
|
|
112
|
+
* Use this object much how you would the `love` object in Love2D.
|
|
113
|
+
* This is the interface returned by {@link createLike}.
|
|
114
|
+
*
|
|
115
|
+
* Check out all the {@link EventMap | callbacks}.
|
|
116
|
+
*/
|
|
117
|
+
export type Like = Callbacks & LikeBase;
|
|
111
118
|
//# sourceMappingURL=like.d.ts.map
|
package/dist/math/rect.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ import { type Vector2 } from '../math/vector2';
|
|
|
41
41
|
*
|
|
42
42
|
* */
|
|
43
43
|
export type Rectangle = [number, number, number, number];
|
|
44
|
+
/** The full library of {@link Rectangle} functions. */
|
|
44
45
|
export declare const Rect: {
|
|
45
46
|
fromPoints(a: Vector2, b: Vector2): Rectangle;
|
|
46
47
|
fromCenter(center: Vector2, size: Vector2): Rectangle;
|
package/dist/math/rect.js
CHANGED
package/dist/math/vector2.d.ts
CHANGED
|
@@ -76,6 +76,9 @@ export type Vector2 = Pair<number>;
|
|
|
76
76
|
declare function map2x1<I, O>(op: (a: I) => O): (a: Pair<I>) => Pair<O>;
|
|
77
77
|
/** @see {@link Vec2.map2} */
|
|
78
78
|
declare function map2x2<I, O>(op: (a: I, b: I) => O): (a: Pair<I>, b: I | Pair<I>) => Pair<O>;
|
|
79
|
+
/**
|
|
80
|
+
* The full library of {@link Vector2} functions.
|
|
81
|
+
*/
|
|
79
82
|
export declare const Vec2: {
|
|
80
83
|
/**
|
|
81
84
|
* Turn a unary function into a pair-wise unary function.
|
package/dist/math/vector2.js
CHANGED
package/dist/scene.d.ts
CHANGED
|
@@ -19,9 +19,9 @@ import type { Like } from './like';
|
|
|
19
19
|
*
|
|
20
20
|
* There is a stack of scenes for state management and/or overlays.
|
|
21
21
|
*
|
|
22
|
-
* Use {@link
|
|
22
|
+
* Use {@link LikeBase.pushScene | pushScene} and {@link LikeBase.popScene | Like.popScene} to manage the stack.
|
|
23
23
|
*
|
|
24
|
-
* {@link
|
|
24
|
+
* {@link LikeBase.setScene | setScene} Sets the top of the stack only, replacing the current scene if any.
|
|
25
25
|
*
|
|
26
26
|
* ## Quick Start
|
|
27
27
|
*
|
|
@@ -46,7 +46,7 @@ import type { Like } from './like';
|
|
|
46
46
|
* like.pushScene(new MagicalGrowingRectangle(), false);
|
|
47
47
|
* ```
|
|
48
48
|
*
|
|
49
|
-
* To get back to global callbacks, just use {@link Like.popScene}
|
|
49
|
+
* To get back to global callbacks, just use {@link Like.popScene | like.popScene}
|
|
50
50
|
*
|
|
51
51
|
* ## Scene Lifecycle
|
|
52
52
|
*
|
|
@@ -122,6 +122,8 @@ import type { Like } from './like';
|
|
|
122
122
|
* opaque is whether or not the scene we've pushed
|
|
123
123
|
* on top of stays loaded.
|
|
124
124
|
*
|
|
125
|
+
* @interface
|
|
126
|
+
*
|
|
125
127
|
*/
|
|
126
128
|
export type Scene = {
|
|
127
129
|
[K in keyof EventMap]?: (like: Like, ...args: EventMap[K]) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "like2d",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.1",
|
|
4
4
|
"description": "A web-native game framework inspired by Love2D",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"license": "MIT",
|
|
64
64
|
"repository": {
|
|
65
65
|
"type": "git",
|
|
66
|
-
"url": "https://github.com/
|
|
66
|
+
"url": "https://github.com/likeOrg/Like2D"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"typescript": "^5.9.3"
|