littlejsengine 1.12.4 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/box2d.wasm.js +630 -0
  2. package/dist/box2d.wasm.wasm +0 -0
  3. package/dist/littlejs.d.ts +437 -219
  4. package/dist/littlejs.esm.js +5950 -5307
  5. package/dist/littlejs.esm.min.js +4 -1
  6. package/dist/littlejs.js +5921 -5295
  7. package/dist/littlejs.min.js +4 -1
  8. package/dist/littlejs.release.js +5485 -4886
  9. package/examples/box2d/game.js +37 -42
  10. package/examples/box2d/gameObjects.js +41 -37
  11. package/examples/box2d/index.html +2 -2
  12. package/examples/box2d/scenes.js +24 -20
  13. package/examples/box2d/tiles.png +0 -0
  14. package/examples/breakout/game.js +1 -1
  15. package/examples/breakout/gameObjects.js +2 -2
  16. package/examples/breakout/index.html +1 -1
  17. package/examples/breakoutTutorial/README.md +2 -2
  18. package/examples/breakoutTutorial/game.js +1 -1
  19. package/examples/breakoutTutorial/index.html +1 -1
  20. package/examples/empty/index.html +1 -1
  21. package/examples/htmlMenu/index.html +1 -1
  22. package/examples/index.html +410 -159
  23. package/examples/module/game.js +1 -1
  24. package/examples/module/index.html +1 -1
  25. package/examples/platformer/game.js +6 -15
  26. package/examples/platformer/gameCharacter.js +6 -6
  27. package/examples/platformer/gameEffects.js +74 -57
  28. package/examples/platformer/gameLevel.js +61 -70
  29. package/examples/platformer/gameObjects.js +4 -4
  30. package/examples/platformer/index.html +1 -1
  31. package/examples/puzzle/index.html +1 -1
  32. package/examples/shorts/base.html +24 -3
  33. package/examples/shorts/box2d.js +46 -0
  34. package/examples/shorts/box2dCar.js +45 -0
  35. package/examples/shorts/flappyGame.js +52 -0
  36. package/examples/shorts/helloWorld.js +6 -3
  37. package/examples/shorts/hillGlideGame.js +56 -0
  38. package/examples/shorts/landerGame.js +32 -0
  39. package/examples/shorts/maze.js +47 -0
  40. package/examples/shorts/medals.js +42 -0
  41. package/examples/shorts/nineSlice.js +21 -0
  42. package/examples/shorts/piano.js +52 -0
  43. package/examples/shorts/platformer.js +24 -20
  44. package/examples/shorts/{pong.js → pongGame.js} +1 -1
  45. package/examples/shorts/postProcess.js +45 -0
  46. package/examples/shorts/raycasting.js +71 -0
  47. package/examples/shorts/slidingPuzzle.js +42 -0
  48. package/examples/shorts/spaceGame.js +56 -0
  49. package/examples/shorts/starfield.js +17 -0
  50. package/examples/shorts/tileLayer.js +3 -5
  51. package/examples/shorts/tiles.png +0 -0
  52. package/examples/shorts/tiltedView.js +8 -7
  53. package/examples/shorts/topDown.js +18 -26
  54. package/examples/shorts/uiSystem.js +36 -0
  55. package/examples/starter/build.bat +6 -1
  56. package/examples/starter/game.js +4 -2
  57. package/examples/starter/index.html +23 -13
  58. package/examples/stress/index.html +2 -3
  59. package/examples/style.css +136 -0
  60. package/examples/typescript/build.js +1 -2
  61. package/examples/typescript/game.js +2 -2
  62. package/examples/typescript/game.ts +1 -1
  63. package/examples/typescript/index.html +1 -1
  64. package/examples/uiSystem/game.js +9 -25
  65. package/examples/uiSystem/index.html +1 -1
  66. package/package.json +1 -1
  67. package/plugins/box2d.js +29 -35
  68. package/plugins/drawUtilities.js +126 -0
  69. package/plugins/newgrounds.js +1 -1
  70. package/plugins/pluginExport.js +8 -2
  71. package/plugins/postProcess.js +2 -2
  72. package/plugins/uiSystem.js +162 -68
  73. package/plugins/zzfxm.js +1 -1
  74. package/reference.md +10 -10
  75. package/src/engine.js +59 -39
  76. package/src/engineAudio.js +38 -20
  77. package/src/engineBuild.bat +6 -1
  78. package/src/engineBuild.js +32 -7
  79. package/src/engineDebug.js +53 -26
  80. package/src/engineDraw.js +108 -57
  81. package/src/engineExport.js +22 -9
  82. package/src/engineInput.js +112 -40
  83. package/src/engineObject.js +68 -67
  84. package/src/engineParticles.js +26 -9
  85. package/src/engineSettings.js +15 -16
  86. package/src/engineTileLayer.js +312 -153
  87. package/src/engineUtilities.js +198 -130
  88. package/src/engineWebGL.js +58 -35
package/src/engineDraw.js CHANGED
@@ -42,6 +42,16 @@ let overlayCanvas;
42
42
  * @memberof Draw */
43
43
  let overlayContext;
44
44
 
45
+ /** The default canvas to use for drawing, usually mainCanvas
46
+ * @type {HTMLCanvasElement|OffscreenCanvas}
47
+ * @memberof Draw */
48
+ let drawCanvas;
49
+
50
+ /** The default 2d context to use for drawing, usually mainContext
51
+ * @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D}
52
+ * @memberof Draw */
53
+ let drawContext;
54
+
45
55
  /** The size of the main canvas (and other secondary canvases)
46
56
  * @type {Vector2}
47
57
  * @memberof Draw */
@@ -73,31 +83,36 @@ let drawCount;
73
83
  * tile(vec2(4,8), vec2(30,10)) // a tile at index (4,8) with a size of (30,10)
74
84
  * @memberof Draw
75
85
  */
76
- function tile(pos=vec2(), size=tileSizeDefault, textureIndex=0, padding=0)
86
+ function tile(pos=new Vector2, size=tileSizeDefault, textureIndex=0, padding=0)
77
87
  {
78
88
  if (headlessMode)
79
89
  return new TileInfo;
80
90
 
81
91
  // if size is a number, make it a vector
82
- if (typeof size === 'number')
92
+ if (typeof size == 'number')
83
93
  {
84
94
  ASSERT(size > 0);
85
- size = vec2(size);
95
+ size = new Vector2(size, size);
86
96
  }
87
97
 
88
- // use pos as a tile index
98
+ // create tile info object
99
+ const tileInfo = new TileInfo(new Vector2, size, textureIndex, padding);
100
+
101
+ // use get the pos of the tile
89
102
  const textureInfo = textureInfos[textureIndex];
90
103
  ASSERT(!!textureInfo, 'Texture not loaded');
91
- const sizePadded = size.add(vec2(padding*2));
92
- if (typeof pos === 'number')
104
+ const sizePaddedX = size.x + padding*2;
105
+ const sizePaddedY = size.y + padding*2;
106
+ if (typeof pos == 'number')
93
107
  {
94
- const cols = textureInfo.size.x / sizePadded.x |0;
95
- pos = cols>0 ? vec2(pos%cols, pos/cols|0) : vec2();
108
+ const cols = textureInfo.size.x / sizePaddedX |0;
109
+ ASSERT(cols>0, 'Tile size is too big for texture');
110
+ const posX = pos % cols, posY = (pos / cols) |0;
111
+ tileInfo.pos.set(posX*sizePaddedX+padding, posY*sizePaddedY+padding);
96
112
  }
97
- pos = vec2(pos.x*sizePadded.x+padding, pos.y*sizePadded.y+padding);
98
-
99
- // return a tile info object
100
- return new TileInfo(pos, size, textureIndex, padding);
113
+ else
114
+ tileInfo.pos.set(pos.x*sizePaddedX+padding, pos.y*sizePaddedY+padding);
115
+ return tileInfo;
101
116
  }
102
117
 
103
118
  /**
@@ -121,6 +136,8 @@ class TileInfo
121
136
  this.textureIndex = textureIndex;
122
137
  /** @property {number} - How many pixels padding around tiles */
123
138
  this.padding = padding;
139
+ /** @property {TextureInfo} - The texture info for this tile */
140
+ this.textureInfo = textureInfos[this.textureIndex];
124
141
  }
125
142
 
126
143
  /** Returns a copy of this tile offset by a vector
@@ -137,14 +154,22 @@ class TileInfo
137
154
  frame(frame)
138
155
  {
139
156
  ASSERT(typeof frame == 'number');
140
- return this.offset(vec2(frame*(this.size.x+this.padding*2), 0));
157
+ return this.offset(new Vector2(frame*(this.size.x+this.padding*2), 0));
141
158
  }
142
159
 
143
- /** Returns the texture info for this tile
144
- * @return {TextureInfo}
145
- */
146
- getTextureInfo()
147
- { return textureInfos[this.textureIndex]; }
160
+ /**
161
+ * Set this tile to use a full image
162
+ * @param {HTMLImageElement|OffscreenCanvas} image
163
+ * @param {WebGLTexture} [glTexture] - webgl texture
164
+ * @return {TileInfo}
165
+ */
166
+ setFullImage(image, glTexture)
167
+ {
168
+ this.pos = new Vector2;
169
+ this.size = new Vector2(image.width, image.height);
170
+ this.textureInfo = new TextureInfo(image, glTexture);
171
+ return this;
172
+ }
148
173
  }
149
174
 
150
175
  /** Texture Info - Stores info about each texture */
@@ -152,9 +177,10 @@ class TextureInfo
152
177
  {
153
178
  /**
154
179
  * Create a TextureInfo, called automatically by the engine
155
- * @param {HTMLImageElement} image
180
+ * @param {HTMLImageElement|OffscreenCanvas} image
181
+ * @param {WebGLTexture} [glTexture] - webgl texture
156
182
  */
157
- constructor(image)
183
+ constructor(image, glTexture)
158
184
  {
159
185
  /** @property {HTMLImageElement} - image source */
160
186
  this.image = image;
@@ -163,7 +189,14 @@ class TextureInfo
163
189
  /** @property {Vector2} - inverse of the size, cached for rendering */
164
190
  this.sizeInverse = vec2(1/image.width, 1/image.height);
165
191
  /** @property {WebGLTexture} - webgl texture */
166
- this.glTexture = glEnable && glCreateTexture(image);
192
+ this.glTexture = glTexture;
193
+ }
194
+
195
+ createWebGLTexture()
196
+ {
197
+ ASSERT(!this.glTexture);
198
+ if (glEnable)
199
+ this.glTexture = glCreateTexture(this.image);
167
200
  }
168
201
  }
169
202
 
@@ -175,11 +208,18 @@ class TextureInfo
175
208
  * @memberof Draw */
176
209
  function screenToWorld(screenPos)
177
210
  {
178
- return new Vector2
179
- (
180
- (screenPos.x - mainCanvasSize.x/2 + .5) / cameraScale + cameraPos.x,
181
- (screenPos.y - mainCanvasSize.y/2 + .5) / -cameraScale + cameraPos.y
182
- );
211
+ let cameraPosRelativeX = (screenPos.x - mainCanvasSize.x/2 + .5) / cameraScale;
212
+ let cameraPosRelativeY = (screenPos.y - mainCanvasSize.y/2 + .5) / -cameraScale;
213
+ if (cameraAngle)
214
+ {
215
+ // apply camera rotation
216
+ const cos = Math.cos(-cameraAngle), sin = Math.sin(-cameraAngle);
217
+ const rotatedX = cameraPosRelativeX * cos - cameraPosRelativeY * sin;
218
+ const rotatedY = cameraPosRelativeX * sin + cameraPosRelativeY * cos;
219
+ cameraPosRelativeX = rotatedX;
220
+ cameraPosRelativeY = rotatedY;
221
+ }
222
+ return new Vector2(cameraPosRelativeX + cameraPos.x, cameraPosRelativeY + cameraPos.y);
183
223
  }
184
224
 
185
225
  /** Convert from world to screen space coordinates
@@ -188,10 +228,21 @@ function screenToWorld(screenPos)
188
228
  * @memberof Draw */
189
229
  function worldToScreen(worldPos)
190
230
  {
231
+ let cameraPosRelativeX = worldPos.x - cameraPos.x;
232
+ let cameraPosRelativeY = worldPos.y - cameraPos.y;
233
+ if (cameraAngle)
234
+ {
235
+ // apply inverse camera rotation
236
+ const cos = Math.cos(cameraAngle), sin = Math.sin(cameraAngle);
237
+ const rotatedX = cameraPosRelativeX * cos - cameraPosRelativeY * sin;
238
+ const rotatedY = cameraPosRelativeX * sin + cameraPosRelativeY * cos;
239
+ cameraPosRelativeX = rotatedX;
240
+ cameraPosRelativeY = rotatedY;
241
+ }
191
242
  return new Vector2
192
243
  (
193
- (worldPos.x - cameraPos.x) * cameraScale + mainCanvasSize.x/2 - .5,
194
- (worldPos.y - cameraPos.y) * -cameraScale + mainCanvasSize.y/2 - .5
244
+ cameraPosRelativeX * cameraScale + mainCanvasSize.x/2 - .5,
245
+ cameraPosRelativeY * -cameraScale + mainCanvasSize.y/2 - .5
195
246
  );
196
247
  }
197
248
 
@@ -212,16 +263,16 @@ function getCameraSize() { return mainCanvasSize.scale(1/cameraScale); }
212
263
  * @param {boolean} [screenSpace=false] - If true the pos and size are in screen space
213
264
  * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context] - Canvas 2D context to draw to
214
265
  * @memberof Draw */
215
- function drawTile(pos, size=vec2(1), tileInfo, color=new Color,
266
+ function drawTile(pos, size=new Vector2(1), tileInfo, color=new Color,
216
267
  angle=0, mirror, additiveColor, useWebGL=glEnable, screenSpace, context)
217
268
  {
218
269
  ASSERT(!context || !useWebGL, 'context only supported in canvas 2D mode');
219
- ASSERT(typeof tileInfo !== 'number' || !tileInfo,
220
- 'this is an old style calls, to fix replace it with tile(tileIndex, tileSize)');
221
- ASSERT(isVector2(pos) && isVector2(size));
222
- ASSERT(isColor(color) && (!additiveColor || isColor(additiveColor)));
270
+ ASSERT(isVector2(pos) && pos.isValid(), 'drawTile pos should be a vec2');
271
+ ASSERT(isVector2(size) && size.isValid(), 'drawTile size should be a vec2');
272
+ ASSERT(isColor(color) && (!additiveColor || isColor(additiveColor)), 'drawTile color is invalid');
273
+ ASSERT(isNumber(angle), 'drawTile angle should be a number');
223
274
 
224
- const textureInfo = tileInfo && tileInfo.getTextureInfo();
275
+ const textureInfo = tileInfo && tileInfo.textureInfo;
225
276
  if (useWebGL)
226
277
  {
227
278
  if (screenSpace)
@@ -265,7 +316,7 @@ function drawTile(pos, size=vec2(1), tileInfo, color=new Color,
265
316
  {
266
317
  // normal canvas 2D rendering method (slower)
267
318
  showWatermark && ++drawCount;
268
- size = vec2(size.x, -size.y); // fix upside down sprites
319
+ size = new Vector2(size.x, -size.y); // fix upside down sprites
269
320
  drawCanvas2D(pos, size, angle, mirror, (context)=>
270
321
  {
271
322
  if (textureInfo)
@@ -325,9 +376,9 @@ function drawLine(posA, posB, thickness=.1, color, useWebGL, screenSpace, contex
325
376
  * @param {number} [lineWidth=0]
326
377
  * @param {Color} [lineColor=(0,0,0,1)]
327
378
  * @param {boolean} [screenSpace=false]
328
- * @param {CanvasRenderingContext2D} [context=mainContext]
379
+ * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=drawContext]
329
380
  * @memberof Draw */
330
- function drawPoly(points, color=new Color, lineWidth=0, lineColor=new Color(0,0,0), screenSpace, context=mainContext)
381
+ function drawPoly(points, color=new Color, lineWidth=0, lineColor=new Color(0,0,0), screenSpace, context=drawContext)
331
382
  {
332
383
  ASSERT(isColor(color) && isColor(lineColor));
333
384
  context.fillStyle = color.toString();
@@ -353,9 +404,9 @@ function drawPoly(points, color=new Color, lineWidth=0, lineColor=new Color(0,0,
353
404
  * @param {number} [lineWidth=0]
354
405
  * @param {Color} [lineColor=(0,0,0,1)]
355
406
  * @param {boolean} [screenSpace=false]
356
- * @param {CanvasRenderingContext2D} [context=mainContext]
407
+ * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=drawContext]
357
408
  * @memberof Draw */
358
- function drawEllipse(pos, width=1, height=1, angle=0, color=new Color, lineWidth=0, lineColor=new Color(0,0,0), screenSpace, context=mainContext)
409
+ function drawEllipse(pos, width=1, height=1, angle=0, color=new Color, lineWidth=0, lineColor=new Color(0,0,0), screenSpace, context=drawContext)
359
410
  {
360
411
  ASSERT(isColor(color) && isColor(lineColor));
361
412
  if (!screenSpace)
@@ -384,21 +435,21 @@ function drawEllipse(pos, width=1, height=1, angle=0, color=new Color, lineWidth
384
435
  * @param {number} [lineWidth=0]
385
436
  * @param {Color} [lineColor=(0,0,0,1)]
386
437
  * @param {boolean} [screenSpace=false]
387
- * @param {CanvasRenderingContext2D} [context=mainContext]
438
+ * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=drawContext]
388
439
  * @memberof Draw */
389
- function drawCircle(pos, radius=1, color=new Color, lineWidth=0, lineColor=new Color(0,0,0), screenSpace, context=mainContext)
440
+ function drawCircle(pos, radius=1, color=new Color, lineWidth=0, lineColor=new Color(0,0,0), screenSpace, context=drawContext)
390
441
  { drawEllipse(pos, radius, radius, 0, color, lineWidth, lineColor, screenSpace, context); }
391
442
 
392
443
  /** Draw directly to a 2d canvas context in world space
393
444
  * @param {Vector2} pos
394
445
  * @param {Vector2} size
395
446
  * @param {number} angle
396
- * @param {boolean} mirror
397
- * @param {Function} drawFunction
447
+ * @param {boolean} [mirror]
448
+ * @param {Function} [drawFunction]
398
449
  * @param {boolean} [screenSpace=false]
399
- * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
450
+ * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=drawContext]
400
451
  * @memberof Draw */
401
- function drawCanvas2D(pos, size, angle, mirror, drawFunction, screenSpace, context=mainContext)
452
+ function drawCanvas2D(pos, size, angle=0, mirror=false, drawFunction, screenSpace=false, context=drawContext)
402
453
  {
403
454
  if (!screenSpace)
404
455
  {
@@ -408,7 +459,7 @@ function drawCanvas2D(pos, size, angle, mirror, drawFunction, screenSpace, conte
408
459
  }
409
460
  context.save();
410
461
  context.translate(pos.x+.5, pos.y+.5);
411
- context.rotate(angle);
462
+ context.rotate(angle-cameraAngle);
412
463
  context.scale(mirror ? -size.x : size.x, -size.y);
413
464
  drawFunction(context);
414
465
  context.restore();
@@ -425,9 +476,9 @@ function drawCanvas2D(pos, size, angle, mirror, drawFunction, screenSpace, conte
425
476
  * @param {CanvasTextAlign} [textAlign='center']
426
477
  * @param {string} [font=fontDefault]
427
478
  * @param {number} [maxWidth]
428
- * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
479
+ * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=drawContext]
429
480
  * @memberof Draw */
430
- function drawText(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, font, maxWidth, context=mainContext)
481
+ function drawText(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, font, maxWidth, context=drawContext)
431
482
  {
432
483
  drawTextScreen(text, worldToScreen(pos), size*cameraScale, color, lineWidth*cameraScale, lineColor, textAlign, font, maxWidth, context);
433
484
  }
@@ -473,22 +524,22 @@ function drawTextScreen(text, pos, size=1, color=new Color, lineWidth=0, lineCol
473
524
  context.lineJoin = 'round';
474
525
 
475
526
  const lines = (text+'').split('\n');
476
- pos = pos.copy();
477
- pos.y -= (lines.length-1) * size/2; // center text vertically
527
+ let posY = pos.y;
528
+ posY -= (lines.length-1) * size/2; // center text vertically
478
529
  lines.forEach(line=>
479
530
  {
480
- lineWidth && context.strokeText(line, pos.x, pos.y, maxWidth);
481
- context.fillText(line, pos.x, pos.y, maxWidth);
482
- pos.y += size;
531
+ lineWidth && context.strokeText(line, pos.x, posY, maxWidth);
532
+ context.fillText(line, pos.x, posY, maxWidth);
533
+ posY += size;
483
534
  });
484
535
  }
485
536
 
486
537
  /** Enable normal or additive blend mode
487
538
  * @param {boolean} [additive]
488
539
  * @param {boolean} [useWebGL=glEnable]
489
- * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
540
+ * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context]
490
541
  * @memberof Draw */
491
- function setBlendMode(additive, useWebGL=glEnable, context)
542
+ function setBlendMode(additive=false, useWebGL=glEnable, context)
492
543
  {
493
544
  ASSERT(!context || !useWebGL, 'context only supported in canvas 2D mode');
494
545
  if (useWebGL)
@@ -496,7 +547,7 @@ function setBlendMode(additive, useWebGL=glEnable, context)
496
547
  else
497
548
  {
498
549
  if (!context)
499
- context = mainContext;
550
+ context = drawContext;
500
551
  context.globalCompositeOperation = additive ? 'lighter' : 'source-over';
501
552
  }
502
553
  }
@@ -507,7 +558,7 @@ function setBlendMode(additive, useWebGL=glEnable, context)
507
558
  function combineCanvases()
508
559
  {
509
560
  // combine canvases
510
- glCopyToContext(mainContext, true);
561
+ glCopyToContext(mainContext);
511
562
  mainContext.drawImage(overlayCanvas, 0, 0);
512
563
 
513
564
  // clear canvases
@@ -14,6 +14,7 @@ export
14
14
  time,
15
15
  timeReal,
16
16
  paused,
17
+ getPaused,
17
18
  setPaused,
18
19
  engineInit,
19
20
  engineObjectsUpdate,
@@ -49,6 +50,7 @@ export
49
50
 
50
51
  // Settings
51
52
  cameraPos,
53
+ cameraAngle,
52
54
  cameraScale,
53
55
  canvasMaxSize,
54
56
  canvasFixedSize,
@@ -63,13 +65,12 @@ export
63
65
  objectDefaultMass,
64
66
  objectDefaultDamping,
65
67
  objectDefaultAngleDamping,
66
- objectDefaultElasticity,
68
+ objectDefaultRestitution,
67
69
  objectDefaultFriction,
68
70
  objectMaxSpeed,
69
71
  gravity,
70
72
  particleEmitRateScale,
71
73
  glEnable,
72
- glOverlay,
73
74
  gamepadsEnable,
74
75
  gamepadDirectionEmulateStick,
75
76
  inputWASDEmulateDirection,
@@ -88,6 +89,7 @@ export
88
89
 
89
90
  // Setters for globals
90
91
  setCameraPos,
92
+ setCameraAngle,
91
93
  setCameraScale,
92
94
  setCanvasMaxSize,
93
95
  setCanvasFixedSize,
@@ -96,15 +98,14 @@ export
96
98
  setFontDefault,
97
99
  setShowSplashScreen,
98
100
  setHeadlessMode,
99
- setGlEnable,
100
- setGlOverlay,
101
+ setGLEnable,
101
102
  setTileSizeDefault,
102
103
  setTileFixBleedScale,
103
104
  setEnablePhysicsSolver,
104
105
  setObjectDefaultMass,
105
106
  setObjectDefaultDamping,
106
107
  setObjectDefaultAngleDamping,
107
- setObjectDefaultElasticity,
108
+ setObjectDefaultRestitution,
108
109
  setObjectDefaultFriction,
109
110
  setObjectMaxSpeed,
110
111
  setGravity,
@@ -149,13 +150,14 @@ export
149
150
  isIntersecting,
150
151
  wave,
151
152
  formatTime,
153
+ fetchJSON,
152
154
 
153
155
  // Random
154
156
  rand,
155
157
  randInt,
156
158
  randSign,
157
159
  randInCircle,
158
- randVector,
160
+ randVec2,
159
161
  randColor,
160
162
 
161
163
  // Utility Classes
@@ -170,7 +172,9 @@ export
170
172
 
171
173
  // Default Colors
172
174
  WHITE,
175
+ CLEAR_WHITE,
173
176
  BLACK,
177
+ CLEAR_BLACK,
174
178
  GRAY,
175
179
  RED,
176
180
  ORANGE,
@@ -219,6 +223,7 @@ export
219
223
  glCopyToContext,
220
224
  glCreateProgram,
221
225
  glCreateTexture,
226
+ glDeleteTexture,
222
227
  glSetTextureData,
223
228
  glDraw,
224
229
  glFlush,
@@ -241,12 +246,15 @@ export
241
246
  keyWasPressed,
242
247
  keyWasReleased,
243
248
  keyDirection,
244
- clearInput,
249
+ inputClear,
250
+ inputClearKey,
245
251
  mouseIsDown,
246
252
  mouseWasPressed,
247
253
  mouseWasReleased,
248
254
  mousePos,
249
255
  mousePosScreen,
256
+ mouseDelta,
257
+ mouseDeltaScreen,
250
258
  mouseWheel,
251
259
  isUsingGamepad,
252
260
  inputPreventDefault,
@@ -259,6 +267,9 @@ export
259
267
  vibrate,
260
268
  vibrateStop,
261
269
  isTouchDevice,
270
+ pointerLockRequest,
271
+ pointerLockExit,
272
+ pointerLockIsActive,
262
273
 
263
274
  // Audio
264
275
  Sound,
@@ -278,10 +289,12 @@ export
278
289
 
279
290
  // Tiles
280
291
  tileCollisionLayers,
281
- getTileCollisionData,
292
+ tileCollisionGetData,
282
293
  tileCollisionTest,
283
294
  tileCollisionRaycast,
295
+ tileCollisionLoad,
284
296
  TileLayerData,
297
+ CanvasLayer,
285
298
  TileLayer,
286
299
  TileCollisionLayer,
287
300
 
@@ -294,4 +307,4 @@ export
294
307
  medalsPreventUnlock,
295
308
  medalsInit,
296
309
  Medal,
297
- };
310
+ };