littlejsengine 1.5.1 → 1.6.0
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 +38 -16
- package/{engine/index.d.ts → build/littlejs.d.ts} +10 -2
- package/{engine/engine.all.module.js → build/littlejs.esm.js} +32 -14
- package/build/littlejs.esm.min.js +1 -0
- package/{engine/engine.all.js → build/littlejs.js} +20 -14
- package/build/littlejs.min.js +1 -0
- package/{engine/engine.all.release.js → build/littlejs.release.js} +19 -13
- package/examples/breakout/index.html +3 -2
- package/examples/electron/build.bat +52 -0
- package/{electron → examples/electron}/electron.js +18 -21
- package/{game.js → examples/electron/game.js} +1 -1
- package/examples/electron/index.html +2 -0
- package/examples/electron/package.json +20 -0
- package/examples/empty/game.js +1 -1
- package/examples/empty/index.html +2 -2
- package/examples/module/game.js +1 -1
- package/examples/module/index.html +2 -1
- package/examples/particles/index.html +3 -2
- package/examples/platformer/index.html +3 -2
- package/examples/puzzle/index.html +3 -2
- package/{build.bat → examples/starter/build.bat} +17 -17
- package/examples/starter/game.js +111 -0
- package/examples/starter/index.html +27 -0
- package/examples/starter/tiles.png +0 -0
- package/examples/stress/index.html +3 -2
- package/examples/typescript/game.js +1 -1
- package/examples/typescript/game.ts +1 -1
- package/examples/typescript/index.html +2 -1
- package/package.json +3 -3
- package/{engine → src}/engine.js +11 -7
- package/src/engineBuild.bat +130 -0
- package/{engine → src}/engineDebug.js +1 -1
- package/{engine → src}/engineExport.js +12 -0
- package/{engine → src}/engineInput.js +3 -3
- package/{engine → src}/engineMedals.js +1 -1
- package/{engine → src}/engineUtilities.js +1 -1
- package/{engine → src}/engineWebGL.js +3 -1
- package/buildSetup.bat +0 -10
- package/electron/electronBuild.bat +0 -32
- package/electron/electronSetup.bat +0 -2
- package/electron/package.json +0 -21
- package/engine/engine.all.min.js +0 -1
- package/engine/engine.all.module.min.js +0 -1
- package/engine/engineBuild.bat +0 -127
- package/index.html +0 -26
- /package/{tiles.png → examples/electron/tiles.png} +0 -0
- /package/{favicon.png → examples/favicon.png} +0 -0
- /package/{engine → src}/engineAudio.js +0 -0
- /package/{engine → src}/engineDraw.js +0 -0
- /package/{engine → src}/engineFont.png +0 -0
- /package/{engine → src}/engineObject.js +0 -0
- /package/{engine → src}/engineParticles.js +0 -0
- /package/{engine → src}/engineRelease.js +0 -0
- /package/{engine → src}/engineSettings.js +0 -0
- /package/{engine → src}/engineTileLayer.js +0 -0
|
@@ -124,7 +124,7 @@ const nearestPowerOfTwo = (v)=> 2**Math.ceil(Math.log2(v));
|
|
|
124
124
|
* @param {Vector2} [sizeB] - Size of box B
|
|
125
125
|
* @return {Boolean} - True if overlapping
|
|
126
126
|
* @memberof Utilities */
|
|
127
|
-
const isOverlapping = (pA, sA, pB, sB)=> abs(pA.x - pB.x)*2 < sA.x + sB.x
|
|
127
|
+
const isOverlapping = (pA, sA, pB, sB)=> abs(pA.x - pB.x)*2 < sA.x + sB.x && abs(pA.y - pB.y)*2 < sA.y + sB.y;
|
|
128
128
|
|
|
129
129
|
/** Returns an oscillating wave between 0 and amplitude with frequency of 1 Hz by default
|
|
130
130
|
* @param {Number} [frequency=1] - Frequency of the wave in Hz
|
|
@@ -898,7 +898,7 @@ const engineName = 'LittleJS';
|
|
|
898
898
|
* @type {String}
|
|
899
899
|
* @default
|
|
900
900
|
* @memberof Engine */
|
|
901
|
-
const engineVersion = '1.
|
|
901
|
+
const engineVersion = '1.6.0';
|
|
902
902
|
|
|
903
903
|
/** Frames per second to update objects
|
|
904
904
|
* @type {Number}
|
|
@@ -1006,8 +1006,8 @@ function engineInit(gameInit, gameUpdate, gameUpdatePost, gameRender, gameRender
|
|
|
1006
1006
|
averageFPS = lerp(.05, averageFPS, 1e3/(frameTimeDeltaMS||1));
|
|
1007
1007
|
const debugSpeedUp = debug && keyIsDown(107); // +
|
|
1008
1008
|
const debugSpeedDown = debug && keyIsDown(109); // -
|
|
1009
|
-
if (debug)
|
|
1010
|
-
frameTimeDeltaMS *= debugSpeedUp ? 5 : debugSpeedDown ? .2 : 1;
|
|
1009
|
+
if (debug) // +/- to speed/slow time
|
|
1010
|
+
frameTimeDeltaMS *= debugSpeedUp ? 5 : debugSpeedDown ? .2 : 1;
|
|
1011
1011
|
timeReal += frameTimeDeltaMS / 1e3;
|
|
1012
1012
|
frameTimeBufferMS += !paused * frameTimeDeltaMS;
|
|
1013
1013
|
if (!debugSpeedUp)
|
|
@@ -1016,8 +1016,8 @@ function engineInit(gameInit, gameUpdate, gameUpdatePost, gameRender, gameRender
|
|
|
1016
1016
|
if (canvasFixedSize.x)
|
|
1017
1017
|
{
|
|
1018
1018
|
// clear canvas and set fixed size
|
|
1019
|
-
|
|
1020
|
-
|
|
1019
|
+
mainCanvas.width = canvasFixedSize.x;
|
|
1020
|
+
mainCanvas.height = canvasFixedSize.y;
|
|
1021
1021
|
|
|
1022
1022
|
// fit to window by adding space on top or bottom if necessary
|
|
1023
1023
|
const aspect = innerWidth / innerHeight;
|
|
@@ -1028,10 +1028,14 @@ function engineInit(gameInit, gameUpdate, gameUpdatePost, gameRender, gameRender
|
|
|
1028
1028
|
else
|
|
1029
1029
|
{
|
|
1030
1030
|
// clear canvas and set size to same as window
|
|
1031
|
-
|
|
1032
|
-
|
|
1031
|
+
mainCanvas.width = min(innerWidth, canvasMaxSize.x);
|
|
1032
|
+
mainCanvas.height = min(innerHeight, canvasMaxSize.y);
|
|
1033
1033
|
}
|
|
1034
1034
|
|
|
1035
|
+
// clear overlay canvas and set size
|
|
1036
|
+
overlayCanvas.width = mainCanvas.width;
|
|
1037
|
+
overlayCanvas.height = mainCanvas.height;
|
|
1038
|
+
|
|
1035
1039
|
// save canvas size
|
|
1036
1040
|
mainCanvasSize = vec2(mainCanvas.width, mainCanvas.height);
|
|
1037
1041
|
|
|
@@ -2083,15 +2087,15 @@ function inputUpdatePost()
|
|
|
2083
2087
|
onkeydown = (e)=>
|
|
2084
2088
|
{
|
|
2085
2089
|
if (debug && e.target != document.body) return;
|
|
2086
|
-
e.repeat || (inputData[isUsingGamepad = 0][
|
|
2090
|
+
e.repeat || (inputData[isUsingGamepad = 0][remapKey(e.which)] = 3);
|
|
2087
2091
|
preventDefaultInput && e.preventDefault();
|
|
2088
2092
|
}
|
|
2089
2093
|
onkeyup = (e)=>
|
|
2090
2094
|
{
|
|
2091
2095
|
if (debug && e.target != document.body) return;
|
|
2092
|
-
inputData[0][
|
|
2096
|
+
inputData[0][remapKey(e.which)] = 4;
|
|
2093
2097
|
}
|
|
2094
|
-
const
|
|
2098
|
+
const remapKey = (c)=> inputWASDEmulateDirection ? c==87?38 : c==83?40 : c==65?37 : c==68?39 : c : c;
|
|
2095
2099
|
|
|
2096
2100
|
///////////////////////////////////////////////////////////////////////////////
|
|
2097
2101
|
// Mouse event handlers
|
|
@@ -3505,7 +3509,7 @@ class Particle extends EngineObject
|
|
|
3505
3509
|
* LittleJS Medal System
|
|
3506
3510
|
* <br> - Tracks and displays medals
|
|
3507
3511
|
* <br> - Saves medals to local storage
|
|
3508
|
-
* <br> - Newgrounds
|
|
3512
|
+
* <br> - Newgrounds integration
|
|
3509
3513
|
* @namespace Medals
|
|
3510
3514
|
*/
|
|
3511
3515
|
|
|
@@ -4124,7 +4128,9 @@ function glRenderPostProcess()
|
|
|
4124
4128
|
{
|
|
4125
4129
|
// copy overlay canvas so it will be included in post processing
|
|
4126
4130
|
mainContext.drawImage(overlayCanvas, 0, 0);
|
|
4127
|
-
|
|
4131
|
+
|
|
4132
|
+
// clear overlay canvas
|
|
4133
|
+
overlayCanvas.width = mainCanvas.width;
|
|
4128
4134
|
}
|
|
4129
4135
|
|
|
4130
4136
|
// setup shader program to draw one triangle
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<html><head>
|
|
2
|
+
<title>Little JS Breakout Game Demo</title>
|
|
2
3
|
<meta name=viewport content=width=device-width,height=device-height,initial-scale=1,maximum-scale=1>
|
|
3
4
|
<meta name=apple-mobile-web-app-capable content=yes>
|
|
4
5
|
<meta name=mobile-web-app-capable content=yes>
|
|
5
|
-
<link rel=icon type=image/png href
|
|
6
|
+
<link rel=icon type=image/png href=../favicon.png>
|
|
6
7
|
</head><body>
|
|
7
8
|
|
|
8
|
-
<script src=../../
|
|
9
|
+
<script src=../../build/littlejs.js?125></script>
|
|
9
10
|
<script src=gameObjects.js?125></script>
|
|
10
11
|
<script src=game.js?125></script>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
rem Simple build script for LittleJS by Frank Force
|
|
2
|
+
rem Minfies and combines index.html and index.js and zips the result
|
|
3
|
+
|
|
4
|
+
set NAME=game
|
|
5
|
+
set BUILD_FOLDER=build
|
|
6
|
+
set BUILD_FILENAME=index.js
|
|
7
|
+
|
|
8
|
+
rem remove old files
|
|
9
|
+
rmdir /s /q %BUILD_FOLDER%
|
|
10
|
+
mkdir %BUILD_FOLDER%
|
|
11
|
+
pushd %BUILD_FOLDER%
|
|
12
|
+
|
|
13
|
+
rem copy engine release build
|
|
14
|
+
type ..\..\..\build\littlejs.release.js >> %BUILD_FILENAME%
|
|
15
|
+
echo. >> %BUILD_FILENAME%
|
|
16
|
+
|
|
17
|
+
rem add your game's files to include here
|
|
18
|
+
type ..\game.js >> %BUILD_FILENAME%
|
|
19
|
+
echo. >> %BUILD_FILENAME%
|
|
20
|
+
|
|
21
|
+
rem copy images to build folder
|
|
22
|
+
copy ..\tiles.png tiles.png
|
|
23
|
+
|
|
24
|
+
rem minify code with uglify
|
|
25
|
+
call npx uglifyjs -o %BUILD_FILENAME% --compress --mangle -- %BUILD_FILENAME%
|
|
26
|
+
if %ERRORLEVEL% NEQ 0 (
|
|
27
|
+
pause
|
|
28
|
+
exit /b %ERRORLEVEL%
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
rem build the html, you can add html header and footers here
|
|
32
|
+
rem type ..\header.html >> index.html
|
|
33
|
+
echo ^<body^>^<script^> >> index.html
|
|
34
|
+
type %BUILD_FILENAME% >> index.html
|
|
35
|
+
echo ^</script^> >> index.html
|
|
36
|
+
|
|
37
|
+
rem delete intermediate files
|
|
38
|
+
del %BUILD_FILENAME%
|
|
39
|
+
|
|
40
|
+
rem copy elecron files to build folder
|
|
41
|
+
copy ..\electron.js electron.js
|
|
42
|
+
copy ..\package.json package.json
|
|
43
|
+
|
|
44
|
+
popd
|
|
45
|
+
|
|
46
|
+
rem build with electron
|
|
47
|
+
call npx electron-packager ./%BUILD_FOLDER% --overwrite
|
|
48
|
+
if %ERRORLEVEL% NEQ 0 (
|
|
49
|
+
pause
|
|
50
|
+
exit /b %ERRORLEVEL%
|
|
51
|
+
)
|
|
52
|
+
pause
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
// Modules to control application life and create native browser window
|
|
2
|
-
const {app, BrowserWindow} = require('electron')
|
|
3
|
-
const path = require('path')
|
|
2
|
+
const { app, BrowserWindow } = require('electron')
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
const createWindow = () => {
|
|
6
5
|
// Create the browser window.
|
|
7
6
|
const mainWindow = new BrowserWindow({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
height: 576,
|
|
11
|
-
webPreferences: {
|
|
12
|
-
preload: path.join(__dirname, 'preload.js')
|
|
13
|
-
}
|
|
7
|
+
width: 800,
|
|
8
|
+
height: 600
|
|
14
9
|
})
|
|
15
|
-
|
|
10
|
+
|
|
16
11
|
// hide menu
|
|
17
12
|
mainWindow.setMenu(null);
|
|
18
13
|
//mainWindow.setFullScreen(true);
|
|
@@ -27,20 +22,22 @@ function createWindow () {
|
|
|
27
22
|
// This method will be called when Electron has finished
|
|
28
23
|
// initialization and is ready to create browser windows.
|
|
29
24
|
// Some APIs can only be used after this event occurs.
|
|
30
|
-
app.whenReady().then(
|
|
25
|
+
app.whenReady().then(() => {
|
|
26
|
+
createWindow()
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
app.on('activate', () => {
|
|
29
|
+
// On macOS it's common to re-create a window in the app when the
|
|
30
|
+
// dock icon is clicked and there are no other windows open.
|
|
31
|
+
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
|
32
|
+
})
|
|
37
33
|
})
|
|
38
34
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
// Quit when all windows are closed, except on macOS. There, it's common
|
|
36
|
+
// for applications and their menu bar to stay active until the user quits
|
|
37
|
+
// explicitly with Cmd + Q.
|
|
38
|
+
app.on('window-all-closed', () => {
|
|
39
|
+
if (process.platform !== 'darwin') app.quit()
|
|
43
40
|
})
|
|
44
41
|
|
|
45
42
|
// In this file you can include the rest of your app's specific main process
|
|
46
|
-
// code. You can also put them in separate files and require them here.
|
|
43
|
+
// code. You can also put them in separate files and require them here.
|
|
@@ -103,7 +103,7 @@ function gameRender()
|
|
|
103
103
|
function gameRenderPost()
|
|
104
104
|
{
|
|
105
105
|
// draw to overlay canvas for hud rendering
|
|
106
|
-
drawTextScreen('
|
|
106
|
+
drawTextScreen('LittleJS Engine Demo', vec2(mainCanvasSize.x/2, 80), 80);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
<body><script>
|
|
2
|
+
eval(Function("[M='DYhuJzCBV~LKby?Vt_b^ejSdE[eOF]^xwJzztBUSE|iPNBKKb?dBsnnlAtsdW{Bah}DrNQBAvepYbgAd|MkbArM~O||rTzOp@j@plQJwXWvVhjJOIAP]qltDKs]}eKr_hNM[lCb@AimlGZse}EkgtrHOvPEpL_wCglz}RRMIaRQzRhG{}zBgw@o]PR]~GKdRJGuuTSzzixXpGA}gRynsIAu{Sw{F}R|LIG@CsRCM`JUJvCzAYYZu@oL[I|WDTw|soA_N|ancvowsba{YWMEFfRfNMYRp_TvI~Fx`ZQzun_?[FQ@j?nsDgS}HlS_G~]h^vAvy^dSsvmUzvoHPLSdEgeGgYV{KTFMcq?byagUHA{yNhjvosWF|J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EjXCkvO`gZSL?NW}PBGqaObGE]Qw[UZtEv~xLk@^~oSXWBaOmjnNQYh^H~KQbhox?X{uNa}aJJf}Qc~`}_MtvjXcNr@?VafbhkRFJqCSFe``I{yqFMjmUVB^fau~}ieSUcEOe`l?VWThanHwXPU`fGHFruFQm`h~`{|GVHv~_Wbz_v]`_TLuGYp_RZvFtTn@@PUTSMWXRNnoEaYKNT{sqQIHt_UUvA|ziPqvbQi~t@s]QmrQaYxpIFHqdYxsRSrUb^GhDk`@wYE^JFABqmjKtkWwWkWfMM}Yj~bvgd`WQYefZg}YqJ'",...']charCodeAtUinyxp',"for(;e<13590;c[e++]=x-128)for(x=1;x<128;n=p.map((i,y)=>(t=r[i]*2+1,t=Math.log(t/(h-t)),A-=a[y]*t,t/750)),A=~-h/(1+Math.exp(A))|1,U=o%h<A,o=o%h+(U?A:h-A)*(o>>13)-!U*A,p.map((i,y)=>(t=r[i]+=(U*h/2-r[i]<<17)/((C[i]+=C[i]<5)+.1)>>17,a[y]+=n[y]*(U-A/h))),x=x*2+U)for(p='010202103203210431053105410642065206541'.split(A=0).map((i,y)=>(t=0,[...i].map((i,y)=>(t=t*997+(c[e-i]|0)|0)),h*512-1&t*997+x)*12+y);o<h*512;o=o*64|M.charCodeAt(d++)&63);for(C=String.fromCharCode(...c);r=/[\0-]/.exec(C);)with(C.split(r))C=join(shift());return C")([],[],1<<13,[0,0,0,0,0,0,0,0,0,0,0,0],new Uint16Array(51e6).fill(1<<11),new Uint8Array(51e6),0,0,0))</script>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "LittleJSGame",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A minimal Electron application",
|
|
5
|
+
"main": "electron.js",
|
|
6
|
+
"scripts": {},
|
|
7
|
+
"repository": "https://github.com/electron/electron-quick-start",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"Electron",
|
|
10
|
+
"LittleJS",
|
|
11
|
+
"Game"
|
|
12
|
+
],
|
|
13
|
+
"author": "GitHub",
|
|
14
|
+
"license": "CC0-1.0",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"electron": "~25.2.0",
|
|
17
|
+
"electron-packager": "~17.1.1"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {}
|
|
20
|
+
}
|
package/examples/empty/game.js
CHANGED
|
@@ -27,7 +27,7 @@ function gameRender()
|
|
|
27
27
|
///////////////////////////////////////////////////////////////////////////////
|
|
28
28
|
function gameRenderPost()
|
|
29
29
|
{
|
|
30
|
-
drawTextScreen('
|
|
30
|
+
drawTextScreen('Hello World!', mainCanvasSize.scale(.5), 80);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
///////////////////////////////////////////////////////////////////////////////
|
package/examples/module/game.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<html><head>
|
|
2
|
+
<title>Little JS Module Demo</title>
|
|
2
3
|
<meta name=viewport content=width=device-width,height=device-height,initial-scale=1,maximum-scale=1>
|
|
3
4
|
<meta name=apple-mobile-web-app-capable content=yes>
|
|
4
5
|
<meta name=mobile-web-app-capable content=yes>
|
|
5
|
-
<link rel=icon type=image/png href
|
|
6
|
+
<link rel=icon type=image/png href=../favicon.png>
|
|
6
7
|
</head><body>
|
|
7
8
|
|
|
8
9
|
<!-- Add your game scripts here -->
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<html><head>
|
|
2
|
+
<title>Little JS Particle System Designer</title>
|
|
2
3
|
<meta name=viewport content=width=device-width,height=device-height,initial-scale=1,maximum-scale=1>
|
|
3
4
|
<meta name=apple-mobile-web-app-capable content=yes>
|
|
4
5
|
<meta name=mobile-web-app-capable content=yes>
|
|
5
|
-
<link rel=icon type=image/png href
|
|
6
|
+
<link rel=icon type=image/png href=../favicon.png>
|
|
6
7
|
<style>
|
|
7
8
|
input
|
|
8
9
|
{
|
|
@@ -15,7 +16,7 @@ button
|
|
|
15
16
|
</style>
|
|
16
17
|
</head><body>
|
|
17
18
|
|
|
18
|
-
<script src=../../
|
|
19
|
+
<script src=../../build/littlejs.js?125></script>
|
|
19
20
|
<script>
|
|
20
21
|
|
|
21
22
|
'use strict';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<html><head>
|
|
2
|
+
<title>Little JS Platforming Game Demo</title>
|
|
2
3
|
<meta name=viewport content=width=device-width,height=device-height,initial-scale=1,maximum-scale=1>
|
|
3
4
|
<meta name=apple-mobile-web-app-capable content=yes>
|
|
4
5
|
<meta name=mobile-web-app-capable content=yes>
|
|
5
|
-
<link rel=icon type=image/png href
|
|
6
|
+
<link rel=icon type=image/png href=../favicon.png>
|
|
6
7
|
</head><body>
|
|
7
8
|
|
|
8
|
-
<script src=../../
|
|
9
|
+
<script src=../../build/littlejs.js?125></script>
|
|
9
10
|
<script src=gameObjects.js?125></script>
|
|
10
11
|
<script src=gamePlayer.js?125></script>
|
|
11
12
|
<script src=gameEffects.js?125></script>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<html><head>
|
|
2
|
+
<title>Little Puzzle Game Demo</title>
|
|
2
3
|
<meta name=viewport content=width=device-width,height=device-height,initial-scale=1,maximum-scale=1>
|
|
3
4
|
<meta name=apple-mobile-web-app-capable content=yes>
|
|
4
5
|
<meta name=mobile-web-app-capable content=yes>
|
|
5
|
-
<link rel=icon type=image/png href
|
|
6
|
+
<link rel=icon type=image/png href=../favicon.png>
|
|
6
7
|
</head><body>
|
|
7
8
|
|
|
8
|
-
<script src=../../
|
|
9
|
+
<script src=../../build/littlejs.js?125></script>
|
|
9
10
|
<script src=game.js?125></script>
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
rem Simple build script for LittleJS by Frank Force
|
|
2
2
|
rem Minfies and combines index.html and index.js and zips the result
|
|
3
|
-
rem Run buildSetup.bat to install required dependencies.
|
|
4
3
|
|
|
5
4
|
set NAME=game
|
|
6
5
|
set BUILD_FOLDER=build
|
|
7
6
|
set BUILD_FILENAME=index.js
|
|
8
7
|
|
|
9
|
-
rem
|
|
10
|
-
|
|
11
|
-
call engineBuild.bat
|
|
12
|
-
if %ERRORLEVEL% NEQ 0 (
|
|
13
|
-
pause
|
|
14
|
-
exit /b %ERRORLEVEL%
|
|
15
|
-
)
|
|
16
|
-
cd ..
|
|
8
|
+
rem install dev packages
|
|
9
|
+
rem call npm install
|
|
17
10
|
|
|
18
11
|
rem remove old files
|
|
19
12
|
del %NAME%.zip
|
|
@@ -21,8 +14,18 @@ rmdir /s /q %BUILD_FOLDER%
|
|
|
21
14
|
|
|
22
15
|
rem copy engine release build
|
|
23
16
|
mkdir %BUILD_FOLDER%
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
pushd %BUILD_FOLDER%
|
|
18
|
+
|
|
19
|
+
rem rebuild engine first
|
|
20
|
+
pushd ..\..\..\src
|
|
21
|
+
call engineBuild.bat
|
|
22
|
+
if %ERRORLEVEL% NEQ 0 (
|
|
23
|
+
pause
|
|
24
|
+
exit /b %ERRORLEVEL%
|
|
25
|
+
)
|
|
26
|
+
popd
|
|
27
|
+
|
|
28
|
+
type ..\..\..\build\littlejs.release.js >> %BUILD_FILENAME%
|
|
26
29
|
echo. >> %BUILD_FILENAME%
|
|
27
30
|
|
|
28
31
|
rem add your game's files to include here
|
|
@@ -41,9 +44,8 @@ if %ERRORLEVEL% NEQ 0 (
|
|
|
41
44
|
)
|
|
42
45
|
del temp_%BUILD_FILENAME%
|
|
43
46
|
|
|
44
|
-
rem more minification with uglify
|
|
47
|
+
rem more minification with uglify
|
|
45
48
|
call npx uglifyjs -o %BUILD_FILENAME% --compress --mangle -- %BUILD_FILENAME%
|
|
46
|
-
rem call terser -o %BUILD_FILENAME% --compress --mangle -- %BUILD_FILENAME%
|
|
47
49
|
if %ERRORLEVEL% NEQ 0 (
|
|
48
50
|
pause
|
|
49
51
|
exit /b %ERRORLEVEL%
|
|
@@ -66,12 +68,10 @@ rem delete intermediate files
|
|
|
66
68
|
del %BUILD_FILENAME%
|
|
67
69
|
|
|
68
70
|
rem zip the result, ect is recommended
|
|
69
|
-
call
|
|
71
|
+
call ..\..\..\node_modules\ect-bin\vendor\win32\ect.exe -9 -strip -zip ..\%NAME%.zip index.html tiles.png
|
|
70
72
|
if %ERRORLEVEL% NEQ 0 (
|
|
71
73
|
pause
|
|
72
74
|
exit /b %ERRORLEVEL%
|
|
73
75
|
)
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
rem pause to see result
|
|
77
|
+
popd
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/*
|
|
2
|
+
LittleJS Hello World Starter Game
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
// sound effects
|
|
8
|
+
const sound_click = new Sound([1,.5]);
|
|
9
|
+
|
|
10
|
+
// medals
|
|
11
|
+
const medal_example = new Medal(0, 'Example Medal', 'Welcome to LittleJS!');
|
|
12
|
+
medalsInit('Hello World');
|
|
13
|
+
|
|
14
|
+
// game variables
|
|
15
|
+
let particleEmiter;
|
|
16
|
+
|
|
17
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
18
|
+
function gameInit()
|
|
19
|
+
{
|
|
20
|
+
// create tile collision and visible tile layer
|
|
21
|
+
initTileCollision(vec2(32, 16));
|
|
22
|
+
const pos = vec2();
|
|
23
|
+
const tileLayer = new TileLayer(pos, tileCollisionSize);
|
|
24
|
+
|
|
25
|
+
// get level data from the tiles image
|
|
26
|
+
const imageLevelDataRow = 1;
|
|
27
|
+
mainContext.drawImage(tileImage, 0, 0);
|
|
28
|
+
for (pos.x = tileCollisionSize.x; pos.x--;)
|
|
29
|
+
for (pos.y = tileCollisionSize.y; pos.y--;)
|
|
30
|
+
{
|
|
31
|
+
const imageData = mainContext.getImageData(pos.x, 16*(imageLevelDataRow+1)-pos.y-1, 1, 1).data;
|
|
32
|
+
if (imageData[0])
|
|
33
|
+
{
|
|
34
|
+
const tileIndex = 1;
|
|
35
|
+
const direction = randInt(4)
|
|
36
|
+
const mirror = randInt(2);
|
|
37
|
+
const color = randColor();
|
|
38
|
+
const data = new TileLayerData(tileIndex, direction, mirror, color);
|
|
39
|
+
tileLayer.setData(pos, data);
|
|
40
|
+
setTileCollisionData(pos, 1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
tileLayer.redraw();
|
|
44
|
+
|
|
45
|
+
// move camera to center of collision
|
|
46
|
+
cameraPos = tileCollisionSize.scale(.5);
|
|
47
|
+
|
|
48
|
+
// enable gravity
|
|
49
|
+
gravity = -.01;
|
|
50
|
+
|
|
51
|
+
// create particle emitter
|
|
52
|
+
particleEmiter = new ParticleEmitter(
|
|
53
|
+
vec2(16), 0, // emitPos, emitAngle
|
|
54
|
+
1, 0, 500, PI, // emitSize, emitTime, emitRate, emiteCone
|
|
55
|
+
0, vec2(16), // tileIndex, tileSize
|
|
56
|
+
new Color(1,1,1), new Color(0,0,0), // colorStartA, colorStartB
|
|
57
|
+
new Color(1,1,1,0), new Color(0,0,0,0), // colorEndA, colorEndB
|
|
58
|
+
2, .2, .2, .1, .05, // time, sizeStart, sizeEnd, speed, angleSpeed
|
|
59
|
+
.99, 1, 1, PI, // damping, angleDamping, gravityScale, cone
|
|
60
|
+
.05, .5, 1, 1 // fadeRate, randomness, collide, additive
|
|
61
|
+
);
|
|
62
|
+
particleEmiter.elasticity = .3; // bounce when it collides
|
|
63
|
+
particleEmiter.trailScale = 2; // stretch in direction of motion
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
67
|
+
function gameUpdate()
|
|
68
|
+
{
|
|
69
|
+
if (mouseWasPressed(0))
|
|
70
|
+
{
|
|
71
|
+
// play sound when mouse is pressed
|
|
72
|
+
sound_click.play(mousePos);
|
|
73
|
+
|
|
74
|
+
// change particle color and set to fade out
|
|
75
|
+
particleEmiter.colorStartA = new Color;
|
|
76
|
+
particleEmiter.colorStartB = randColor();
|
|
77
|
+
particleEmiter.colorEndA = particleEmiter.colorStartA.scale(1,0);
|
|
78
|
+
particleEmiter.colorEndB = particleEmiter.colorStartB.scale(1,0);
|
|
79
|
+
|
|
80
|
+
// unlock medals
|
|
81
|
+
medal_example.unlock();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// move particles to mouse location if on screen
|
|
85
|
+
if (mousePosScreen.x)
|
|
86
|
+
particleEmiter.pos = mousePos;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
90
|
+
function gameUpdatePost()
|
|
91
|
+
{
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
96
|
+
function gameRender()
|
|
97
|
+
{
|
|
98
|
+
// draw a grey square in the background without using webgl
|
|
99
|
+
drawRect(cameraPos, tileCollisionSize.add(vec2(5)), new Color(.2,.2,.2), 0, 0);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
103
|
+
function gameRenderPost()
|
|
104
|
+
{
|
|
105
|
+
// draw to overlay canvas for hud rendering
|
|
106
|
+
drawTextScreen('LittleJS Engine Demo', vec2(mainCanvasSize.x/2, 80), 80);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
110
|
+
// Startup LittleJS Engine
|
|
111
|
+
engineInit(gameInit, gameUpdate, gameUpdatePost, gameRender, gameRenderPost, 'tiles.png');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<html><head>
|
|
2
|
+
<title>Little JS Starter Project</title>
|
|
3
|
+
<meta name=viewport content=width=device-width,height=device-height,initial-scale=1,maximum-scale=1>
|
|
4
|
+
<meta name=apple-mobile-web-app-capable content=yes>
|
|
5
|
+
<meta name=mobile-web-app-capable content=yes>
|
|
6
|
+
<link rel=icon type=image/png href=../favicon.png>
|
|
7
|
+
</head><body>
|
|
8
|
+
|
|
9
|
+
<!-- LittleJS engine scripts -->
|
|
10
|
+
<script src=../../src/engineDebug.js?125></script>
|
|
11
|
+
<script src=../../src/engineUtilities.js?125></script>
|
|
12
|
+
<script src=../../src/engineSettings.js?125></script>
|
|
13
|
+
<script src=../../src/engineObject.js?125></script>
|
|
14
|
+
<script src=../../src/engineDraw.js?125></script>
|
|
15
|
+
<script src=../../src/engineInput.js?125></script>
|
|
16
|
+
<script src=../../src/engineAudio.js?125></script>
|
|
17
|
+
<script src=../../src/engineTileLayer.js?125></script>
|
|
18
|
+
<script src=../../src/engineParticles.js?125></script>
|
|
19
|
+
<script src=../../src/engineMedals.js?125></script>
|
|
20
|
+
<script src=../../src/engineWebGL.js?125></script>
|
|
21
|
+
<script src=../../src/engine.js?125></script>
|
|
22
|
+
|
|
23
|
+
<!-- You can also include all engine scripts like this... -->
|
|
24
|
+
<!-- <script src=engine/engine.all.js></script> -->
|
|
25
|
+
|
|
26
|
+
<!-- Add your game scripts here -->
|
|
27
|
+
<script src=game.js?125></script>
|
|
Binary file
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<html><head>
|
|
2
|
+
<title>Little JS Stress Test</title>
|
|
2
3
|
<meta name=viewport content=width=device-width,height=device-height,initial-scale=1,maximum-scale=1>
|
|
3
4
|
<meta name=apple-mobile-web-app-capable content=yes>
|
|
4
5
|
<meta name=mobile-web-app-capable content=yes>
|
|
5
|
-
<link rel=icon type=image/png href
|
|
6
|
+
<link rel=icon type=image/png href=../favicon.png>
|
|
6
7
|
</head><body>
|
|
7
8
|
|
|
8
|
-
<script src=../../
|
|
9
|
+
<script src=../../build/littlejs.min.js?125></script>
|
|
9
10
|
<script>
|
|
10
11
|
|
|
11
12
|
/*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
// import module
|
|
6
|
-
import * as LittleJS from '../../
|
|
6
|
+
import * as LittleJS from '../../build/littlejs.esm.js';
|
|
7
7
|
const { Vector2, Color, Timer, vec2 } = LittleJS;
|
|
8
8
|
// sound effects
|
|
9
9
|
const sound_click = new LittleJS.Sound([1, .5]);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<html><head>
|
|
2
|
+
<title>Little TypeScript Demo</title>
|
|
2
3
|
<meta name=viewport content=width=device-width,height=device-height,initial-scale=1,maximum-scale=1>
|
|
3
4
|
<meta name=apple-mobile-web-app-capable content=yes>
|
|
4
5
|
<meta name=mobile-web-app-capable content=yes>
|
|
5
|
-
<link rel=icon type=image/png href
|
|
6
|
+
<link rel=icon type=image/png href=../favicon.png>
|
|
6
7
|
</head><body>
|
|
7
8
|
|
|
8
9
|
<!-- Add your game scripts here -->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "littlejsengine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "LittleJS - Tiny and Fast HTML5 Game Engine",
|
|
5
5
|
"main": "engine/engine.all.module.js",
|
|
6
6
|
"repository": {
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/KilledByAPixel/LittleJS",
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "
|
|
26
|
+
"build": "cd src && engineBuild.bat"
|
|
27
27
|
},
|
|
28
|
-
"
|
|
28
|
+
"devDependencies": {
|
|
29
29
|
"ect-bin": "~1.4.1",
|
|
30
30
|
"google-closure-compiler": "~20230502.0.0",
|
|
31
31
|
"roadroller": "~2.1.0",
|