littlejsengine 1.14.4 → 1.14.5
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 +2 -2
- package/dist/littlejs.esm.js +7 -7
- package/dist/littlejs.esm.min.js +1 -1
- package/dist/littlejs.js +7 -7
- package/dist/littlejs.min.js +1 -1
- package/dist/littlejs.release.js +1 -1
- package/examples/shorts/music.js +3 -3
- package/package.json +1 -1
- package/reference.md +1 -1
- package/src/engine.js +1 -1
- package/src/engineDebug.js +6 -6
package/examples/shorts/music.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Music player variables
|
|
2
2
|
let musicSound = new SoundWave('song.mp3');
|
|
3
|
-
let musicVolume =
|
|
3
|
+
let musicVolume = 1;
|
|
4
4
|
let musicInstance;
|
|
5
5
|
|
|
6
6
|
// UI elements
|
|
@@ -10,8 +10,8 @@ function gameInit()
|
|
|
10
10
|
{
|
|
11
11
|
// load ui system plugin
|
|
12
12
|
new UISystemPlugin;
|
|
13
|
-
uiSystem.defaultSoundPress = new Sound([.
|
|
14
|
-
uiSystem.defaultSoundClick = new Sound([.
|
|
13
|
+
uiSystem.defaultSoundPress = new Sound([.5,0,220]);
|
|
14
|
+
uiSystem.defaultSoundClick = new Sound([.5,0,440]);
|
|
15
15
|
uiSystem.defaultCornerRadius = 20;
|
|
16
16
|
|
|
17
17
|
// setup music player UI
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -426,7 +426,7 @@ particleEmitRateScale = 1 // Scales particles emit rate
|
|
|
426
426
|
```javascript
|
|
427
427
|
ASSERT(assert, output) // Asserts if the expression is false
|
|
428
428
|
debugRect(pos, size, color='#fff', time=0, angle=0, fill) // Draw debug rectangle
|
|
429
|
-
debugCircle(pos,
|
|
429
|
+
debugCircle(pos, size, color='#fff', time=0, fill) // Draw debug circle
|
|
430
430
|
debugPoint(pos, color, time, angle) // Draw debug point
|
|
431
431
|
debugLine(posA, posB, color, width=.1, time) // Draw debug line
|
|
432
432
|
debugText(text, pos, size=1, color='#fff', time=0, angle=0) // Draw debug text
|
package/src/engine.js
CHANGED
package/src/engineDebug.js
CHANGED
|
@@ -94,15 +94,15 @@ function debugPoly(pos, points, color='#fff', time=0, angle=0, fill=false)
|
|
|
94
94
|
|
|
95
95
|
/** Draw a debug circle in world space
|
|
96
96
|
* @param {Vector2} pos
|
|
97
|
-
* @param {number} [
|
|
97
|
+
* @param {number} [size] - diameter
|
|
98
98
|
* @param {string} [color]
|
|
99
99
|
* @param {number} [time]
|
|
100
100
|
* @param {boolean} [fill]
|
|
101
101
|
* @memberof Debug */
|
|
102
|
-
function debugCircle(pos,
|
|
102
|
+
function debugCircle(pos, size=0, color='#fff', time=0, fill=false)
|
|
103
103
|
{
|
|
104
104
|
ASSERT(typeof color === 'string', 'pass in css color strings');
|
|
105
|
-
debugPrimitives.push({pos, size
|
|
105
|
+
debugPrimitives.push({pos, size, color, time:new Timer(time), angle:0, fill});
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/** Draw a debug point in world space
|
|
@@ -302,7 +302,7 @@ function debugRender()
|
|
|
302
302
|
{
|
|
303
303
|
const drawPos = centerPos.add(vec2(j*stickScale*2, i*stickScale*3));
|
|
304
304
|
const stickPos = drawPos.add(sticks[j].scale(stickScale));
|
|
305
|
-
debugCircle(drawPos, stickScale, '#fff7',0,true);
|
|
305
|
+
debugCircle(drawPos, stickScale*2, '#fff7',0,true);
|
|
306
306
|
debugLine(drawPos, stickPos, '#f00');
|
|
307
307
|
debugPoint(stickPos, '#f00');
|
|
308
308
|
}
|
|
@@ -310,7 +310,7 @@ function debugRender()
|
|
|
310
310
|
{
|
|
311
311
|
const drawPos = centerPos.add(vec2(j*buttonScale*2, i*stickScale*3-stickScale-buttonScale));
|
|
312
312
|
const pressed = gamepad.buttons[j].pressed;
|
|
313
|
-
debugCircle(drawPos, buttonScale, pressed ? '#f00' : '#fff7', 0, true);
|
|
313
|
+
debugCircle(drawPos, buttonScale*2, pressed ? '#f00' : '#fff7', 0, true);
|
|
314
314
|
debugText(''+j, drawPos, .2);
|
|
315
315
|
}
|
|
316
316
|
}
|
|
@@ -410,7 +410,7 @@ function debugRender()
|
|
|
410
410
|
{
|
|
411
411
|
// circle
|
|
412
412
|
overlayContext.beginPath();
|
|
413
|
-
overlayContext.arc(0, 0, p.size*cameraScale, 0, 9);
|
|
413
|
+
overlayContext.arc(0, 0, p.size*cameraScale/2, 0, 9);
|
|
414
414
|
p.fill && overlayContext.fill();
|
|
415
415
|
overlayContext.stroke();
|
|
416
416
|
}
|