littlejsengine 1.11.8 → 1.11.10
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 +496 -493
- package/dist/littlejs.esm.js +533 -522
- package/dist/littlejs.esm.min.js +1 -1
- package/dist/littlejs.js +531 -520
- package/dist/littlejs.min.js +1 -1
- package/dist/littlejs.release.js +487 -479
- package/examples/index.html +8 -2
- package/examples/module/game.js +2 -2
- package/examples/shorts/base.html +1 -1
- package/examples/starter/game.js +8 -1
- 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 +38 -34
- package/plugins/postProcess.js +18 -4
- package/plugins/uiSystem.js +196 -30
- package/reference.md +3 -3
- 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 -2
- package/src/engineInput.js +30 -30
- package/src/engineMedals.js +1 -1
- package/src/engineObject.js +42 -37
- package/src/engineParticles.js +10 -10
- package/src/engineSettings.js +74 -72
- package/src/engineTileLayer.js +21 -21
- package/src/engineUtilities.js +168 -168
- package/src/engineWebGL.js +3 -3
package/src/engineParticles.js
CHANGED
|
@@ -46,11 +46,11 @@ class ParticleEmitter extends EngineObject
|
|
|
46
46
|
* @param {Number} [particleConeAngle] - Cone for start particle angle
|
|
47
47
|
* @param {Number} [fadeRate] - How quick to fade particles at start/end in percent of life
|
|
48
48
|
* @param {Number} [randomness] - Apply extra randomness percent
|
|
49
|
-
* @param {
|
|
50
|
-
* @param {
|
|
51
|
-
* @param {
|
|
49
|
+
* @param {boolean} [collideTiles] - Do particles collide against tiles
|
|
50
|
+
* @param {boolean} [additive] - Should particles use additive blend
|
|
51
|
+
* @param {boolean} [randomColorLinear] - Should color be randomized linearly or across each component
|
|
52
52
|
* @param {Number} [renderOrder] - Render order for particles (additive is above other stuff by default)
|
|
53
|
-
* @param {
|
|
53
|
+
* @param {boolean} [localSpace] - Should it be in local space of emitter (world space is default)
|
|
54
54
|
*/
|
|
55
55
|
constructor
|
|
56
56
|
(
|
|
@@ -104,7 +104,7 @@ class ParticleEmitter extends EngineObject
|
|
|
104
104
|
this.colorEndA = colorEndA;
|
|
105
105
|
/** @property {Color} - Color at end of life 2, randomized between end colors */
|
|
106
106
|
this.colorEndB = colorEndB;
|
|
107
|
-
/** @property {
|
|
107
|
+
/** @property {boolean} - Should color be randomized linearly or across each component */
|
|
108
108
|
this.randomColorLinear = randomColorLinear;
|
|
109
109
|
|
|
110
110
|
// particle settings
|
|
@@ -130,11 +130,11 @@ class ParticleEmitter extends EngineObject
|
|
|
130
130
|
this.fadeRate = fadeRate;
|
|
131
131
|
/** @property {Number} - Apply extra randomness percent */
|
|
132
132
|
this.randomness = randomness;
|
|
133
|
-
/** @property {
|
|
133
|
+
/** @property {boolean} - Do particles collide against tiles */
|
|
134
134
|
this.collideTiles = collideTiles;
|
|
135
|
-
/** @property {
|
|
135
|
+
/** @property {boolean} - Should particles use additive blend */
|
|
136
136
|
this.additive = additive;
|
|
137
|
-
/** @property {
|
|
137
|
+
/** @property {boolean} - Should it be in local space of emitter */
|
|
138
138
|
this.localSpace = localSpace;
|
|
139
139
|
/** @property {Number} - If non zero the particle is drawn as a trail, stretched in the direction of velocity */
|
|
140
140
|
this.trailScale = 0;
|
|
@@ -244,7 +244,7 @@ class Particle extends EngineObject
|
|
|
244
244
|
* @param {Number} sizeStart - Size at start of life
|
|
245
245
|
* @param {Number} sizeEnd - Size at end of life
|
|
246
246
|
* @param {Number} fadeRate - How quick to fade in/out
|
|
247
|
-
* @param {
|
|
247
|
+
* @param {boolean} additive - Does it use additive blend mode
|
|
248
248
|
* @param {Number} trailScale - If a trail, how long to make it
|
|
249
249
|
* @param {ParticleEmitter} [localSpaceEmitter] - Parent emitter if local space
|
|
250
250
|
* @param {Function} [destroyCallback] - Callback when particle dies
|
|
@@ -266,7 +266,7 @@ class Particle extends EngineObject
|
|
|
266
266
|
this.sizeEndDelta = sizeEnd - sizeStart;
|
|
267
267
|
/** @property {Number} - How quick to fade in/out */
|
|
268
268
|
this.fadeRate = fadeRate;
|
|
269
|
-
/** @property {
|
|
269
|
+
/** @property {boolean} - Is it additive */
|
|
270
270
|
this.additive = additive;
|
|
271
271
|
/** @property {Number} - If a trail, how long to make it */
|
|
272
272
|
this.trailScale = trailScale;
|
package/src/engineSettings.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
let cameraPos = vec2();
|
|
17
17
|
|
|
18
18
|
/** Scale of camera in world space
|
|
19
|
-
* @type {
|
|
19
|
+
* @type {number}
|
|
20
20
|
* @default
|
|
21
21
|
* @memberof Settings */
|
|
22
22
|
let cameraScale = 32;
|
|
@@ -38,31 +38,33 @@ let canvasMaxSize = vec2(1920, 1080);
|
|
|
38
38
|
let canvasFixedSize = vec2();
|
|
39
39
|
|
|
40
40
|
/** Use nearest neighbor scaling algorithm for canvas for more pixelated look
|
|
41
|
-
*
|
|
41
|
+
* - Must be set before startup to take effect
|
|
42
|
+
* - If enabled sets css image-rendering:pixelated
|
|
43
|
+
* @type {boolean}
|
|
42
44
|
* @default
|
|
43
45
|
* @memberof Settings */
|
|
44
46
|
let canvasPixelated = true;
|
|
45
47
|
|
|
46
48
|
/** Disables texture filtering for crisper pixel art
|
|
47
|
-
* @type {
|
|
49
|
+
* @type {boolean}
|
|
48
50
|
* @default
|
|
49
51
|
* @memberof Settings */
|
|
50
52
|
let tilesPixelated = true;
|
|
51
53
|
|
|
52
54
|
/** Default font used for text rendering
|
|
53
|
-
* @type {
|
|
55
|
+
* @type {string}
|
|
54
56
|
* @default
|
|
55
57
|
* @memberof Settings */
|
|
56
58
|
let fontDefault = 'arial';
|
|
57
59
|
|
|
58
60
|
/** Enable to show the LittleJS splash screen be shown on startup
|
|
59
|
-
* @type {
|
|
61
|
+
* @type {boolean}
|
|
60
62
|
* @default
|
|
61
63
|
* @memberof Settings */
|
|
62
64
|
let showSplashScreen = false;
|
|
63
65
|
|
|
64
66
|
/** Disables all rendering, audio, and input for servers
|
|
65
|
-
* @type {
|
|
67
|
+
* @type {boolean}
|
|
66
68
|
* @default
|
|
67
69
|
* @memberof Settings */
|
|
68
70
|
let headlessMode = false;
|
|
@@ -71,13 +73,13 @@ let headlessMode = false;
|
|
|
71
73
|
// WebGL settings
|
|
72
74
|
|
|
73
75
|
/** Enable webgl rendering, webgl can be disabled and removed from build (with some features disabled)
|
|
74
|
-
* @type {
|
|
76
|
+
* @type {boolean}
|
|
75
77
|
* @default
|
|
76
78
|
* @memberof Settings */
|
|
77
79
|
let glEnable = true;
|
|
78
80
|
|
|
79
81
|
/** Fixes slow rendering in some browsers by not compositing the WebGL canvas
|
|
80
|
-
* @type {
|
|
82
|
+
* @type {boolean}
|
|
81
83
|
* @default
|
|
82
84
|
* @memberof Settings */
|
|
83
85
|
let glOverlay = true;
|
|
@@ -92,7 +94,7 @@ let glOverlay = true;
|
|
|
92
94
|
let tileSizeDefault = vec2(16);
|
|
93
95
|
|
|
94
96
|
/** How many pixels smaller to draw tiles to prevent bleeding from neighbors
|
|
95
|
-
* @type {
|
|
97
|
+
* @type {number}
|
|
96
98
|
* @default
|
|
97
99
|
* @memberof Settings */
|
|
98
100
|
let tileFixBleedScale = 0;
|
|
@@ -101,55 +103,55 @@ let tileFixBleedScale = 0;
|
|
|
101
103
|
// Object settings
|
|
102
104
|
|
|
103
105
|
/** Enable physics solver for collisions between objects
|
|
104
|
-
* @type {
|
|
106
|
+
* @type {boolean}
|
|
105
107
|
* @default
|
|
106
108
|
* @memberof Settings */
|
|
107
109
|
let enablePhysicsSolver = true;
|
|
108
110
|
|
|
109
111
|
/** Default object mass for collision calculations (how heavy objects are)
|
|
110
|
-
* @type {
|
|
112
|
+
* @type {number}
|
|
111
113
|
* @default
|
|
112
114
|
* @memberof Settings */
|
|
113
115
|
let objectDefaultMass = 1;
|
|
114
116
|
|
|
115
117
|
/** How much to slow velocity by each frame (0-1)
|
|
116
|
-
* @type {
|
|
118
|
+
* @type {number}
|
|
117
119
|
* @default
|
|
118
120
|
* @memberof Settings */
|
|
119
121
|
let objectDefaultDamping = 1;
|
|
120
122
|
|
|
121
123
|
/** How much to slow angular velocity each frame (0-1)
|
|
122
|
-
* @type {
|
|
124
|
+
* @type {number}
|
|
123
125
|
* @default
|
|
124
126
|
* @memberof Settings */
|
|
125
127
|
let objectDefaultAngleDamping = 1;
|
|
126
128
|
|
|
127
129
|
/** How much to bounce when a collision occurs (0-1)
|
|
128
|
-
* @type {
|
|
130
|
+
* @type {number}
|
|
129
131
|
* @default
|
|
130
132
|
* @memberof Settings */
|
|
131
133
|
let objectDefaultElasticity = 0;
|
|
132
134
|
|
|
133
135
|
/** How much to slow when touching (0-1)
|
|
134
|
-
* @type {
|
|
136
|
+
* @type {number}
|
|
135
137
|
* @default
|
|
136
138
|
* @memberof Settings */
|
|
137
139
|
let objectDefaultFriction = .8;
|
|
138
140
|
|
|
139
141
|
/** Clamp max speed to avoid fast objects missing collisions
|
|
140
|
-
* @type {
|
|
142
|
+
* @type {number}
|
|
141
143
|
* @default
|
|
142
144
|
* @memberof Settings */
|
|
143
145
|
let objectMaxSpeed = 1;
|
|
144
146
|
|
|
145
147
|
/** How much gravity to apply to objects along the Y axis, negative is down
|
|
146
|
-
* @type {
|
|
148
|
+
* @type {number}
|
|
147
149
|
* @default
|
|
148
150
|
* @memberof Settings */
|
|
149
151
|
let gravity = 0;
|
|
150
152
|
|
|
151
153
|
/** Scales emit rate of particles, useful for low graphics mode (0 disables particle emitters)
|
|
152
|
-
* @type {
|
|
154
|
+
* @type {number}
|
|
153
155
|
* @default
|
|
154
156
|
* @memberof Settings */
|
|
155
157
|
let particleEmitRateScale = 1;
|
|
@@ -158,26 +160,26 @@ let particleEmitRateScale = 1;
|
|
|
158
160
|
// Input settings
|
|
159
161
|
|
|
160
162
|
/** Should gamepads be allowed
|
|
161
|
-
* @type {
|
|
163
|
+
* @type {boolean}
|
|
162
164
|
* @default
|
|
163
165
|
* @memberof Settings */
|
|
164
166
|
let gamepadsEnable = true;
|
|
165
167
|
|
|
166
168
|
/** If true, the dpad input is also routed to the left analog stick (for better accessability)
|
|
167
|
-
* @type {
|
|
169
|
+
* @type {boolean}
|
|
168
170
|
* @default
|
|
169
171
|
* @memberof Settings */
|
|
170
172
|
let gamepadDirectionEmulateStick = true;
|
|
171
173
|
|
|
172
174
|
/** If true the WASD keys are also routed to the direction keys (for better accessability)
|
|
173
|
-
* @type {
|
|
175
|
+
* @type {boolean}
|
|
174
176
|
* @default
|
|
175
177
|
* @memberof Settings */
|
|
176
178
|
let inputWASDEmulateDirection = true;
|
|
177
179
|
|
|
178
180
|
/** True if touch input is enabled for mobile devices
|
|
179
181
|
* - Touch events will be routed to mouse events
|
|
180
|
-
* @type {
|
|
182
|
+
* @type {boolean}
|
|
181
183
|
* @default
|
|
182
184
|
* @memberof Settings */
|
|
183
185
|
let touchInputEnable = true;
|
|
@@ -185,31 +187,31 @@ let touchInputEnable = true;
|
|
|
185
187
|
/** True if touch gamepad should appear on mobile devices
|
|
186
188
|
* - Supports left analog stick, 4 face buttons and start button (button 9)
|
|
187
189
|
* - Must be set by end of gameInit to be activated
|
|
188
|
-
* @type {
|
|
190
|
+
* @type {boolean}
|
|
189
191
|
* @default
|
|
190
192
|
* @memberof Settings */
|
|
191
193
|
let touchGamepadEnable = false;
|
|
192
194
|
|
|
193
195
|
/** True if touch gamepad should be analog stick or false to use if 8 way dpad
|
|
194
|
-
* @type {
|
|
196
|
+
* @type {boolean}
|
|
195
197
|
* @default
|
|
196
198
|
* @memberof Settings */
|
|
197
199
|
let touchGamepadAnalog = true;
|
|
198
200
|
|
|
199
201
|
/** Size of virtual gamepad for touch devices in pixels
|
|
200
|
-
* @type {
|
|
202
|
+
* @type {number}
|
|
201
203
|
* @default
|
|
202
204
|
* @memberof Settings */
|
|
203
205
|
let touchGamepadSize = 99;
|
|
204
206
|
|
|
205
207
|
/** Transparency of touch gamepad overlay
|
|
206
|
-
* @type {
|
|
208
|
+
* @type {number}
|
|
207
209
|
* @default
|
|
208
210
|
* @memberof Settings */
|
|
209
211
|
let touchGamepadAlpha = .3;
|
|
210
212
|
|
|
211
213
|
/** Allow vibration hardware if it exists
|
|
212
|
-
* @type {
|
|
214
|
+
* @type {boolean}
|
|
213
215
|
* @default
|
|
214
216
|
* @memberof Settings */
|
|
215
217
|
let vibrateEnable = true;
|
|
@@ -218,25 +220,25 @@ let vibrateEnable = true;
|
|
|
218
220
|
// Audio settings
|
|
219
221
|
|
|
220
222
|
/** All audio code can be disabled and removed from build
|
|
221
|
-
* @type {
|
|
223
|
+
* @type {boolean}
|
|
222
224
|
* @default
|
|
223
225
|
* @memberof Settings */
|
|
224
226
|
let soundEnable = true;
|
|
225
227
|
|
|
226
228
|
/** Volume scale to apply to all sound, music and speech
|
|
227
|
-
* @type {
|
|
229
|
+
* @type {number}
|
|
228
230
|
* @default
|
|
229
231
|
* @memberof Settings */
|
|
230
232
|
let soundVolume = .3;
|
|
231
233
|
|
|
232
234
|
/** Default range where sound no longer plays
|
|
233
|
-
* @type {
|
|
235
|
+
* @type {number}
|
|
234
236
|
* @default
|
|
235
237
|
* @memberof Settings */
|
|
236
238
|
let soundDefaultRange = 40;
|
|
237
239
|
|
|
238
240
|
/** Default range percent to start tapering off sound (0-1)
|
|
239
|
-
* @type {
|
|
241
|
+
* @type {number}
|
|
240
242
|
* @default
|
|
241
243
|
* @memberof Settings */
|
|
242
244
|
let soundDefaultTaper = .7;
|
|
@@ -245,13 +247,13 @@ let soundDefaultTaper = .7;
|
|
|
245
247
|
// Medals settings
|
|
246
248
|
|
|
247
249
|
/** How long to show medals for in seconds
|
|
248
|
-
* @type {
|
|
250
|
+
* @type {number}
|
|
249
251
|
* @default
|
|
250
252
|
* @memberof Settings */
|
|
251
253
|
let medalDisplayTime = 5;
|
|
252
254
|
|
|
253
255
|
/** How quickly to slide on/off medals in seconds
|
|
254
|
-
* @type {
|
|
256
|
+
* @type {number}
|
|
255
257
|
* @default
|
|
256
258
|
* @memberof Settings */
|
|
257
259
|
let medalDisplaySlideTime = .5;
|
|
@@ -263,13 +265,13 @@ let medalDisplaySlideTime = .5;
|
|
|
263
265
|
let medalDisplaySize = vec2(640, 80);
|
|
264
266
|
|
|
265
267
|
/** Size of icon in medal display
|
|
266
|
-
* @type {
|
|
268
|
+
* @type {number}
|
|
267
269
|
* @default
|
|
268
270
|
* @memberof Settings */
|
|
269
271
|
let medalDisplayIconSize = 50;
|
|
270
272
|
|
|
271
273
|
/** Set to stop medals from being unlockable (like if cheats are enabled)
|
|
272
|
-
* @type {
|
|
274
|
+
* @type {boolean}
|
|
273
275
|
* @default
|
|
274
276
|
* @memberof Settings */
|
|
275
277
|
let medalsPreventUnlock = false;
|
|
@@ -283,7 +285,7 @@ let medalsPreventUnlock = false;
|
|
|
283
285
|
function setCameraPos(pos) { cameraPos = pos; }
|
|
284
286
|
|
|
285
287
|
/** Set scale of camera in world space
|
|
286
|
-
* @param {
|
|
288
|
+
* @param {number} scale
|
|
287
289
|
* @memberof Settings */
|
|
288
290
|
function setCameraScale(scale) { cameraScale = scale; }
|
|
289
291
|
|
|
@@ -298,37 +300,37 @@ function setCanvasMaxSize(size) { canvasMaxSize = size; }
|
|
|
298
300
|
function setCanvasFixedSize(size) { canvasFixedSize = size; }
|
|
299
301
|
|
|
300
302
|
/** Use nearest neighbor scaling algorithm for canvas for more pixelated look
|
|
301
|
-
* @param {
|
|
303
|
+
* @param {boolean} pixelated
|
|
302
304
|
* @memberof Settings */
|
|
303
305
|
function setCanvasPixelated(pixelated) { canvasPixelated = pixelated; }
|
|
304
306
|
|
|
305
307
|
/** Disables texture filtering for crisper pixel art
|
|
306
|
-
* @param {
|
|
308
|
+
* @param {boolean} pixelated
|
|
307
309
|
* @memberof Settings */
|
|
308
310
|
function setTilesPixelated(pixelated) { tilesPixelated = pixelated; }
|
|
309
311
|
|
|
310
312
|
/** Set default font used for text rendering
|
|
311
|
-
* @param {
|
|
313
|
+
* @param {string} font
|
|
312
314
|
* @memberof Settings */
|
|
313
315
|
function setFontDefault(font) { fontDefault = font; }
|
|
314
316
|
|
|
315
317
|
/** Set if the LittleJS splash screen be shown on startup
|
|
316
|
-
* @param {
|
|
318
|
+
* @param {boolean} show
|
|
317
319
|
* @memberof Settings */
|
|
318
320
|
function setShowSplashScreen(show) { showSplashScreen = show; }
|
|
319
321
|
|
|
320
322
|
/** Set to disable rendering, audio, and input for servers
|
|
321
|
-
* @param {
|
|
323
|
+
* @param {boolean} headless
|
|
322
324
|
* @memberof Settings */
|
|
323
325
|
function setHeadlessMode(headless) { headlessMode = headless; }
|
|
324
326
|
|
|
325
327
|
/** Set if webgl rendering is enabled
|
|
326
|
-
* @param {
|
|
328
|
+
* @param {boolean} enable
|
|
327
329
|
* @memberof Settings */
|
|
328
330
|
function setGlEnable(enable) { glEnable = enable; }
|
|
329
331
|
|
|
330
332
|
/** Set to not composite the WebGL canvas
|
|
331
|
-
* @param {
|
|
333
|
+
* @param {boolean} overlay
|
|
332
334
|
* @memberof Settings */
|
|
333
335
|
function setGlOverlay(overlay) { glOverlay = overlay; }
|
|
334
336
|
|
|
@@ -338,107 +340,107 @@ function setGlOverlay(overlay) { glOverlay = overlay; }
|
|
|
338
340
|
function setTileSizeDefault(size) { tileSizeDefault = size; }
|
|
339
341
|
|
|
340
342
|
/** Set to prevent tile bleeding from neighbors in pixels
|
|
341
|
-
* @param {
|
|
343
|
+
* @param {number} scale
|
|
342
344
|
* @memberof Settings */
|
|
343
345
|
function setTileFixBleedScale(scale) { tileFixBleedScale = scale; }
|
|
344
346
|
|
|
345
347
|
/** Set if collisions between objects are enabled
|
|
346
|
-
* @param {
|
|
348
|
+
* @param {boolean} enable
|
|
347
349
|
* @memberof Settings */
|
|
348
350
|
function setEnablePhysicsSolver(enable) { enablePhysicsSolver = enable; }
|
|
349
351
|
|
|
350
352
|
/** Set default object mass for collision calculations
|
|
351
|
-
* @param {
|
|
353
|
+
* @param {number} mass
|
|
352
354
|
* @memberof Settings */
|
|
353
355
|
function setObjectDefaultMass(mass) { objectDefaultMass = mass; }
|
|
354
356
|
|
|
355
357
|
/** Set how much to slow velocity by each frame
|
|
356
|
-
* @param {
|
|
358
|
+
* @param {number} damp
|
|
357
359
|
* @memberof Settings */
|
|
358
360
|
function setObjectDefaultDamping(damp) { objectDefaultDamping = damp; }
|
|
359
361
|
|
|
360
362
|
/** Set how much to slow angular velocity each frame
|
|
361
|
-
* @param {
|
|
363
|
+
* @param {number} damp
|
|
362
364
|
* @memberof Settings */
|
|
363
365
|
function setObjectDefaultAngleDamping(damp) { objectDefaultAngleDamping = damp; }
|
|
364
366
|
|
|
365
367
|
/** Set how much to bounce when a collision occur
|
|
366
|
-
* @param {
|
|
368
|
+
* @param {number} elasticity
|
|
367
369
|
* @memberof Settings */
|
|
368
370
|
function setObjectDefaultElasticity(elasticity) { objectDefaultElasticity = elasticity; }
|
|
369
371
|
|
|
370
372
|
/** Set how much to slow when touching
|
|
371
|
-
* @param {
|
|
373
|
+
* @param {number} friction
|
|
372
374
|
* @memberof Settings */
|
|
373
375
|
function setObjectDefaultFriction(friction) { objectDefaultFriction = friction; }
|
|
374
376
|
|
|
375
377
|
/** Set max speed to avoid fast objects missing collisions
|
|
376
|
-
* @param {
|
|
378
|
+
* @param {number} speed
|
|
377
379
|
* @memberof Settings */
|
|
378
380
|
function setObjectMaxSpeed(speed) { objectMaxSpeed = speed; }
|
|
379
381
|
|
|
380
382
|
/** Set how much gravity to apply to objects along the Y axis
|
|
381
|
-
* @param {
|
|
383
|
+
* @param {number} newGravity
|
|
382
384
|
* @memberof Settings */
|
|
383
385
|
function setGravity(newGravity) { gravity = newGravity; }
|
|
384
386
|
|
|
385
387
|
/** Set to scales emit rate of particles
|
|
386
|
-
* @param {
|
|
388
|
+
* @param {number} scale
|
|
387
389
|
* @memberof Settings */
|
|
388
390
|
function setParticleEmitRateScale(scale) { particleEmitRateScale = scale; }
|
|
389
391
|
|
|
390
392
|
/** Set if gamepads are enabled
|
|
391
|
-
* @param {
|
|
393
|
+
* @param {boolean} enable
|
|
392
394
|
* @memberof Settings */
|
|
393
395
|
function setGamepadsEnable(enable) { gamepadsEnable = enable; }
|
|
394
396
|
|
|
395
397
|
/** Set if the dpad input is also routed to the left analog stick
|
|
396
|
-
* @param {
|
|
398
|
+
* @param {boolean} enable
|
|
397
399
|
* @memberof Settings */
|
|
398
400
|
function setGamepadDirectionEmulateStick(enable) { gamepadDirectionEmulateStick = enable; }
|
|
399
401
|
|
|
400
402
|
/** Set if true the WASD keys are also routed to the direction keys
|
|
401
|
-
* @param {
|
|
403
|
+
* @param {boolean} enable
|
|
402
404
|
* @memberof Settings */
|
|
403
405
|
function setInputWASDEmulateDirection(enable) { inputWASDEmulateDirection = enable; }
|
|
404
406
|
|
|
405
407
|
/** Set if touch input is allowed
|
|
406
|
-
* @param {
|
|
408
|
+
* @param {boolean} enable
|
|
407
409
|
* @memberof Settings */
|
|
408
410
|
function setTouchInputEnable(enable) { touchInputEnable = enable; }
|
|
409
411
|
|
|
410
412
|
/** Set if touch gamepad should appear on mobile devices
|
|
411
|
-
* @param {
|
|
413
|
+
* @param {boolean} enable
|
|
412
414
|
* @memberof Settings */
|
|
413
415
|
function setTouchGamepadEnable(enable) { touchGamepadEnable = enable; }
|
|
414
416
|
|
|
415
417
|
/** Set if touch gamepad should be analog stick or 8 way dpad
|
|
416
|
-
* @param {
|
|
418
|
+
* @param {boolean} analog
|
|
417
419
|
* @memberof Settings */
|
|
418
420
|
function setTouchGamepadAnalog(analog) { touchGamepadAnalog = analog; }
|
|
419
421
|
|
|
420
422
|
/** Set size of virtual gamepad for touch devices in pixels
|
|
421
|
-
* @param {
|
|
423
|
+
* @param {number} size
|
|
422
424
|
* @memberof Settings */
|
|
423
425
|
function setTouchGamepadSize(size) { touchGamepadSize = size; }
|
|
424
426
|
|
|
425
427
|
/** Set transparency of touch gamepad overlay
|
|
426
|
-
* @param {
|
|
428
|
+
* @param {number} alpha
|
|
427
429
|
* @memberof Settings */
|
|
428
430
|
function setTouchGamepadAlpha(alpha) { touchGamepadAlpha = alpha; }
|
|
429
431
|
|
|
430
432
|
/** Set to allow vibration hardware if it exists
|
|
431
|
-
* @param {
|
|
433
|
+
* @param {boolean} enable
|
|
432
434
|
* @memberof Settings */
|
|
433
435
|
function setVibrateEnable(enable) { vibrateEnable = enable; }
|
|
434
436
|
|
|
435
437
|
/** Set to disable all audio code
|
|
436
|
-
* @param {
|
|
438
|
+
* @param {boolean} enable
|
|
437
439
|
* @memberof Settings */
|
|
438
440
|
function setSoundEnable(enable) { soundEnable = enable; }
|
|
439
441
|
|
|
440
442
|
/** Set volume scale to apply to all sound, music and speech
|
|
441
|
-
* @param {
|
|
443
|
+
* @param {number} volume
|
|
442
444
|
* @memberof Settings */
|
|
443
445
|
function setSoundVolume(volume)
|
|
444
446
|
{
|
|
@@ -448,22 +450,22 @@ function setSoundVolume(volume)
|
|
|
448
450
|
}
|
|
449
451
|
|
|
450
452
|
/** Set default range where sound no longer plays
|
|
451
|
-
* @param {
|
|
453
|
+
* @param {number} range
|
|
452
454
|
* @memberof Settings */
|
|
453
455
|
function setSoundDefaultRange(range) { soundDefaultRange = range; }
|
|
454
456
|
|
|
455
457
|
/** Set default range percent to start tapering off sound
|
|
456
|
-
* @param {
|
|
458
|
+
* @param {number} taper
|
|
457
459
|
* @memberof Settings */
|
|
458
460
|
function setSoundDefaultTaper(taper) { soundDefaultTaper = taper; }
|
|
459
461
|
|
|
460
462
|
/** Set how long to show medals for in seconds
|
|
461
|
-
* @param {
|
|
463
|
+
* @param {number} time
|
|
462
464
|
* @memberof Settings */
|
|
463
465
|
function setMedalDisplayTime(time) { medalDisplayTime = time; }
|
|
464
466
|
|
|
465
467
|
/** Set how quickly to slide on/off medals in seconds
|
|
466
|
-
* @param {
|
|
468
|
+
* @param {number} time
|
|
467
469
|
* @memberof Settings */
|
|
468
470
|
function setMedalDisplaySlideTime(time) { medalDisplaySlideTime = time; }
|
|
469
471
|
|
|
@@ -473,21 +475,21 @@ function setMedalDisplaySlideTime(time) { medalDisplaySlideTime = time; }
|
|
|
473
475
|
function setMedalDisplaySize(size) { medalDisplaySize = size; }
|
|
474
476
|
|
|
475
477
|
/** Set size of icon in medal display
|
|
476
|
-
* @param {
|
|
478
|
+
* @param {number} size
|
|
477
479
|
* @memberof Settings */
|
|
478
480
|
function setMedalDisplayIconSize(size) { medalDisplayIconSize = size; }
|
|
479
481
|
|
|
480
482
|
/** Set to stop medals from being unlockable
|
|
481
|
-
* @param {
|
|
483
|
+
* @param {boolean} preventUnlock
|
|
482
484
|
* @memberof Settings */
|
|
483
485
|
function setMedalsPreventUnlock(preventUnlock) { medalsPreventUnlock = preventUnlock; }
|
|
484
486
|
|
|
485
487
|
/** Set if watermark with FPS should be shown
|
|
486
|
-
* @param {
|
|
488
|
+
* @param {boolean} show
|
|
487
489
|
* @memberof Debug */
|
|
488
490
|
function setShowWatermark(show) { showWatermark = show; }
|
|
489
491
|
|
|
490
492
|
/** Set key code used to toggle debug mode, Esc by default
|
|
491
|
-
* @param {
|
|
493
|
+
* @param {string} key
|
|
492
494
|
* @memberof Debug */
|
|
493
495
|
function setDebugKey(key) { debugKey = key; }
|