littlejsengine 1.11.9 → 1.11.13
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/littlejs.d.ts +485 -492
- package/dist/littlejs.esm.js +548 -529
- package/dist/littlejs.esm.min.js +1 -1
- package/dist/littlejs.js +546 -525
- package/dist/littlejs.min.js +1 -1
- package/dist/littlejs.release.js +502 -484
- package/examples/htmlMenu/game.js +11 -1
- package/examples/htmlMenu/index.html +1 -10
- package/examples/module/game.js +2 -2
- package/examples/shorts/base.html +1 -1
- package/examples/starter/build/index.html +2 -0
- package/examples/starter/build/index.js +1 -0
- package/examples/starter/build/tiles.png +0 -0
- package/examples/starter/build.js +13 -3
- package/examples/starter/game.js +8 -1
- package/examples/starter/game.zip +0 -0
- package/examples/typescript/build/dist/littlejs.esm.js +4834 -0
- package/examples/typescript/build/examples/typescript/build.js +24 -0
- package/examples/typescript/build/examples/typescript/game.js +102 -0
- package/examples/typescript/build.bat +5 -0
- package/examples/typescript/build.js +33 -0
- package/examples/typescript/game.js +102 -0
- package/examples/typescript/game.ts +134 -0
- package/examples/typescript/index.html +10 -0
- package/examples/typescript/tiles.png +0 -0
- package/examples/typescript/tsconfig.json +8 -0
- package/package.json +1 -1
- package/plugins/newgrounds.js +44 -35
- package/plugins/postProcess.js +18 -4
- package/plugins/uiSystem.js +196 -30
- package/src/engine.js +21 -20
- package/src/engineAudio.js +59 -59
- package/src/engineDebug.js +44 -41
- package/src/engineDraw.js +58 -58
- package/src/engineExport.js +2 -4
- package/src/engineInput.js +40 -35
- package/src/engineMedals.js +21 -11
- package/src/engineObject.js +42 -35
- package/src/engineParticles.js +10 -10
- package/src/engineSettings.js +77 -82
- package/src/engineTileLayer.js +21 -21
- package/src/engineUtilities.js +150 -150
- package/src/engineWebGL.js +3 -3
package/dist/littlejs.d.ts
CHANGED
|
@@ -19,48 +19,48 @@ declare module "littlejsengine" {
|
|
|
19
19
|
* @namespace Engine
|
|
20
20
|
*/
|
|
21
21
|
/** Name of engine
|
|
22
|
-
* @type {
|
|
22
|
+
* @type {string}
|
|
23
23
|
* @default
|
|
24
24
|
* @memberof Engine */
|
|
25
25
|
export const engineName: string;
|
|
26
26
|
/** Version of engine
|
|
27
|
-
* @type {
|
|
27
|
+
* @type {string}
|
|
28
28
|
* @default
|
|
29
29
|
* @memberof Engine */
|
|
30
30
|
export const engineVersion: string;
|
|
31
31
|
/** Frames per second to update
|
|
32
|
-
* @type {
|
|
32
|
+
* @type {number}
|
|
33
33
|
* @default
|
|
34
34
|
* @memberof Engine */
|
|
35
35
|
export const frameRate: number;
|
|
36
36
|
/** How many seconds each frame lasts, engine uses a fixed time step
|
|
37
|
-
* @type {
|
|
37
|
+
* @type {number}
|
|
38
38
|
* @default 1/60
|
|
39
39
|
* @memberof Engine */
|
|
40
40
|
export const timeDelta: number;
|
|
41
41
|
/** Array containing all engine objects
|
|
42
|
-
* @type {Array}
|
|
42
|
+
* @type {Array<EngineObject>}
|
|
43
43
|
* @memberof Engine */
|
|
44
|
-
export let engineObjects:
|
|
44
|
+
export let engineObjects: Array<EngineObject>;
|
|
45
45
|
/** Current update frame, used to calculate time
|
|
46
|
-
* @type {
|
|
46
|
+
* @type {number}
|
|
47
47
|
* @memberof Engine */
|
|
48
48
|
export let frame: number;
|
|
49
49
|
/** Current engine time since start in seconds
|
|
50
|
-
* @type {
|
|
50
|
+
* @type {number}
|
|
51
51
|
* @memberof Engine */
|
|
52
52
|
export let time: number;
|
|
53
53
|
/** Actual clock time since start in seconds (not affected by pause or frame rate clamping)
|
|
54
|
-
* @type {
|
|
54
|
+
* @type {number}
|
|
55
55
|
* @memberof Engine */
|
|
56
56
|
export let timeReal: number;
|
|
57
57
|
/** Is the game paused? Causes time and objects to not be updated
|
|
58
|
-
* @type {
|
|
58
|
+
* @type {boolean}
|
|
59
59
|
* @default false
|
|
60
60
|
* @memberof Engine */
|
|
61
61
|
export let paused: boolean;
|
|
62
62
|
/** Set if game is paused
|
|
63
|
-
* @param {
|
|
63
|
+
* @param {boolean} isPaused
|
|
64
64
|
* @memberof Engine */
|
|
65
65
|
export function setPaused(isPaused: boolean): void;
|
|
66
66
|
/** Startup LittleJS engine with your callback functions
|
|
@@ -69,10 +69,10 @@ declare module "littlejsengine" {
|
|
|
69
69
|
* @param {Function} gameUpdatePost - Called after physics and objects are updated, even when paused
|
|
70
70
|
* @param {Function} gameRender - Called before objects are rendered, for drawing the background
|
|
71
71
|
* @param {Function} gameRenderPost - Called after objects are rendered, useful for drawing UI
|
|
72
|
-
* @param {Array} [imageSources=[]] - List of images to load
|
|
72
|
+
* @param {Array<string>} [imageSources=[]] - List of images to load
|
|
73
73
|
* @param {HTMLElement} [rootElement] - Root element to attach to, the document body by default
|
|
74
74
|
* @memberof Engine */
|
|
75
|
-
export function engineInit(gameInit: Function | (() => Promise<any>), gameUpdate: Function, gameUpdatePost: Function, gameRender: Function, gameRenderPost: Function, imageSources?:
|
|
75
|
+
export function engineInit(gameInit: Function | (() => Promise<any>), gameUpdate: Function, gameUpdatePost: Function, gameRender: Function, gameRenderPost: Function, imageSources?: Array<string>, rootElement?: HTMLElement): void;
|
|
76
76
|
/** Update each engine object, remove destroyed objects, and update time
|
|
77
77
|
* @memberof Engine */
|
|
78
78
|
export function engineObjectsUpdate(): void;
|
|
@@ -81,25 +81,25 @@ declare module "littlejsengine" {
|
|
|
81
81
|
export function engineObjectsDestroy(): void;
|
|
82
82
|
/** Collects all object within a given area
|
|
83
83
|
* @param {Vector2} [pos] - Center of test area, or undefined for all objects
|
|
84
|
-
* @param {
|
|
85
|
-
* @param {Array} [objects=engineObjects] - List of objects to check
|
|
86
|
-
* @return {Array} - List of collected objects
|
|
84
|
+
* @param {Vector2|number} [size] - Radius of circle if float, rectangle size if Vector2
|
|
85
|
+
* @param {Array<EngineObject>} [objects=engineObjects] - List of objects to check
|
|
86
|
+
* @return {Array<EngineObject>} - List of collected objects
|
|
87
87
|
* @memberof Engine */
|
|
88
|
-
export function engineObjectsCollect(pos?: Vector2, size?:
|
|
88
|
+
export function engineObjectsCollect(pos?: Vector2, size?: Vector2 | number, objects?: Array<EngineObject>): Array<EngineObject>;
|
|
89
89
|
/** Triggers a callback for each object within a given area
|
|
90
90
|
* @param {Vector2} [pos] - Center of test area, or undefined for all objects
|
|
91
|
-
* @param {
|
|
91
|
+
* @param {Vector2|number} [size] - Radius of circle if float, rectangle size if Vector2
|
|
92
92
|
* @param {Function} [callbackFunction] - Calls this function on every object that passes the test
|
|
93
|
-
* @param {Array} [objects=engineObjects] - List of objects to check
|
|
93
|
+
* @param {Array<EngineObject>} [objects=engineObjects] - List of objects to check
|
|
94
94
|
* @memberof Engine */
|
|
95
|
-
export function engineObjectsCallback(pos?: Vector2, size?:
|
|
95
|
+
export function engineObjectsCallback(pos?: Vector2, size?: Vector2 | number, callbackFunction?: Function, objects?: Array<EngineObject>): void;
|
|
96
96
|
/** Return a list of objects intersecting a ray
|
|
97
97
|
* @param {Vector2} start
|
|
98
98
|
* @param {Vector2} end
|
|
99
|
-
* @param {Array} [objects=engineObjects] - List of objects to check
|
|
100
|
-
* @return {Array} - List of objects hit
|
|
99
|
+
* @param {Array<EngineObject>} [objects=engineObjects] - List of objects to check
|
|
100
|
+
* @return {Array<EngineObject>} - List of objects hit
|
|
101
101
|
* @memberof Engine */
|
|
102
|
-
export function engineObjectsRaycast(start: Vector2, end: Vector2, objects?:
|
|
102
|
+
export function engineObjectsRaycast(start: Vector2, end: Vector2, objects?: Array<EngineObject>): Array<EngineObject>;
|
|
103
103
|
/** Add a new update function for a plugin
|
|
104
104
|
* @param {Function} [updateFunction]
|
|
105
105
|
* @param {Function} [renderFunction]
|
|
@@ -115,64 +115,64 @@ declare module "littlejsengine" {
|
|
|
115
115
|
* @namespace Debug
|
|
116
116
|
*/
|
|
117
117
|
/** True if debug is enabled
|
|
118
|
-
* @type {
|
|
118
|
+
* @type {boolean}
|
|
119
119
|
* @default
|
|
120
120
|
* @memberof Debug */
|
|
121
121
|
export const debug: boolean;
|
|
122
122
|
/** True if the debug overlay is active, always false in release builds
|
|
123
|
-
* @type {
|
|
123
|
+
* @type {boolean}
|
|
124
124
|
* @default
|
|
125
125
|
* @memberof Debug */
|
|
126
126
|
export let debugOverlay: boolean;
|
|
127
127
|
/** True if watermark with FPS should be shown, false in release builds
|
|
128
|
-
* @type {
|
|
128
|
+
* @type {boolean}
|
|
129
129
|
* @default
|
|
130
130
|
* @memberof Debug */
|
|
131
131
|
export let showWatermark: boolean;
|
|
132
132
|
/** Asserts if the expression is false, does not do anything in release builds
|
|
133
|
-
* @param {
|
|
133
|
+
* @param {boolean} assert
|
|
134
134
|
* @param {Object} [output]
|
|
135
135
|
* @memberof Debug */
|
|
136
136
|
export function ASSERT(assert: boolean, output?: any): void;
|
|
137
137
|
/** Draw a debug rectangle in world space
|
|
138
138
|
* @param {Vector2} pos
|
|
139
139
|
* @param {Vector2} [size=Vector2()]
|
|
140
|
-
* @param {
|
|
141
|
-
* @param {
|
|
142
|
-
* @param {
|
|
143
|
-
* @param {
|
|
140
|
+
* @param {string} [color]
|
|
141
|
+
* @param {number} [time]
|
|
142
|
+
* @param {number} [angle]
|
|
143
|
+
* @param {boolean} [fill]
|
|
144
144
|
* @memberof Debug */
|
|
145
145
|
export function debugRect(pos: Vector2, size?: Vector2, color?: string, time?: number, angle?: number, fill?: boolean): void;
|
|
146
146
|
/** Draw a debug poly in world space
|
|
147
147
|
* @param {Vector2} pos
|
|
148
|
-
* @param {Array}
|
|
149
|
-
* @param {
|
|
150
|
-
* @param {
|
|
151
|
-
* @param {
|
|
152
|
-
* @param {
|
|
148
|
+
* @param {Array<Vector2>} points
|
|
149
|
+
* @param {string} [color]
|
|
150
|
+
* @param {number} [time]
|
|
151
|
+
* @param {number} [angle]
|
|
152
|
+
* @param {boolean} [fill]
|
|
153
153
|
* @memberof Debug */
|
|
154
|
-
export function debugPoly(pos: Vector2, points:
|
|
154
|
+
export function debugPoly(pos: Vector2, points: Array<Vector2>, color?: string, time?: number, angle?: number, fill?: boolean): void;
|
|
155
155
|
/** Draw a debug circle in world space
|
|
156
156
|
* @param {Vector2} pos
|
|
157
|
-
* @param {
|
|
158
|
-
* @param {
|
|
159
|
-
* @param {
|
|
160
|
-
* @param {
|
|
157
|
+
* @param {number} [radius]
|
|
158
|
+
* @param {string} [color]
|
|
159
|
+
* @param {number} [time]
|
|
160
|
+
* @param {boolean} [fill]
|
|
161
161
|
* @memberof Debug */
|
|
162
162
|
export function debugCircle(pos: Vector2, radius?: number, color?: string, time?: number, fill?: boolean): void;
|
|
163
163
|
/** Draw a debug point in world space
|
|
164
164
|
* @param {Vector2} pos
|
|
165
|
-
* @param {
|
|
166
|
-
* @param {
|
|
167
|
-
* @param {
|
|
165
|
+
* @param {string} [color]
|
|
166
|
+
* @param {number} [time]
|
|
167
|
+
* @param {number} [angle]
|
|
168
168
|
* @memberof Debug */
|
|
169
169
|
export function debugPoint(pos: Vector2, color?: string, time?: number, angle?: number): void;
|
|
170
170
|
/** Draw a debug line in world space
|
|
171
171
|
* @param {Vector2} posA
|
|
172
172
|
* @param {Vector2} posB
|
|
173
|
-
* @param {
|
|
174
|
-
* @param {
|
|
175
|
-
* @param {
|
|
173
|
+
* @param {string} [color]
|
|
174
|
+
* @param {number} [thickness]
|
|
175
|
+
* @param {number} [time]
|
|
176
176
|
* @memberof Debug */
|
|
177
177
|
export function debugLine(posA: Vector2, posB: Vector2, color?: string, thickness?: number, time?: number): void;
|
|
178
178
|
/** Draw a debug combined axis aligned bounding box in world space
|
|
@@ -180,17 +180,17 @@ declare module "littlejsengine" {
|
|
|
180
180
|
* @param {Vector2} sA - size A
|
|
181
181
|
* @param {Vector2} pB - position B
|
|
182
182
|
* @param {Vector2} sB - size B
|
|
183
|
-
* @param {
|
|
183
|
+
* @param {string} [color]
|
|
184
184
|
* @memberof Debug */
|
|
185
185
|
export function debugOverlap(pA: Vector2, sA: Vector2, pB: Vector2, sB: Vector2, color?: string): void;
|
|
186
186
|
/** Draw a debug axis aligned bounding box in world space
|
|
187
|
-
* @param {
|
|
187
|
+
* @param {string} text
|
|
188
188
|
* @param {Vector2} pos
|
|
189
|
-
* @param {
|
|
190
|
-
* @param {
|
|
191
|
-
* @param {
|
|
192
|
-
* @param {
|
|
193
|
-
* @param {
|
|
189
|
+
* @param {number} [size]
|
|
190
|
+
* @param {string} [color]
|
|
191
|
+
* @param {number} [time]
|
|
192
|
+
* @param {number} [angle]
|
|
193
|
+
* @param {string} [font]
|
|
194
194
|
* @memberof Debug */
|
|
195
195
|
export function debugText(text: string, pos: Vector2, size?: number, color?: string, time?: number, angle?: number, font?: string): void;
|
|
196
196
|
/** Clear all debug primitives in the list
|
|
@@ -201,19 +201,19 @@ declare module "littlejsengine" {
|
|
|
201
201
|
export function debugScreenshot(): void;
|
|
202
202
|
/** Save a canvas to disk
|
|
203
203
|
* @param {HTMLCanvasElement} canvas
|
|
204
|
-
* @param {
|
|
205
|
-
* @param {
|
|
204
|
+
* @param {string} [filename]
|
|
205
|
+
* @param {string} [type]
|
|
206
206
|
* @memberof Debug */
|
|
207
207
|
export function debugSaveCanvas(canvas: HTMLCanvasElement, filename?: string, type?: string): void;
|
|
208
208
|
/** Save a text file to disk
|
|
209
|
-
* @param {
|
|
210
|
-
* @param {
|
|
211
|
-
* @param {
|
|
209
|
+
* @param {string} text
|
|
210
|
+
* @param {string} [filename]
|
|
211
|
+
* @param {string} [type]
|
|
212
212
|
* @memberof Debug */
|
|
213
213
|
export function debugSaveText(text: string, filename?: string, type?: string): void;
|
|
214
214
|
/** Save a data url to disk
|
|
215
|
-
* @param {
|
|
216
|
-
* @param {
|
|
215
|
+
* @param {string} dataURL
|
|
216
|
+
* @param {string} filename
|
|
217
217
|
* @memberof Debug */
|
|
218
218
|
export function debugSaveDataURL(dataURL: string, filename: string): void;
|
|
219
219
|
/**
|
|
@@ -227,7 +227,7 @@ declare module "littlejsengine" {
|
|
|
227
227
|
* @memberof Settings */
|
|
228
228
|
export let cameraPos: Vector2;
|
|
229
229
|
/** Scale of camera in world space
|
|
230
|
-
* @type {
|
|
230
|
+
* @type {number}
|
|
231
231
|
* @default
|
|
232
232
|
* @memberof Settings */
|
|
233
233
|
export let cameraScale: number;
|
|
@@ -243,27 +243,30 @@ declare module "littlejsengine" {
|
|
|
243
243
|
* @memberof Settings */
|
|
244
244
|
export let canvasFixedSize: Vector2;
|
|
245
245
|
/** Use nearest neighbor scaling algorithm for canvas for more pixelated look
|
|
246
|
-
*
|
|
246
|
+
* - Must be set before startup to take effect
|
|
247
|
+
* - If enabled sets css image-rendering:pixelated
|
|
248
|
+
* @type {boolean}
|
|
247
249
|
* @default
|
|
248
250
|
* @memberof Settings */
|
|
249
251
|
export let canvasPixelated: boolean;
|
|
250
252
|
/** Disables texture filtering for crisper pixel art
|
|
251
|
-
* @type {
|
|
253
|
+
* @type {boolean}
|
|
252
254
|
* @default
|
|
253
255
|
* @memberof Settings */
|
|
254
256
|
export let tilesPixelated: boolean;
|
|
255
257
|
/** Default font used for text rendering
|
|
256
|
-
* @type {
|
|
258
|
+
* @type {string}
|
|
257
259
|
* @default
|
|
258
260
|
* @memberof Settings */
|
|
259
261
|
export let fontDefault: string;
|
|
260
262
|
/** Enable to show the LittleJS splash screen be shown on startup
|
|
261
|
-
* @type {
|
|
263
|
+
* @type {boolean}
|
|
262
264
|
* @default
|
|
263
265
|
* @memberof Settings */
|
|
264
266
|
export let showSplashScreen: boolean;
|
|
265
267
|
/** Disables all rendering, audio, and input for servers
|
|
266
|
-
*
|
|
268
|
+
* - Must be set before startup to take effect
|
|
269
|
+
* @type {boolean}
|
|
267
270
|
* @default
|
|
268
271
|
* @memberof Settings */
|
|
269
272
|
export let headlessMode: boolean;
|
|
@@ -273,134 +276,136 @@ declare module "littlejsengine" {
|
|
|
273
276
|
* @memberof Settings */
|
|
274
277
|
export let tileSizeDefault: Vector2;
|
|
275
278
|
/** How many pixels smaller to draw tiles to prevent bleeding from neighbors
|
|
276
|
-
* @type {
|
|
279
|
+
* @type {number}
|
|
277
280
|
* @default
|
|
278
281
|
* @memberof Settings */
|
|
279
282
|
export let tileFixBleedScale: number;
|
|
280
283
|
/** Enable physics solver for collisions between objects
|
|
281
|
-
* @type {
|
|
284
|
+
* @type {boolean}
|
|
282
285
|
* @default
|
|
283
286
|
* @memberof Settings */
|
|
284
287
|
export let enablePhysicsSolver: boolean;
|
|
285
288
|
/** Default object mass for collision calculations (how heavy objects are)
|
|
286
|
-
* @type {
|
|
289
|
+
* @type {number}
|
|
287
290
|
* @default
|
|
288
291
|
* @memberof Settings */
|
|
289
292
|
export let objectDefaultMass: number;
|
|
290
293
|
/** How much to slow velocity by each frame (0-1)
|
|
291
|
-
* @type {
|
|
294
|
+
* @type {number}
|
|
292
295
|
* @default
|
|
293
296
|
* @memberof Settings */
|
|
294
297
|
export let objectDefaultDamping: number;
|
|
295
298
|
/** How much to slow angular velocity each frame (0-1)
|
|
296
|
-
* @type {
|
|
299
|
+
* @type {number}
|
|
297
300
|
* @default
|
|
298
301
|
* @memberof Settings */
|
|
299
302
|
export let objectDefaultAngleDamping: number;
|
|
300
303
|
/** How much to bounce when a collision occurs (0-1)
|
|
301
|
-
* @type {
|
|
304
|
+
* @type {number}
|
|
302
305
|
* @default
|
|
303
306
|
* @memberof Settings */
|
|
304
307
|
export let objectDefaultElasticity: number;
|
|
305
308
|
/** How much to slow when touching (0-1)
|
|
306
|
-
* @type {
|
|
309
|
+
* @type {number}
|
|
307
310
|
* @default
|
|
308
311
|
* @memberof Settings */
|
|
309
312
|
export let objectDefaultFriction: number;
|
|
310
313
|
/** Clamp max speed to avoid fast objects missing collisions
|
|
311
|
-
* @type {
|
|
314
|
+
* @type {number}
|
|
312
315
|
* @default
|
|
313
316
|
* @memberof Settings */
|
|
314
317
|
export let objectMaxSpeed: number;
|
|
315
318
|
/** How much gravity to apply to objects along the Y axis, negative is down
|
|
316
|
-
* @type {
|
|
319
|
+
* @type {number}
|
|
317
320
|
* @default
|
|
318
321
|
* @memberof Settings */
|
|
319
322
|
export let gravity: number;
|
|
320
323
|
/** Scales emit rate of particles, useful for low graphics mode (0 disables particle emitters)
|
|
321
|
-
* @type {
|
|
324
|
+
* @type {number}
|
|
322
325
|
* @default
|
|
323
326
|
* @memberof Settings */
|
|
324
327
|
export let particleEmitRateScale: number;
|
|
325
328
|
/** Enable webgl rendering, webgl can be disabled and removed from build (with some features disabled)
|
|
326
|
-
*
|
|
329
|
+
* - Must be set before startup to take effect
|
|
330
|
+
* @type {boolean}
|
|
327
331
|
* @default
|
|
328
332
|
* @memberof Settings */
|
|
329
333
|
export let glEnable: boolean;
|
|
330
334
|
/** Fixes slow rendering in some browsers by not compositing the WebGL canvas
|
|
331
|
-
*
|
|
335
|
+
* - Must be set before startup to take effect
|
|
336
|
+
* @type {boolean}
|
|
332
337
|
* @default
|
|
333
338
|
* @memberof Settings */
|
|
334
339
|
export let glOverlay: boolean;
|
|
335
340
|
/** Should gamepads be allowed
|
|
336
|
-
* @type {
|
|
341
|
+
* @type {boolean}
|
|
337
342
|
* @default
|
|
338
343
|
* @memberof Settings */
|
|
339
344
|
export let gamepadsEnable: boolean;
|
|
340
345
|
/** If true, the dpad input is also routed to the left analog stick (for better accessability)
|
|
341
|
-
* @type {
|
|
346
|
+
* @type {boolean}
|
|
342
347
|
* @default
|
|
343
348
|
* @memberof Settings */
|
|
344
349
|
export let gamepadDirectionEmulateStick: boolean;
|
|
345
350
|
/** If true the WASD keys are also routed to the direction keys (for better accessability)
|
|
346
|
-
* @type {
|
|
351
|
+
* @type {boolean}
|
|
347
352
|
* @default
|
|
348
353
|
* @memberof Settings */
|
|
349
354
|
export let inputWASDEmulateDirection: boolean;
|
|
350
355
|
/** True if touch gamepad should appear on mobile devices
|
|
351
356
|
* - Supports left analog stick, 4 face buttons and start button (button 9)
|
|
352
|
-
* - Must be set
|
|
353
|
-
* @type {
|
|
357
|
+
* - Must be set before startup to take effect
|
|
358
|
+
* @type {boolean}
|
|
354
359
|
* @default
|
|
355
360
|
* @memberof Settings */
|
|
356
361
|
export let touchGamepadEnable: boolean;
|
|
357
362
|
/** True if touch gamepad should be analog stick or false to use if 8 way dpad
|
|
358
|
-
* @type {
|
|
363
|
+
* @type {boolean}
|
|
359
364
|
* @default
|
|
360
365
|
* @memberof Settings */
|
|
361
366
|
export let touchGamepadAnalog: boolean;
|
|
362
367
|
/** Size of virtual gamepad for touch devices in pixels
|
|
363
|
-
* @type {
|
|
368
|
+
* @type {number}
|
|
364
369
|
* @default
|
|
365
370
|
* @memberof Settings */
|
|
366
371
|
export let touchGamepadSize: number;
|
|
367
372
|
/** Transparency of touch gamepad overlay
|
|
368
|
-
* @type {
|
|
373
|
+
* @type {number}
|
|
369
374
|
* @default
|
|
370
375
|
* @memberof Settings */
|
|
371
376
|
export let touchGamepadAlpha: number;
|
|
372
377
|
/** Allow vibration hardware if it exists
|
|
373
|
-
* @type {
|
|
378
|
+
* @type {boolean}
|
|
374
379
|
* @default
|
|
375
380
|
* @memberof Settings */
|
|
376
381
|
export let vibrateEnable: boolean;
|
|
377
382
|
/** All audio code can be disabled and removed from build
|
|
378
|
-
* @type {
|
|
383
|
+
* @type {boolean}
|
|
379
384
|
* @default
|
|
380
385
|
* @memberof Settings */
|
|
381
386
|
export let soundEnable: boolean;
|
|
382
387
|
/** Volume scale to apply to all sound, music and speech
|
|
383
|
-
* @type {
|
|
388
|
+
* @type {number}
|
|
384
389
|
* @default
|
|
385
390
|
* @memberof Settings */
|
|
386
391
|
export let soundVolume: number;
|
|
387
392
|
/** Default range where sound no longer plays
|
|
388
|
-
* @type {
|
|
393
|
+
* @type {number}
|
|
389
394
|
* @default
|
|
390
395
|
* @memberof Settings */
|
|
391
396
|
export let soundDefaultRange: number;
|
|
392
397
|
/** Default range percent to start tapering off sound (0-1)
|
|
393
|
-
* @type {
|
|
398
|
+
* @type {number}
|
|
394
399
|
* @default
|
|
395
400
|
* @memberof Settings */
|
|
396
401
|
export let soundDefaultTaper: number;
|
|
397
402
|
/** How long to show medals for in seconds
|
|
398
|
-
* @type {
|
|
403
|
+
* @type {number}
|
|
399
404
|
* @default
|
|
400
405
|
* @memberof Settings */
|
|
401
406
|
export let medalDisplayTime: number;
|
|
402
407
|
/** How quickly to slide on/off medals in seconds
|
|
403
|
-
* @type {
|
|
408
|
+
* @type {number}
|
|
404
409
|
* @default
|
|
405
410
|
* @memberof Settings */
|
|
406
411
|
export let medalDisplaySlideTime: number;
|
|
@@ -409,17 +414,12 @@ declare module "littlejsengine" {
|
|
|
409
414
|
* @default Vector2(640,80)
|
|
410
415
|
* @memberof Settings */
|
|
411
416
|
export let medalDisplaySize: Vector2;
|
|
412
|
-
/** Size of icon in medal display
|
|
413
|
-
* @type {Number}
|
|
414
|
-
* @default
|
|
415
|
-
* @memberof Settings */
|
|
416
|
-
export let medalDisplayIconSize: number;
|
|
417
417
|
/** Set position of camera in world space
|
|
418
418
|
* @param {Vector2} pos
|
|
419
419
|
* @memberof Settings */
|
|
420
420
|
export function setCameraPos(pos: Vector2): void;
|
|
421
421
|
/** Set scale of camera in world space
|
|
422
|
-
* @param {
|
|
422
|
+
* @param {number} scale
|
|
423
423
|
* @memberof Settings */
|
|
424
424
|
export function setCameraScale(scale: number): void;
|
|
425
425
|
/** Set max size of the canvas
|
|
@@ -431,31 +431,31 @@ declare module "littlejsengine" {
|
|
|
431
431
|
* @memberof Settings */
|
|
432
432
|
export function setCanvasFixedSize(size: Vector2): void;
|
|
433
433
|
/** Use nearest neighbor scaling algorithm for canvas for more pixelated look
|
|
434
|
-
* @param {
|
|
434
|
+
* @param {boolean} pixelated
|
|
435
435
|
* @memberof Settings */
|
|
436
436
|
export function setCanvasPixelated(pixelated: boolean): void;
|
|
437
437
|
/** Disables texture filtering for crisper pixel art
|
|
438
|
-
* @param {
|
|
438
|
+
* @param {boolean} pixelated
|
|
439
439
|
* @memberof Settings */
|
|
440
440
|
export function setTilesPixelated(pixelated: boolean): void;
|
|
441
441
|
/** Set default font used for text rendering
|
|
442
|
-
* @param {
|
|
442
|
+
* @param {string} font
|
|
443
443
|
* @memberof Settings */
|
|
444
444
|
export function setFontDefault(font: string): void;
|
|
445
445
|
/** Set if the LittleJS splash screen be shown on startup
|
|
446
|
-
* @param {
|
|
446
|
+
* @param {boolean} show
|
|
447
447
|
* @memberof Settings */
|
|
448
448
|
export function setShowSplashScreen(show: boolean): void;
|
|
449
449
|
/** Set to disable rendering, audio, and input for servers
|
|
450
|
-
* @param {
|
|
450
|
+
* @param {boolean} headless
|
|
451
451
|
* @memberof Settings */
|
|
452
452
|
export function setHeadlessMode(headless: boolean): void;
|
|
453
453
|
/** Set if webgl rendering is enabled
|
|
454
|
-
* @param {
|
|
454
|
+
* @param {boolean} enable
|
|
455
455
|
* @memberof Settings */
|
|
456
456
|
export function setGlEnable(enable: boolean): void;
|
|
457
457
|
/** Set to not composite the WebGL canvas
|
|
458
|
-
* @param {
|
|
458
|
+
* @param {boolean} overlay
|
|
459
459
|
* @memberof Settings */
|
|
460
460
|
export function setGlOverlay(overlay: boolean): void;
|
|
461
461
|
/** Set default size of tiles in pixels
|
|
@@ -463,123 +463,119 @@ declare module "littlejsengine" {
|
|
|
463
463
|
* @memberof Settings */
|
|
464
464
|
export function setTileSizeDefault(size: Vector2): void;
|
|
465
465
|
/** Set to prevent tile bleeding from neighbors in pixels
|
|
466
|
-
* @param {
|
|
466
|
+
* @param {number} scale
|
|
467
467
|
* @memberof Settings */
|
|
468
468
|
export function setTileFixBleedScale(scale: number): void;
|
|
469
469
|
/** Set if collisions between objects are enabled
|
|
470
|
-
* @param {
|
|
470
|
+
* @param {boolean} enable
|
|
471
471
|
* @memberof Settings */
|
|
472
472
|
export function setEnablePhysicsSolver(enable: boolean): void;
|
|
473
473
|
/** Set default object mass for collision calculations
|
|
474
|
-
* @param {
|
|
474
|
+
* @param {number} mass
|
|
475
475
|
* @memberof Settings */
|
|
476
476
|
export function setObjectDefaultMass(mass: number): void;
|
|
477
477
|
/** Set how much to slow velocity by each frame
|
|
478
|
-
* @param {
|
|
478
|
+
* @param {number} damp
|
|
479
479
|
* @memberof Settings */
|
|
480
480
|
export function setObjectDefaultDamping(damp: number): void;
|
|
481
481
|
/** Set how much to slow angular velocity each frame
|
|
482
|
-
* @param {
|
|
482
|
+
* @param {number} damp
|
|
483
483
|
* @memberof Settings */
|
|
484
484
|
export function setObjectDefaultAngleDamping(damp: number): void;
|
|
485
485
|
/** Set how much to bounce when a collision occur
|
|
486
|
-
* @param {
|
|
486
|
+
* @param {number} elasticity
|
|
487
487
|
* @memberof Settings */
|
|
488
488
|
export function setObjectDefaultElasticity(elasticity: number): void;
|
|
489
489
|
/** Set how much to slow when touching
|
|
490
|
-
* @param {
|
|
490
|
+
* @param {number} friction
|
|
491
491
|
* @memberof Settings */
|
|
492
492
|
export function setObjectDefaultFriction(friction: number): void;
|
|
493
493
|
/** Set max speed to avoid fast objects missing collisions
|
|
494
|
-
* @param {
|
|
494
|
+
* @param {number} speed
|
|
495
495
|
* @memberof Settings */
|
|
496
496
|
export function setObjectMaxSpeed(speed: number): void;
|
|
497
497
|
/** Set how much gravity to apply to objects along the Y axis
|
|
498
|
-
* @param {
|
|
498
|
+
* @param {number} newGravity
|
|
499
499
|
* @memberof Settings */
|
|
500
500
|
export function setGravity(newGravity: number): void;
|
|
501
501
|
/** Set to scales emit rate of particles
|
|
502
|
-
* @param {
|
|
502
|
+
* @param {number} scale
|
|
503
503
|
* @memberof Settings */
|
|
504
504
|
export function setParticleEmitRateScale(scale: number): void;
|
|
505
505
|
/** Set if touch input is allowed
|
|
506
|
-
* @param {
|
|
506
|
+
* @param {boolean} enable
|
|
507
507
|
* @memberof Settings */
|
|
508
508
|
export function setTouchInputEnable(enable: boolean): void;
|
|
509
509
|
/** Set if gamepads are enabled
|
|
510
|
-
* @param {
|
|
510
|
+
* @param {boolean} enable
|
|
511
511
|
* @memberof Settings */
|
|
512
512
|
export function setGamepadsEnable(enable: boolean): void;
|
|
513
513
|
/** Set if the dpad input is also routed to the left analog stick
|
|
514
|
-
* @param {
|
|
514
|
+
* @param {boolean} enable
|
|
515
515
|
* @memberof Settings */
|
|
516
516
|
export function setGamepadDirectionEmulateStick(enable: boolean): void;
|
|
517
517
|
/** Set if true the WASD keys are also routed to the direction keys
|
|
518
|
-
* @param {
|
|
518
|
+
* @param {boolean} enable
|
|
519
519
|
* @memberof Settings */
|
|
520
520
|
export function setInputWASDEmulateDirection(enable: boolean): void;
|
|
521
521
|
/** Set if touch gamepad should appear on mobile devices
|
|
522
|
-
* @param {
|
|
522
|
+
* @param {boolean} enable
|
|
523
523
|
* @memberof Settings */
|
|
524
524
|
export function setTouchGamepadEnable(enable: boolean): void;
|
|
525
525
|
/** Set if touch gamepad should be analog stick or 8 way dpad
|
|
526
|
-
* @param {
|
|
526
|
+
* @param {boolean} analog
|
|
527
527
|
* @memberof Settings */
|
|
528
528
|
export function setTouchGamepadAnalog(analog: boolean): void;
|
|
529
529
|
/** Set size of virtual gamepad for touch devices in pixels
|
|
530
|
-
* @param {
|
|
530
|
+
* @param {number} size
|
|
531
531
|
* @memberof Settings */
|
|
532
532
|
export function setTouchGamepadSize(size: number): void;
|
|
533
533
|
/** Set transparency of touch gamepad overlay
|
|
534
|
-
* @param {
|
|
534
|
+
* @param {number} alpha
|
|
535
535
|
* @memberof Settings */
|
|
536
536
|
export function setTouchGamepadAlpha(alpha: number): void;
|
|
537
537
|
/** Set to allow vibration hardware if it exists
|
|
538
|
-
* @param {
|
|
538
|
+
* @param {boolean} enable
|
|
539
539
|
* @memberof Settings */
|
|
540
540
|
export function setVibrateEnable(enable: boolean): void;
|
|
541
541
|
/** Set to disable all audio code
|
|
542
|
-
* @param {
|
|
542
|
+
* @param {boolean} enable
|
|
543
543
|
* @memberof Settings */
|
|
544
544
|
export function setSoundEnable(enable: boolean): void;
|
|
545
545
|
/** Set volume scale to apply to all sound, music and speech
|
|
546
|
-
* @param {
|
|
546
|
+
* @param {number} volume
|
|
547
547
|
* @memberof Settings */
|
|
548
548
|
export function setSoundVolume(volume: number): void;
|
|
549
549
|
/** Set default range where sound no longer plays
|
|
550
|
-
* @param {
|
|
550
|
+
* @param {number} range
|
|
551
551
|
* @memberof Settings */
|
|
552
552
|
export function setSoundDefaultRange(range: number): void;
|
|
553
553
|
/** Set default range percent to start tapering off sound
|
|
554
|
-
* @param {
|
|
554
|
+
* @param {number} taper
|
|
555
555
|
* @memberof Settings */
|
|
556
556
|
export function setSoundDefaultTaper(taper: number): void;
|
|
557
557
|
/** Set how long to show medals for in seconds
|
|
558
|
-
* @param {
|
|
558
|
+
* @param {number} time
|
|
559
559
|
* @memberof Settings */
|
|
560
560
|
export function setMedalDisplayTime(time: number): void;
|
|
561
561
|
/** Set how quickly to slide on/off medals in seconds
|
|
562
|
-
* @param {
|
|
562
|
+
* @param {number} time
|
|
563
563
|
* @memberof Settings */
|
|
564
564
|
export function setMedalDisplaySlideTime(time: number): void;
|
|
565
565
|
/** Set size of medal display
|
|
566
566
|
* @param {Vector2} size
|
|
567
567
|
* @memberof Settings */
|
|
568
568
|
export function setMedalDisplaySize(size: Vector2): void;
|
|
569
|
-
/** Set size of icon in medal display
|
|
570
|
-
* @param {Number} size
|
|
571
|
-
* @memberof Settings */
|
|
572
|
-
export function setMedalDisplayIconSize(size: number): void;
|
|
573
569
|
/** Set to stop medals from being unlockable
|
|
574
|
-
* @param {
|
|
570
|
+
* @param {boolean} preventUnlock
|
|
575
571
|
* @memberof Settings */
|
|
576
572
|
export function setMedalsPreventUnlock(preventUnlock: boolean): void;
|
|
577
573
|
/** Set if watermark with FPS should be shown
|
|
578
|
-
* @param {
|
|
574
|
+
* @param {boolean} show
|
|
579
575
|
* @memberof Debug */
|
|
580
576
|
export function setShowWatermark(show: boolean): void;
|
|
581
577
|
/** Set key code used to toggle debug mode, Esc by default
|
|
582
|
-
* @param {
|
|
578
|
+
* @param {string} key
|
|
583
579
|
* @memberof Debug */
|
|
584
580
|
export function setDebugKey(key: string): void;
|
|
585
581
|
/**
|
|
@@ -592,95 +588,95 @@ declare module "littlejsengine" {
|
|
|
592
588
|
* @namespace Utilities
|
|
593
589
|
*/
|
|
594
590
|
/** A shortcut to get Math.PI
|
|
595
|
-
* @type {
|
|
591
|
+
* @type {number}
|
|
596
592
|
* @default Math.PI
|
|
597
593
|
* @memberof Utilities */
|
|
598
594
|
export const PI: number;
|
|
599
595
|
/** Returns absolute value of value passed in
|
|
600
|
-
* @param {
|
|
601
|
-
* @return {
|
|
596
|
+
* @param {number} value
|
|
597
|
+
* @return {number}
|
|
602
598
|
* @memberof Utilities */
|
|
603
599
|
export function abs(value: number): number;
|
|
604
600
|
/** Returns lowest of two values passed in
|
|
605
|
-
* @param {
|
|
606
|
-
* @param {
|
|
607
|
-
* @return {
|
|
601
|
+
* @param {number} valueA
|
|
602
|
+
* @param {number} valueB
|
|
603
|
+
* @return {number}
|
|
608
604
|
* @memberof Utilities */
|
|
609
605
|
export function min(valueA: number, valueB: number): number;
|
|
610
606
|
/** Returns highest of two values passed in
|
|
611
|
-
* @param {
|
|
612
|
-
* @param {
|
|
613
|
-
* @return {
|
|
607
|
+
* @param {number} valueA
|
|
608
|
+
* @param {number} valueB
|
|
609
|
+
* @return {number}
|
|
614
610
|
* @memberof Utilities */
|
|
615
611
|
export function max(valueA: number, valueB: number): number;
|
|
616
612
|
/** Returns the sign of value passed in
|
|
617
|
-
* @param {
|
|
618
|
-
* @return {
|
|
613
|
+
* @param {number} value
|
|
614
|
+
* @return {number}
|
|
619
615
|
* @memberof Utilities */
|
|
620
616
|
export function sign(value: number): number;
|
|
621
617
|
/** Returns first parm modulo the second param, but adjusted so negative numbers work as expected
|
|
622
|
-
* @param {
|
|
623
|
-
* @param {
|
|
624
|
-
* @return {
|
|
618
|
+
* @param {number} dividend
|
|
619
|
+
* @param {number} [divisor]
|
|
620
|
+
* @return {number}
|
|
625
621
|
* @memberof Utilities */
|
|
626
622
|
export function mod(dividend: number, divisor?: number): number;
|
|
627
623
|
/** Clamps the value between max and min
|
|
628
|
-
* @param {
|
|
629
|
-
* @param {
|
|
630
|
-
* @param {
|
|
631
|
-
* @return {
|
|
624
|
+
* @param {number} value
|
|
625
|
+
* @param {number} [min]
|
|
626
|
+
* @param {number} [max]
|
|
627
|
+
* @return {number}
|
|
632
628
|
* @memberof Utilities */
|
|
633
629
|
export function clamp(value: number, min?: number, max?: number): number;
|
|
634
630
|
/** Returns what percentage the value is between valueA and valueB
|
|
635
|
-
* @param {
|
|
636
|
-
* @param {
|
|
637
|
-
* @param {
|
|
638
|
-
* @return {
|
|
631
|
+
* @param {number} value
|
|
632
|
+
* @param {number} valueA
|
|
633
|
+
* @param {number} valueB
|
|
634
|
+
* @return {number}
|
|
639
635
|
* @memberof Utilities */
|
|
640
636
|
export function percent(value: number, valueA: number, valueB: number): number;
|
|
641
637
|
/** Returns signed wrapped distance between the two values passed in
|
|
642
|
-
* @param {
|
|
643
|
-
* @param {
|
|
644
|
-
* @param {
|
|
645
|
-
* @returns {
|
|
638
|
+
* @param {number} valueA
|
|
639
|
+
* @param {number} valueB
|
|
640
|
+
* @param {number} [wrapSize]
|
|
641
|
+
* @returns {number}
|
|
646
642
|
* @memberof Utilities */
|
|
647
643
|
export function distanceWrap(valueA: number, valueB: number, wrapSize?: number): number;
|
|
648
644
|
/** Linearly interpolates between values passed in with wrapping
|
|
649
|
-
* @param {
|
|
650
|
-
* @param {
|
|
651
|
-
* @param {
|
|
652
|
-
* @param {
|
|
653
|
-
* @returns {
|
|
645
|
+
* @param {number} percent
|
|
646
|
+
* @param {number} valueA
|
|
647
|
+
* @param {number} valueB
|
|
648
|
+
* @param {number} [wrapSize]
|
|
649
|
+
* @returns {number}
|
|
654
650
|
* @memberof Utilities */
|
|
655
651
|
export function lerpWrap(percent: number, valueA: number, valueB: number, wrapSize?: number): number;
|
|
656
652
|
/** Returns signed wrapped distance between the two angles passed in
|
|
657
|
-
* @param {
|
|
658
|
-
* @param {
|
|
659
|
-
* @returns {
|
|
653
|
+
* @param {number} angleA
|
|
654
|
+
* @param {number} angleB
|
|
655
|
+
* @returns {number}
|
|
660
656
|
* @memberof Utilities */
|
|
661
657
|
export function distanceAngle(angleA: number, angleB: number): number;
|
|
662
658
|
/** Linearly interpolates between the angles passed in with wrapping
|
|
663
|
-
* @param {
|
|
664
|
-
* @param {
|
|
665
|
-
* @param {
|
|
666
|
-
* @returns {
|
|
659
|
+
* @param {number} percent
|
|
660
|
+
* @param {number} angleA
|
|
661
|
+
* @param {number} angleB
|
|
662
|
+
* @returns {number}
|
|
667
663
|
* @memberof Utilities */
|
|
668
664
|
export function lerpAngle(percent: number, angleA: number, angleB: number): number;
|
|
669
665
|
/** Linearly interpolates between values passed in using percent
|
|
670
|
-
* @param {
|
|
671
|
-
* @param {
|
|
672
|
-
* @param {
|
|
673
|
-
* @return {
|
|
666
|
+
* @param {number} percent
|
|
667
|
+
* @param {number} valueA
|
|
668
|
+
* @param {number} valueB
|
|
669
|
+
* @return {number}
|
|
674
670
|
* @memberof Utilities */
|
|
675
671
|
export function lerp(percent: number, valueA: number, valueB: number): number;
|
|
676
672
|
/** Applies smoothstep function to the percentage value
|
|
677
|
-
* @param {
|
|
678
|
-
* @return {
|
|
673
|
+
* @param {number} percent
|
|
674
|
+
* @return {number}
|
|
679
675
|
* @memberof Utilities */
|
|
680
676
|
export function smoothStep(percent: number): number;
|
|
681
677
|
/** Returns the nearest power of two not less then the value
|
|
682
|
-
* @param {
|
|
683
|
-
* @return {
|
|
678
|
+
* @param {number} value
|
|
679
|
+
* @return {number}
|
|
684
680
|
* @memberof Utilities */
|
|
685
681
|
export function nearestPowerOfTwo(value: number): number;
|
|
686
682
|
/** Returns true if two axis aligned bounding boxes are overlapping
|
|
@@ -688,7 +684,7 @@ declare module "littlejsengine" {
|
|
|
688
684
|
* @param {Vector2} sizeA - Size of box A
|
|
689
685
|
* @param {Vector2} posB - Center of box B
|
|
690
686
|
* @param {Vector2} [sizeB=(0,0)] - Size of box B, a point if undefined
|
|
691
|
-
* @return {
|
|
687
|
+
* @return {boolean} - True if overlapping
|
|
692
688
|
* @memberof Utilities */
|
|
693
689
|
export function isOverlapping(posA: Vector2, sizeA: Vector2, posB: Vector2, sizeB?: Vector2): boolean;
|
|
694
690
|
/** Returns true if a line segment is intersecting an axis aligned box
|
|
@@ -696,55 +692,55 @@ declare module "littlejsengine" {
|
|
|
696
692
|
* @param {Vector2} end - End of raycast
|
|
697
693
|
* @param {Vector2} pos - Center of box
|
|
698
694
|
* @param {Vector2} size - Size of box
|
|
699
|
-
* @return {
|
|
695
|
+
* @return {boolean} - True if intersecting
|
|
700
696
|
* @memberof Utilities */
|
|
701
697
|
export function isIntersecting(start: Vector2, end: Vector2, pos: Vector2, size: Vector2): boolean;
|
|
702
698
|
/** Returns an oscillating wave between 0 and amplitude with frequency of 1 Hz by default
|
|
703
|
-
* @param {
|
|
704
|
-
* @param {
|
|
705
|
-
* @param {
|
|
706
|
-
* @return {
|
|
699
|
+
* @param {number} [frequency] - Frequency of the wave in Hz
|
|
700
|
+
* @param {number} [amplitude] - Amplitude (max height) of the wave
|
|
701
|
+
* @param {number} [t=time] - Value to use for time of the wave
|
|
702
|
+
* @return {number} - Value waving between 0 and amplitude
|
|
707
703
|
* @memberof Utilities */
|
|
708
704
|
export function wave(frequency?: number, amplitude?: number, t?: number): number;
|
|
709
705
|
/** Formats seconds to mm:ss style for display purposes
|
|
710
|
-
* @param {
|
|
711
|
-
* @return {
|
|
706
|
+
* @param {number} t - time in seconds
|
|
707
|
+
* @return {string}
|
|
712
708
|
* @memberof Utilities */
|
|
713
709
|
export function formatTime(t: number): string;
|
|
714
710
|
/** Random global functions
|
|
715
711
|
* @namespace Random */
|
|
716
712
|
/** Returns a random value between the two values passed in
|
|
717
|
-
* @param {
|
|
718
|
-
* @param {
|
|
719
|
-
* @return {
|
|
713
|
+
* @param {number} [valueA]
|
|
714
|
+
* @param {number} [valueB]
|
|
715
|
+
* @return {number}
|
|
720
716
|
* @memberof Random */
|
|
721
717
|
export function rand(valueA?: number, valueB?: number): number;
|
|
722
718
|
/** Returns a floored random value between the two values passed in
|
|
723
719
|
* The upper bound is exclusive. (If 2 is passed in, result will be 0 or 1)
|
|
724
|
-
* @param {
|
|
725
|
-
* @param {
|
|
726
|
-
* @return {
|
|
720
|
+
* @param {number} valueA
|
|
721
|
+
* @param {number} [valueB]
|
|
722
|
+
* @return {number}
|
|
727
723
|
* @memberof Random */
|
|
728
724
|
export function randInt(valueA: number, valueB?: number): number;
|
|
729
725
|
/** Randomly returns either -1 or 1
|
|
730
|
-
* @return {
|
|
726
|
+
* @return {number}
|
|
731
727
|
* @memberof Random */
|
|
732
728
|
export function randSign(): number;
|
|
733
729
|
/** Returns a random Vector2 within a circular shape
|
|
734
|
-
* @param {
|
|
735
|
-
* @param {
|
|
730
|
+
* @param {number} [radius]
|
|
731
|
+
* @param {number} [minRadius]
|
|
736
732
|
* @return {Vector2}
|
|
737
733
|
* @memberof Random */
|
|
738
734
|
export function randInCircle(radius?: number, minRadius?: number): Vector2;
|
|
739
735
|
/** Returns a random Vector2 with the passed in length
|
|
740
|
-
* @param {
|
|
736
|
+
* @param {number} [length]
|
|
741
737
|
* @return {Vector2}
|
|
742
738
|
* @memberof Random */
|
|
743
739
|
export function randVector(length?: number): Vector2;
|
|
744
740
|
/** Returns a random color between the two passed in colors, combine components if linear
|
|
745
741
|
* @param {Color} [colorA=(1,1,1,1)]
|
|
746
742
|
* @param {Color} [colorB=(0,0,0,1)]
|
|
747
|
-
* @param {
|
|
743
|
+
* @param {boolean} [linear]
|
|
748
744
|
* @return {Color}
|
|
749
745
|
* @memberof Random */
|
|
750
746
|
export function randColor(colorA?: Color, colorB?: Color, linear?: boolean): Color;
|
|
@@ -760,22 +756,22 @@ declare module "littlejsengine" {
|
|
|
760
756
|
*/
|
|
761
757
|
export class RandomGenerator {
|
|
762
758
|
/** Create a random number generator with the seed passed in
|
|
763
|
-
* @param {
|
|
759
|
+
* @param {number} seed - Starting seed */
|
|
764
760
|
constructor(seed: number);
|
|
765
|
-
/** @property {
|
|
761
|
+
/** @property {number} - random seed */
|
|
766
762
|
seed: number;
|
|
767
763
|
/** Returns a seeded random value between the two values passed in
|
|
768
|
-
* @param {
|
|
769
|
-
* @param {
|
|
770
|
-
* @return {
|
|
764
|
+
* @param {number} [valueA]
|
|
765
|
+
* @param {number} [valueB]
|
|
766
|
+
* @return {number} */
|
|
771
767
|
float(valueA?: number, valueB?: number): number;
|
|
772
768
|
/** Returns a floored seeded random value the two values passed in
|
|
773
|
-
* @param {
|
|
774
|
-
* @param {
|
|
775
|
-
* @return {
|
|
769
|
+
* @param {number} valueA
|
|
770
|
+
* @param {number} [valueB]
|
|
771
|
+
* @return {number} */
|
|
776
772
|
int(valueA: number, valueB?: number): number;
|
|
777
773
|
/** Randomly returns either -1 or 1 deterministically
|
|
778
|
-
* @return {
|
|
774
|
+
* @return {number} */
|
|
779
775
|
sign(): number;
|
|
780
776
|
}
|
|
781
777
|
/**
|
|
@@ -789,16 +785,16 @@ declare module "littlejsengine" {
|
|
|
789
785
|
*/
|
|
790
786
|
export class Vector2 {
|
|
791
787
|
/** Create a 2D vector with the x and y passed in, can also be created with vec2()
|
|
792
|
-
* @param {
|
|
793
|
-
* @param {
|
|
788
|
+
* @param {number} [x] - X axis location
|
|
789
|
+
* @param {number} [y] - Y axis location */
|
|
794
790
|
constructor(x?: number, y?: number);
|
|
795
|
-
/** @property {
|
|
791
|
+
/** @property {number} - X axis location */
|
|
796
792
|
x: number;
|
|
797
|
-
/** @property {
|
|
793
|
+
/** @property {number} - Y axis location */
|
|
798
794
|
y: number;
|
|
799
795
|
/** Sets values of this vector and returns self
|
|
800
|
-
* @param {
|
|
801
|
-
* @param {
|
|
796
|
+
* @param {number} [x] - X axis location
|
|
797
|
+
* @param {number} [y] - Y axis location
|
|
802
798
|
* @return {Vector2} */
|
|
803
799
|
set(x?: number, y?: number): Vector2;
|
|
804
800
|
/** Returns a new vector that is a copy of this
|
|
@@ -821,57 +817,57 @@ declare module "littlejsengine" {
|
|
|
821
817
|
* @return {Vector2} */
|
|
822
818
|
divide(v: Vector2): Vector2;
|
|
823
819
|
/** Returns a copy of this vector scaled by the vector passed in
|
|
824
|
-
* @param {
|
|
820
|
+
* @param {number} s - scale
|
|
825
821
|
* @return {Vector2} */
|
|
826
822
|
scale(s: number): Vector2;
|
|
827
823
|
/** Returns the length of this vector
|
|
828
|
-
* @return {
|
|
824
|
+
* @return {number} */
|
|
829
825
|
length(): number;
|
|
830
826
|
/** Returns the length of this vector squared
|
|
831
|
-
* @return {
|
|
827
|
+
* @return {number} */
|
|
832
828
|
lengthSquared(): number;
|
|
833
829
|
/** Returns the distance from this vector to vector passed in
|
|
834
830
|
* @param {Vector2} v - other vector
|
|
835
|
-
* @return {
|
|
831
|
+
* @return {number} */
|
|
836
832
|
distance(v: Vector2): number;
|
|
837
833
|
/** Returns the distance squared from this vector to vector passed in
|
|
838
834
|
* @param {Vector2} v - other vector
|
|
839
|
-
* @return {
|
|
835
|
+
* @return {number} */
|
|
840
836
|
distanceSquared(v: Vector2): number;
|
|
841
837
|
/** Returns a new vector in same direction as this one with the length passed in
|
|
842
|
-
* @param {
|
|
838
|
+
* @param {number} [length]
|
|
843
839
|
* @return {Vector2} */
|
|
844
840
|
normalize(length?: number): Vector2;
|
|
845
841
|
/** Returns a new vector clamped to length passed in
|
|
846
|
-
* @param {
|
|
842
|
+
* @param {number} [length]
|
|
847
843
|
* @return {Vector2} */
|
|
848
844
|
clampLength(length?: number): Vector2;
|
|
849
845
|
/** Returns the dot product of this and the vector passed in
|
|
850
846
|
* @param {Vector2} v - other vector
|
|
851
|
-
* @return {
|
|
847
|
+
* @return {number} */
|
|
852
848
|
dot(v: Vector2): number;
|
|
853
849
|
/** Returns the cross product of this and the vector passed in
|
|
854
850
|
* @param {Vector2} v - other vector
|
|
855
|
-
* @return {
|
|
851
|
+
* @return {number} */
|
|
856
852
|
cross(v: Vector2): number;
|
|
857
853
|
/** Returns the clockwise angle of this vector, up is angle 0
|
|
858
|
-
* @return {
|
|
854
|
+
* @return {number} */
|
|
859
855
|
angle(): number;
|
|
860
856
|
/** Sets this vector with clockwise angle and length passed in
|
|
861
|
-
* @param {
|
|
862
|
-
* @param {
|
|
857
|
+
* @param {number} [angle]
|
|
858
|
+
* @param {number} [length]
|
|
863
859
|
* @return {Vector2} */
|
|
864
860
|
setAngle(angle?: number, length?: number): Vector2;
|
|
865
861
|
/** Returns copy of this vector rotated by the clockwise angle passed in
|
|
866
|
-
* @param {
|
|
862
|
+
* @param {number} angle
|
|
867
863
|
* @return {Vector2} */
|
|
868
864
|
rotate(angle: number): Vector2;
|
|
869
865
|
/** Set the integer direction of this vector, corresponding to multiples of 90 degree rotation (0-3)
|
|
870
|
-
* @param {
|
|
871
|
-
* @param {
|
|
866
|
+
* @param {number} [direction]
|
|
867
|
+
* @param {number} [length] */
|
|
872
868
|
setDirection(direction?: number, length?: number): Vector2;
|
|
873
869
|
/** Returns the integer direction of this vector, corresponding to multiples of 90 degree rotation (0-3)
|
|
874
|
-
* @return {
|
|
870
|
+
* @return {number} */
|
|
875
871
|
direction(): number;
|
|
876
872
|
/** Returns a copy of this vector that has been inverted
|
|
877
873
|
* @return {Vector2} */
|
|
@@ -880,23 +876,23 @@ declare module "littlejsengine" {
|
|
|
880
876
|
* @return {Vector2} */
|
|
881
877
|
floor(): Vector2;
|
|
882
878
|
/** Returns the area this vector covers as a rectangle
|
|
883
|
-
* @return {
|
|
879
|
+
* @return {number} */
|
|
884
880
|
area(): number;
|
|
885
881
|
/** Returns a new vector that is p percent between this and the vector passed in
|
|
886
882
|
* @param {Vector2} v - other vector
|
|
887
|
-
* @param {
|
|
883
|
+
* @param {number} percent
|
|
888
884
|
* @return {Vector2} */
|
|
889
885
|
lerp(v: Vector2, percent: number): Vector2;
|
|
890
886
|
/** Returns true if this vector is within the bounds of an array size passed in
|
|
891
887
|
* @param {Vector2} arraySize
|
|
892
|
-
* @return {
|
|
888
|
+
* @return {boolean} */
|
|
893
889
|
arrayCheck(arraySize: Vector2): boolean;
|
|
894
890
|
/** Returns this vector expressed as a string
|
|
895
|
-
* @param {
|
|
896
|
-
* @return {
|
|
891
|
+
* @param {number} digits - precision to display
|
|
892
|
+
* @return {string} */
|
|
897
893
|
toString(digits?: number): string;
|
|
898
894
|
/** Checks if this is a valid vector
|
|
899
|
-
* @return {
|
|
895
|
+
* @return {boolean} */
|
|
900
896
|
isValid(): boolean;
|
|
901
897
|
}
|
|
902
898
|
/**
|
|
@@ -910,24 +906,24 @@ declare module "littlejsengine" {
|
|
|
910
906
|
*/
|
|
911
907
|
export class Color {
|
|
912
908
|
/** Create a color with the rgba components passed in, white by default
|
|
913
|
-
* @param {
|
|
914
|
-
* @param {
|
|
915
|
-
* @param {
|
|
916
|
-
* @param {
|
|
909
|
+
* @param {number} [r] - red
|
|
910
|
+
* @param {number} [g] - green
|
|
911
|
+
* @param {number} [b] - blue
|
|
912
|
+
* @param {number} [a] - alpha*/
|
|
917
913
|
constructor(r?: number, g?: number, b?: number, a?: number);
|
|
918
|
-
/** @property {
|
|
914
|
+
/** @property {number} - Red */
|
|
919
915
|
r: number;
|
|
920
|
-
/** @property {
|
|
916
|
+
/** @property {number} - Green */
|
|
921
917
|
g: number;
|
|
922
|
-
/** @property {
|
|
918
|
+
/** @property {number} - Blue */
|
|
923
919
|
b: number;
|
|
924
|
-
/** @property {
|
|
920
|
+
/** @property {number} - Alpha */
|
|
925
921
|
a: number;
|
|
926
922
|
/** Sets values of this color and returns self
|
|
927
|
-
* @param {
|
|
928
|
-
* @param {
|
|
929
|
-
* @param {
|
|
930
|
-
* @param {
|
|
923
|
+
* @param {number} [r] - red
|
|
924
|
+
* @param {number} [g] - green
|
|
925
|
+
* @param {number} [b] - blue
|
|
926
|
+
* @param {number} [a] - alpha
|
|
931
927
|
* @return {Color} */
|
|
932
928
|
set(r?: number, g?: number, b?: number, a?: number): Color;
|
|
933
929
|
/** Returns a new color that is a copy of this
|
|
@@ -950,8 +946,8 @@ declare module "littlejsengine" {
|
|
|
950
946
|
* @return {Color} */
|
|
951
947
|
divide(c: Color): Color;
|
|
952
948
|
/** Returns a copy of this color scaled by the value passed in, alpha can be scaled separately
|
|
953
|
-
* @param {
|
|
954
|
-
* @param {
|
|
949
|
+
* @param {number} scale
|
|
950
|
+
* @param {number} [alphaScale=scale]
|
|
955
951
|
* @return {Color} */
|
|
956
952
|
scale(scale: number, alphaScale?: number): Color;
|
|
957
953
|
/** Returns a copy of this color clamped to the valid range between 0 and 1
|
|
@@ -959,37 +955,37 @@ declare module "littlejsengine" {
|
|
|
959
955
|
clamp(): Color;
|
|
960
956
|
/** Returns a new color that is p percent between this and the color passed in
|
|
961
957
|
* @param {Color} c - other color
|
|
962
|
-
* @param {
|
|
958
|
+
* @param {number} percent
|
|
963
959
|
* @return {Color} */
|
|
964
960
|
lerp(c: Color, percent: number): Color;
|
|
965
961
|
/** Sets this color given a hue, saturation, lightness, and alpha
|
|
966
|
-
* @param {
|
|
967
|
-
* @param {
|
|
968
|
-
* @param {
|
|
969
|
-
* @param {
|
|
962
|
+
* @param {number} [h] - hue
|
|
963
|
+
* @param {number} [s] - saturation
|
|
964
|
+
* @param {number} [l] - lightness
|
|
965
|
+
* @param {number} [a] - alpha
|
|
970
966
|
* @return {Color} */
|
|
971
967
|
setHSLA(h?: number, s?: number, l?: number, a?: number): Color;
|
|
972
968
|
/** Returns this color expressed in hsla format
|
|
973
|
-
* @return {Array} */
|
|
974
|
-
HSLA():
|
|
969
|
+
* @return {Array<number>} */
|
|
970
|
+
HSLA(): Array<number>;
|
|
975
971
|
/** Returns a new color that has each component randomly adjusted
|
|
976
|
-
* @param {
|
|
977
|
-
* @param {
|
|
972
|
+
* @param {number} [amount]
|
|
973
|
+
* @param {number} [alphaAmount]
|
|
978
974
|
* @return {Color} */
|
|
979
975
|
mutate(amount?: number, alphaAmount?: number): Color;
|
|
980
976
|
/** Returns this color expressed as a hex color code
|
|
981
|
-
* @param {
|
|
982
|
-
* @return {
|
|
977
|
+
* @param {boolean} [useAlpha] - if alpha should be included in result
|
|
978
|
+
* @return {string} */
|
|
983
979
|
toString(useAlpha?: boolean): string;
|
|
984
980
|
/** Set this color from a hex code
|
|
985
|
-
* @param {
|
|
981
|
+
* @param {string} hex - html hex code
|
|
986
982
|
* @return {Color} */
|
|
987
983
|
setHex(hex: string): Color;
|
|
988
984
|
/** Returns this color expressed as 32 bit RGBA value
|
|
989
|
-
* @return {
|
|
985
|
+
* @return {number} */
|
|
990
986
|
rgbaInt(): number;
|
|
991
987
|
/** Checks if this is a valid color
|
|
992
|
-
* @return {
|
|
988
|
+
* @return {boolean} */
|
|
993
989
|
isValid(): boolean;
|
|
994
990
|
}
|
|
995
991
|
/**
|
|
@@ -1003,41 +999,41 @@ declare module "littlejsengine" {
|
|
|
1003
999
|
*/
|
|
1004
1000
|
export class Timer {
|
|
1005
1001
|
/** Create a timer object set time passed in
|
|
1006
|
-
* @param {
|
|
1002
|
+
* @param {number} [timeLeft] - How much time left before the timer elapses in seconds */
|
|
1007
1003
|
constructor(timeLeft?: number);
|
|
1008
1004
|
time: number;
|
|
1009
1005
|
setTime: number;
|
|
1010
1006
|
/** Set the timer with seconds passed in
|
|
1011
|
-
* @param {
|
|
1007
|
+
* @param {number} [timeLeft] - How much time left before the timer is elapsed in seconds */
|
|
1012
1008
|
set(timeLeft?: number): void;
|
|
1013
1009
|
/** Unset the timer */
|
|
1014
1010
|
unset(): void;
|
|
1015
1011
|
/** Returns true if set
|
|
1016
|
-
* @return {
|
|
1012
|
+
* @return {boolean} */
|
|
1017
1013
|
isSet(): boolean;
|
|
1018
1014
|
/** Returns true if set and has not elapsed
|
|
1019
|
-
* @return {
|
|
1015
|
+
* @return {boolean} */
|
|
1020
1016
|
active(): boolean;
|
|
1021
1017
|
/** Returns true if set and elapsed
|
|
1022
|
-
* @return {
|
|
1018
|
+
* @return {boolean} */
|
|
1023
1019
|
elapsed(): boolean;
|
|
1024
1020
|
/** Get how long since elapsed, returns 0 if not set (returns negative if currently active)
|
|
1025
|
-
* @return {
|
|
1021
|
+
* @return {number} */
|
|
1026
1022
|
get(): number;
|
|
1027
1023
|
/** Get percentage elapsed based on time it was set to, returns 0 if not set
|
|
1028
|
-
* @return {
|
|
1024
|
+
* @return {number} */
|
|
1029
1025
|
getPercent(): number;
|
|
1030
1026
|
/** Returns this timer expressed as a string
|
|
1031
|
-
* @return {
|
|
1027
|
+
* @return {string} */
|
|
1032
1028
|
toString(): string;
|
|
1033
1029
|
/** Get how long since elapsed, returns 0 if not set (returns negative if currently active)
|
|
1034
|
-
* @return {
|
|
1030
|
+
* @return {number} */
|
|
1035
1031
|
valueOf(): number;
|
|
1036
1032
|
}
|
|
1037
1033
|
/**
|
|
1038
1034
|
* Create a 2d vector, can take another Vector2 to copy, 2 scalars, or 1 scalar
|
|
1039
|
-
* @param {
|
|
1040
|
-
* @param {
|
|
1035
|
+
* @param {Vector2|number} [x]
|
|
1036
|
+
* @param {number} [y]
|
|
1041
1037
|
* @return {Vector2}
|
|
1042
1038
|
* @example
|
|
1043
1039
|
* let a = vec2(0, 1); // vector with coordinates (0, 1)
|
|
@@ -1046,23 +1042,23 @@ declare module "littlejsengine" {
|
|
|
1046
1042
|
* b = vec2(); // set b to (0, 0)
|
|
1047
1043
|
* @memberof Utilities
|
|
1048
1044
|
*/
|
|
1049
|
-
export function vec2(x?:
|
|
1045
|
+
export function vec2(x?: Vector2 | number, y?: number): Vector2;
|
|
1050
1046
|
/**
|
|
1051
1047
|
* Create a color object with RGBA values, white by default
|
|
1052
|
-
* @param {
|
|
1053
|
-
* @param {
|
|
1054
|
-
* @param {
|
|
1055
|
-
* @param {
|
|
1048
|
+
* @param {number} [r=1] - red
|
|
1049
|
+
* @param {number} [g=1] - green
|
|
1050
|
+
* @param {number} [b=1] - blue
|
|
1051
|
+
* @param {number} [a=1] - alpha
|
|
1056
1052
|
* @return {Color}
|
|
1057
1053
|
* @memberof Utilities
|
|
1058
1054
|
*/
|
|
1059
1055
|
export function rgb(r?: number, g?: number, b?: number, a?: number): Color;
|
|
1060
1056
|
/**
|
|
1061
1057
|
* Create a color object with HSLA values, white by default
|
|
1062
|
-
* @param {
|
|
1063
|
-
* @param {
|
|
1064
|
-
* @param {
|
|
1065
|
-
* @param {
|
|
1058
|
+
* @param {number} [h=0] - hue
|
|
1059
|
+
* @param {number} [s=0] - saturation
|
|
1060
|
+
* @param {number} [l=1] - lightness
|
|
1061
|
+
* @param {number} [a=1] - alpha
|
|
1066
1062
|
* @return {Color}
|
|
1067
1063
|
* @memberof Utilities
|
|
1068
1064
|
*/
|
|
@@ -1070,7 +1066,7 @@ declare module "littlejsengine" {
|
|
|
1070
1066
|
/**
|
|
1071
1067
|
* Check if object is a valid Color
|
|
1072
1068
|
* @param {any} c
|
|
1073
|
-
* @return {
|
|
1069
|
+
* @return {boolean}
|
|
1074
1070
|
* @memberof Utilities
|
|
1075
1071
|
*/
|
|
1076
1072
|
export function isColor(c: any): boolean;
|
|
@@ -1126,10 +1122,10 @@ declare module "littlejsengine" {
|
|
|
1126
1122
|
* Create a tile info object using a grid based system
|
|
1127
1123
|
* - This can take vecs or floats for easier use and conversion
|
|
1128
1124
|
* - If an index is passed in, the tile size and index will determine the position
|
|
1129
|
-
* @param {
|
|
1130
|
-
* @param {
|
|
1131
|
-
* @param {
|
|
1132
|
-
* @param {
|
|
1125
|
+
* @param {Vector2|number} [pos=0] - Index of tile in sheet
|
|
1126
|
+
* @param {Vector2|number} [size=tileSizeDefault] - Size of tile in pixels
|
|
1127
|
+
* @param {number} [textureIndex] - Texture index to use
|
|
1128
|
+
* @param {number} [padding] - How many pixels padding around tiles
|
|
1133
1129
|
* @return {TileInfo}
|
|
1134
1130
|
* @example
|
|
1135
1131
|
* tile(2) // a tile at index 2 using the default tile size of 16
|
|
@@ -1138,7 +1134,7 @@ declare module "littlejsengine" {
|
|
|
1138
1134
|
* tile(vec2(4,8), vec2(30,10)) // a tile at index (4,8) with a size of (30,10)
|
|
1139
1135
|
* @memberof Draw
|
|
1140
1136
|
*/
|
|
1141
|
-
export function tile(pos?:
|
|
1137
|
+
export function tile(pos?: Vector2 | number, size?: Vector2 | number, textureIndex?: number, padding?: number): TileInfo;
|
|
1142
1138
|
/**
|
|
1143
1139
|
* Tile Info - Stores info about how to draw a tile
|
|
1144
1140
|
*/
|
|
@@ -1146,17 +1142,17 @@ declare module "littlejsengine" {
|
|
|
1146
1142
|
/** Create a tile info object
|
|
1147
1143
|
* @param {Vector2} [pos=(0,0)] - Top left corner of tile in pixels
|
|
1148
1144
|
* @param {Vector2} [size=tileSizeDefault] - Size of tile in pixels
|
|
1149
|
-
* @param {
|
|
1150
|
-
* @param {
|
|
1145
|
+
* @param {number} [textureIndex] - Texture index to use
|
|
1146
|
+
* @param {number} [padding] - How many pixels padding around tiles
|
|
1151
1147
|
*/
|
|
1152
1148
|
constructor(pos?: Vector2, size?: Vector2, textureIndex?: number, padding?: number);
|
|
1153
1149
|
/** @property {Vector2} - Top left corner of tile in pixels */
|
|
1154
1150
|
pos: Vector2;
|
|
1155
1151
|
/** @property {Vector2} - Size of tile in pixels */
|
|
1156
1152
|
size: Vector2;
|
|
1157
|
-
/** @property {
|
|
1153
|
+
/** @property {number} - Texture index to use */
|
|
1158
1154
|
textureIndex: number;
|
|
1159
|
-
/** @property {
|
|
1155
|
+
/** @property {number} - How many pixels padding around tiles */
|
|
1160
1156
|
padding: number;
|
|
1161
1157
|
/** Returns a copy of this tile offset by a vector
|
|
1162
1158
|
* @param {Vector2} offset - Offset to apply in pixels
|
|
@@ -1164,7 +1160,7 @@ declare module "littlejsengine" {
|
|
|
1164
1160
|
*/
|
|
1165
1161
|
offset(offset: Vector2): TileInfo;
|
|
1166
1162
|
/** Returns a copy of this tile offset by a number of animation frames
|
|
1167
|
-
* @param {
|
|
1163
|
+
* @param {number} frame - Offset to apply in animation frames
|
|
1168
1164
|
* @return {TileInfo}
|
|
1169
1165
|
*/
|
|
1170
1166
|
frame(frame: number): TileInfo;
|
|
@@ -1243,11 +1239,11 @@ declare module "littlejsengine" {
|
|
|
1243
1239
|
* @param {Vector2} [size=(1,1)] - Size of the tile in world space
|
|
1244
1240
|
* @param {TileInfo}[tileInfo] - Tile info to use, untextured if undefined
|
|
1245
1241
|
* @param {Color} [color=(1,1,1,1)] - Color to modulate with
|
|
1246
|
-
* @param {
|
|
1247
|
-
* @param {
|
|
1242
|
+
* @param {number} [angle] - Angle to rotate by
|
|
1243
|
+
* @param {boolean} [mirror] - If true image is flipped along the Y axis
|
|
1248
1244
|
* @param {Color} [additiveColor=(0,0,0,0)] - Additive color to be applied
|
|
1249
|
-
* @param {
|
|
1250
|
-
* @param {
|
|
1245
|
+
* @param {boolean} [useWebGL=glEnable] - Use accelerated WebGL rendering
|
|
1246
|
+
* @param {boolean} [screenSpace=false] - If true the pos and size are in screen space
|
|
1251
1247
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context] - Canvas 2D context to draw to
|
|
1252
1248
|
* @memberof Draw */
|
|
1253
1249
|
export function drawTile(pos: Vector2, size?: Vector2, tileInfo?: TileInfo, color?: Color, angle?: number, mirror?: boolean, additiveColor?: Color, useWebGL?: boolean, screenSpace?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
@@ -1255,107 +1251,107 @@ declare module "littlejsengine" {
|
|
|
1255
1251
|
* @param {Vector2} pos
|
|
1256
1252
|
* @param {Vector2} [size=(1,1)]
|
|
1257
1253
|
* @param {Color} [color=(1,1,1,1)]
|
|
1258
|
-
* @param {
|
|
1259
|
-
* @param {
|
|
1260
|
-
* @param {
|
|
1254
|
+
* @param {number} [angle]
|
|
1255
|
+
* @param {boolean} [useWebGL=glEnable]
|
|
1256
|
+
* @param {boolean} [screenSpace=false]
|
|
1261
1257
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context]
|
|
1262
1258
|
* @memberof Draw */
|
|
1263
1259
|
export function drawRect(pos: Vector2, size?: Vector2, color?: Color, angle?: number, useWebGL?: boolean, screenSpace?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1264
1260
|
/** Draw colored line between two points
|
|
1265
1261
|
* @param {Vector2} posA
|
|
1266
1262
|
* @param {Vector2} posB
|
|
1267
|
-
* @param {
|
|
1263
|
+
* @param {number} [thickness]
|
|
1268
1264
|
* @param {Color} [color=(1,1,1,1)]
|
|
1269
|
-
* @param {
|
|
1270
|
-
* @param {
|
|
1265
|
+
* @param {boolean} [useWebGL=glEnable]
|
|
1266
|
+
* @param {boolean} [screenSpace=false]
|
|
1271
1267
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context]
|
|
1272
1268
|
* @memberof Draw */
|
|
1273
1269
|
export function drawLine(posA: Vector2, posB: Vector2, thickness?: number, color?: Color, useWebGL?: boolean, screenSpace?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1274
1270
|
/** Draw colored polygon using passed in points
|
|
1275
|
-
* @param {Array} points - Array of Vector2 points
|
|
1271
|
+
* @param {Array<Vector2>} points - Array of Vector2 points
|
|
1276
1272
|
* @param {Color} [color=(1,1,1,1)]
|
|
1277
|
-
* @param {
|
|
1273
|
+
* @param {number} [lineWidth=0]
|
|
1278
1274
|
* @param {Color} [lineColor=(0,0,0,1)]
|
|
1279
|
-
* @param {
|
|
1275
|
+
* @param {boolean} [screenSpace=false]
|
|
1280
1276
|
* @param {CanvasRenderingContext2D} [context=mainContext]
|
|
1281
1277
|
* @memberof Draw */
|
|
1282
|
-
export function drawPoly(points:
|
|
1278
|
+
export function drawPoly(points: Array<Vector2>, color?: Color, lineWidth?: number, lineColor?: Color, screenSpace?: boolean, context?: CanvasRenderingContext2D): void;
|
|
1283
1279
|
/** Draw colored ellipse using passed in point
|
|
1284
1280
|
* @param {Vector2} pos
|
|
1285
|
-
* @param {
|
|
1286
|
-
* @param {
|
|
1287
|
-
* @param {
|
|
1281
|
+
* @param {number} [width=1]
|
|
1282
|
+
* @param {number} [height=1]
|
|
1283
|
+
* @param {number} [angle=0]
|
|
1288
1284
|
* @param {Color} [color=(1,1,1,1)]
|
|
1289
|
-
* @param {
|
|
1285
|
+
* @param {number} [lineWidth=0]
|
|
1290
1286
|
* @param {Color} [lineColor=(0,0,0,1)]
|
|
1291
|
-
* @param {
|
|
1287
|
+
* @param {boolean} [screenSpace=false]
|
|
1292
1288
|
* @param {CanvasRenderingContext2D} [context=mainContext]
|
|
1293
1289
|
* @memberof Draw */
|
|
1294
1290
|
export function drawEllipse(pos: Vector2, width?: number, height?: number, angle?: number, color?: Color, lineWidth?: number, lineColor?: Color, screenSpace?: boolean, context?: CanvasRenderingContext2D): void;
|
|
1295
1291
|
/** Draw colored circle using passed in point
|
|
1296
1292
|
* @param {Vector2} pos
|
|
1297
|
-
* @param {
|
|
1293
|
+
* @param {number} [radius=1]
|
|
1298
1294
|
* @param {Color} [color=(1,1,1,1)]
|
|
1299
|
-
* @param {
|
|
1295
|
+
* @param {number} [lineWidth=0]
|
|
1300
1296
|
* @param {Color} [lineColor=(0,0,0,1)]
|
|
1301
|
-
* @param {
|
|
1297
|
+
* @param {boolean} [screenSpace=false]
|
|
1302
1298
|
* @param {CanvasRenderingContext2D} [context=mainContext]
|
|
1303
1299
|
* @memberof Draw */
|
|
1304
1300
|
export function drawCircle(pos: Vector2, radius?: number, color?: Color, lineWidth?: number, lineColor?: Color, screenSpace?: boolean, context?: CanvasRenderingContext2D): void;
|
|
1305
1301
|
/** Draw directly to a 2d canvas context in world space
|
|
1306
1302
|
* @param {Vector2} pos
|
|
1307
1303
|
* @param {Vector2} size
|
|
1308
|
-
* @param {
|
|
1309
|
-
* @param {
|
|
1304
|
+
* @param {number} angle
|
|
1305
|
+
* @param {boolean} mirror
|
|
1310
1306
|
* @param {Function} drawFunction
|
|
1311
|
-
* @param {
|
|
1307
|
+
* @param {boolean} [screenSpace=false]
|
|
1312
1308
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
|
|
1313
1309
|
* @memberof Draw */
|
|
1314
1310
|
export function drawCanvas2D(pos: Vector2, size: Vector2, angle: number, mirror: boolean, drawFunction: Function, screenSpace?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1315
1311
|
/** Draw text on main canvas in world space
|
|
1316
1312
|
* Automatically splits new lines into rows
|
|
1317
|
-
* @param {
|
|
1313
|
+
* @param {string} text
|
|
1318
1314
|
* @param {Vector2} pos
|
|
1319
|
-
* @param {
|
|
1315
|
+
* @param {number} [size]
|
|
1320
1316
|
* @param {Color} [color=(1,1,1,1)]
|
|
1321
|
-
* @param {
|
|
1317
|
+
* @param {number} [lineWidth]
|
|
1322
1318
|
* @param {Color} [lineColor=(0,0,0,1)]
|
|
1323
1319
|
* @param {CanvasTextAlign} [textAlign='center']
|
|
1324
|
-
* @param {
|
|
1325
|
-
* @param {
|
|
1320
|
+
* @param {string} [font=fontDefault]
|
|
1321
|
+
* @param {number} [maxWidth]
|
|
1326
1322
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
|
|
1327
1323
|
* @memberof Draw */
|
|
1328
1324
|
export function drawText(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, maxWidth?: number, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1329
1325
|
/** Draw text on overlay canvas in world space
|
|
1330
1326
|
* Automatically splits new lines into rows
|
|
1331
|
-
* @param {
|
|
1327
|
+
* @param {string} text
|
|
1332
1328
|
* @param {Vector2} pos
|
|
1333
|
-
* @param {
|
|
1329
|
+
* @param {number} [size]
|
|
1334
1330
|
* @param {Color} [color=(1,1,1,1)]
|
|
1335
|
-
* @param {
|
|
1331
|
+
* @param {number} [lineWidth]
|
|
1336
1332
|
* @param {Color} [lineColor=(0,0,0,1)]
|
|
1337
1333
|
* @param {CanvasTextAlign} [textAlign='center']
|
|
1338
|
-
* @param {
|
|
1339
|
-
* @param {
|
|
1334
|
+
* @param {string} [font=fontDefault]
|
|
1335
|
+
* @param {number} [maxWidth]
|
|
1340
1336
|
* @memberof Draw */
|
|
1341
1337
|
export function drawTextOverlay(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, maxWidth?: number): void;
|
|
1342
1338
|
/** Draw text on overlay canvas in screen space
|
|
1343
1339
|
* Automatically splits new lines into rows
|
|
1344
|
-
* @param {
|
|
1340
|
+
* @param {string} text
|
|
1345
1341
|
* @param {Vector2} pos
|
|
1346
|
-
* @param {
|
|
1342
|
+
* @param {number} [size]
|
|
1347
1343
|
* @param {Color} [color=(1,1,1,1)]
|
|
1348
|
-
* @param {
|
|
1344
|
+
* @param {number} [lineWidth]
|
|
1349
1345
|
* @param {Color} [lineColor=(0,0,0,1)]
|
|
1350
1346
|
* @param {CanvasTextAlign} [textAlign]
|
|
1351
|
-
* @param {
|
|
1352
|
-
* @param {
|
|
1347
|
+
* @param {string} [font=fontDefault]
|
|
1348
|
+
* @param {number} [maxWidth]
|
|
1353
1349
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
|
|
1354
1350
|
* @memberof Draw */
|
|
1355
1351
|
export function drawTextScreen(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, maxWidth?: number, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1356
1352
|
/** Enable normal or additive blend mode
|
|
1357
|
-
* @param {
|
|
1358
|
-
* @param {
|
|
1353
|
+
* @param {boolean} [additive]
|
|
1354
|
+
* @param {boolean} [useWebGL=glEnable]
|
|
1359
1355
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
|
|
1360
1356
|
* @memberof Draw */
|
|
1361
1357
|
export function setBlendMode(additive?: boolean, useWebGL?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
@@ -1389,29 +1385,29 @@ declare module "littlejsengine" {
|
|
|
1389
1385
|
paddingSize: Vector2;
|
|
1390
1386
|
context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
1391
1387
|
/** Draw text in world space using the image font
|
|
1392
|
-
* @param {
|
|
1388
|
+
* @param {string} text
|
|
1393
1389
|
* @param {Vector2} pos
|
|
1394
|
-
* @param {
|
|
1395
|
-
* @param {
|
|
1390
|
+
* @param {number} [scale=.25]
|
|
1391
|
+
* @param {boolean} [center]
|
|
1396
1392
|
*/
|
|
1397
1393
|
drawText(text: string, pos: Vector2, scale?: number, center?: boolean): void;
|
|
1398
1394
|
/** Draw text in screen space using the image font
|
|
1399
|
-
* @param {
|
|
1395
|
+
* @param {string} text
|
|
1400
1396
|
* @param {Vector2} pos
|
|
1401
|
-
* @param {
|
|
1402
|
-
* @param {
|
|
1397
|
+
* @param {number} [scale]
|
|
1398
|
+
* @param {boolean} [center]
|
|
1403
1399
|
*/
|
|
1404
1400
|
drawTextScreen(text: string, pos: Vector2, scale?: number, center?: boolean): void;
|
|
1405
1401
|
}
|
|
1406
1402
|
/** Returns true if fullscreen mode is active
|
|
1407
|
-
* @return {
|
|
1403
|
+
* @return {boolean}
|
|
1408
1404
|
* @memberof Draw */
|
|
1409
1405
|
export function isFullscreen(): boolean;
|
|
1410
1406
|
/** Toggle fullscreen mode
|
|
1411
1407
|
* @memberof Draw */
|
|
1412
1408
|
export function toggleFullscreen(): void;
|
|
1413
1409
|
/** Set the cursor style
|
|
1414
|
-
* @param {
|
|
1410
|
+
* @param {string} cursorStyle - CSS cursor style (auto, none, crosshair, etc)
|
|
1415
1411
|
* @memberof Draw */
|
|
1416
1412
|
export function setCursor(cursorStyle?: string): void;
|
|
1417
1413
|
/** Get the camera's visible area in world space
|
|
@@ -1445,7 +1441,7 @@ declare module "littlejsengine" {
|
|
|
1445
1441
|
export function glCompileShader(source: string, type: number): WebGLShader;
|
|
1446
1442
|
/** Draw any sprites still in the buffer and copy to main canvas
|
|
1447
1443
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context
|
|
1448
|
-
* @param {
|
|
1444
|
+
* @param {boolean} [forceDraw]
|
|
1449
1445
|
* @memberof WebGL */
|
|
1450
1446
|
export function glCopyToContext(context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, forceDraw?: boolean): void;
|
|
1451
1447
|
/** Create WebGL program with given shaders
|
|
@@ -1482,14 +1478,14 @@ declare module "littlejsengine" {
|
|
|
1482
1478
|
* @memberof WebGL */
|
|
1483
1479
|
export function glSetTexture(texture: WebGLTexture): void;
|
|
1484
1480
|
/** Set anti-aliasing for webgl canvas
|
|
1485
|
-
* @param {
|
|
1481
|
+
* @param {boolean} [antialias]
|
|
1486
1482
|
* @memberof WebGL */
|
|
1487
1483
|
export function glSetAntialias(antialias?: boolean): void;
|
|
1488
1484
|
/** Clear the canvas and setup the viewport
|
|
1489
1485
|
* @memberof WebGL */
|
|
1490
1486
|
export function glClearCanvas(): void;
|
|
1491
1487
|
/** Should webgl be setup with anti-aliasing? must be set before calling engineInit
|
|
1492
|
-
* @type {
|
|
1488
|
+
* @type {boolean}
|
|
1493
1489
|
* @memberof WebGL */
|
|
1494
1490
|
export let glAntialias: boolean;
|
|
1495
1491
|
export let glShader: any;
|
|
@@ -1511,21 +1507,21 @@ declare module "littlejsengine" {
|
|
|
1511
1507
|
* @namespace Input
|
|
1512
1508
|
*/
|
|
1513
1509
|
/** Returns true if device key is down
|
|
1514
|
-
* @param {
|
|
1515
|
-
* @param {
|
|
1516
|
-
* @return {
|
|
1510
|
+
* @param {string|number} key
|
|
1511
|
+
* @param {number} [device]
|
|
1512
|
+
* @return {boolean}
|
|
1517
1513
|
* @memberof Input */
|
|
1518
1514
|
export function keyIsDown(key: string | number, device?: number): boolean;
|
|
1519
1515
|
/** Returns true if device key was pressed this frame
|
|
1520
|
-
* @param {
|
|
1521
|
-
* @param {
|
|
1522
|
-
* @return {
|
|
1516
|
+
* @param {string|number} key
|
|
1517
|
+
* @param {number} [device]
|
|
1518
|
+
* @return {boolean}
|
|
1523
1519
|
* @memberof Input */
|
|
1524
1520
|
export function keyWasPressed(key: string | number, device?: number): boolean;
|
|
1525
1521
|
/** Returns true if device key was released this frame
|
|
1526
|
-
* @param {
|
|
1527
|
-
* @param {
|
|
1528
|
-
* @return {
|
|
1522
|
+
* @param {string|number} key
|
|
1523
|
+
* @param {number} [device]
|
|
1524
|
+
* @return {boolean}
|
|
1529
1525
|
* @memberof Input */
|
|
1530
1526
|
export function keyWasReleased(key: string | number, device?: number): boolean;
|
|
1531
1527
|
/** Returns input vector from arrow keys or WASD if enabled
|
|
@@ -1545,21 +1541,21 @@ declare module "littlejsengine" {
|
|
|
1545
1541
|
* @namespace Input
|
|
1546
1542
|
*/
|
|
1547
1543
|
/** Returns true if device key is down
|
|
1548
|
-
* @param {
|
|
1549
|
-
* @param {
|
|
1550
|
-
* @return {
|
|
1544
|
+
* @param {string|number} key
|
|
1545
|
+
* @param {number} [device]
|
|
1546
|
+
* @return {boolean}
|
|
1551
1547
|
* @memberof Input */
|
|
1552
1548
|
export function mouseIsDown(key: string | number, device?: number): boolean;
|
|
1553
1549
|
/** Returns true if device key was pressed this frame
|
|
1554
|
-
* @param {
|
|
1555
|
-
* @param {
|
|
1556
|
-
* @return {
|
|
1550
|
+
* @param {string|number} key
|
|
1551
|
+
* @param {number} [device]
|
|
1552
|
+
* @return {boolean}
|
|
1557
1553
|
* @memberof Input */
|
|
1558
1554
|
export function mouseWasPressed(key: string | number, device?: number): boolean;
|
|
1559
1555
|
/** Returns true if device key was released this frame
|
|
1560
|
-
* @param {
|
|
1561
|
-
* @param {
|
|
1562
|
-
* @return {
|
|
1556
|
+
* @param {string|number} key
|
|
1557
|
+
* @param {number} [device]
|
|
1558
|
+
* @return {boolean}
|
|
1563
1559
|
* @memberof Input */
|
|
1564
1560
|
export function mouseWasReleased(key: string | number, device?: number): boolean;
|
|
1565
1561
|
/** Mouse pos in world space
|
|
@@ -1571,44 +1567,40 @@ declare module "littlejsengine" {
|
|
|
1571
1567
|
* @memberof Input */
|
|
1572
1568
|
export let mousePosScreen: Vector2;
|
|
1573
1569
|
/** Mouse wheel delta this frame
|
|
1574
|
-
* @type {
|
|
1570
|
+
* @type {number}
|
|
1575
1571
|
* @memberof Input */
|
|
1576
1572
|
export let mouseWheel: number;
|
|
1577
1573
|
/** Returns true if user is using gamepad (has more recently pressed a gamepad button)
|
|
1578
|
-
* @type {
|
|
1574
|
+
* @type {boolean}
|
|
1579
1575
|
* @memberof Input */
|
|
1580
1576
|
export let isUsingGamepad: boolean;
|
|
1581
|
-
/** Prevents input continuing to the default browser handling (false by default)
|
|
1582
|
-
* @type {Boolean}
|
|
1583
|
-
* @memberof Input */
|
|
1584
|
-
export let preventDefaultInput: boolean;
|
|
1585
1577
|
/** Returns true if gamepad button is down
|
|
1586
|
-
* @param {
|
|
1587
|
-
* @param {
|
|
1588
|
-
* @return {
|
|
1578
|
+
* @param {number} button
|
|
1579
|
+
* @param {number} [gamepad]
|
|
1580
|
+
* @return {boolean}
|
|
1589
1581
|
* @memberof Input */
|
|
1590
1582
|
export function gamepadIsDown(button: number, gamepad?: number): boolean;
|
|
1591
1583
|
/** Returns true if gamepad button was pressed
|
|
1592
|
-
* @param {
|
|
1593
|
-
* @param {
|
|
1594
|
-
* @return {
|
|
1584
|
+
* @param {number} button
|
|
1585
|
+
* @param {number} [gamepad]
|
|
1586
|
+
* @return {boolean}
|
|
1595
1587
|
* @memberof Input */
|
|
1596
1588
|
export function gamepadWasPressed(button: number, gamepad?: number): boolean;
|
|
1597
1589
|
/** Returns true if gamepad button was released
|
|
1598
|
-
* @param {
|
|
1599
|
-
* @param {
|
|
1600
|
-
* @return {
|
|
1590
|
+
* @param {number} button
|
|
1591
|
+
* @param {number} [gamepad]
|
|
1592
|
+
* @return {boolean}
|
|
1601
1593
|
* @memberof Input */
|
|
1602
1594
|
export function gamepadWasReleased(button: number, gamepad?: number): boolean;
|
|
1603
1595
|
/** Returns gamepad stick value
|
|
1604
|
-
* @param {
|
|
1605
|
-
* @param {
|
|
1596
|
+
* @param {number} stick
|
|
1597
|
+
* @param {number} [gamepad]
|
|
1606
1598
|
* @return {Vector2}
|
|
1607
1599
|
* @memberof Input */
|
|
1608
1600
|
export function gamepadStick(stick: number, gamepad?: number): Vector2;
|
|
1609
1601
|
export function gamepadsUpdate(): void;
|
|
1610
1602
|
/** Pulse the vibration hardware if it exists
|
|
1611
|
-
* @param {
|
|
1603
|
+
* @param {number|Array} [pattern] - single value in ms or vibration interval array
|
|
1612
1604
|
* @memberof Input */
|
|
1613
1605
|
export function vibrate(pattern?: number | any[]): void;
|
|
1614
1606
|
/** Cancel any ongoing vibration
|
|
@@ -1631,31 +1623,31 @@ declare module "littlejsengine" {
|
|
|
1631
1623
|
export class Sound {
|
|
1632
1624
|
/** Create a sound object and cache the zzfx samples for later use
|
|
1633
1625
|
* @param {Array} zzfxSound - Array of zzfx parameters, ex. [.5,.5]
|
|
1634
|
-
* @param {
|
|
1635
|
-
* @param {
|
|
1626
|
+
* @param {number} [range=soundDefaultRange] - World space max range of sound, will not play if camera is farther away
|
|
1627
|
+
* @param {number} [taper=soundDefaultTaper] - At what percentage of range should it start tapering
|
|
1636
1628
|
*/
|
|
1637
1629
|
constructor(zzfxSound: any[], range?: number, taper?: number);
|
|
1638
|
-
/** @property {
|
|
1630
|
+
/** @property {number} - World space max range of sound, will not play if camera is farther away */
|
|
1639
1631
|
range: number;
|
|
1640
|
-
/** @property {
|
|
1632
|
+
/** @property {number} - At what percentage of range should it start tapering off */
|
|
1641
1633
|
taper: number;
|
|
1642
|
-
/** @property {
|
|
1634
|
+
/** @property {number} - How much to randomize frequency each time sound plays */
|
|
1643
1635
|
randomness: any;
|
|
1644
1636
|
sampleChannels: any[][];
|
|
1645
1637
|
sampleRate: number;
|
|
1646
1638
|
/** Play the sound
|
|
1647
1639
|
* @param {Vector2} [pos] - World space position to play the sound, sound is not attenuated if null
|
|
1648
|
-
* @param {
|
|
1649
|
-
* @param {
|
|
1650
|
-
* @param {
|
|
1651
|
-
* @param {
|
|
1640
|
+
* @param {number} [volume] - How much to scale volume by (in addition to range fade)
|
|
1641
|
+
* @param {number} [pitch] - How much to scale pitch by (also adjusted by this.randomness)
|
|
1642
|
+
* @param {number} [randomnessScale] - How much to scale randomness
|
|
1643
|
+
* @param {boolean} [loop] - Should the sound loop
|
|
1652
1644
|
* @return {AudioBufferSourceNode} - The audio source node
|
|
1653
1645
|
*/
|
|
1654
1646
|
play(pos?: Vector2, volume?: number, pitch?: number, randomnessScale?: number, loop?: boolean): AudioBufferSourceNode;
|
|
1655
1647
|
gainNode: GainNode;
|
|
1656
1648
|
source: AudioBufferSourceNode;
|
|
1657
1649
|
/** Set the sound volume of the most recently played instance of this sound
|
|
1658
|
-
* @param {
|
|
1650
|
+
* @param {number} [volume] - How much to scale volume by
|
|
1659
1651
|
*/
|
|
1660
1652
|
setVolume(volume?: number): void;
|
|
1661
1653
|
/** Stop the last instance of this sound that was played */
|
|
@@ -1665,18 +1657,18 @@ declare module "littlejsengine" {
|
|
|
1665
1657
|
*/
|
|
1666
1658
|
getSource(): AudioBufferSourceNode;
|
|
1667
1659
|
/** Play the sound as a note with a semitone offset
|
|
1668
|
-
* @param {
|
|
1660
|
+
* @param {number} semitoneOffset - How many semitones to offset pitch
|
|
1669
1661
|
* @param {Vector2} [pos] - World space position to play the sound, sound is not attenuated if null
|
|
1670
|
-
* @param {
|
|
1662
|
+
* @param {number} [volume=1] - How much to scale volume by (in addition to range fade)
|
|
1671
1663
|
* @return {AudioBufferSourceNode} - The audio source node
|
|
1672
1664
|
*/
|
|
1673
1665
|
playNote(semitoneOffset: number, pos?: Vector2, volume?: number): AudioBufferSourceNode;
|
|
1674
1666
|
/** Get how long this sound is in seconds
|
|
1675
|
-
* @return {
|
|
1667
|
+
* @return {number} - How long the sound is in seconds (undefined if loading)
|
|
1676
1668
|
*/
|
|
1677
1669
|
getDuration(): number;
|
|
1678
1670
|
/** Check if sound is loading, for sounds fetched from a url
|
|
1679
|
-
* @return {
|
|
1671
|
+
* @return {boolean} - True if sound is loading and not ready to play
|
|
1680
1672
|
*/
|
|
1681
1673
|
isLoading(): boolean;
|
|
1682
1674
|
}
|
|
@@ -1692,10 +1684,10 @@ declare module "littlejsengine" {
|
|
|
1692
1684
|
*/
|
|
1693
1685
|
export class SoundWave extends Sound {
|
|
1694
1686
|
/** Create a sound object and cache the wave file for later use
|
|
1695
|
-
* @param {
|
|
1696
|
-
* @param {
|
|
1697
|
-
* @param {
|
|
1698
|
-
* @param {
|
|
1687
|
+
* @param {string} filename - Filename of audio file to load
|
|
1688
|
+
* @param {number} [randomness] - How much to randomize frequency each time sound plays
|
|
1689
|
+
* @param {number} [range=soundDefaultRange] - World space max range of sound, will not play if camera is farther away
|
|
1690
|
+
* @param {number} [taper=soundDefaultTaper] - At what percentage of range should it start tapering off
|
|
1699
1691
|
* @param {Function} [onloadCallback] - callback function to call when sound is loaded
|
|
1700
1692
|
*/
|
|
1701
1693
|
constructor(filename: string, randomness?: number, range?: number, taper?: number, onloadCallback?: Function);
|
|
@@ -1732,30 +1724,30 @@ declare module "littlejsengine" {
|
|
|
1732
1724
|
*/
|
|
1733
1725
|
export class Music extends Sound {
|
|
1734
1726
|
/** Create a music object and cache the zzfx music samples for later use
|
|
1735
|
-
* @param {[Array, Array, Array,
|
|
1727
|
+
* @param {[Array, Array, Array, number]} zzfxMusic - Array of zzfx music parameters
|
|
1736
1728
|
*/
|
|
1737
1729
|
constructor(zzfxMusic: [any[], any[], any[], number]);
|
|
1738
1730
|
sampleChannels: any[];
|
|
1739
1731
|
/** Play the music
|
|
1740
|
-
* @param {
|
|
1741
|
-
* @param {
|
|
1732
|
+
* @param {number} [volume=1] - How much to scale volume by
|
|
1733
|
+
* @param {boolean} [loop] - True if the music should loop
|
|
1742
1734
|
* @return {AudioBufferSourceNode} - The audio source node
|
|
1743
1735
|
*/
|
|
1744
1736
|
playMusic(volume?: number, loop?: boolean): AudioBufferSourceNode;
|
|
1745
1737
|
}
|
|
1746
1738
|
/** Play an mp3, ogg, or wav audio from a local file or url
|
|
1747
|
-
* @param {
|
|
1748
|
-
* @param {
|
|
1749
|
-
* @param {
|
|
1739
|
+
* @param {string} filename - Location of sound file to play
|
|
1740
|
+
* @param {number} [volume] - How much to scale volume by
|
|
1741
|
+
* @param {boolean} [loop] - True if the music should loop
|
|
1750
1742
|
* @return {SoundWave} - The sound object for this file
|
|
1751
1743
|
* @memberof Audio */
|
|
1752
1744
|
export function playAudioFile(filename: string, volume?: number, loop?: boolean): SoundWave;
|
|
1753
1745
|
/** Speak text with passed in settings
|
|
1754
|
-
* @param {
|
|
1755
|
-
* @param {
|
|
1756
|
-
* @param {
|
|
1757
|
-
* @param {
|
|
1758
|
-
* @param {
|
|
1746
|
+
* @param {string} text - The text to speak
|
|
1747
|
+
* @param {string} [language] - The language/accent to use (examples: en, it, ru, ja, zh)
|
|
1748
|
+
* @param {number} [volume] - How much to scale volume by
|
|
1749
|
+
* @param {number} [rate] - How quickly to speak
|
|
1750
|
+
* @param {number} [pitch] - How much to change the pitch by
|
|
1759
1751
|
* @return {SpeechSynthesisUtterance} - The utterance that was spoken
|
|
1760
1752
|
* @memberof Audio */
|
|
1761
1753
|
export function speak(text: string, language?: string, volume?: number, rate?: number, pitch?: number): SpeechSynthesisUtterance;
|
|
@@ -1763,9 +1755,9 @@ declare module "littlejsengine" {
|
|
|
1763
1755
|
* @memberof Audio */
|
|
1764
1756
|
export function speakStop(): void;
|
|
1765
1757
|
/** Get frequency of a note on a musical scale
|
|
1766
|
-
* @param {
|
|
1767
|
-
* @param {
|
|
1768
|
-
* @return {
|
|
1758
|
+
* @param {number} semitoneOffset - How many semitones away from the root note
|
|
1759
|
+
* @param {number} [rootFrequency=220] - Frequency at semitone offset 0
|
|
1760
|
+
* @return {number} - The frequency of the note
|
|
1769
1761
|
* @memberof Audio */
|
|
1770
1762
|
export function getNoteFrequency(semitoneOffset: number, rootFrequency?: number): number;
|
|
1771
1763
|
/**
|
|
@@ -1784,11 +1776,11 @@ declare module "littlejsengine" {
|
|
|
1784
1776
|
export let audioContext: AudioContext;
|
|
1785
1777
|
/** Play cached audio samples with given settings
|
|
1786
1778
|
* @param {Array} sampleChannels - Array of arrays of samples to play (for stereo playback)
|
|
1787
|
-
* @param {
|
|
1788
|
-
* @param {
|
|
1789
|
-
* @param {
|
|
1790
|
-
* @param {
|
|
1791
|
-
* @param {
|
|
1779
|
+
* @param {number} [volume] - How much to scale volume by
|
|
1780
|
+
* @param {number} [rate] - The playback rate to use
|
|
1781
|
+
* @param {number} [pan] - How much to apply stereo panning
|
|
1782
|
+
* @param {boolean} [loop] - True if the sound should loop when it reaches the end
|
|
1783
|
+
* @param {number} [sampleRate=44100] - Sample rate for the sound
|
|
1792
1784
|
* @param {GainNode} [gainNode] - Optional gain node for volume control while playing
|
|
1793
1785
|
* @return {AudioBufferSourceNode} - The audio node of the sound played
|
|
1794
1786
|
* @memberof Audio */
|
|
@@ -1833,9 +1825,9 @@ declare module "littlejsengine" {
|
|
|
1833
1825
|
* @param {Vector2} [pos=(0,0)] - World space position of the object
|
|
1834
1826
|
* @param {Vector2} [size=(1,1)] - World space size of the object
|
|
1835
1827
|
* @param {TileInfo} [tileInfo] - Tile info to render object (undefined is untextured)
|
|
1836
|
-
* @param {
|
|
1828
|
+
* @param {number} [angle] - Angle the object is rotated by
|
|
1837
1829
|
* @param {Color} [color=(1,1,1,1)] - Color to apply to tile when rendered
|
|
1838
|
-
* @param {
|
|
1830
|
+
* @param {number} [renderOrder] - Objects sorted by renderOrder before being rendered
|
|
1839
1831
|
*/
|
|
1840
1832
|
constructor(pos?: Vector2, size?: Vector2, tileInfo?: TileInfo, angle?: number, color?: Color, renderOrder?: number);
|
|
1841
1833
|
/** @property {Vector2} - World space position of the object */
|
|
@@ -1846,57 +1838,58 @@ declare module "littlejsengine" {
|
|
|
1846
1838
|
drawSize: any;
|
|
1847
1839
|
/** @property {TileInfo} - Tile info to render object (undefined is untextured) */
|
|
1848
1840
|
tileInfo: TileInfo;
|
|
1849
|
-
/** @property {
|
|
1841
|
+
/** @property {number} - Angle to rotate the object */
|
|
1850
1842
|
angle: number;
|
|
1851
1843
|
/** @property {Color} - Color to apply when rendered */
|
|
1852
1844
|
color: Color;
|
|
1853
1845
|
/** @property {Color} - Additive color to apply when rendered */
|
|
1854
1846
|
additiveColor: any;
|
|
1855
|
-
/** @property {
|
|
1847
|
+
/** @property {boolean} - Should it flip along y axis when rendered */
|
|
1856
1848
|
mirror: boolean;
|
|
1857
|
-
/** @property {
|
|
1849
|
+
/** @property {number} [mass=objectDefaultMass] - How heavy the object is, static if 0 */
|
|
1858
1850
|
mass: number;
|
|
1859
|
-
/** @property {
|
|
1851
|
+
/** @property {number} [damping=objectDefaultDamping] - How much to slow down velocity each frame (0-1) */
|
|
1860
1852
|
damping: number;
|
|
1861
|
-
/** @property {
|
|
1853
|
+
/** @property {number} [angleDamping=objectDefaultAngleDamping] - How much to slow down rotation each frame (0-1) */
|
|
1862
1854
|
angleDamping: number;
|
|
1863
|
-
/** @property {
|
|
1855
|
+
/** @property {number} [elasticity=objectDefaultElasticity] - How bouncy the object is when colliding (0-1) */
|
|
1864
1856
|
elasticity: number;
|
|
1865
|
-
/** @property {
|
|
1857
|
+
/** @property {number} [friction=objectDefaultFriction] - How much friction to apply when sliding (0-1) */
|
|
1866
1858
|
friction: number;
|
|
1867
|
-
/** @property {
|
|
1859
|
+
/** @property {number} - How much to scale gravity by for this object */
|
|
1868
1860
|
gravityScale: number;
|
|
1869
|
-
/** @property {
|
|
1861
|
+
/** @property {number} - Objects are sorted by render order */
|
|
1870
1862
|
renderOrder: number;
|
|
1871
1863
|
/** @property {Vector2} - Velocity of the object */
|
|
1872
1864
|
velocity: Vector2;
|
|
1873
|
-
/** @property {
|
|
1865
|
+
/** @property {number} - Angular velocity of the object */
|
|
1874
1866
|
angleVelocity: number;
|
|
1875
|
-
/** @property {
|
|
1867
|
+
/** @property {number} - Track when object was created */
|
|
1876
1868
|
spawnTime: number;
|
|
1877
|
-
/** @property {Array} - List of children of this object */
|
|
1869
|
+
/** @property {Array<EngineObject>} - List of children of this object */
|
|
1878
1870
|
children: any[];
|
|
1879
|
-
/** @property {
|
|
1871
|
+
/** @property {boolean} - Limit object speed using linear or circular math */
|
|
1880
1872
|
clampSpeedLinear: boolean;
|
|
1873
|
+
/** @property {EngineObject} - Object we are standing on, if any */
|
|
1874
|
+
groundObject: any;
|
|
1881
1875
|
/** @property {EngineObject} - Parent of object if in local space */
|
|
1882
1876
|
parent: any;
|
|
1883
1877
|
/** @property {Vector2} - Local position if child */
|
|
1884
1878
|
localPos: Vector2;
|
|
1885
|
-
/** @property {
|
|
1879
|
+
/** @property {number} - Local angle if child */
|
|
1886
1880
|
localAngle: number;
|
|
1887
|
-
/** @property {
|
|
1881
|
+
/** @property {boolean} - Object collides with the tile collision */
|
|
1888
1882
|
collideTiles: boolean;
|
|
1889
|
-
/** @property {
|
|
1883
|
+
/** @property {boolean} - Object collides with solid objects */
|
|
1890
1884
|
collideSolidObjects: boolean;
|
|
1891
|
-
/** @property {
|
|
1885
|
+
/** @property {boolean} - Object collides with and blocks other objects */
|
|
1892
1886
|
isSolid: boolean;
|
|
1893
|
-
/** @property {
|
|
1887
|
+
/** @property {boolean} - Object collides with raycasts */
|
|
1894
1888
|
collideRaycast: boolean;
|
|
1895
1889
|
/** Update the object transform, called automatically by engine even when paused */
|
|
1896
1890
|
updateTransforms(): void;
|
|
1897
1891
|
/** Update the object physics, called automatically by engine once each frame */
|
|
1898
1892
|
update(): void;
|
|
1899
|
-
groundObject: any;
|
|
1900
1893
|
/** Render the object, draws a tile by default, automatically called each frame, sorted by renderOrder */
|
|
1901
1894
|
render(): void;
|
|
1902
1895
|
/** Destroy this object, destroy it's children, detach it's parent, and mark it for removal */
|
|
@@ -1915,17 +1908,17 @@ declare module "littlejsengine" {
|
|
|
1915
1908
|
* @param {Vector2} vec - world space vector */
|
|
1916
1909
|
worldToLocalVector(vec: Vector2): Vector2;
|
|
1917
1910
|
/** Called to check if a tile collision should be resolved
|
|
1918
|
-
* @param {
|
|
1911
|
+
* @param {number} tileData - the value of the tile at the position
|
|
1919
1912
|
* @param {Vector2} pos - tile where the collision occurred
|
|
1920
|
-
* @return {
|
|
1913
|
+
* @return {boolean} - true if the collision should be resolved */
|
|
1921
1914
|
collideWithTile(tileData: number, pos: Vector2): boolean;
|
|
1922
1915
|
/** Called to check if a object collision should be resolved
|
|
1923
1916
|
* @param {EngineObject} object - the object to test against
|
|
1924
|
-
* @return {
|
|
1917
|
+
* @return {boolean} - true if the collision should be resolved
|
|
1925
1918
|
*/
|
|
1926
1919
|
collideWithObject(object: EngineObject): boolean;
|
|
1927
1920
|
/** How long since the object was created
|
|
1928
|
-
* @return {
|
|
1921
|
+
* @return {number} */
|
|
1929
1922
|
getAliveTime(): number;
|
|
1930
1923
|
/** Apply acceleration to this object (adjust velocity, not affected by mass)
|
|
1931
1924
|
* @param {Vector2} acceleration */
|
|
@@ -1934,24 +1927,24 @@ declare module "littlejsengine" {
|
|
|
1934
1927
|
* @param {Vector2} force */
|
|
1935
1928
|
applyForce(force: Vector2): void;
|
|
1936
1929
|
/** Get the direction of the mirror
|
|
1937
|
-
* @return {
|
|
1930
|
+
* @return {number} -1 if this.mirror is true, or 1 if not mirrored */
|
|
1938
1931
|
getMirrorSign(): number;
|
|
1939
1932
|
/** Attaches a child to this with a given local transform
|
|
1940
1933
|
* @param {EngineObject} child
|
|
1941
1934
|
* @param {Vector2} [localPos=(0,0)]
|
|
1942
|
-
* @param {
|
|
1935
|
+
* @param {number} [localAngle] */
|
|
1943
1936
|
addChild(child: EngineObject, localPos?: Vector2, localAngle?: number): void;
|
|
1944
1937
|
/** Removes a child from this one
|
|
1945
1938
|
* @param {EngineObject} child */
|
|
1946
1939
|
removeChild(child: EngineObject): void;
|
|
1947
1940
|
/** Set how this object collides
|
|
1948
|
-
* @param {
|
|
1949
|
-
* @param {
|
|
1950
|
-
* @param {
|
|
1951
|
-
* @param {
|
|
1941
|
+
* @param {boolean} [collideSolidObjects] - Does it collide with solid objects?
|
|
1942
|
+
* @param {boolean} [isSolid] - Does it collide with and block other objects? (expensive in large numbers)
|
|
1943
|
+
* @param {boolean} [collideTiles] - Does it collide with the tile collision?
|
|
1944
|
+
* @param {boolean} [collideRaycast] - Does it collide with raycasts? */
|
|
1952
1945
|
setCollision(collideSolidObjects?: boolean, isSolid?: boolean, collideTiles?: boolean, collideRaycast?: boolean): void;
|
|
1953
1946
|
/** Returns string containing info about this object for debugging
|
|
1954
|
-
* @return {
|
|
1947
|
+
* @return {string} */
|
|
1955
1948
|
toString(): string;
|
|
1956
1949
|
/** Render debug info for this object */
|
|
1957
1950
|
renderDebugInfo(): void;
|
|
@@ -1968,9 +1961,9 @@ declare module "littlejsengine" {
|
|
|
1968
1961
|
* @namespace TileCollision
|
|
1969
1962
|
*/
|
|
1970
1963
|
/** The tile collision layer grid, use setTileCollisionData and getTileCollisionData to access
|
|
1971
|
-
* @type {Array}
|
|
1964
|
+
* @type {Array<number>}
|
|
1972
1965
|
* @memberof TileCollision */
|
|
1973
|
-
export let tileCollision:
|
|
1966
|
+
export let tileCollision: Array<number>;
|
|
1974
1967
|
/** Size of the tile collision layer 2d grid
|
|
1975
1968
|
* @type {Vector2}
|
|
1976
1969
|
* @memberof TileCollision */
|
|
@@ -1981,19 +1974,19 @@ declare module "littlejsengine" {
|
|
|
1981
1974
|
export function initTileCollision(size: Vector2): void;
|
|
1982
1975
|
/** Set tile collision data for a given cell in the grid
|
|
1983
1976
|
* @param {Vector2} pos
|
|
1984
|
-
* @param {
|
|
1977
|
+
* @param {number} [data]
|
|
1985
1978
|
* @memberof TileCollision */
|
|
1986
1979
|
export function setTileCollisionData(pos: Vector2, data?: number): void;
|
|
1987
1980
|
/** Get tile collision data for a given cell in the grid
|
|
1988
1981
|
* @param {Vector2} pos
|
|
1989
|
-
* @return {
|
|
1982
|
+
* @return {number}
|
|
1990
1983
|
* @memberof TileCollision */
|
|
1991
1984
|
export function getTileCollisionData(pos: Vector2): number;
|
|
1992
1985
|
/** Check if collision with another object should occur
|
|
1993
1986
|
* @param {Vector2} pos
|
|
1994
1987
|
* @param {Vector2} [size=(0,0)]
|
|
1995
1988
|
* @param {EngineObject} [object]
|
|
1996
|
-
* @return {
|
|
1989
|
+
* @return {boolean}
|
|
1997
1990
|
* @memberof TileCollision */
|
|
1998
1991
|
export function tileCollisionTest(pos: Vector2, size?: Vector2, object?: EngineObject): boolean;
|
|
1999
1992
|
/** Return the center of first tile hit, undefined if nothing was hit.
|
|
@@ -2016,16 +2009,16 @@ declare module "littlejsengine" {
|
|
|
2016
2009
|
*/
|
|
2017
2010
|
export class TileLayerData {
|
|
2018
2011
|
/** Create a tile layer data object, one for each tile in a TileLayer
|
|
2019
|
-
* @param {
|
|
2020
|
-
* @param {
|
|
2021
|
-
* @param {
|
|
2012
|
+
* @param {number} [tile] - The tile to use, untextured if undefined
|
|
2013
|
+
* @param {number} [direction] - Integer direction of tile, in 90 degree increments
|
|
2014
|
+
* @param {boolean} [mirror] - If the tile should be mirrored along the x axis
|
|
2022
2015
|
* @param {Color} [color] - Color of the tile */
|
|
2023
2016
|
constructor(tile?: number, direction?: number, mirror?: boolean, color?: Color);
|
|
2024
|
-
/** @property {
|
|
2017
|
+
/** @property {number} - The tile to use, untextured if undefined */
|
|
2025
2018
|
tile: number;
|
|
2026
|
-
/** @property {
|
|
2019
|
+
/** @property {number} - Integer direction of tile, in 90 degree increments */
|
|
2027
2020
|
direction: number;
|
|
2028
|
-
/** @property {
|
|
2021
|
+
/** @property {boolean} - If the tile should be mirrored along the x axis */
|
|
2029
2022
|
mirror: boolean;
|
|
2030
2023
|
/** @property {Color} - Color of the tile */
|
|
2031
2024
|
color: Color;
|
|
@@ -2050,7 +2043,7 @@ declare module "littlejsengine" {
|
|
|
2050
2043
|
* @param {Vector2} [size=tileCollisionSize] - World space size
|
|
2051
2044
|
* @param {TileInfo} [tileInfo] - Tile info for layer
|
|
2052
2045
|
* @param {Vector2} [scale=(1,1)] - How much to scale this layer when rendered
|
|
2053
|
-
* @param {
|
|
2046
|
+
* @param {number} [renderOrder] - Objects are sorted by renderOrder
|
|
2054
2047
|
*/
|
|
2055
2048
|
constructor(position?: Vector2, size?: Vector2, tileInfo?: TileInfo, scale?: Vector2, renderOrder?: number);
|
|
2056
2049
|
/** @property {HTMLCanvasElement} - The canvas used by this tile layer */
|
|
@@ -2059,7 +2052,7 @@ declare module "littlejsengine" {
|
|
|
2059
2052
|
context: CanvasRenderingContext2D;
|
|
2060
2053
|
/** @property {Vector2} - How much to scale this layer when rendered */
|
|
2061
2054
|
scale: Vector2;
|
|
2062
|
-
/** @property {
|
|
2055
|
+
/** @property {boolean} - If true this layer will render to overlay canvas and appear above all objects */
|
|
2063
2056
|
isOverlay: boolean;
|
|
2064
2057
|
data: TileLayerData[];
|
|
2065
2058
|
/** Draw all the tile data to an offscreen canvas
|
|
@@ -2067,7 +2060,7 @@ declare module "littlejsengine" {
|
|
|
2067
2060
|
redraw(): void;
|
|
2068
2061
|
/** Call to start the redraw process
|
|
2069
2062
|
* - This can be used to manually update small parts of the level
|
|
2070
|
-
* @param {
|
|
2063
|
+
* @param {boolean} [clear] - Should it clear the canvas before drawing */
|
|
2071
2064
|
redrawStart(clear?: boolean): void;
|
|
2072
2065
|
/** Call to end the redraw process */
|
|
2073
2066
|
redrawEnd(): void;
|
|
@@ -2075,20 +2068,20 @@ declare module "littlejsengine" {
|
|
|
2075
2068
|
* This can be used to clear out tiles when they are destroyed
|
|
2076
2069
|
* Tiles can also be redrawn if inside a redrawStart/End block
|
|
2077
2070
|
* @param {Vector2} layerPos
|
|
2078
|
-
* @param {
|
|
2071
|
+
* @param {boolean} [clear] - should the old tile be cleared out
|
|
2079
2072
|
*/
|
|
2080
2073
|
drawTileData(layerPos: Vector2, clear?: boolean): void;
|
|
2081
2074
|
/** Draw directly to the 2D canvas in world space (bypass webgl)
|
|
2082
2075
|
* @param {Vector2} pos
|
|
2083
2076
|
* @param {Vector2} size
|
|
2084
|
-
* @param {
|
|
2085
|
-
* @param {
|
|
2077
|
+
* @param {number} angle
|
|
2078
|
+
* @param {boolean} mirror
|
|
2086
2079
|
* @param {Function} drawFunction */
|
|
2087
2080
|
drawCanvas2D(pos: Vector2, size: Vector2, angle: number, mirror: boolean, drawFunction: Function): void;
|
|
2088
2081
|
/** Set data at a given position in the array
|
|
2089
2082
|
* @param {Vector2} layerPos - Local position in array
|
|
2090
2083
|
* @param {TileLayerData} data - Data to set
|
|
2091
|
-
* @param {
|
|
2084
|
+
* @param {boolean} [redraw] - Force the tile to redraw if true */
|
|
2092
2085
|
setData(layerPos: Vector2, data: TileLayerData, redraw?: boolean): void;
|
|
2093
2086
|
/** Get data at a given position in the array
|
|
2094
2087
|
* @param {Vector2} layerPos - Local position in array
|
|
@@ -2101,14 +2094,14 @@ declare module "littlejsengine" {
|
|
|
2101
2094
|
* @param {Vector2} [size=(1,1)]
|
|
2102
2095
|
* @param {TileInfo} [tileInfo]
|
|
2103
2096
|
* @param {Color} [color=(1,1,1,1)]
|
|
2104
|
-
* @param {
|
|
2105
|
-
* @param {
|
|
2097
|
+
* @param {number} [angle=0]
|
|
2098
|
+
* @param {boolean} [mirror=0] */
|
|
2106
2099
|
drawTile(pos: Vector2, size?: Vector2, tileInfo?: TileInfo, color?: Color, angle?: number, mirror?: boolean): void;
|
|
2107
2100
|
/** Draw a rectangle directly onto the layer canvas in world space
|
|
2108
2101
|
* @param {Vector2} pos
|
|
2109
2102
|
* @param {Vector2} [size=(1,1)]
|
|
2110
2103
|
* @param {Color} [color=(1,1,1,1)]
|
|
2111
|
-
* @param {
|
|
2104
|
+
* @param {number} [angle=0] */
|
|
2112
2105
|
drawRect(pos: Vector2, size?: Vector2, color?: Color, angle?: number): void;
|
|
2113
2106
|
}
|
|
2114
2107
|
/**
|
|
@@ -2155,11 +2148,11 @@ declare module "littlejsengine" {
|
|
|
2155
2148
|
* @param {Number} [particleConeAngle] - Cone for start particle angle
|
|
2156
2149
|
* @param {Number} [fadeRate] - How quick to fade particles at start/end in percent of life
|
|
2157
2150
|
* @param {Number} [randomness] - Apply extra randomness percent
|
|
2158
|
-
* @param {
|
|
2159
|
-
* @param {
|
|
2160
|
-
* @param {
|
|
2151
|
+
* @param {boolean} [collideTiles] - Do particles collide against tiles
|
|
2152
|
+
* @param {boolean} [additive] - Should particles use additive blend
|
|
2153
|
+
* @param {boolean} [randomColorLinear] - Should color be randomized linearly or across each component
|
|
2161
2154
|
* @param {Number} [renderOrder] - Render order for particles (additive is above other stuff by default)
|
|
2162
|
-
* @param {
|
|
2155
|
+
* @param {boolean} [localSpace] - Should it be in local space of emitter (world space is default)
|
|
2163
2156
|
*/
|
|
2164
2157
|
constructor(position: Vector2, angle?: number, emitSize?: number | Vector2, emitTime?: number, emitRate?: number, emitConeAngle?: number, tileInfo?: TileInfo, colorStartA?: Color, colorStartB?: Color, colorEndA?: Color, colorEndB?: Color, particleTime?: number, sizeStart?: number, sizeEnd?: number, speed?: number, angleSpeed?: number, damping?: number, angleDamping?: number, gravityScale?: number, particleConeAngle?: number, fadeRate?: number, randomness?: number, collideTiles?: boolean, additive?: boolean, randomColorLinear?: boolean, renderOrder?: number, localSpace?: boolean);
|
|
2165
2158
|
/** @property {Number|Vector2} - World space size of the emitter (float for circle diameter, vec2 for rect) */
|
|
@@ -2178,7 +2171,7 @@ declare module "littlejsengine" {
|
|
|
2178
2171
|
colorEndA: Color;
|
|
2179
2172
|
/** @property {Color} - Color at end of life 2, randomized between end colors */
|
|
2180
2173
|
colorEndB: Color;
|
|
2181
|
-
/** @property {
|
|
2174
|
+
/** @property {boolean} - Should color be randomized linearly or across each component */
|
|
2182
2175
|
randomColorLinear: boolean;
|
|
2183
2176
|
/** @property {Number} - How long particles live */
|
|
2184
2177
|
particleTime: number;
|
|
@@ -2196,9 +2189,9 @@ declare module "littlejsengine" {
|
|
|
2196
2189
|
fadeRate: number;
|
|
2197
2190
|
/** @property {Number} - Apply extra randomness percent */
|
|
2198
2191
|
randomness: number;
|
|
2199
|
-
/** @property {
|
|
2192
|
+
/** @property {boolean} - Should particles use additive blend */
|
|
2200
2193
|
additive: boolean;
|
|
2201
|
-
/** @property {
|
|
2194
|
+
/** @property {boolean} - Should it be in local space of emitter */
|
|
2202
2195
|
localSpace: boolean;
|
|
2203
2196
|
/** @property {Number} - If non zero the particle is drawn as a trail, stretched in the direction of velocity */
|
|
2204
2197
|
trailScale: number;
|
|
@@ -2229,7 +2222,7 @@ declare module "littlejsengine" {
|
|
|
2229
2222
|
* @param {Number} sizeStart - Size at start of life
|
|
2230
2223
|
* @param {Number} sizeEnd - Size at end of life
|
|
2231
2224
|
* @param {Number} fadeRate - How quick to fade in/out
|
|
2232
|
-
* @param {
|
|
2225
|
+
* @param {boolean} additive - Does it use additive blend mode
|
|
2233
2226
|
* @param {Number} trailScale - If a trail, how long to make it
|
|
2234
2227
|
* @param {ParticleEmitter} [localSpaceEmitter] - Parent emitter if local space
|
|
2235
2228
|
* @param {Function} [destroyCallback] - Callback when particle dies
|
|
@@ -2247,7 +2240,7 @@ declare module "littlejsengine" {
|
|
|
2247
2240
|
sizeEndDelta: number;
|
|
2248
2241
|
/** @property {Number} - How quick to fade in/out */
|
|
2249
2242
|
fadeRate: number;
|
|
2250
|
-
/** @property {
|
|
2243
|
+
/** @property {boolean} - Is it additive */
|
|
2251
2244
|
additive: boolean;
|
|
2252
2245
|
/** @property {Number} - If a trail, how long to make it */
|
|
2253
2246
|
trailScale: number;
|
|
@@ -2268,7 +2261,7 @@ declare module "littlejsengine" {
|
|
|
2268
2261
|
* @memberof Medals */
|
|
2269
2262
|
export const medals: any;
|
|
2270
2263
|
/** Set to stop medals from being unlockable (like if cheats are enabled)
|
|
2271
|
-
* @type {
|
|
2264
|
+
* @type {boolean}
|
|
2272
2265
|
* @default
|
|
2273
2266
|
* @memberof Settings */
|
|
2274
2267
|
export let medalsPreventUnlock: boolean;
|
|
@@ -2307,7 +2300,7 @@ declare module "littlejsengine" {
|
|
|
2307
2300
|
description: string;
|
|
2308
2301
|
/** @property {String} - Icon for the medal */
|
|
2309
2302
|
icon: string;
|
|
2310
|
-
/** @property {
|
|
2303
|
+
/** @property {boolean} - Is the medal unlocked? */
|
|
2311
2304
|
unlocked: boolean;
|
|
2312
2305
|
image: HTMLImageElement;
|
|
2313
2306
|
/** Unlocks a medal if not already unlocked */
|
|
@@ -2318,9 +2311,9 @@ declare module "littlejsengine" {
|
|
|
2318
2311
|
render(hidePercent?: number): void;
|
|
2319
2312
|
/** Render the icon for a medal
|
|
2320
2313
|
* @param {Vector2} pos - Screen space position
|
|
2321
|
-
* @param {Number}
|
|
2314
|
+
* @param {Number} size - Screen space size
|
|
2322
2315
|
*/
|
|
2323
|
-
renderIcon(pos: Vector2, size
|
|
2316
|
+
renderIcon(pos: Vector2, size: number): void;
|
|
2324
2317
|
storageKey(): string;
|
|
2325
2318
|
}
|
|
2326
2319
|
}
|