littlejsengine 1.8.1 → 1.8.4
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 +15 -10
- package/build/littlejs.esm.js +140 -127
- package/build/littlejs.js +57 -44
- package/build/littlejs.min.js +1 -1
- package/build/littlejs.release.js +57 -44
- package/examples/breakout/gameObjects.js +1 -1
- package/examples/breakout/index.html +3 -3
- package/examples/breakoutTutorial/README.md +3 -1
- package/examples/breakoutTutorial/index.html +2 -2
- package/examples/electron/index.html +2 -2
- package/examples/js13k/index.html +13 -13
- package/examples/module/game.js +1 -1
- package/examples/module/index.html +1 -1
- package/examples/particles/index.html +1 -1
- package/examples/platformer/index.html +6 -6
- package/examples/puzzle/index.html +2 -2
- package/examples/starter/index.html +13 -13
- package/examples/stress/index.html +3 -3
- package/examples/typescript/game.ts +1 -1
- package/examples/typescript/index.html +1 -1
- package/package.json +2 -1
- package/src/engine.js +2 -2
- package/src/engineAudio.js +2 -1
- package/src/engineDraw.js +35 -18
- package/src/engineExport.js +83 -83
- package/src/engineObject.js +1 -0
- package/src/engineWebGL.js +17 -23
- package/build/littlejs.d.ts +0 -2003
- package/build/littlejs.esm.min.js +0 -1
package/README.md
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
## 🚂 All aboard!
|
|
10
10
|
|
|
11
|
-
LittleJS is a lightweight open source HTML5 game engine
|
|
12
|
-
It's small footprint is packed with a comprehensive feature set
|
|
11
|
+
LittleJS is a lightweight open source HTML5 game engine for modern web development.
|
|
12
|
+
It's small footprint is packed with a comprehensive feature set including hybrid rendering, physics, particles, sound effects, music, and input handling.
|
|
13
13
|
The code is very clean and well documented with some fun examples to get you started. Choo-Choo! 🚂
|
|
14
14
|
|
|
15
15
|
<div align="center">
|
|
@@ -28,27 +28,28 @@ LittleJS is a small but powerful game engine with many features and no dependenc
|
|
|
28
28
|
|
|
29
29
|
- Super fast sprite and tile map rendering engine with WebGL
|
|
30
30
|
- Update and render over 10,000 objects at a solid 60fps
|
|
31
|
-
- Apply [Shadertoy](https://www.shadertoy.com) compatible shaders for post
|
|
31
|
+
- Apply [Shadertoy](https://www.shadertoy.com) compatible shaders for post-processing effects
|
|
32
32
|
- Robust particle effect system and [effect design tool](https://killedbyapixel.github.io/LittleJS/examples/particles/)
|
|
33
33
|
|
|
34
34
|
### 🔊 Audio
|
|
35
35
|
|
|
36
|
-
- Positional sound effects with wave or
|
|
36
|
+
- Positional sound effects with wave files or ZzFX
|
|
37
|
+
- Use [ZzFX](https://killedbyapixel.github.io/ZzFX/) sound effect generator to play sounds without asset files
|
|
37
38
|
- Music with mp3, ogg, wave, or [ZzFXM](https://keithclark.github.io/ZzFXM/)
|
|
38
39
|
|
|
39
40
|
### 🎮 Input
|
|
40
41
|
|
|
41
|
-
- Comprehensive
|
|
42
|
+
- Comprehensive input handling for keyboard, mouse, gamepad, and touch
|
|
42
43
|
- On screen touch gamepad designed for mobile devices
|
|
43
44
|
|
|
44
45
|
### 💥 Physics
|
|
45
46
|
|
|
46
|
-
- 2D physics engine with collision handling for axis aligned boxes
|
|
47
|
+
- Robust 2D physics engine with collision handling for axis aligned boxes
|
|
47
48
|
- Very fast collision and raycasting for tile maps
|
|
48
49
|
|
|
49
|
-
### 🚀
|
|
50
|
+
### 🚀 Flexibility
|
|
50
51
|
|
|
51
|
-
- Compatible with all modern web
|
|
52
|
+
- Compatible with all modern web browsers and on mobile devices
|
|
52
53
|
- Support for TypeScript and Modules with example projects for both
|
|
53
54
|
- Ideal for size coding competitions like [js13kGames](https://js13kgames.com/), [starter project builds to a 7KB zip](https://killedbyapixel.github.io/LittleJS/examples/js13k)
|
|
54
55
|
- Builds to an executable with [Electron](https://www.electronjs.org/) for distribution on Windows, macOS, and Linux
|
|
@@ -65,8 +66,10 @@ LittleJS is a small but powerful game engine with many features and no dependenc
|
|
|
65
66
|
|
|
66
67
|
## Demos
|
|
67
68
|
|
|
69
|
+
These examples are for both learning and using as starter projects to create your own games.
|
|
70
|
+
|
|
68
71
|
### [Starter Project](https://killedbyapixel.github.io/LittleJS/examples/starter/) - Clean example with only a few things to get you started
|
|
69
|
-
### [Breakout](https://killedbyapixel.github.io/LittleJS/examples/breakout/) -
|
|
72
|
+
### [Breakout](https://killedbyapixel.github.io/LittleJS/examples/breakout/) - Block breaking game with post-processing effects
|
|
70
73
|
### [Puzzle Game](https://killedbyapixel.github.io/LittleJS/examples/puzzle/) - Match 3 puzzle game with HD rendering and high score tracking
|
|
71
74
|
### [Platformer](https://killedbyapixel.github.io/LittleJS/examples/platformer/) - Platformer/shooter with procedural generation and destruction
|
|
72
75
|
### [Stress Test](https://killedbyapixel.github.io/LittleJS/examples/stress/) - Max sprite/object test and music system demo
|
|
@@ -74,12 +77,14 @@ LittleJS is a small but powerful game engine with many features and no dependenc
|
|
|
74
77
|
|
|
75
78
|
## How to use LittleJS
|
|
76
79
|
|
|
77
|
-
To
|
|
80
|
+
To get started download the latest LittleJS package from GitHub or install via npm: ```npm install littlejsengine```.
|
|
78
81
|
|
|
79
82
|
[The Breakout Tutorial](https://github.com/KilledByAPixel/LittleJS/tree/main/examples/breakoutTutorial) demonstrates how to make a simple game from scratch. [The tutorial is also available on YouTube.](https://youtu.be/tSwDx-NWTXE?si=bkjMa8-7AN2Wg5MO)
|
|
80
83
|
|
|
81
84
|
[This GitNation talk explains how LittleJS works with some tips on how to use it.](https://youtu.be/_dXKU0WgAj8?si=ZDXLYAFDWp54hrGT)
|
|
82
85
|
|
|
86
|
+
Join our vibrant community on [Discord](https://discord.gg/zb7hcGkyZe) to get help, share your projects, and collaborate with others.
|
|
87
|
+
|
|
83
88
|
## Builds
|
|
84
89
|
|
|
85
90
|
To easily include LittleJS in your game, you can use one of the pre-built js files.
|
package/build/littlejs.esm.js
CHANGED
|
@@ -1558,6 +1558,7 @@ class EngineObject
|
|
|
1558
1558
|
// set passed in params
|
|
1559
1559
|
ASSERT(isVector2(pos) && isVector2(size)); // ensure pos and size are vec2s
|
|
1560
1560
|
ASSERT(typeof tileInfo !== 'number' || !tileInfo); // prevent old style calls
|
|
1561
|
+
ASSERT(!(renderOrder instanceof Color)); // prevent old style calls
|
|
1561
1562
|
// to fix old calls, replace with tile(tileIndex, tileSize)
|
|
1562
1563
|
|
|
1563
1564
|
/** @property {Vector2} - World space position of the object */
|
|
@@ -2079,16 +2080,18 @@ function worldToScreen(worldPos)
|
|
|
2079
2080
|
* @param {Color} [additiveColor=Color(0,0,0,0)] - Additive color to be applied
|
|
2080
2081
|
* @param {Boolean} [useWebGL=glEnable] - Use accelerated WebGL rendering
|
|
2081
2082
|
* @param {Boolean} [screenSpace=0] - If true the pos and size are in screen space
|
|
2083
|
+
* @param {CanvasRenderingContext2D} [context] - Canvas 2D context to draw to
|
|
2082
2084
|
* @memberof Draw */
|
|
2083
2085
|
function drawTile(pos, size=vec2(1), tileInfo, color=new Color,
|
|
2084
|
-
angle=0, mirror, additiveColor=new Color(0,0,0,0), useWebGL=glEnable, screenSpace)
|
|
2086
|
+
angle=0, mirror, additiveColor=new Color(0,0,0,0), useWebGL=glEnable, screenSpace, context)
|
|
2085
2087
|
{
|
|
2088
|
+
ASSERT(!context || !useWebGL); // context only supported in canvas 2D mode
|
|
2086
2089
|
ASSERT(typeof tileInfo !== 'number' || !tileInfo); // prevent old style calls
|
|
2087
2090
|
// to fix old calls, replace with tile(tileIndex, tileSize)
|
|
2088
2091
|
|
|
2089
2092
|
showWatermark && ++drawCount;
|
|
2090
2093
|
const textureInfo = tileInfo && tileInfo.getTextureInfo();
|
|
2091
|
-
if (
|
|
2094
|
+
if (useWebGL)
|
|
2092
2095
|
{
|
|
2093
2096
|
if (screenSpace)
|
|
2094
2097
|
{
|
|
@@ -2139,7 +2142,7 @@ function drawTile(pos, size=vec2(1), tileInfo, color=new Color,
|
|
|
2139
2142
|
context.fillStyle = color;
|
|
2140
2143
|
context.fillRect(-.5, -.5, 1, 1);
|
|
2141
2144
|
}
|
|
2142
|
-
},
|
|
2145
|
+
}, screenSpace, context);
|
|
2143
2146
|
}
|
|
2144
2147
|
}
|
|
2145
2148
|
|
|
@@ -2150,28 +2153,36 @@ function drawTile(pos, size=vec2(1), tileInfo, color=new Color,
|
|
|
2150
2153
|
* @param {Number} [angle=0]
|
|
2151
2154
|
* @param {Boolean} [useWebGL=glEnable]
|
|
2152
2155
|
* @param {Boolean} [screenSpace=0]
|
|
2156
|
+
* @param {CanvasRenderingContext2D} [context]
|
|
2153
2157
|
* @memberof Draw */
|
|
2154
|
-
function drawRect(pos, size, color, angle, useWebGL, screenSpace)
|
|
2155
|
-
{
|
|
2158
|
+
function drawRect(pos, size, color, angle, useWebGL, screenSpace, context)
|
|
2159
|
+
{
|
|
2160
|
+
drawTile(pos, size, undefined, color, angle, 0, undefined, useWebGL, screenSpace, context);
|
|
2161
|
+
}
|
|
2156
2162
|
|
|
2157
2163
|
/** Draw colored polygon using passed in points
|
|
2158
2164
|
* @param {Array} points - Array of Vector2 points
|
|
2159
2165
|
* @param {Color} [color=Color()]
|
|
2160
2166
|
* @param {Boolean} [useWebGL=glEnable]
|
|
2161
2167
|
* @param {Boolean} [screenSpace=0]
|
|
2168
|
+
* @param {CanvasRenderingContext2D} [context]
|
|
2162
2169
|
* @memberof Draw */
|
|
2163
|
-
function drawPoly(points, color=new Color, useWebGL=glEnable, screenSpace)
|
|
2170
|
+
function drawPoly(points, color=new Color, useWebGL=glEnable, screenSpace, context)
|
|
2164
2171
|
{
|
|
2172
|
+
ASSERT(!context || !useWebGL); // context only supported in canvas 2D mode
|
|
2173
|
+
|
|
2165
2174
|
if (useWebGL)
|
|
2166
2175
|
glDrawPoints(screenSpace ? points.map(screenToWorld) : points, color.rgbaInt());
|
|
2167
2176
|
else
|
|
2168
2177
|
{
|
|
2169
2178
|
// draw using canvas
|
|
2170
|
-
|
|
2171
|
-
|
|
2179
|
+
if (!context)
|
|
2180
|
+
context = mainContext;
|
|
2181
|
+
context.fillStyle = color;
|
|
2182
|
+
context.beginPath();
|
|
2172
2183
|
for (const point of screenSpace ? points : points.map(worldToScreen))
|
|
2173
|
-
|
|
2174
|
-
|
|
2184
|
+
context.lineTo(point.x, point.y);
|
|
2185
|
+
context.fill();
|
|
2175
2186
|
}
|
|
2176
2187
|
}
|
|
2177
2188
|
|
|
@@ -2182,12 +2193,13 @@ function drawPoly(points, color=new Color, useWebGL=glEnable, screenSpace)
|
|
|
2182
2193
|
* @param {Color} [color=Color()]
|
|
2183
2194
|
* @param {Boolean} [useWebGL=glEnable]
|
|
2184
2195
|
* @param {Boolean} [screenSpace=0]
|
|
2196
|
+
* @param {CanvasRenderingContext2D} [context]
|
|
2185
2197
|
* @memberof Draw */
|
|
2186
|
-
function drawLine(posA, posB, thickness=.1, color, useWebGL, screenSpace)
|
|
2198
|
+
function drawLine(posA, posB, thickness=.1, color, useWebGL, screenSpace, context)
|
|
2187
2199
|
{
|
|
2188
2200
|
const halfDelta = vec2((posB.x - posA.x)/2, (posB.y - posA.y)/2);
|
|
2189
2201
|
const size = vec2(thickness, halfDelta.length()*2);
|
|
2190
|
-
drawRect(posA.add(halfDelta), size, color, halfDelta.angle(), useWebGL, screenSpace);
|
|
2202
|
+
drawRect(posA.add(halfDelta), size, color, halfDelta.angle(), useWebGL, screenSpace, context);
|
|
2191
2203
|
}
|
|
2192
2204
|
|
|
2193
2205
|
/** Draw directly to a 2d canvas context in world space
|
|
@@ -2196,10 +2208,10 @@ function drawLine(posA, posB, thickness=.1, color, useWebGL, screenSpace)
|
|
|
2196
2208
|
* @param {Number} angle
|
|
2197
2209
|
* @param {Boolean} mirror
|
|
2198
2210
|
* @param {Function} drawFunction
|
|
2199
|
-
* @param {CanvasRenderingContext2D} [context=mainContext]
|
|
2200
2211
|
* @param {Boolean} [screenSpace=0]
|
|
2212
|
+
* @param {CanvasRenderingContext2D} [context=mainContext]
|
|
2201
2213
|
* @memberof Draw */
|
|
2202
|
-
function drawCanvas2D(pos, size, angle, mirror, drawFunction, context
|
|
2214
|
+
function drawCanvas2D(pos, size, angle, mirror, drawFunction, screenSpace, context=mainContext)
|
|
2203
2215
|
{
|
|
2204
2216
|
if (!screenSpace)
|
|
2205
2217
|
{
|
|
@@ -2218,13 +2230,19 @@ function drawCanvas2D(pos, size, angle, mirror, drawFunction, context = mainCont
|
|
|
2218
2230
|
/** Enable normal or additive blend mode
|
|
2219
2231
|
* @param {Boolean} [additive=0]
|
|
2220
2232
|
* @param {Boolean} [useWebGL=glEnable]
|
|
2233
|
+
* @param {CanvasRenderingContext2D} [context=mainContext]
|
|
2221
2234
|
* @memberof Draw */
|
|
2222
|
-
function setBlendMode(additive, useWebGL=glEnable)
|
|
2235
|
+
function setBlendMode(additive, useWebGL=glEnable, context)
|
|
2223
2236
|
{
|
|
2224
|
-
|
|
2225
|
-
|
|
2237
|
+
ASSERT(!context || !useWebGL); // context only supported in canvas 2D mode
|
|
2238
|
+
if (useWebGL)
|
|
2239
|
+
glAdditive = additive;
|
|
2226
2240
|
else
|
|
2227
|
-
|
|
2241
|
+
{
|
|
2242
|
+
if (!context)
|
|
2243
|
+
context = mainContext;
|
|
2244
|
+
context.globalCompositeOperation = additive ? 'lighter' : 'source-over';
|
|
2245
|
+
}
|
|
2228
2246
|
}
|
|
2229
2247
|
|
|
2230
2248
|
/** Draw text on overlay canvas in world space
|
|
@@ -2876,7 +2894,8 @@ class Sound
|
|
|
2876
2894
|
if (zzfxSound)
|
|
2877
2895
|
{
|
|
2878
2896
|
// generate zzfx sound now for fast playback
|
|
2879
|
-
this.randomness = zzfxSound[1] ||
|
|
2897
|
+
this.randomness = zzfxSound[1] || 0;
|
|
2898
|
+
zzfxSound[1] = 0; // generate without randomness
|
|
2880
2899
|
this.sampleChannels = [zzfxG(...zzfxSound)];
|
|
2881
2900
|
this.sampleRate = zzfxR;
|
|
2882
2901
|
}
|
|
@@ -4382,21 +4401,20 @@ function glInit()
|
|
|
4382
4401
|
'#version 300 es\n' + // specify GLSL ES version
|
|
4383
4402
|
'precision highp float;'+ // use highp for better accuracy
|
|
4384
4403
|
'uniform mat4 m;'+ // transform matrix
|
|
4385
|
-
'in
|
|
4386
|
-
'in vec4 c,a;'+ // color, additiveColor
|
|
4404
|
+
'in vec4 p,c,a;'+ // position, uv, color, additiveColor
|
|
4387
4405
|
'out vec4 v,d,e;'+ // return uv, color, additiveColor
|
|
4388
4406
|
'void main(){'+ // shader entry point
|
|
4389
|
-
'gl_Position=m*vec4(p,1,1);'+ // transform position
|
|
4390
|
-
'v=
|
|
4407
|
+
'gl_Position=m*vec4(p.xy,1,1);'+ // transform position
|
|
4408
|
+
'v=p;d=c;e=a;'+ // pass stuff to fragment shader
|
|
4391
4409
|
'}' // end of shader
|
|
4392
4410
|
,
|
|
4393
4411
|
'#version 300 es\n' + // specify GLSL ES version
|
|
4394
4412
|
'precision highp float;'+ // use highp for better accuracy
|
|
4395
|
-
'in vec4 v,d,e;'+ // uv, color, additiveColor
|
|
4413
|
+
'in vec4 v,d,e;'+ // position, uv, color, additiveColor
|
|
4396
4414
|
'uniform sampler2D s;'+ // texture
|
|
4397
4415
|
'out vec4 c;'+ // out color
|
|
4398
4416
|
'void main(){'+ // shader entry point
|
|
4399
|
-
'c=texture(s,v.
|
|
4417
|
+
'c=texture(s,v.zw)*d+e;'+ // modulate texture by color plus additive
|
|
4400
4418
|
'}' // end of shader
|
|
4401
4419
|
);
|
|
4402
4420
|
|
|
@@ -4421,7 +4439,7 @@ function glPreRender()
|
|
|
4421
4439
|
glContext.bindTexture(gl_TEXTURE_2D, glActiveTexture = textureInfos[0].glTexture);
|
|
4422
4440
|
glContext.bindBuffer(gl_ARRAY_BUFFER, glArrayBuffer);
|
|
4423
4441
|
glContext.bufferData(gl_ARRAY_BUFFER, gl_VERTEX_BUFFER_SIZE, gl_DYNAMIC_DRAW);
|
|
4424
|
-
|
|
4442
|
+
glAdditive = 0;
|
|
4425
4443
|
|
|
4426
4444
|
// set vertex attributes
|
|
4427
4445
|
let offset = 0;
|
|
@@ -4432,33 +4450,25 @@ function glPreRender()
|
|
|
4432
4450
|
glContext.vertexAttribPointer(location, size, type, normalize, gl_VERTEX_BYTE_STRIDE, offset);
|
|
4433
4451
|
offset += size*typeSize;
|
|
4434
4452
|
}
|
|
4435
|
-
initVertexAttribArray('p', gl_FLOAT, 4,
|
|
4436
|
-
initVertexAttribArray('t', gl_FLOAT, 4, 2); // texture coords
|
|
4453
|
+
initVertexAttribArray('p', gl_FLOAT, 4, 4); // position & texture coords
|
|
4437
4454
|
initVertexAttribArray('c', gl_UNSIGNED_BYTE, 1, 4, 1); // color
|
|
4438
4455
|
initVertexAttribArray('a', gl_UNSIGNED_BYTE, 1, 4, 1); // additiveColor
|
|
4439
4456
|
|
|
4440
4457
|
// build the transform matrix
|
|
4441
4458
|
const sx = 2 * cameraScale / mainCanvas.width;
|
|
4442
4459
|
const sy = 2 * cameraScale / mainCanvas.height;
|
|
4460
|
+
const cx = -1 - sx*cameraPos.x;
|
|
4461
|
+
const cy = -1 - sy*cameraPos.y;
|
|
4443
4462
|
glContext.uniformMatrix4fv(glContext.getUniformLocation(glShader, 'm'), 0,
|
|
4444
4463
|
new Float32Array([
|
|
4445
|
-
sx,
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4464
|
+
sx, 0, 0, 0,
|
|
4465
|
+
0, sy, 0, 0,
|
|
4466
|
+
1, 1, -1, 1,
|
|
4467
|
+
cx, cy, 0, 0
|
|
4449
4468
|
])
|
|
4450
4469
|
);
|
|
4451
4470
|
}
|
|
4452
4471
|
|
|
4453
|
-
/** Set the WebGl blend mode, normally you should call setBlendMode instead
|
|
4454
|
-
* @param {Boolean} [additive=0]
|
|
4455
|
-
* @memberof WebGL */
|
|
4456
|
-
function glSetBlendMode(additive=0)
|
|
4457
|
-
{
|
|
4458
|
-
// setup blending
|
|
4459
|
-
glAdditive = additive;
|
|
4460
|
-
}
|
|
4461
|
-
|
|
4462
4472
|
/** Set the WebGl texture, called automatically if using multiple textures
|
|
4463
4473
|
* - This may also flush the gl buffer resulting in more draw calls and worse performance
|
|
4464
4474
|
* @param {WebGLTexture} texture
|
|
@@ -4694,8 +4704,11 @@ function glRenderPostProcess()
|
|
|
4694
4704
|
glFlush(); // clear out the buffer
|
|
4695
4705
|
mainContext.drawImage(glCanvas, 0, 0); // copy to the main canvas
|
|
4696
4706
|
}
|
|
4697
|
-
else
|
|
4707
|
+
else
|
|
4708
|
+
{
|
|
4709
|
+
// set the viewport
|
|
4698
4710
|
glContext.viewport(0, 0, glCanvas.width = mainCanvas.width, glCanvas.height = mainCanvas.height);
|
|
4711
|
+
}
|
|
4699
4712
|
|
|
4700
4713
|
if (glPostIncludeOverlay)
|
|
4701
4714
|
{
|
|
@@ -4799,7 +4812,7 @@ const engineName = 'LittleJS';
|
|
|
4799
4812
|
* @type {String}
|
|
4800
4813
|
* @default
|
|
4801
4814
|
* @memberof Engine */
|
|
4802
|
-
const engineVersion = '1.8.
|
|
4815
|
+
const engineVersion = '1.8.4';
|
|
4803
4816
|
|
|
4804
4817
|
/** Frames per second to update objects
|
|
4805
4818
|
* @type {Number}
|
|
@@ -4860,7 +4873,7 @@ let frameTimeLastMS = 0, frameTimeBufferMS = 0, averageFPS = 0;
|
|
|
4860
4873
|
* @param {Function} gameUpdatePost - Called after physics and objects are updated, setup camera and prepare for render
|
|
4861
4874
|
* @param {Function} gameRender - Called before objects are rendered, draw any background effects that appear behind objects
|
|
4862
4875
|
* @param {Function} gameRenderPost - Called after objects are rendered, draw effects or hud that appear above all objects
|
|
4863
|
-
* @param {
|
|
4876
|
+
* @param {Array} [imageSources=['tiles.png']] - Image to load
|
|
4864
4877
|
* @memberof Engine */
|
|
4865
4878
|
function engineInit(gameInit, gameUpdate, gameUpdatePost, gameRender, gameRenderPost, imageSources=['tiles.png'])
|
|
4866
4879
|
{
|
|
@@ -5102,11 +5115,80 @@ function engineObjectsCallback(pos, size, callbackFunction, objects=engineObject
|
|
|
5102
5115
|
|
|
5103
5116
|
/**
|
|
5104
5117
|
* LittleJS Module Export
|
|
5105
|
-
* - Export engine as a module
|
|
5118
|
+
* - Export engine as a module
|
|
5106
5119
|
*/
|
|
5107
5120
|
|
|
5108
5121
|
export {
|
|
5109
|
-
|
|
5122
|
+
|
|
5123
|
+
// Engine
|
|
5124
|
+
engineName,
|
|
5125
|
+
engineVersion,
|
|
5126
|
+
frameRate,
|
|
5127
|
+
timeDelta,
|
|
5128
|
+
engineObjects,
|
|
5129
|
+
frame,
|
|
5130
|
+
time,
|
|
5131
|
+
timeReal,
|
|
5132
|
+
paused,
|
|
5133
|
+
setPaused,
|
|
5134
|
+
engineInit,
|
|
5135
|
+
engineObjectsUpdate,
|
|
5136
|
+
engineObjectsDestroy,
|
|
5137
|
+
engineObjectsCallback,
|
|
5138
|
+
|
|
5139
|
+
// Globals
|
|
5140
|
+
debug,
|
|
5141
|
+
showWatermark,
|
|
5142
|
+
|
|
5143
|
+
// Debug
|
|
5144
|
+
ASSERT,
|
|
5145
|
+
debugRect,
|
|
5146
|
+
debugCircle,
|
|
5147
|
+
debugPoint,
|
|
5148
|
+
debugLine,
|
|
5149
|
+
debugAABB,
|
|
5150
|
+
debugText,
|
|
5151
|
+
debugClear,
|
|
5152
|
+
debugSaveCanvas,
|
|
5153
|
+
|
|
5154
|
+
// Settings
|
|
5155
|
+
cameraPos,
|
|
5156
|
+
cameraScale,
|
|
5157
|
+
canvasMaxSize,
|
|
5158
|
+
canvasFixedSize,
|
|
5159
|
+
canvasPixelated,
|
|
5160
|
+
fontDefault,
|
|
5161
|
+
tileSizeDefault,
|
|
5162
|
+
tileFixBleedScale,
|
|
5163
|
+
enablePhysicsSolver,
|
|
5164
|
+
objectDefaultMass,
|
|
5165
|
+
objectDefaultDamping,
|
|
5166
|
+
objectDefaultAngleDamping,
|
|
5167
|
+
objectDefaultElasticity,
|
|
5168
|
+
objectDefaultFriction,
|
|
5169
|
+
objectMaxSpeed,
|
|
5170
|
+
gravity,
|
|
5171
|
+
particleEmitRateScale,
|
|
5172
|
+
glEnable,
|
|
5173
|
+
glOverlay,
|
|
5174
|
+
gamepadsEnable,
|
|
5175
|
+
gamepadDirectionEmulateStick,
|
|
5176
|
+
inputWASDEmulateDirection,
|
|
5177
|
+
touchGamepadEnable,
|
|
5178
|
+
touchGamepadAnalog,
|
|
5179
|
+
touchGamepadSize,
|
|
5180
|
+
touchGamepadAlpha,
|
|
5181
|
+
vibrateEnable,
|
|
5182
|
+
soundEnable,
|
|
5183
|
+
soundVolume,
|
|
5184
|
+
soundDefaultRange,
|
|
5185
|
+
soundDefaultTaper,
|
|
5186
|
+
medalDisplayTime,
|
|
5187
|
+
medalDisplaySlideTime,
|
|
5188
|
+
medalDisplaySize,
|
|
5189
|
+
medalDisplayIconSize,
|
|
5190
|
+
|
|
5191
|
+
// Setters for globals
|
|
5110
5192
|
setCameraPos,
|
|
5111
5193
|
setCameraScale,
|
|
5112
5194
|
setCanvasMaxSize,
|
|
@@ -5146,58 +5228,6 @@ export {
|
|
|
5146
5228
|
setShowWatermark,
|
|
5147
5229
|
setDebugKey,
|
|
5148
5230
|
|
|
5149
|
-
// Settings
|
|
5150
|
-
canvasMaxSize,
|
|
5151
|
-
canvasFixedSize,
|
|
5152
|
-
canvasPixelated,
|
|
5153
|
-
fontDefault,
|
|
5154
|
-
tileSizeDefault,
|
|
5155
|
-
tileFixBleedScale,
|
|
5156
|
-
enablePhysicsSolver,
|
|
5157
|
-
objectDefaultMass,
|
|
5158
|
-
objectDefaultDamping,
|
|
5159
|
-
objectDefaultAngleDamping,
|
|
5160
|
-
objectDefaultElasticity,
|
|
5161
|
-
objectDefaultFriction,
|
|
5162
|
-
objectMaxSpeed,
|
|
5163
|
-
gravity,
|
|
5164
|
-
particleEmitRateScale,
|
|
5165
|
-
cameraPos,
|
|
5166
|
-
cameraScale,
|
|
5167
|
-
glEnable,
|
|
5168
|
-
glOverlay,
|
|
5169
|
-
gamepadsEnable,
|
|
5170
|
-
gamepadDirectionEmulateStick,
|
|
5171
|
-
inputWASDEmulateDirection,
|
|
5172
|
-
touchGamepadEnable,
|
|
5173
|
-
touchGamepadAnalog,
|
|
5174
|
-
touchGamepadSize,
|
|
5175
|
-
touchGamepadAlpha,
|
|
5176
|
-
vibrateEnable,
|
|
5177
|
-
soundEnable,
|
|
5178
|
-
soundVolume,
|
|
5179
|
-
soundDefaultRange,
|
|
5180
|
-
soundDefaultTaper,
|
|
5181
|
-
medalDisplayTime,
|
|
5182
|
-
medalDisplaySlideTime,
|
|
5183
|
-
medalDisplaySize,
|
|
5184
|
-
medalDisplayIconSize,
|
|
5185
|
-
|
|
5186
|
-
// Globals
|
|
5187
|
-
debug,
|
|
5188
|
-
showWatermark,
|
|
5189
|
-
|
|
5190
|
-
// Debug
|
|
5191
|
-
ASSERT,
|
|
5192
|
-
debugRect,
|
|
5193
|
-
debugCircle,
|
|
5194
|
-
debugPoint,
|
|
5195
|
-
debugLine,
|
|
5196
|
-
debugAABB,
|
|
5197
|
-
debugText,
|
|
5198
|
-
debugClear,
|
|
5199
|
-
debugSaveCanvas,
|
|
5200
|
-
|
|
5201
5231
|
// Utilities
|
|
5202
5232
|
PI,
|
|
5203
5233
|
abs,
|
|
@@ -5235,9 +5265,6 @@ export {
|
|
|
5235
5265
|
rgb,
|
|
5236
5266
|
hsl,
|
|
5237
5267
|
|
|
5238
|
-
// Base
|
|
5239
|
-
EngineObject,
|
|
5240
|
-
|
|
5241
5268
|
// Draw
|
|
5242
5269
|
textureInfos,
|
|
5243
5270
|
tile,
|
|
@@ -5262,6 +5289,15 @@ export {
|
|
|
5262
5289
|
isFullscreen,
|
|
5263
5290
|
toggleFullscreen,
|
|
5264
5291
|
|
|
5292
|
+
// WebGL
|
|
5293
|
+
glCanvas,
|
|
5294
|
+
glContext,
|
|
5295
|
+
glSetTexture,
|
|
5296
|
+
glCompileShader,
|
|
5297
|
+
glCreateProgram,
|
|
5298
|
+
glCreateTexture,
|
|
5299
|
+
glInitPostProcess,
|
|
5300
|
+
|
|
5265
5301
|
// Input
|
|
5266
5302
|
keyIsDown,
|
|
5267
5303
|
keyWasPressed,
|
|
@@ -5296,6 +5332,9 @@ export {
|
|
|
5296
5332
|
playSamples,
|
|
5297
5333
|
zzfx,
|
|
5298
5334
|
|
|
5335
|
+
// Base Object
|
|
5336
|
+
EngineObject,
|
|
5337
|
+
|
|
5299
5338
|
// Tiles
|
|
5300
5339
|
tileCollision,
|
|
5301
5340
|
tileCollisionSize,
|
|
@@ -5318,30 +5357,4 @@ export {
|
|
|
5318
5357
|
newgroundsInit,
|
|
5319
5358
|
Medal,
|
|
5320
5359
|
Newgrounds,
|
|
5321
|
-
|
|
5322
|
-
// WebGL
|
|
5323
|
-
glCanvas,
|
|
5324
|
-
glContext,
|
|
5325
|
-
glSetBlendMode,
|
|
5326
|
-
glSetTexture,
|
|
5327
|
-
glCompileShader,
|
|
5328
|
-
glCreateProgram,
|
|
5329
|
-
glCreateTexture,
|
|
5330
|
-
glInitPostProcess,
|
|
5331
|
-
|
|
5332
|
-
// Engine
|
|
5333
|
-
engineName,
|
|
5334
|
-
engineVersion,
|
|
5335
|
-
frameRate,
|
|
5336
|
-
timeDelta,
|
|
5337
|
-
engineObjects,
|
|
5338
|
-
frame,
|
|
5339
|
-
time,
|
|
5340
|
-
timeReal,
|
|
5341
|
-
paused,
|
|
5342
|
-
setPaused,
|
|
5343
|
-
engineInit,
|
|
5344
|
-
engineObjectsUpdate,
|
|
5345
|
-
engineObjectsDestroy,
|
|
5346
|
-
engineObjectsCallback,
|
|
5347
5360
|
};
|