like2d 2.10.1 → 2.11.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/dist/engine.d.ts +2 -2
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +3 -5
- package/dist/events.d.ts +20 -18
- package/dist/events.d.ts.map +1 -1
- package/dist/graphics/canvas.d.ts +4 -4
- package/dist/graphics/canvas.d.ts.map +1 -1
- package/dist/graphics/canvas.js +8 -5
- package/dist/graphics/{drawing.d.ts → graphics.d.ts} +41 -33
- package/dist/graphics/graphics.d.ts.map +1 -0
- package/dist/graphics/{drawing.js → graphics.js} +126 -109
- package/dist/graphics/index.d.ts +2 -13
- package/dist/graphics/index.d.ts.map +1 -1
- package/dist/graphics/index.js +1 -9
- package/dist/input/gamepad-mapping.js +1 -1
- package/dist/input/mouse.d.ts.map +1 -1
- package/dist/input/mouse.js +2 -1
- package/dist/like.d.ts +4 -2
- package/dist/like.d.ts.map +1 -1
- package/dist/timer/timer.d.ts.map +1 -1
- package/dist/timer/timer.js +1 -2
- package/package.json +1 -1
- package/dist/graphics/drawing.d.ts.map +0 -1
package/dist/engine.d.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @module engine
|
|
3
3
|
* @description Core game engine - lifecycle management and event dispatch.
|
|
4
4
|
*/
|
|
5
|
-
import type { EventType, EventMap, Dispatcher } from './events';
|
|
5
|
+
import type { EventType, EventMap, Dispatcher, LikeCanvasElement } from './events';
|
|
6
6
|
import type { Like } from './like';
|
|
7
7
|
export type EngineDispatcher = Dispatcher<EventType>;
|
|
8
8
|
export type EngineProps<T extends keyof EventMap> = {
|
|
9
|
-
canvas:
|
|
9
|
+
canvas: LikeCanvasElement;
|
|
10
10
|
abort: AbortSignal;
|
|
11
11
|
dispatch: Dispatcher<T>;
|
|
12
12
|
};
|
package/dist/engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAa,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAa,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC9F,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAInC,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;AACrD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,MAAM,QAAQ,IAAI;IAClD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;CACzB,CAAA;AAED;;;GAGG;AACH,qBAAa,MAAM;IAaL,OAAO,CAAC,SAAS;IAZ7B;4BACwB;IACxB,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,KAAK,CAAyB;IAEtC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;gBAEA,SAAS,EAAE,WAAW;IAqD1C,OAAO,CAAC,QAAQ;IAShB;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B5B;;OAEG;IACH,OAAO,IAAI,IAAI;CAIhB"}
|
package/dist/engine.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Timer } from './timer/timer';
|
|
|
8
8
|
import { Keyboard } from './input/keyboard';
|
|
9
9
|
import { Mouse } from './input/mouse';
|
|
10
10
|
import { Gamepad } from './input/gamepad';
|
|
11
|
-
import {
|
|
11
|
+
import { Graphics } from './graphics/index';
|
|
12
12
|
import { Canvas } from './graphics/canvas';
|
|
13
13
|
import { sceneDispatch } from './scene';
|
|
14
14
|
/**
|
|
@@ -61,17 +61,15 @@ export class Engine {
|
|
|
61
61
|
this.canvas = document.createElement('canvas');
|
|
62
62
|
const canvas = new Canvas(this.canvas, this.dispatch.bind(this), this.abort.signal);
|
|
63
63
|
this.canvas.addEventListener("like:updateRenderTarget", (event) => {
|
|
64
|
-
|
|
65
|
-
return;
|
|
66
|
-
this.like.gfx = bindGraphics(event.detail.target.getContext('2d'));
|
|
64
|
+
this.like.gfx.setContext(event.detail.target.getContext("2d"));
|
|
67
65
|
});
|
|
68
66
|
this.container.appendChild(this.canvas);
|
|
69
|
-
let gfx = bindGraphics(this.canvas.getContext('2d'));
|
|
70
67
|
const props = {
|
|
71
68
|
canvas: this.canvas,
|
|
72
69
|
dispatch: this.dispatch.bind(this),
|
|
73
70
|
abort: this.abort.signal,
|
|
74
71
|
};
|
|
72
|
+
const gfx = new Graphics(this.canvas.getContext('2d'));
|
|
75
73
|
const audio = new Audio();
|
|
76
74
|
const timer = new Timer(props);
|
|
77
75
|
const keyboard = new Keyboard(props);
|
package/dist/events.d.ts
CHANGED
|
@@ -5,24 +5,26 @@
|
|
|
5
5
|
import type { Vector2 } from './math/vector2';
|
|
6
6
|
import type { LikeButton } from './input';
|
|
7
7
|
export type MouseButton = 'left' | 'middle' | 'right';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
8
|
+
export type LikeCanvasEventMap = HTMLElementEventMap & {
|
|
9
|
+
'like:mousemoved': CustomEvent<{
|
|
10
|
+
pos: Vector2;
|
|
11
|
+
delta: Vector2;
|
|
12
|
+
}>;
|
|
13
|
+
'like:updateRenderTarget': CustomEvent<{
|
|
14
|
+
target: HTMLCanvasElement;
|
|
15
|
+
}>;
|
|
16
|
+
'like:resizeCanvas': CustomEvent<{
|
|
17
|
+
size: Vector2;
|
|
18
|
+
}>;
|
|
19
|
+
'like:preDraw': CustomEvent<{}>;
|
|
20
|
+
'like:postDraw': CustomEvent<{}>;
|
|
21
|
+
'like:update': CustomEvent<{
|
|
22
|
+
dt: number;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
export type LikeCanvasEvent = LikeCanvasEventMap;
|
|
26
|
+
export interface LikeCanvasElement extends HTMLCanvasElement {
|
|
27
|
+
addEventListener<K extends keyof LikeCanvasEventMap>(type: K, listener: (this: LikeCanvasElement, ev: LikeCanvasEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* The master type will all events on it.
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG;IACrD,iBAAiB,EAAE,WAAW,CAAC;Q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AEjH;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,SAAS,IAAI,CAAC,CAAC,SAAS,CAAC,EACxD,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,KACd,IAAI,CAAC;AAEV;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;KACrB,CAAC,IAAI,SAAS,GAAG;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;CACpE,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Dispatcher } from "../events";
|
|
1
|
+
import { type Dispatcher, type LikeCanvasElement } from "../events";
|
|
2
2
|
import { Rectangle } from "../math/rect";
|
|
3
3
|
import { type Vector2 } from "../math/vector2";
|
|
4
4
|
export type CanvasModeOptions = {
|
|
@@ -18,7 +18,7 @@ export declare class Canvas {
|
|
|
18
18
|
private resizeTimeoutId;
|
|
19
19
|
constructor(
|
|
20
20
|
/** The ultimately visible canvas in the browser */
|
|
21
|
-
displayCanvas:
|
|
21
|
+
displayCanvas: LikeCanvasElement, dispatch: Dispatcher<'resize'>, abort: AbortSignal);
|
|
22
22
|
/** Get a unified canvas info object. */
|
|
23
23
|
getMode(): {
|
|
24
24
|
size: Vector2;
|
|
@@ -59,7 +59,7 @@ export declare class Canvas {
|
|
|
59
59
|
/** Called every frame by the engine after drawing */
|
|
60
60
|
private postDraw;
|
|
61
61
|
/** @returns if size was changed. */
|
|
62
|
-
static setCanvasElemSize(canvas:
|
|
63
|
-
static getCanvasElemSize(canvas:
|
|
62
|
+
static setCanvasElemSize(canvas: LikeCanvasElement, newSize: Vector2): boolean;
|
|
63
|
+
static getCanvasElemSize(canvas: LikeCanvasElement): Vector2;
|
|
64
64
|
}
|
|
65
65
|
//# sourceMappingURL=canvas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/graphics/canvas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/graphics/canvas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAQ,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC;AACxD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE5C,qBAAa,MAAM;IAUX,mDAAmD;IACnD,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,KAAK;IAZjB;;;MAGE;IACF,OAAO,CAAC,YAAY,CAAoB;IAExC,OAAO,CAAC,eAAe,CAAU;;IAG7B,mDAAmD;IAC3C,aAAa,EAAE,iBAAiB,EAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,EAC9B,KAAK,EAAE,WAAW;IAoE9B,wCAAwC;IACxC,OAAO,IAAI;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,iBAAiB,CAAA;KAAE;IAStD;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,GAAE,OAAO,CAAC,iBAAiB,CAAM;IA6BhE,8CAA8C;IAC9C,OAAO,IAAI,OAAO;IAIlB,OAAO,CAAC,cAAc;IAWtB,wCAAwC;IACxC,OAAO,IAAI,SAAS;IAIpB,uDAAuD;IACvD,OAAO,CAAC,mBAAmB;IAO3B,yBAAyB;IACzB,aAAa,IAAI,OAAO;IAIxB,sBAAsB;IACtB,aAAa,CAAC,UAAU,EAAE,OAAO;IAWjC;;;OAGG;IACH,OAAO,CAAC,OAAO;IAmBf,qDAAqD;IACrD,OAAO,CAAC,QAAQ;IA2BhB,qCAAqC;IACzC,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO;IAU1E,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO;CAG/D"}
|
package/dist/graphics/canvas.js
CHANGED
|
@@ -208,11 +208,14 @@ export class Canvas {
|
|
|
208
208
|
}
|
|
209
209
|
/** @returns if size was changed. */
|
|
210
210
|
static setCanvasElemSize(canvas, newSize) {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
return
|
|
214
|
-
|
|
215
|
-
|
|
211
|
+
const ctx = canvas.getContext('2d');
|
|
212
|
+
if (!ctx)
|
|
213
|
+
return false;
|
|
214
|
+
if (canvas.width === newSize[0] && canvas.height === newSize[1])
|
|
215
|
+
return false;
|
|
216
|
+
canvas.width = newSize[0];
|
|
217
|
+
canvas.height = newSize[1];
|
|
218
|
+
return true;
|
|
216
219
|
}
|
|
217
220
|
static getCanvasElemSize(canvas) {
|
|
218
221
|
return [canvas.width, canvas.height];
|
|
@@ -75,43 +75,51 @@ export declare class ImageHandle {
|
|
|
75
75
|
* ```
|
|
76
76
|
*
|
|
77
77
|
*/
|
|
78
|
-
export declare
|
|
78
|
+
export declare class Graphics {
|
|
79
|
+
private ctx;
|
|
80
|
+
constructor(ctx: CanvasRenderingContext2D);
|
|
81
|
+
/**
|
|
82
|
+
* Set the 2d drawing context for graphics.
|
|
83
|
+
*
|
|
84
|
+
* Be aware that that `like` can set this value at any time.
|
|
85
|
+
*/
|
|
86
|
+
setContext(ctx: CanvasRenderingContext2D): void;
|
|
79
87
|
/**
|
|
80
88
|
* Clears the canvas with a solid color.
|
|
81
|
-
* @param ctx Canvas context.
|
|
89
|
+
* @param this.ctx Canvas context.
|
|
82
90
|
* @param color Fill color.
|
|
83
91
|
*/
|
|
84
|
-
clear(
|
|
92
|
+
clear(color?: Color): void;
|
|
85
93
|
/**
|
|
86
94
|
* Draws a rectangle.
|
|
87
|
-
* @param ctx Canvas context.
|
|
95
|
+
* @param this.ctx Canvas context.
|
|
88
96
|
* @param mode Fill or line.
|
|
89
97
|
* @param color Fill or stroke color.
|
|
90
98
|
* @param rect Rectangle [x, y, w, h].
|
|
91
99
|
* @param props Optional stroke properties.
|
|
92
100
|
*/
|
|
93
|
-
rectangle(
|
|
101
|
+
rectangle(mode: DrawMode, color: Color, rect: Rectangle, props?: ShapeProps): void;
|
|
94
102
|
/**
|
|
95
103
|
* Draws a circle or ellipse.
|
|
96
|
-
* @param ctx Canvas context.
|
|
104
|
+
* @param this.ctx Canvas context.
|
|
97
105
|
* @param mode Fill or line.
|
|
98
106
|
* @param color Fill or stroke color.
|
|
99
107
|
* @param position Center position.
|
|
100
108
|
* @param radii Radius (number) or [rx, ry] for ellipse.
|
|
101
109
|
* @param props Optional arc, center, and stroke properties. Center is true by default.
|
|
102
110
|
*/
|
|
103
|
-
circle(
|
|
111
|
+
circle(mode: DrawMode, color: Color, position: Vector2, radii: number | Vector2, props?: ShapeProps & {
|
|
104
112
|
arc?: [number, number];
|
|
105
113
|
center?: boolean;
|
|
106
114
|
}): void;
|
|
107
115
|
/**
|
|
108
116
|
* Draws connected line segments.
|
|
109
|
-
* @param ctx Canvas context.
|
|
117
|
+
* @param this.ctx Canvas context.
|
|
110
118
|
* @param color Stroke color.
|
|
111
119
|
* @param points Array of [x, y] positions.
|
|
112
120
|
* @param props Optional stroke properties.
|
|
113
121
|
*/
|
|
114
|
-
line(
|
|
122
|
+
line(color: Color, points: Vector2[], props?: ShapeProps): void;
|
|
115
123
|
/**
|
|
116
124
|
* Draws text at a position.
|
|
117
125
|
*
|
|
@@ -122,82 +130,82 @@ export declare const draw: {
|
|
|
122
130
|
* to the left and right of its position. If you align right, your position
|
|
123
131
|
* becomes the upper-right corner of the text.
|
|
124
132
|
*
|
|
125
|
-
* @param ctx Canvas context.
|
|
133
|
+
* @param this.ctx Canvas context.
|
|
126
134
|
* @param color Fill color.
|
|
127
135
|
* @param text Text string.
|
|
128
136
|
* @param position Top-left position.
|
|
129
137
|
* @param props {@link PrintProps} Optional font, text limit, or alignment.
|
|
130
138
|
*/
|
|
131
|
-
print(
|
|
139
|
+
print(color: Color, text: string, position: Vector2, props?: PrintProps): void;
|
|
132
140
|
/**
|
|
133
141
|
* Draws an image.
|
|
134
142
|
*
|
|
135
143
|
* @remarks named "draw" because it draws anything _drawable_
|
|
136
144
|
* in the long run.
|
|
137
145
|
*
|
|
138
|
-
* @param ctx Canvas context.
|
|
146
|
+
* @param this.ctx Canvas context.
|
|
139
147
|
* @param handle Image handle from newImage.
|
|
140
148
|
* @param position Draw position.
|
|
141
149
|
* @param props Optional rotation, scale, origin, or quad.
|
|
142
150
|
*/
|
|
143
|
-
draw(
|
|
151
|
+
draw(handle: ImageHandle, position: Vector2, props?: DrawProps): void;
|
|
144
152
|
/**
|
|
145
153
|
* Loads an image from a path.
|
|
146
154
|
* Unlike built-in loading, this pretends to be synchronous.
|
|
147
|
-
* @param ctx Canvas context.
|
|
155
|
+
* @param this.ctx Canvas context.
|
|
148
156
|
* @param path Image file path.
|
|
149
157
|
* @returns ImageHandle for use with draw.
|
|
150
158
|
*/
|
|
151
|
-
newImage(
|
|
159
|
+
newImage(path: string): ImageHandle;
|
|
152
160
|
/**
|
|
153
161
|
* Sets the clipping region.
|
|
154
|
-
* @param ctx Canvas context.
|
|
162
|
+
* @param this.ctx Canvas context.
|
|
155
163
|
* @param rect Clipping rectangle, or full canvas if omitted.
|
|
156
164
|
*/
|
|
157
|
-
clip(
|
|
165
|
+
clip(rect?: Rectangle): void;
|
|
158
166
|
/**
|
|
159
167
|
* Draws a polygon.
|
|
160
|
-
* @param ctx Canvas context.
|
|
168
|
+
* @param this.ctx Canvas context.
|
|
161
169
|
* @param mode Fill or line.
|
|
162
170
|
* @param color Fill or stroke color.
|
|
163
171
|
* @param points Array of [x, y] vertices.
|
|
164
172
|
* @param props Optional stroke properties.
|
|
165
173
|
*/
|
|
166
|
-
polygon(
|
|
174
|
+
polygon(mode: DrawMode, color: Color, points: Vector2[], props?: ShapeProps): void;
|
|
167
175
|
/**
|
|
168
176
|
* Draws individual pixels.
|
|
169
|
-
* @param ctx Canvas context.
|
|
177
|
+
* @param this.ctx Canvas context.
|
|
170
178
|
* @param color Fill color.
|
|
171
179
|
* @param pts Array of [x, y] positions.
|
|
172
180
|
*/
|
|
173
|
-
points(
|
|
181
|
+
points(color: Color, pts: Vector2[]): void;
|
|
174
182
|
/**
|
|
175
183
|
* Saves canvas state.
|
|
176
|
-
* @param ctx Canvas context.
|
|
184
|
+
* @param this.ctx Canvas context.
|
|
177
185
|
*/
|
|
178
|
-
push(
|
|
186
|
+
push(): void;
|
|
179
187
|
/**
|
|
180
188
|
* Restores canvas state.
|
|
181
|
-
* @param ctx Canvas context.
|
|
189
|
+
* @param this.ctx Canvas context.
|
|
182
190
|
*/
|
|
183
|
-
pop(
|
|
191
|
+
pop(): void;
|
|
184
192
|
/**
|
|
185
193
|
* Applies a translation.
|
|
186
|
-
* @param ctx Canvas context.
|
|
194
|
+
* @param this.ctx Canvas context.
|
|
187
195
|
* @param offset [x, y] offset.
|
|
188
196
|
*/
|
|
189
|
-
translate(
|
|
197
|
+
translate(offset: Vector2): void;
|
|
190
198
|
/**
|
|
191
199
|
* Applies a rotation.
|
|
192
|
-
* @param ctx Canvas context.
|
|
200
|
+
* @param this.ctx Canvas context.
|
|
193
201
|
* @param angle Rotation in radians.
|
|
194
202
|
*/
|
|
195
|
-
rotate(
|
|
203
|
+
rotate(angle: number): void;
|
|
196
204
|
/**
|
|
197
205
|
* Applies a scale.
|
|
198
|
-
* @param ctx Canvas context.
|
|
206
|
+
* @param this.ctx Canvas context.
|
|
199
207
|
* @param factor Scale factor (number or [x, y]).
|
|
200
208
|
*/
|
|
201
|
-
scale(
|
|
202
|
-
}
|
|
203
|
-
//# sourceMappingURL=
|
|
209
|
+
scale(factor: number | Vector2): void;
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=graphics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphics.d.ts","sourceRoot":"","sources":["../../src/graphics/graphics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAQ,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC;;;;GAIG;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC;AAE/D,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG;IACnC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF,qBAAa,WAAW;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC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AAW,EACnB,QAAQ,EAAE,OAAO,EACjB,KAAK,CAAC,EAAE,SAAS,GAChB,IAAI;IAuBP;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW;IAInC;;;;OAIG;IACH,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI;IAW5B;;;;;;;OAOG;IACH,OAAO,CACL,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,OAAO,EAAE,EACjB,KAAK,CAAC,EAAE,UAAU,GACjB,IAAI;IAkBP;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI;IAK1C;;;OAGG;IACH,IAAI,IAAI,IAAI;IAIZ;;;OAGG;IACH,GAAG,IAAI,IAAI;IAIX;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAKhC;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI3B;;;;OAIG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;CAItC"}
|
|
@@ -128,46 +128,62 @@ function getFontHeight(ctx) {
|
|
|
128
128
|
* ```
|
|
129
129
|
*
|
|
130
130
|
*/
|
|
131
|
-
export
|
|
131
|
+
export class Graphics {
|
|
132
|
+
constructor(ctx) {
|
|
133
|
+
Object.defineProperty(this, "ctx", {
|
|
134
|
+
enumerable: true,
|
|
135
|
+
configurable: true,
|
|
136
|
+
writable: true,
|
|
137
|
+
value: ctx
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Set the 2d drawing context for graphics.
|
|
142
|
+
*
|
|
143
|
+
* Be aware that that `like` can set this value at any time.
|
|
144
|
+
*/
|
|
145
|
+
setContext(ctx) {
|
|
146
|
+
this.ctx = ctx;
|
|
147
|
+
}
|
|
132
148
|
/**
|
|
133
149
|
* Clears the canvas with a solid color.
|
|
134
|
-
* @param ctx Canvas context.
|
|
150
|
+
* @param this.ctx Canvas context.
|
|
135
151
|
* @param color Fill color.
|
|
136
152
|
*/
|
|
137
|
-
clear(
|
|
138
|
-
ctx.fillStyle = parseColor(color);
|
|
139
|
-
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
140
|
-
}
|
|
153
|
+
clear(color = [0, 0, 0, 1]) {
|
|
154
|
+
this.ctx.fillStyle = parseColor(color);
|
|
155
|
+
this.ctx.fillRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
|
|
156
|
+
}
|
|
141
157
|
/**
|
|
142
158
|
* Draws a rectangle.
|
|
143
|
-
* @param ctx Canvas context.
|
|
159
|
+
* @param this.ctx Canvas context.
|
|
144
160
|
* @param mode Fill or line.
|
|
145
161
|
* @param color Fill or stroke color.
|
|
146
162
|
* @param rect Rectangle [x, y, w, h].
|
|
147
163
|
* @param props Optional stroke properties.
|
|
148
164
|
*/
|
|
149
|
-
rectangle(
|
|
165
|
+
rectangle(mode, color, rect, props) {
|
|
150
166
|
const c = applyColor(color);
|
|
151
167
|
if (mode === "fill") {
|
|
152
|
-
ctx.fillStyle = c;
|
|
153
|
-
ctx.fillRect(...rect);
|
|
168
|
+
this.ctx.fillStyle = c;
|
|
169
|
+
this.ctx.fillRect(...rect);
|
|
154
170
|
}
|
|
155
171
|
else {
|
|
156
|
-
setStrokeProps(ctx, props);
|
|
157
|
-
ctx.strokeStyle = c;
|
|
158
|
-
ctx.strokeRect(...rect);
|
|
172
|
+
setStrokeProps(this.ctx, props);
|
|
173
|
+
this.ctx.strokeStyle = c;
|
|
174
|
+
this.ctx.strokeRect(...rect);
|
|
159
175
|
}
|
|
160
|
-
}
|
|
176
|
+
}
|
|
161
177
|
/**
|
|
162
178
|
* Draws a circle or ellipse.
|
|
163
|
-
* @param ctx Canvas context.
|
|
179
|
+
* @param this.ctx Canvas context.
|
|
164
180
|
* @param mode Fill or line.
|
|
165
181
|
* @param color Fill or stroke color.
|
|
166
182
|
* @param position Center position.
|
|
167
183
|
* @param radii Radius (number) or [rx, ry] for ellipse.
|
|
168
184
|
* @param props Optional arc, center, and stroke properties. Center is true by default.
|
|
169
185
|
*/
|
|
170
|
-
circle(
|
|
186
|
+
circle(mode, color, position, radii, props) {
|
|
171
187
|
const center = (props && 'center' in props) ? props.center : true;
|
|
172
188
|
const c = applyColor(color);
|
|
173
189
|
const size = typeof radii === "number" ? [radii, radii] : radii;
|
|
@@ -175,43 +191,43 @@ export const draw = {
|
|
|
175
191
|
if (!center) {
|
|
176
192
|
position = Vec2.add(position, size);
|
|
177
193
|
}
|
|
178
|
-
ctx.save();
|
|
179
|
-
ctx.translate(...position);
|
|
180
|
-
ctx.scale(...size);
|
|
181
|
-
ctx.beginPath();
|
|
182
|
-
ctx.arc(0, 0, 1, startAngle, endAngle);
|
|
194
|
+
this.ctx.save();
|
|
195
|
+
this.ctx.translate(...position);
|
|
196
|
+
this.ctx.scale(...size);
|
|
197
|
+
this.ctx.beginPath();
|
|
198
|
+
this.ctx.arc(0, 0, 1, startAngle, endAngle);
|
|
183
199
|
if (mode == 'fill')
|
|
184
|
-
ctx.lineTo(0, 0);
|
|
185
|
-
ctx.closePath();
|
|
186
|
-
ctx.restore();
|
|
200
|
+
this.ctx.lineTo(0, 0);
|
|
201
|
+
this.ctx.closePath();
|
|
202
|
+
this.ctx.restore();
|
|
187
203
|
if (mode === "fill") {
|
|
188
|
-
ctx.fillStyle = c;
|
|
189
|
-
ctx.fill();
|
|
204
|
+
this.ctx.fillStyle = c;
|
|
205
|
+
this.ctx.fill();
|
|
190
206
|
}
|
|
191
207
|
else {
|
|
192
|
-
setStrokeProps(ctx, props);
|
|
193
|
-
ctx.strokeStyle = c;
|
|
194
|
-
ctx.stroke();
|
|
208
|
+
setStrokeProps(this.ctx, props);
|
|
209
|
+
this.ctx.strokeStyle = c;
|
|
210
|
+
this.ctx.stroke();
|
|
195
211
|
}
|
|
196
|
-
}
|
|
212
|
+
}
|
|
197
213
|
/**
|
|
198
214
|
* Draws connected line segments.
|
|
199
|
-
* @param ctx Canvas context.
|
|
215
|
+
* @param this.ctx Canvas context.
|
|
200
216
|
* @param color Stroke color.
|
|
201
217
|
* @param points Array of [x, y] positions.
|
|
202
218
|
* @param props Optional stroke properties.
|
|
203
219
|
*/
|
|
204
|
-
line(
|
|
220
|
+
line(color, points, props) {
|
|
205
221
|
if (points.length < 2)
|
|
206
222
|
return;
|
|
207
|
-
setStrokeProps(ctx, props);
|
|
208
|
-
ctx.beginPath();
|
|
223
|
+
setStrokeProps(this.ctx, props);
|
|
224
|
+
this.ctx.beginPath();
|
|
209
225
|
const [[x0, y0], ...rest] = points;
|
|
210
|
-
ctx.moveTo(x0, y0);
|
|
211
|
-
rest.forEach(([x, y]) => ctx.lineTo(x, y));
|
|
212
|
-
ctx.strokeStyle = applyColor(color);
|
|
213
|
-
ctx.stroke();
|
|
214
|
-
}
|
|
226
|
+
this.ctx.moveTo(x0, y0);
|
|
227
|
+
rest.forEach(([x, y]) => this.ctx.lineTo(x, y));
|
|
228
|
+
this.ctx.strokeStyle = applyColor(color);
|
|
229
|
+
this.ctx.stroke();
|
|
230
|
+
}
|
|
215
231
|
/**
|
|
216
232
|
* Draws text at a position.
|
|
217
233
|
*
|
|
@@ -222,44 +238,44 @@ export const draw = {
|
|
|
222
238
|
* to the left and right of its position. If you align right, your position
|
|
223
239
|
* becomes the upper-right corner of the text.
|
|
224
240
|
*
|
|
225
|
-
* @param ctx Canvas context.
|
|
241
|
+
* @param this.ctx Canvas context.
|
|
226
242
|
* @param color Fill color.
|
|
227
243
|
* @param text Text string.
|
|
228
244
|
* @param position Top-left position.
|
|
229
245
|
* @param props {@link PrintProps} Optional font, text limit, or alignment.
|
|
230
246
|
*/
|
|
231
|
-
print(
|
|
247
|
+
print(color, text, position, props) {
|
|
232
248
|
const [x, y] = position;
|
|
233
249
|
const { font = "16px sans-serif" } = props ?? {};
|
|
234
|
-
ctx.fillStyle = parseColor(color);
|
|
235
|
-
ctx.font = font;
|
|
236
|
-
ctx.textAlign = props?.align ?? "left";
|
|
250
|
+
this.ctx.fillStyle = parseColor(color);
|
|
251
|
+
this.ctx.font = font;
|
|
252
|
+
this.ctx.textAlign = props?.align ?? "left";
|
|
237
253
|
if (props && 'width' in props) {
|
|
238
254
|
const { width } = props;
|
|
239
|
-
const lines = wrapText(ctx, text, width);
|
|
240
|
-
const lineHeight = getFontHeight(ctx);
|
|
241
|
-
ctx.textBaseline = "top";
|
|
255
|
+
const lines = wrapText(this.ctx, text, width);
|
|
256
|
+
const lineHeight = getFontHeight(this.ctx);
|
|
257
|
+
this.ctx.textBaseline = "top";
|
|
242
258
|
lines.forEach((line, i) => {
|
|
243
|
-
ctx.fillText(line, x, y + i * lineHeight, width);
|
|
259
|
+
this.ctx.fillText(line, x, y + i * lineHeight, width);
|
|
244
260
|
});
|
|
245
|
-
ctx.textBaseline = "alphabetic";
|
|
261
|
+
this.ctx.textBaseline = "alphabetic";
|
|
246
262
|
}
|
|
247
263
|
else {
|
|
248
|
-
ctx.fillText(text, x, y);
|
|
264
|
+
this.ctx.fillText(text, x, y);
|
|
249
265
|
}
|
|
250
|
-
}
|
|
266
|
+
}
|
|
251
267
|
/**
|
|
252
268
|
* Draws an image.
|
|
253
269
|
*
|
|
254
270
|
* @remarks named "draw" because it draws anything _drawable_
|
|
255
271
|
* in the long run.
|
|
256
272
|
*
|
|
257
|
-
* @param ctx Canvas context.
|
|
273
|
+
* @param this.ctx Canvas context.
|
|
258
274
|
* @param handle Image handle from newImage.
|
|
259
275
|
* @param position Draw position.
|
|
260
276
|
* @param props Optional rotation, scale, origin, or quad.
|
|
261
277
|
*/
|
|
262
|
-
draw(
|
|
278
|
+
draw(handle, position, props) {
|
|
263
279
|
if (!handle.isReady())
|
|
264
280
|
return;
|
|
265
281
|
const element = handle.getElement();
|
|
@@ -269,120 +285,121 @@ export const draw = {
|
|
|
269
285
|
const { r = 0, scale = 1, origin = 0, quad } = props ?? {};
|
|
270
286
|
const [sx, sy] = typeof scale === "number" ? [scale, scale] : scale;
|
|
271
287
|
const [ox, oy] = typeof origin === "number" ? [origin, origin] : origin;
|
|
272
|
-
ctx.save();
|
|
273
|
-
ctx.translate(x, y);
|
|
274
|
-
ctx.rotate(r);
|
|
275
|
-
ctx.scale(sx, sy);
|
|
288
|
+
this.ctx.save();
|
|
289
|
+
this.ctx.translate(x, y);
|
|
290
|
+
this.ctx.rotate(r);
|
|
291
|
+
this.ctx.scale(sx, sy);
|
|
276
292
|
if (quad) {
|
|
277
293
|
const [qx, qy, qw, qh] = quad;
|
|
278
|
-
ctx.drawImage(element, qx, qy, qw, qh, -ox, -oy, qw, qh);
|
|
294
|
+
this.ctx.drawImage(element, qx, qy, qw, qh, -ox, -oy, qw, qh);
|
|
279
295
|
}
|
|
280
296
|
else {
|
|
281
|
-
ctx.drawImage(element, -ox, -oy);
|
|
297
|
+
this.ctx.drawImage(element, -ox, -oy);
|
|
282
298
|
}
|
|
283
|
-
ctx.restore();
|
|
284
|
-
}
|
|
299
|
+
this.ctx.restore();
|
|
300
|
+
}
|
|
285
301
|
/**
|
|
286
302
|
* Loads an image from a path.
|
|
287
303
|
* Unlike built-in loading, this pretends to be synchronous.
|
|
288
|
-
* @param ctx Canvas context.
|
|
304
|
+
* @param this.ctx Canvas context.
|
|
289
305
|
* @param path Image file path.
|
|
290
306
|
* @returns ImageHandle for use with draw.
|
|
291
307
|
*/
|
|
292
|
-
newImage(
|
|
308
|
+
newImage(path) {
|
|
293
309
|
return new ImageHandle(path);
|
|
294
|
-
}
|
|
310
|
+
}
|
|
295
311
|
/**
|
|
296
312
|
* Sets the clipping region.
|
|
297
|
-
* @param ctx Canvas context.
|
|
313
|
+
* @param this.ctx Canvas context.
|
|
298
314
|
* @param rect Clipping rectangle, or full canvas if omitted.
|
|
299
315
|
*/
|
|
300
|
-
clip(
|
|
301
|
-
ctx.beginPath();
|
|
316
|
+
clip(rect) {
|
|
317
|
+
this.ctx.beginPath();
|
|
302
318
|
if (rect) {
|
|
303
319
|
const [x, y, w, h] = rect;
|
|
304
|
-
ctx.rect(x, y, w, h);
|
|
320
|
+
this.ctx.rect(x, y, w, h);
|
|
305
321
|
}
|
|
306
322
|
else {
|
|
307
|
-
ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
323
|
+
this.ctx.rect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
|
|
308
324
|
}
|
|
309
|
-
ctx.clip();
|
|
310
|
-
}
|
|
325
|
+
this.ctx.clip();
|
|
326
|
+
}
|
|
311
327
|
/**
|
|
312
328
|
* Draws a polygon.
|
|
313
|
-
* @param ctx Canvas context.
|
|
329
|
+
* @param this.ctx Canvas context.
|
|
314
330
|
* @param mode Fill or line.
|
|
315
331
|
* @param color Fill or stroke color.
|
|
316
332
|
* @param points Array of [x, y] vertices.
|
|
317
333
|
* @param props Optional stroke properties.
|
|
318
334
|
*/
|
|
319
|
-
polygon(
|
|
335
|
+
polygon(mode, color, points, props) {
|
|
320
336
|
if (points.length < 3)
|
|
321
337
|
return;
|
|
322
338
|
const c = applyColor(color);
|
|
323
|
-
ctx.beginPath();
|
|
339
|
+
this.ctx.beginPath();
|
|
324
340
|
const [[x0, y0], ...rest] = points;
|
|
325
|
-
ctx.moveTo(x0, y0);
|
|
326
|
-
rest.forEach(([x, y]) => ctx.lineTo(x, y));
|
|
327
|
-
ctx.closePath();
|
|
341
|
+
this.ctx.moveTo(x0, y0);
|
|
342
|
+
rest.forEach(([x, y]) => this.ctx.lineTo(x, y));
|
|
343
|
+
this.ctx.closePath();
|
|
328
344
|
if (mode === "fill") {
|
|
329
|
-
ctx.fillStyle = c;
|
|
330
|
-
ctx.fill();
|
|
345
|
+
this.ctx.fillStyle = c;
|
|
346
|
+
this.ctx.fill();
|
|
331
347
|
}
|
|
332
348
|
else {
|
|
333
|
-
setStrokeProps(ctx, props);
|
|
334
|
-
ctx.strokeStyle = c;
|
|
335
|
-
ctx.stroke();
|
|
349
|
+
setStrokeProps(this.ctx, props);
|
|
350
|
+
this.ctx.strokeStyle = c;
|
|
351
|
+
this.ctx.stroke();
|
|
336
352
|
}
|
|
337
|
-
}
|
|
353
|
+
}
|
|
338
354
|
/**
|
|
339
355
|
* Draws individual pixels.
|
|
340
|
-
* @param ctx Canvas context.
|
|
356
|
+
* @param this.ctx Canvas context.
|
|
341
357
|
* @param color Fill color.
|
|
342
358
|
* @param pts Array of [x, y] positions.
|
|
343
359
|
*/
|
|
344
|
-
points(
|
|
345
|
-
ctx.fillStyle = applyColor(color);
|
|
346
|
-
pts.forEach(([x, y]) => ctx.fillRect(x, y, 1, 1));
|
|
347
|
-
}
|
|
360
|
+
points(color, pts) {
|
|
361
|
+
this.ctx.fillStyle = applyColor(color);
|
|
362
|
+
pts.forEach(([x, y]) => this.ctx.fillRect(x, y, 1, 1));
|
|
363
|
+
}
|
|
348
364
|
/**
|
|
349
365
|
* Saves canvas state.
|
|
350
|
-
* @param ctx Canvas context.
|
|
366
|
+
* @param this.ctx Canvas context.
|
|
351
367
|
*/
|
|
352
|
-
push(
|
|
353
|
-
ctx.save();
|
|
354
|
-
}
|
|
368
|
+
push() {
|
|
369
|
+
this.ctx.save();
|
|
370
|
+
}
|
|
355
371
|
/**
|
|
356
372
|
* Restores canvas state.
|
|
357
|
-
* @param ctx Canvas context.
|
|
373
|
+
* @param this.ctx Canvas context.
|
|
358
374
|
*/
|
|
359
|
-
pop(
|
|
360
|
-
ctx.restore();
|
|
361
|
-
}
|
|
375
|
+
pop() {
|
|
376
|
+
this.ctx.restore();
|
|
377
|
+
}
|
|
362
378
|
/**
|
|
363
379
|
* Applies a translation.
|
|
364
|
-
* @param ctx Canvas context.
|
|
380
|
+
* @param this.ctx Canvas context.
|
|
365
381
|
* @param offset [x, y] offset.
|
|
366
382
|
*/
|
|
367
|
-
translate(
|
|
383
|
+
translate(offset) {
|
|
368
384
|
const [x, y] = offset;
|
|
369
|
-
ctx.translate(x, y);
|
|
370
|
-
}
|
|
385
|
+
this.ctx.translate(x, y);
|
|
386
|
+
}
|
|
371
387
|
/**
|
|
372
388
|
* Applies a rotation.
|
|
373
|
-
* @param ctx Canvas context.
|
|
389
|
+
* @param this.ctx Canvas context.
|
|
374
390
|
* @param angle Rotation in radians.
|
|
375
391
|
*/
|
|
376
|
-
rotate(
|
|
377
|
-
ctx.rotate(angle);
|
|
378
|
-
}
|
|
392
|
+
rotate(angle) {
|
|
393
|
+
this.ctx.rotate(angle);
|
|
394
|
+
}
|
|
379
395
|
/**
|
|
380
396
|
* Applies a scale.
|
|
381
|
-
* @param ctx Canvas context.
|
|
397
|
+
* @param this.ctx Canvas context.
|
|
382
398
|
* @param factor Scale factor (number or [x, y]).
|
|
383
399
|
*/
|
|
384
|
-
scale(
|
|
400
|
+
scale(factor) {
|
|
385
401
|
const [sx, sy] = typeof factor === "number" ? [factor, factor] : factor;
|
|
386
|
-
ctx.scale(sx, sy);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
402
|
+
this.ctx.scale(sx, sy);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
;
|
package/dist/graphics/index.d.ts
CHANGED
|
@@ -2,18 +2,7 @@
|
|
|
2
2
|
* @module graphics
|
|
3
3
|
* @description a reduced-state, Love2D-like wrapper around browser canvas
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export { draw } from "./drawing";
|
|
5
|
+
export type { Color, DrawMode, ShapeProps, DrawProps, PrintProps, ImageHandle, } from "./graphics";
|
|
6
|
+
export { Graphics } from "./graphics";
|
|
8
7
|
export type { CanvasModeOptions, CanvasSize, Canvas, } from "./canvas";
|
|
9
|
-
type Bind<F> = F extends (ctx: CanvasRenderingContext2D, ...args: infer A) => infer R ? (...args: A) => R : never;
|
|
10
|
-
/**
|
|
11
|
-
* A graphics object with a canvas already attatched to it.
|
|
12
|
-
* Calling its methods will draw to the render canvas.
|
|
13
|
-
* See {@link graphics} for more info.
|
|
14
|
-
*/
|
|
15
|
-
export type BoundGraphics = {
|
|
16
|
-
[K in keyof typeof draw]: Bind<(typeof draw)[K]>;
|
|
17
|
-
};
|
|
18
|
-
export declare function bindGraphics(ctx: CanvasRenderingContext2D): BoundGraphics;
|
|
19
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graphics/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graphics/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACV,KAAK,EACL,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,MAAM,GACP,MAAM,UAAU,CAAC"}
|
package/dist/graphics/index.js
CHANGED
|
@@ -2,12 +2,4 @@
|
|
|
2
2
|
* @module graphics
|
|
3
3
|
* @description a reduced-state, Love2D-like wrapper around browser canvas
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
export { draw } from "./drawing";
|
|
7
|
-
export function bindGraphics(ctx) {
|
|
8
|
-
const bound = {};
|
|
9
|
-
for (const [name, fn] of Object.entries(draw)) {
|
|
10
|
-
bound[name] = (...args) => fn(ctx, ...args);
|
|
11
|
-
}
|
|
12
|
-
return bound;
|
|
13
|
-
}
|
|
5
|
+
export { Graphics } from "./graphics";
|
|
@@ -65,7 +65,7 @@ export const mapStick = (gp, mapping) => {
|
|
|
65
65
|
return mapping.map((axis) => (axis.invert ? -1 : 1) * (gp.axes[axis.index] ?? 0));
|
|
66
66
|
};
|
|
67
67
|
//// ************* SDL Gamepad auto-binding system ******************* ////
|
|
68
|
-
import mappingDbRaw from "./controllerdb.json";
|
|
68
|
+
import mappingDbRaw from "./controllerdb.json" with { type: 'json' };
|
|
69
69
|
const mappingDb = new Map(Object.entries(mappingDbRaw[detectedOs]).map(([k, v]) => [
|
|
70
70
|
Number(k),
|
|
71
71
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mouse.d.ts","sourceRoot":"","sources":["../../src/input/mouse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,WAAW,EAAmB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"mouse.d.ts","sourceRoot":"","sources":["../../src/input/mouse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,WAAW,EAAmB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQxC,KAAK,SAAS,GACV;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAElC,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAElE;;GAEG;AACH,qBAAa,KAAK;IAChB,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,GAAG,CAAmB;IAC9B,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,OAAO,CAA0B;IACzC;;OAEG;IACH,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,MAAM,CAAoB;IAIlC,OAAO,CAAC,UAAU,CAAsD;IACxE,OAAO,CAAC,YAAY,CAAgF;IACpG,OAAO,CAAC,UAAU,CAAS;gBAEf,KAAK,EAAE,WAAW,CAAC,cAAc,CAAC;IAwC9C,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,WAAW;IAMnB,oDAAoD;IACpD,WAAW,IAAI,OAAO;IAItB,uEAAuE;IACvE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO;IAIpC,kCAAkC;IAClC,iBAAiB,IAAI,GAAG,CAAC,WAAW,CAAC;IAIrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,OAAO,CAAC,IAAI,EAAE,YAAY;IAgB1B,OAAO,IAAI,SAAS;IAIpB;;;OAGG;IACH,cAAc,CAAC,GAAG,EAAE,OAAO;IAQ3B;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,OAAO;IAUzB;;OAEG;IACH,eAAe,IAAI,OAAO;IAI1B;;OAEG;IACH,eAAe,IAAI,OAAO;IAI1B;;OAEG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC;CACzB"}
|
package/dist/input/mouse.js
CHANGED
|
@@ -91,7 +91,8 @@ export class Mouse {
|
|
|
91
91
|
this.canvas.addEventListener("mouseleave", () => this.buttons.clear(), {
|
|
92
92
|
signal: abort,
|
|
93
93
|
});
|
|
94
|
-
this.canvas.addEventListener("
|
|
94
|
+
this.canvas.addEventListener("pointerlockchange", // unsupported on mobile, will have to test.
|
|
95
|
+
() => {
|
|
95
96
|
if (!this.isPointerLocked())
|
|
96
97
|
this.enableLock = false;
|
|
97
98
|
}, { signal: abort });
|
package/dist/like.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { Keyboard } from './input/keyboard';
|
|
|
9
9
|
import type { Mouse } from './input/mouse';
|
|
10
10
|
import type { Gamepad } from './input/gamepad';
|
|
11
11
|
import type { Canvas } from './graphics/canvas';
|
|
12
|
-
import type {
|
|
12
|
+
import type { Graphics } from './graphics/index';
|
|
13
13
|
import { EventMap, EventType, LikeEvent } from './events';
|
|
14
14
|
import { Scene } from './scene';
|
|
15
15
|
export type TopLevelEventHandler = (event: LikeEvent) => void;
|
|
@@ -38,9 +38,11 @@ export type Like = Callbacks & {
|
|
|
38
38
|
/** Get and set screen size, choosing between native and pixel perfect prescaling. Plus fullscreen control. */
|
|
39
39
|
readonly canvas: Canvas;
|
|
40
40
|
/** Graphics module: LOVE-style rendering, plus a pseudo-synchronous way to load images. */
|
|
41
|
-
gfx:
|
|
41
|
+
readonly gfx: Graphics;
|
|
42
42
|
/** I think you meant to type `canvas`. */
|
|
43
43
|
window?: never;
|
|
44
|
+
/** Shortened to `like.gfx`. */
|
|
45
|
+
graphics?: never;
|
|
44
46
|
/**
|
|
45
47
|
* Start the game loop. Call this only once.
|
|
46
48
|
* @returns Promise that resolves when the engine is ready
|
package/dist/like.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"like.d.ts","sourceRoot":"","sources":["../src/like.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"like.d.ts","sourceRoot":"","sources":["../src/like.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,K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AC,OAAO,EAAE,OAAO,CAAC;IAC1B,8GAA8G;IAC9G,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2FAA2F;IAC3F,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;IAEvB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC;IAEjB;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAE9B;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;IAEnC;;;;OAIG;IACH,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACzC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../src/timer/timer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../src/timer/timer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,qBAAa,KAAK;IAChB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,UAAU,CAAuB;gBAE7B,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC;IAIrC,OAAO,CAAC,MAAM;IAad;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB,wDAAwD;IACxD,MAAM,IAAI,MAAM;IAIhB,2BAA2B;IAC3B,OAAO,IAAI,MAAM;IAIjB;;;;;OAKG;IACH,UAAU,IAAI,OAAO;IAUrB;;;OAGG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAG9B"}
|
package/dist/timer/timer.js
CHANGED
|
@@ -38,8 +38,7 @@ export class Timer {
|
|
|
38
38
|
});
|
|
39
39
|
props.canvas.addEventListener("like:update", this.update.bind(this), { signal: props.abort });
|
|
40
40
|
}
|
|
41
|
-
update(
|
|
42
|
-
const { dt } = ev.detail;
|
|
41
|
+
update({ detail: { dt } }) {
|
|
43
42
|
this.currentDelta = dt;
|
|
44
43
|
this.totalTime += dt;
|
|
45
44
|
this.frameCount++;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drawing.d.ts","sourceRoot":"","sources":["../../src/graphics/drawing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAQ,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC;;;;GAIG;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC;AAE/D,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG;IACnC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC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