rapid-render 0.1.0 → 0.1.2-1.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 +59 -97
- package/dist/assets.d.ts +92 -0
- package/dist/audio.d.ts +59 -0
- package/dist/depth.d.ts +8 -0
- package/dist/game.d.ts +292 -0
- package/dist/index.d.ts +9 -3
- package/dist/input.d.ts +93 -0
- package/dist/interface.d.ts +337 -32
- package/dist/light.d.ts +7 -0
- package/dist/line.d.ts +15 -2
- package/dist/log.d.ts +2 -0
- package/dist/math.d.ts +272 -45
- package/dist/particle.d.ts +73 -0
- package/dist/rapid.global.js +1 -1
- package/dist/rapid.js +1 -1
- package/dist/rapid.umd.cjs +1 -1
- package/dist/regions/attributes.d.ts +44 -0
- package/dist/regions/graphic_region.d.ts +7 -20
- package/dist/regions/region.d.ts +23 -7
- package/dist/regions/sprite_region.d.ts +5 -26
- package/dist/render.d.ts +159 -45
- package/dist/texture.d.ts +105 -13
- package/dist/tilemap.d.ts +98 -0
- package/dist/utils.d.ts +106 -0
- package/dist/webgl/glshader.d.ts +15 -4
- package/dist/webgl/uniform.d.ts +14 -0
- package/dist/webgl/utils.d.ts +11 -1
- package/package.json +11 -5
package/dist/input.d.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Vec2 } from "./math";
|
|
2
|
+
import Rapid from "./render";
|
|
3
|
+
import { Entity } from "./game";
|
|
4
|
+
/**
|
|
5
|
+
* Manages user input for keyboard and mouse events.
|
|
6
|
+
* Tracks key and button states, including pressed/released states for the current and previous frames.
|
|
7
|
+
*/
|
|
8
|
+
export declare class InputManager {
|
|
9
|
+
private rapid;
|
|
10
|
+
private canvas;
|
|
11
|
+
private mousePosition;
|
|
12
|
+
private keysDown;
|
|
13
|
+
private keysDownLastFrame;
|
|
14
|
+
private buttonsDown;
|
|
15
|
+
private buttonsDownLastFrame;
|
|
16
|
+
/**
|
|
17
|
+
* Creates an instance of InputManager.
|
|
18
|
+
* @param rapid - The Rapid instance for rendering and coordinate conversion.
|
|
19
|
+
*/
|
|
20
|
+
constructor(rapid: Rapid);
|
|
21
|
+
/**
|
|
22
|
+
* Attaches all necessary event listeners for keyboard and mouse input.
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
private attachEventListeners;
|
|
26
|
+
/**
|
|
27
|
+
* Updates the state of keys and buttons for the next frame.
|
|
28
|
+
*/
|
|
29
|
+
updateNextFrame(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Checks if a key is currently pressed (continuous detection).
|
|
32
|
+
* @param key - The key code (e.g., "KeyW", "Space").
|
|
33
|
+
* @returns True if the key is pressed, false otherwise.
|
|
34
|
+
*/
|
|
35
|
+
isKeyDown(key: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Checks if a key is currently released.
|
|
38
|
+
* @param key - The key code (e.g., "KeyW", "Space").
|
|
39
|
+
* @returns True if the key is released, false otherwise.
|
|
40
|
+
*/
|
|
41
|
+
isKeyUp(key: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Checks if a key was pressed in the current frame (single trigger).
|
|
44
|
+
* @param key - The key code (e.g., "KeyW", "Space").
|
|
45
|
+
* @returns True if the key was just pressed, false otherwise.
|
|
46
|
+
*/
|
|
47
|
+
wasKeyPressed(key: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Checks if a key was released in the current frame (single trigger).
|
|
50
|
+
* @param key - The key code (e.g., "KeyW", "Space").
|
|
51
|
+
* @returns True if the key was just released, false otherwise.
|
|
52
|
+
*/
|
|
53
|
+
wasKeyReleased(key: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Checks if a mouse button is currently pressed (continuous detection).
|
|
56
|
+
* @param button - The mouse button number (0: left, 1: middle, 2: right).
|
|
57
|
+
* @returns True if the button is pressed, false otherwise.
|
|
58
|
+
*/
|
|
59
|
+
isButtonDown(button: number): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Checks if a mouse button is currently released.
|
|
62
|
+
* @param button - The mouse button number (0: left, 1: middle, 2: right).
|
|
63
|
+
* @returns True if the button is released, false otherwise.
|
|
64
|
+
*/
|
|
65
|
+
isButtonUp(button: number): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Checks if a mouse button was pressed in the current frame (single trigger).
|
|
68
|
+
* @param button - The mouse button number (0: left, 1: middle, 2: right).
|
|
69
|
+
* @returns True if the button was just pressed, false otherwise.
|
|
70
|
+
*/
|
|
71
|
+
wasButtonPressed(button: number): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Checks if a mouse button was released in the current frame (single trigger).
|
|
74
|
+
* @param button - The mouse button number (0: left, 1: middle, 2: right).
|
|
75
|
+
* @returns True if the button was just released, false otherwise.
|
|
76
|
+
*/
|
|
77
|
+
wasButtonReleased(button: number): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Converts the mouse position to local coordinates relative to an entity.
|
|
80
|
+
* @param entity - The entity to convert coordinates for.
|
|
81
|
+
* @returns The mouse position in the entity's local coordinate system.
|
|
82
|
+
*/
|
|
83
|
+
getMouseLocal(entity: Entity): Vec2;
|
|
84
|
+
/**
|
|
85
|
+
* Removes all event listeners and cleans up resources.
|
|
86
|
+
*/
|
|
87
|
+
destroy(): void;
|
|
88
|
+
private handleMouseMove;
|
|
89
|
+
private handleKeyDown;
|
|
90
|
+
private handleKeyUp;
|
|
91
|
+
private handleMouseDown;
|
|
92
|
+
private handleMouseUp;
|
|
93
|
+
}
|
package/dist/interface.d.ts
CHANGED
|
@@ -1,12 +1,58 @@
|
|
|
1
|
+
import { AudioPlayer } from "./audio";
|
|
2
|
+
import { Entity } from "./game";
|
|
1
3
|
import { Color, Vec2 } from "./math";
|
|
4
|
+
import { Texture } from "./texture";
|
|
5
|
+
import { TileSet } from "./tilemap";
|
|
2
6
|
import GLShader from "./webgl/glshader";
|
|
7
|
+
import { Uniform } from "./webgl/uniform";
|
|
8
|
+
/**
|
|
9
|
+
* @ignore
|
|
10
|
+
*/
|
|
3
11
|
export type WebGLContext = WebGL2RenderingContext | WebGLRenderingContext;
|
|
4
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Defines the required mathematical operations for an object to be tweenable.
|
|
14
|
+
*/
|
|
15
|
+
export interface IMathObject<T> {
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new object that is a copy of the current instance.
|
|
18
|
+
* @returns A new instance of the object.
|
|
19
|
+
*/
|
|
20
|
+
clone(): IMathObject<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Adds another object's values to this one.
|
|
23
|
+
* @param other - The object to add.
|
|
24
|
+
* @returns A new object with the result of the addition.
|
|
25
|
+
*/
|
|
26
|
+
add(other: IMathObject<T>): IMathObject<T>;
|
|
27
|
+
/**
|
|
28
|
+
* Subtracts another object's values from this one.
|
|
29
|
+
* @param other - The object to subtract.
|
|
30
|
+
* @returns A new object with the result of the subtraction.
|
|
31
|
+
*/
|
|
32
|
+
subtract(other: IMathObject<T>): IMathObject<T>;
|
|
33
|
+
/**
|
|
34
|
+
* Multiplies the object's values by a scalar.
|
|
35
|
+
* @param scalar - The number to multiply by.
|
|
36
|
+
* @returns A new object with the result of the multiplication.
|
|
37
|
+
*/
|
|
38
|
+
multiply(scalar: number | IMathObject<T>): IMathObject<T>;
|
|
39
|
+
}
|
|
40
|
+
export declare enum ScaleRadio {
|
|
41
|
+
KEEP = "keep",
|
|
42
|
+
KEEP_H = "keep_h",
|
|
43
|
+
KEEP_W = "keep_w",
|
|
44
|
+
IGNORE = "ignore",
|
|
45
|
+
EXPAND = "expand"
|
|
46
|
+
}
|
|
47
|
+
export interface IRapidOptions {
|
|
5
48
|
canvas: HTMLCanvasElement;
|
|
6
|
-
pixelDensity?: number;
|
|
7
49
|
width?: number;
|
|
8
50
|
height?: number;
|
|
9
51
|
backgroundColor?: Color;
|
|
52
|
+
antialias?: boolean;
|
|
53
|
+
devicePixelRatio?: number;
|
|
54
|
+
scaleEnable?: boolean;
|
|
55
|
+
scaleRadio?: ScaleRadio;
|
|
10
56
|
}
|
|
11
57
|
export interface IAttribute {
|
|
12
58
|
name: string;
|
|
@@ -16,16 +62,44 @@ export interface IAttribute {
|
|
|
16
62
|
stride: number;
|
|
17
63
|
offset?: number;
|
|
18
64
|
}
|
|
19
|
-
export interface
|
|
65
|
+
export interface IEntityTransformOptions {
|
|
66
|
+
position?: Vec2;
|
|
67
|
+
scale?: Vec2 | number;
|
|
68
|
+
rotation?: number;
|
|
69
|
+
x?: number;
|
|
70
|
+
y?: number;
|
|
71
|
+
tags?: string[];
|
|
72
|
+
}
|
|
73
|
+
export interface ITilemapEntityOptions extends IEntityTransformOptions {
|
|
74
|
+
tileset: TileSet;
|
|
75
|
+
}
|
|
76
|
+
export interface ITransformOptions {
|
|
77
|
+
restoreTransform?: boolean;
|
|
78
|
+
saveTransform?: boolean;
|
|
79
|
+
position?: Vec2;
|
|
80
|
+
scale?: Vec2 | number;
|
|
81
|
+
rotation?: number;
|
|
82
|
+
x?: number;
|
|
83
|
+
y?: number;
|
|
84
|
+
offset?: Vec2;
|
|
85
|
+
offsetX?: number;
|
|
86
|
+
offsetY?: number;
|
|
87
|
+
origin?: Vec2 | number;
|
|
88
|
+
afterSave?(): unknown;
|
|
89
|
+
beforRestore?(): unknown;
|
|
90
|
+
}
|
|
91
|
+
export interface ISpriteRenderOptions extends ITransformOptions, IShaderRenderOptions {
|
|
20
92
|
color?: Color;
|
|
21
|
-
|
|
22
|
-
|
|
93
|
+
texture?: Texture;
|
|
94
|
+
offset?: Vec2;
|
|
95
|
+
flipX?: boolean;
|
|
96
|
+
flipY?: boolean;
|
|
23
97
|
}
|
|
24
|
-
export interface
|
|
98
|
+
export interface ITextTextureOptions {
|
|
25
99
|
/**
|
|
26
100
|
* The text string to be rendered.
|
|
27
101
|
*/
|
|
28
|
-
text
|
|
102
|
+
text?: string;
|
|
29
103
|
/**
|
|
30
104
|
* The font size for the text.
|
|
31
105
|
* Default is 16.
|
|
@@ -53,36 +127,267 @@ export interface ITextOptions {
|
|
|
53
127
|
* Default is 'top'.
|
|
54
128
|
*/
|
|
55
129
|
textBaseline?: CanvasTextBaseline;
|
|
56
|
-
/**
|
|
57
|
-
* Whether to apply antialiasing to the texture.
|
|
58
|
-
* Default is `false`.
|
|
59
|
-
*/
|
|
60
|
-
antialias?: boolean;
|
|
61
130
|
}
|
|
62
|
-
export
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
131
|
+
export interface ILineStyleOptions extends IGraphicRenderOptions {
|
|
132
|
+
width?: number;
|
|
133
|
+
closed?: boolean;
|
|
134
|
+
roundCap?: boolean;
|
|
135
|
+
textureMode?: LineTextureMode;
|
|
136
|
+
points: Vec2[];
|
|
66
137
|
}
|
|
67
|
-
export declare enum
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
SQUARE = 2
|
|
138
|
+
export declare enum LineTextureMode {
|
|
139
|
+
STRETCH = "stretch",
|
|
140
|
+
REPEAT = "repeat"
|
|
71
141
|
}
|
|
72
|
-
export
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
miterLimit?: number;
|
|
142
|
+
export declare enum TextureWrapMode {
|
|
143
|
+
REPEAT = "repeat",
|
|
144
|
+
CLAMP = "clamp",
|
|
145
|
+
MIRROR = "mirror"
|
|
77
146
|
}
|
|
78
|
-
export interface IRenderLineOptions extends
|
|
79
|
-
points: Vec2[];
|
|
80
|
-
color?: Color;
|
|
147
|
+
export interface IRenderLineOptions extends ILineStyleOptions, ITransformOptions {
|
|
81
148
|
}
|
|
82
|
-
export interface
|
|
83
|
-
|
|
84
|
-
color?: Color;
|
|
149
|
+
export interface IGraphicRenderOptions extends ITransformOptions, IShaderRenderOptions {
|
|
150
|
+
color?: Color | Color[];
|
|
85
151
|
drawType?: number;
|
|
152
|
+
uv?: Vec2[];
|
|
153
|
+
texture?: Texture;
|
|
154
|
+
}
|
|
155
|
+
export interface IPolygonGraphicRenderOptions extends IGraphicRenderOptions {
|
|
156
|
+
points: Vec2[];
|
|
157
|
+
}
|
|
158
|
+
export interface ICircleRenderOptions extends IGraphicRenderOptions {
|
|
159
|
+
radius: number;
|
|
160
|
+
segments?: number;
|
|
161
|
+
}
|
|
162
|
+
export interface IRectRenderOptions extends IGraphicRenderOptions {
|
|
163
|
+
width: number;
|
|
164
|
+
height: number;
|
|
86
165
|
}
|
|
87
|
-
export
|
|
166
|
+
export declare enum MaskType {
|
|
167
|
+
Include = "normal",
|
|
168
|
+
Exclude = "inverse"
|
|
169
|
+
}
|
|
170
|
+
export type UniformType = Record<string, number | Array<any> | boolean | Texture>;
|
|
88
171
|
export type Images = ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | OffscreenCanvas;
|
|
172
|
+
export interface IRegisterTileOptions extends ISpriteRenderOptions {
|
|
173
|
+
texture: Texture;
|
|
174
|
+
offsetX?: number;
|
|
175
|
+
offsetY?: number;
|
|
176
|
+
ySortOffset?: number;
|
|
177
|
+
}
|
|
178
|
+
export interface YSortCallback {
|
|
179
|
+
ySort: number;
|
|
180
|
+
render?: () => void;
|
|
181
|
+
entity?: Entity;
|
|
182
|
+
renderSprite?: ISpriteRenderOptions;
|
|
183
|
+
}
|
|
184
|
+
export interface IEntityTilemapLayerOptions extends ITilemapLayerOptions, IEntityTransformOptions {
|
|
185
|
+
}
|
|
186
|
+
export interface ITilemapLayerOptions {
|
|
187
|
+
error?: number | Vec2;
|
|
188
|
+
errorX?: number;
|
|
189
|
+
errorY?: number;
|
|
190
|
+
ySortCallback?: Array<YSortCallback>;
|
|
191
|
+
shape?: TilemapShape;
|
|
192
|
+
tileSet: TileSet;
|
|
193
|
+
eachTile?: (tileId: string | number, mapX: number, mapY: number) => ISpriteRenderOptions | undefined | void;
|
|
194
|
+
}
|
|
195
|
+
export interface ILayerRenderOptions extends ITransformOptions, ITilemapLayerOptions {
|
|
196
|
+
}
|
|
197
|
+
export interface IShaderRenderOptions {
|
|
198
|
+
shader?: GLShader;
|
|
199
|
+
uniforms?: Uniform;
|
|
200
|
+
}
|
|
201
|
+
export declare enum TilemapShape {
|
|
202
|
+
SQUARE = "square",
|
|
203
|
+
ISOMETRIC = "isometric"
|
|
204
|
+
}
|
|
205
|
+
export declare enum ShaderType {
|
|
206
|
+
SPRITE = "sprite",
|
|
207
|
+
GRAPHIC = "graphic"
|
|
208
|
+
}
|
|
209
|
+
export declare enum BlendMode {
|
|
210
|
+
Additive = "additive",
|
|
211
|
+
Subtractive = "subtractive",
|
|
212
|
+
Mix = "mix"
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Interface for light rendering options
|
|
216
|
+
*/
|
|
217
|
+
export interface ILightRenderOptions {
|
|
218
|
+
/** Position of the light source */
|
|
219
|
+
lightSource: Vec2;
|
|
220
|
+
/** Array of vertex arrays for occlusion objects, each occlusion object is defined by a set of vertices */
|
|
221
|
+
occlusion: Vec2[][];
|
|
222
|
+
/** Base projection length that controls shadow length */
|
|
223
|
+
baseProjectionLength?: number;
|
|
224
|
+
/** Type of mask to apply */
|
|
225
|
+
type?: MaskType;
|
|
226
|
+
}
|
|
227
|
+
export interface ICameraOptions extends ITransformOptions {
|
|
228
|
+
center?: boolean;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Defines particle emitter shape types
|
|
232
|
+
*/
|
|
233
|
+
export declare enum ParticleShape {
|
|
234
|
+
/**
|
|
235
|
+
* Point emitter, emits particles from a single point
|
|
236
|
+
*/
|
|
237
|
+
POINT = "point",
|
|
238
|
+
/**
|
|
239
|
+
* Circle emitter, emits particles randomly from a circular area
|
|
240
|
+
*/
|
|
241
|
+
CIRCLE = "circle",
|
|
242
|
+
/**
|
|
243
|
+
* Rectangle emitter, emits particles randomly from a rectangular area
|
|
244
|
+
*/
|
|
245
|
+
RECT = "rect"
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Defines particle attribute animation
|
|
249
|
+
* @template T Attribute type, can be number, vector or color
|
|
250
|
+
*/
|
|
251
|
+
export interface ParticleAttribute<T extends number | Vec2 | Color> {
|
|
252
|
+
/**
|
|
253
|
+
* Damping coefficient, controls attribute decay rate over time
|
|
254
|
+
*/
|
|
255
|
+
damping?: number;
|
|
256
|
+
/**
|
|
257
|
+
* Initial attribute value
|
|
258
|
+
*/
|
|
259
|
+
start: T;
|
|
260
|
+
/**
|
|
261
|
+
* Final attribute value, uses initial value if not specified
|
|
262
|
+
*/
|
|
263
|
+
end?: T;
|
|
264
|
+
/**
|
|
265
|
+
* Attribute change rate, automatically calculated from start and end if not specified
|
|
266
|
+
*/
|
|
267
|
+
delta?: T;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Particle system configuration options
|
|
271
|
+
*/
|
|
272
|
+
export interface IParticleOptions extends ITransformOptions, IShaderRenderOptions {
|
|
273
|
+
/**
|
|
274
|
+
* Particle texture, can be a single texture, array of textures, or weighted texture array
|
|
275
|
+
*/
|
|
276
|
+
texture: Texture | Texture[] | [Texture, number][];
|
|
277
|
+
/**
|
|
278
|
+
* Particle emission rate (particles per second)
|
|
279
|
+
*/
|
|
280
|
+
emitRate?: number;
|
|
281
|
+
/**
|
|
282
|
+
* Emission time interval in seconds
|
|
283
|
+
*/
|
|
284
|
+
emitTime?: number;
|
|
285
|
+
/**
|
|
286
|
+
* Maximum number of particles limit
|
|
287
|
+
*/
|
|
288
|
+
maxParticles?: number;
|
|
289
|
+
/**
|
|
290
|
+
* Particle lifetime in seconds, can be fixed value or range
|
|
291
|
+
*/
|
|
292
|
+
life?: number | [number, number];
|
|
293
|
+
/**
|
|
294
|
+
* Particle animation properties collection
|
|
295
|
+
*/
|
|
296
|
+
animation: {
|
|
297
|
+
/**
|
|
298
|
+
* Velocity vector, controls particle movement direction and speed
|
|
299
|
+
*/
|
|
300
|
+
velocity?: ParticleAttribute<Vec2>;
|
|
301
|
+
/**
|
|
302
|
+
* Acceleration vector, controls particle velocity changes
|
|
303
|
+
*/
|
|
304
|
+
acceleration?: ParticleAttribute<Vec2>;
|
|
305
|
+
/**
|
|
306
|
+
* Speed scalar, used in combination with rotation direction
|
|
307
|
+
*/
|
|
308
|
+
speed?: ParticleAttribute<number>;
|
|
309
|
+
/**
|
|
310
|
+
* Scale factor, controls particle size
|
|
311
|
+
*/
|
|
312
|
+
scale?: ParticleAttribute<number>;
|
|
313
|
+
/**
|
|
314
|
+
* Rotation angle (in radians)
|
|
315
|
+
*/
|
|
316
|
+
rotation?: ParticleAttribute<number>;
|
|
317
|
+
/**
|
|
318
|
+
* Color and transparency
|
|
319
|
+
*/
|
|
320
|
+
color?: ParticleAttribute<Color>;
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* Emitter shape
|
|
324
|
+
*/
|
|
325
|
+
emitShape?: ParticleShape;
|
|
326
|
+
/**
|
|
327
|
+
* Circular emitter radius
|
|
328
|
+
*/
|
|
329
|
+
emitRadius?: number;
|
|
330
|
+
/**
|
|
331
|
+
* Rectangular emitter dimensions
|
|
332
|
+
*/
|
|
333
|
+
emitRect?: {
|
|
334
|
+
width: number;
|
|
335
|
+
height: number;
|
|
336
|
+
};
|
|
337
|
+
/**
|
|
338
|
+
* Whether to use local coordinate system, true means particles are relative to emitter position,
|
|
339
|
+
* false means using global coordinates
|
|
340
|
+
*/
|
|
341
|
+
localSpace?: boolean;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Particle attribute data types
|
|
345
|
+
*/
|
|
346
|
+
export type ParticleAttributeTypes = number | Vec2 | Color;
|
|
347
|
+
/**
|
|
348
|
+
* Particle attribute runtime data
|
|
349
|
+
* @template T Attribute type
|
|
350
|
+
*/
|
|
351
|
+
export type ParticleAttributeData<T extends ParticleAttributeTypes> = {
|
|
352
|
+
/**
|
|
353
|
+
* Attribute change rate per second
|
|
354
|
+
*/
|
|
355
|
+
delta?: T;
|
|
356
|
+
/**
|
|
357
|
+
* Current attribute value
|
|
358
|
+
*/
|
|
359
|
+
value: T;
|
|
360
|
+
/**
|
|
361
|
+
* Damping coefficient
|
|
362
|
+
*/
|
|
363
|
+
damping?: number;
|
|
364
|
+
};
|
|
365
|
+
export interface IGameOptions extends IRapidOptions {
|
|
366
|
+
}
|
|
367
|
+
export interface ISound {
|
|
368
|
+
element: HTMLAudioElement;
|
|
369
|
+
source: MediaElementAudioSourceNode | null;
|
|
370
|
+
gainNode: GainNode;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Interface for an asset to be loaded.
|
|
374
|
+
*/
|
|
375
|
+
export interface IAsset {
|
|
376
|
+
type: 'json' | 'audio' | 'image';
|
|
377
|
+
name: string;
|
|
378
|
+
url: string;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Interface for the assets storage structure.
|
|
382
|
+
*/
|
|
383
|
+
export interface IAssets {
|
|
384
|
+
json: {
|
|
385
|
+
[key: string]: any;
|
|
386
|
+
};
|
|
387
|
+
audio: {
|
|
388
|
+
[key: string]: AudioPlayer;
|
|
389
|
+
};
|
|
390
|
+
images: {
|
|
391
|
+
[key: string]: Texture;
|
|
392
|
+
};
|
|
393
|
+
}
|
package/dist/light.d.ts
ADDED
package/dist/line.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ILineStyleOptions } from "./interface";
|
|
2
2
|
import { Vec2 } from "./math";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
export declare const getLineNormal: (points: Vec2[], closed?: boolean) => {
|
|
7
|
+
normals: {
|
|
8
|
+
normal: Vec2;
|
|
9
|
+
miters: number;
|
|
10
|
+
}[];
|
|
11
|
+
length: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const getLineGeometry: (options: ILineStyleOptions) => {
|
|
14
|
+
vertices: Vec2[];
|
|
15
|
+
uv: Vec2[];
|
|
16
|
+
};
|
package/dist/log.d.ts
ADDED