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 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 44100hertz/Like2D/examples/starter my-game
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/44100hertz/Like2D)
147
+ [GitHub](https://github.com/likeOrg/Like2D)
148
148
 
149
- [Full Documentation](https://44100hertz.github.io/Like2D/api/documents/README.html)
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 BoundGraphics} object with a canvas already on it.
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 radii Radius (number) or [rx, ry] for ellipse.
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 canvas The canvas to draw to.
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 BoundGraphics} object with a canvas already on it.
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 radii Radius (number) or [rx, ry] for ellipse.
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 canvas The canvas to draw to.
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) {
@@ -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
@@ -6,8 +6,6 @@
6
6
  * Here are the top-level events, modules, and the scene system.
7
7
  *
8
8
  * See {@link createLike} to get started.
9
- *
10
- * @module like
11
9
  */
12
10
  import { Engine } from './engine';
13
11
  /**
@@ -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
  *
@@ -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
  *
@@ -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
- * ### 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.
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;
@@ -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
- * ### 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.
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 Like instance.
21
- * Use this object much how you would the `love` object in Love2D.
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 Like = Callbacks & {
25
- /** Handle a pool of pseudo-synchronous audio sources with global volume control and more. */
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
- * Use {@link popScene} to clear away the current scene,
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
- * {@link callOwnHandlers} is the default behavior.
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
@@ -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
@@ -1,4 +1,5 @@
1
1
  import { Vec2 } from '../math/vector2';
2
+ /** The full library of {@link Rectangle} functions. */
2
3
  export const Rect = {
3
4
  fromPoints(a, b) {
4
5
  const minX = Math.min(a[0], b[0]);
@@ -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.
@@ -15,6 +15,9 @@ function map2x2(op) {
15
15
  ? [op(a[0], b[0]), op(a[1], b[1])]
16
16
  : [op(a[0], b), op(a[1], b)];
17
17
  }
18
+ /**
19
+ * The full library of {@link Vector2} functions.
20
+ */
18
21
  export const Vec2 = {
19
22
  /**
20
23
  * Turn a unary function into a pair-wise unary function.
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 Like.pushScene} and {@link Like.popScene} to manage the stack.
22
+ * Use {@link LikeBase.pushScene | pushScene} and {@link LikeBase.popScene | Like.popScene} to manage the stack.
23
23
  *
24
- * {@link like.setScene} Sets the top of the stack only, replacing the current scene if any.
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.0",
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/44100hertz/Like2D"
66
+ "url": "https://github.com/likeOrg/Like2D"
67
67
  },
68
68
  "devDependencies": {
69
69
  "typescript": "^5.9.3"