littlejsengine 1.6.92 → 1.7.11
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 +31 -24
- package/build/littlejs.d.ts +87 -60
- package/build/littlejs.esm.js +322 -189
- package/build/littlejs.esm.min.js +1 -1
- package/build/littlejs.js +316 -185
- package/build/littlejs.min.js +1 -1
- package/build/littlejs.release.js +296 -182
- package/examples/breakout/index.html +3 -3
- package/examples/breakoutTutorial/index.html +2 -2
- package/examples/electron/index.html +2 -2
- package/examples/js13k/index.html +13 -13
- package/examples/module/index.html +1 -1
- package/examples/particles/index.html +1 -1
- package/examples/platformer/gameEffects.js +11 -10
- 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 +4 -4
- package/examples/typescript/index.html +1 -1
- package/package.json +1 -1
- package/src/engine.js +2 -2
- package/src/engineAudio.js +43 -15
- package/src/engineBuild.js +18 -5
- package/src/engineDebug.js +21 -5
- package/src/engineDraw.js +61 -60
- package/src/engineExport.js +6 -4
- package/src/engineInput.js +26 -34
- package/src/engineObject.js +2 -2
- package/src/engineRelease.js +1 -2
- package/src/engineSettings.js +1 -0
- package/src/engineUtilities.js +95 -40
- package/src/engineWebGL.js +63 -27
package/README.md
CHANGED
|
@@ -6,66 +6,72 @@
|
|
|
6
6
|
[![DeepScan][deepscan]][deepscan-url]
|
|
7
7
|
[![Discord][discord]][discord-url]
|
|
8
8
|
|
|
9
|
-
## All aboard!
|
|
9
|
+
## 🚂 All aboard!
|
|
10
|
+
|
|
11
|
+
LittleJS is a lightweight open source HTML5 game engine designed for modern web development.
|
|
12
|
+
It's small footprint is packed with a comprehensive feature set, including hybrid rendering, physics, particles, sound effects, music, input handling, and debug tools.
|
|
13
|
+
The code is very clean and well documented with a several examples to get you started. Choo-Choo! 🚂
|
|
10
14
|
|
|
11
|
-
LittleJS is a super lightweight JavaScript game engine designed for modern web development. With its fast hybrid rendering system, it offers a comprehensive suite of game development tools from rendering to sound effects. The code is very clean and well documented with a variety of examples to get you started. Choo-Choo! 🚂
|
|
12
15
|
<div align="center">
|
|
13
|
-
|
|
16
|
+
|
|
14
17
|
## [Demo](https://killedbyapixel.github.io/LittleJS/examples/starter/) | [Docs](https://killedbyapixel.github.io/LittleJS/docs) | [Trailer](https://youtu.be/chuBzGjv7Ms) | [Discord](https://discord.gg/zb7hcGkyZe) | [Tutorial](https://github.com/KilledByAPixel/LittleJS/tree/main/examples/breakoutTutorial)
|
|
18
|
+
|
|
15
19
|
</div>
|
|
16
20
|
|
|
17
21
|

|
|
18
22
|
|
|
19
|
-
## Demos
|
|
20
|
-
|
|
21
|
-
### [Starter Project](https://killedbyapixel.github.io/LittleJS/examples/starter/) - Clean example with only a few things to get you started
|
|
22
|
-
### [Puzzle Game](https://killedbyapixel.github.io/LittleJS/examples/puzzle/) - Match 3 puzzle game with HD rendering and high score tracking
|
|
23
|
-
### [Platformer](https://killedbyapixel.github.io/LittleJS/examples/platformer/) - Platformer/shooter with procedural generation and destruction
|
|
24
|
-
### [Breakout](https://killedbyapixel.github.io/LittleJS/examples/breakout/) - Breakout game with post processing effect
|
|
25
|
-
### [Stress Test](https://killedbyapixel.github.io/LittleJS/examples/stress/) - Max sprite/object test and music system demo
|
|
26
|
-
### [Particle System Designer](https://killedbyapixel.github.io/LittleJS/examples/particles/) - Particle system editor and visualizer
|
|
27
|
-
|
|
28
23
|
## About LittleJS
|
|
29
24
|
|
|
30
25
|
LittleJS is a small but powerful game engine with many features and no depenencies.
|
|
31
26
|
|
|
32
|
-
### Graphics
|
|
27
|
+
### ✨ Graphics
|
|
33
28
|
|
|
34
29
|
- Super fast sprite and tile map rendering engine with WebGL
|
|
35
30
|
- Update and render 10,000+ objects at 60fps, often many times more
|
|
31
|
+
- Particle effect system and [design tool](https://killedbyapixel.github.io/LittleJS/examples/particles/)
|
|
36
32
|
- Apply [Shadertoy](https://www.shadertoy.com) compatible shaders for post processinge effects
|
|
37
33
|
|
|
38
|
-
### Audio
|
|
34
|
+
### 🔊 Audio
|
|
39
35
|
|
|
40
36
|
- Positional sound effects with [ZzFX](https://killedbyapixel.github.io/ZzFX/) sound effect generator
|
|
41
37
|
- Music with [ZzFXM](https://keithclark.github.io/ZzFXM/), mp3, or wav audio
|
|
42
38
|
|
|
43
|
-
### Input
|
|
39
|
+
### 🎮 Input
|
|
44
40
|
|
|
45
41
|
- Input processing system for keyboard, mouse, gamepad, and touch
|
|
46
42
|
- On screen touch gamepad for mobile devices
|
|
47
43
|
|
|
48
|
-
### Physics
|
|
44
|
+
### 💥 Physics
|
|
49
45
|
|
|
50
46
|
- 2D physics engine with collision handling for axis aligned boxes
|
|
51
47
|
- Very fast collision handling and raycasting for tile maps
|
|
52
48
|
|
|
53
|
-
### Flexability
|
|
49
|
+
### 🚀 Flexability
|
|
54
50
|
|
|
55
51
|
- Designed to work with all modern web bowsers and mobile devices
|
|
56
|
-
- Compatible with TypeScript and
|
|
52
|
+
- Compatible with TypeScript and Modules with example projects for both
|
|
57
53
|
- For size coding competitions like [js13kGames](https://js13kgames.com/), [a special example project builds to a 7KB zip file](https://killedbyapixel.github.io/LittleJS/examples/js13k)
|
|
58
|
-
- Builds to a Windows executable with [Electron](https://www.electronjs.org/) for distribution on platforms like Steam
|
|
59
|
-
- Open Source with the [MIT license](https://github.com/KilledByAPixel/LittleJS/blob/main/LICENSE) so it can be used for anything you want
|
|
54
|
+
- Builds to a Windows executable with [Electron](https://www.electronjs.org/) for distribution on PC platforms like Steam
|
|
55
|
+
- Open Source with the [MIT license](https://github.com/KilledByAPixel/LittleJS/blob/main/LICENSE) so it can be used for anything you want forever
|
|
60
56
|
|
|
61
|
-
### And more...
|
|
57
|
+
### 🛠️ And more...
|
|
62
58
|
|
|
63
59
|
- Node.js build system
|
|
64
|
-
-
|
|
60
|
+
- 2D vector math library
|
|
61
|
+
- Debug primitive rendering system
|
|
65
62
|
- Particle effects system and design tool
|
|
66
63
|
- Bitmap font rendering and includes a built in engine font
|
|
67
64
|
- Medal system tracks and displays achievements with Newgrounds integration
|
|
68
65
|
|
|
66
|
+
## Demos
|
|
67
|
+
|
|
68
|
+
### [Starter Project](https://killedbyapixel.github.io/LittleJS/examples/starter/) - Clean example with only a few things to get you started
|
|
69
|
+
### [Puzzle Game](https://killedbyapixel.github.io/LittleJS/examples/puzzle/) - Match 3 puzzle game with HD rendering and high score tracking
|
|
70
|
+
### [Platformer](https://killedbyapixel.github.io/LittleJS/examples/platformer/) - Platformer/shooter with procedural generation and destruction
|
|
71
|
+
### [Breakout](https://killedbyapixel.github.io/LittleJS/examples/breakout/) - Breakout game with post processing effect
|
|
72
|
+
### [Stress Test](https://killedbyapixel.github.io/LittleJS/examples/stress/) - Max sprite/object test and music system demo
|
|
73
|
+
### [Particle System Designer](https://killedbyapixel.github.io/LittleJS/examples/particles/) - Particle system editor and visualizer
|
|
74
|
+
|
|
69
75
|
## How to use LittleJS
|
|
70
76
|
|
|
71
77
|
To use LittleJS download the latest package from GitHub or call ```npm install littlejsengine```. This package contains the engine and several small examples.
|
|
@@ -95,7 +101,8 @@ The starter example project also includes a node js file [build.js](https://gith
|
|
|
95
101
|
|
|
96
102
|
## Engine Source Code
|
|
97
103
|
|
|
98
|
-
This engine is made with simplicity in mind using clean easy to read code.
|
|
104
|
+
This engine is made with simplicity in mind using clean easy to read code.
|
|
105
|
+
There are only a few core files used by the entire engine.
|
|
99
106
|
|
|
100
107
|
- [engine.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engine.js) - Top level engine init, update, and render
|
|
101
108
|
- [engineSettings.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineSettings.js) - Global engine settings
|
|
@@ -105,7 +112,7 @@ This engine is made with simplicity in mind using clean easy to read code. There
|
|
|
105
112
|
- [engineInput.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineInput.js) - Input for keyboard, mouse, touch, and gamepad
|
|
106
113
|
- [engineUtilities.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineUtilities.js) - Vector2, Color, and Timer clases and math functions
|
|
107
114
|
|
|
108
|
-
Optional Components, these components are built to synergize with the rest of the engine but are not
|
|
115
|
+
Optional Components, these components are built to synergize with the rest of the engine but are not required.
|
|
109
116
|
|
|
110
117
|
- [engineTileLayer.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineTileLayer.js) - Tile layer rendering and collision
|
|
111
118
|
- [engineParticles.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineParticles.js) - Particle system with fast rendering and collision
|
package/build/littlejs.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare module "littlejs.esm" {
|
|
2
2
|
/**
|
|
3
3
|
* LittleJS Module Export
|
|
4
|
-
* - Export engine as a module with
|
|
4
|
+
* - Export engine as a module with functions where necessary
|
|
5
5
|
*/
|
|
6
6
|
/** Set position of camera in world space
|
|
7
7
|
* @param {Vector2} pos
|
|
@@ -404,8 +404,9 @@ declare module "littlejs.esm" {
|
|
|
404
404
|
/** Save a canvas to disk
|
|
405
405
|
* @param {HTMLCanvasElement} canvas
|
|
406
406
|
* @param {String} [filename]
|
|
407
|
+
* @param {String} [type='image/png']
|
|
407
408
|
* @memberof Debug */
|
|
408
|
-
export function debugSaveCanvas(canvas: HTMLCanvasElement, filename?: string): void;
|
|
409
|
+
export function debugSaveCanvas(canvas: HTMLCanvasElement, filename?: string, type?: string): void;
|
|
409
410
|
/** A shortcut to get Math.PI
|
|
410
411
|
* @type {Number}
|
|
411
412
|
* @default Math.PI
|
|
@@ -446,20 +447,48 @@ declare module "littlejs.esm" {
|
|
|
446
447
|
* @return {Number}
|
|
447
448
|
* @memberof Utilities */
|
|
448
449
|
export function clamp(value: number, min?: number, max?: number): number;
|
|
449
|
-
/** Returns what percentage the value is between
|
|
450
|
+
/** Returns what percentage the value is between valueA and valueB
|
|
450
451
|
* @param {Number} value
|
|
451
|
-
* @param {Number}
|
|
452
|
-
* @param {Number}
|
|
452
|
+
* @param {Number} valueA
|
|
453
|
+
* @param {Number} valueB
|
|
453
454
|
* @return {Number}
|
|
454
455
|
* @memberof Utilities */
|
|
455
|
-
export function percent(value: number,
|
|
456
|
-
/**
|
|
456
|
+
export function percent(value: number, valueA: number, valueB: number): number;
|
|
457
|
+
/** Returns signed wrapped distance between the two values passed in
|
|
458
|
+
* @param {Number} valueA
|
|
459
|
+
* @param {Number} valueB
|
|
460
|
+
* @param {Number} [wrapSize=1]
|
|
461
|
+
* @returns {Number}
|
|
462
|
+
* @memberof Utilities */
|
|
463
|
+
export function distanceWrap(valueA: number, valueB: number, wrapSize?: number): number;
|
|
464
|
+
/** Linearly interpolates between values passed in with wrappping
|
|
457
465
|
* @param {Number} percent
|
|
458
|
-
* @param {Number}
|
|
459
|
-
* @param {Number}
|
|
466
|
+
* @param {Number} valueA
|
|
467
|
+
* @param {Number} valueB
|
|
468
|
+
* @param {Number} [wrapSize=1]
|
|
469
|
+
* @returns {Number}
|
|
470
|
+
* @memberof Utilities */
|
|
471
|
+
export function lerpWrap(percent: number, valueA: number, valueB: number, wrapSize?: number): number;
|
|
472
|
+
/** Returns signed wrapped distance between the two angles passed in
|
|
473
|
+
* @param {Number} angleA
|
|
474
|
+
* @param {Number} angleB
|
|
475
|
+
* @returns {Number}
|
|
476
|
+
* @memberof Utilities */
|
|
477
|
+
export function distanceAngle(angleA: number, angleB: number): number;
|
|
478
|
+
/** Linearly interpolates between the angles passed in with wrappping
|
|
479
|
+
* @param {Number} percent
|
|
480
|
+
* @param {Number} angleA
|
|
481
|
+
* @param {Number} angleB
|
|
482
|
+
* @returns {Number}
|
|
483
|
+
* @memberof Utilities */
|
|
484
|
+
export function lerpAngle(percent: number, angleA: number, angleB: number): number;
|
|
485
|
+
/** Linearly interpolates between values passed in using percent
|
|
486
|
+
* @param {Number} percent
|
|
487
|
+
* @param {Number} valueA
|
|
488
|
+
* @param {Number} valueB
|
|
460
489
|
* @return {Number}
|
|
461
490
|
* @memberof Utilities */
|
|
462
|
-
export function lerp(percent: number,
|
|
491
|
+
export function lerp(percent: number, valueA: number, valueB: number): number;
|
|
463
492
|
/** Applies smoothstep function to the percentage value
|
|
464
493
|
* @param {Number} percent
|
|
465
494
|
* @return {Number}
|
|
@@ -499,11 +528,11 @@ declare module "littlejs.esm" {
|
|
|
499
528
|
* @memberof Random */
|
|
500
529
|
export function rand(valueA?: number, valueB?: number): number;
|
|
501
530
|
/** Returns a floored random value the two values passed in
|
|
502
|
-
* @param {Number}
|
|
531
|
+
* @param {Number} valueA
|
|
503
532
|
* @param {Number} [valueB=0]
|
|
504
533
|
* @return {Number}
|
|
505
534
|
* @memberof Random */
|
|
506
|
-
export function randInt(valueA
|
|
535
|
+
export function randInt(valueA: number, valueB?: number): number;
|
|
507
536
|
/** Randomly returns either -1 or 1
|
|
508
537
|
* @return {Number}
|
|
509
538
|
* @memberof Random */
|
|
@@ -526,21 +555,36 @@ declare module "littlejs.esm" {
|
|
|
526
555
|
* @return {Color}
|
|
527
556
|
* @memberof Random */
|
|
528
557
|
export function randColor(colorA?: Color, colorB?: Color, linear?: boolean): Color;
|
|
529
|
-
/**
|
|
530
|
-
*
|
|
531
|
-
*
|
|
532
|
-
*
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
558
|
+
/**
|
|
559
|
+
* Seeded random number generator
|
|
560
|
+
* - Can be used to create a deterministic random number sequence
|
|
561
|
+
* @example
|
|
562
|
+
* let r = new RandomGenerator(123); // random number generator with seed 123
|
|
563
|
+
* let a = r.rand(); // random value between 0 and 1
|
|
564
|
+
* let b = r.randInt(10); // random integer between 0 and 9
|
|
565
|
+
* r.seed = 123; // reset the seed
|
|
566
|
+
* let c = r.rand(); // the same value as a
|
|
567
|
+
*/
|
|
568
|
+
export class RandomGenerator {
|
|
569
|
+
/** Create a random number generator with the seed passed in
|
|
570
|
+
* @param {Number} seed - Starting seed */
|
|
571
|
+
constructor(seed: number);
|
|
572
|
+
/** @property {Number} - random seed */
|
|
573
|
+
seed: number;
|
|
574
|
+
/** Returns a seeded random value between the two values passed in
|
|
575
|
+
* @param {Number} [valueA=1]
|
|
576
|
+
* @param {Number} [valueB=0]
|
|
577
|
+
* @return {Number} */
|
|
578
|
+
float(valueA?: number, valueB?: number): number;
|
|
579
|
+
/** Returns a floored seeded random value the two values passed in
|
|
580
|
+
* @param {Number} valueA
|
|
581
|
+
* @param {Number} [valueB=0]
|
|
582
|
+
* @return {Number} */
|
|
583
|
+
int(valueA: number, valueB?: number): number;
|
|
584
|
+
/** Randomly returns either -1 or 1 deterministically
|
|
585
|
+
* @return {Number} */
|
|
586
|
+
sign(): number;
|
|
587
|
+
}
|
|
544
588
|
/**
|
|
545
589
|
* 2D Vector object with vector math library
|
|
546
590
|
* - Functions do not change this so they can be chained together
|
|
@@ -810,12 +854,12 @@ declare module "littlejs.esm" {
|
|
|
810
854
|
export function hsl(h?: number, s?: number, l?: number, a?: number): Color;
|
|
811
855
|
/**
|
|
812
856
|
* LittleJS Object Base Object Class
|
|
813
|
-
* -
|
|
857
|
+
* - Top level object class used by the engine
|
|
814
858
|
* - Automatically adds self to object list
|
|
815
859
|
* - Will be updated and rendered each frame
|
|
816
860
|
* - Renders as a sprite from a tilesheet by default
|
|
817
861
|
* - Can have color and addtive color applied
|
|
818
|
-
* -
|
|
862
|
+
* - 2D Physics and collision system
|
|
819
863
|
* - Sorted by renderOrder
|
|
820
864
|
* - Objects can have children attached
|
|
821
865
|
* - Parents are updated before children, and set child transform
|
|
@@ -956,13 +1000,11 @@ declare module "littlejs.esm" {
|
|
|
956
1000
|
* @memberof Draw */
|
|
957
1001
|
export let mainCanvasSize: Vector2;
|
|
958
1002
|
/** Convert from screen to world space coordinates
|
|
959
|
-
* - if calling outside of render, you may need to manually set mainCanvasSize
|
|
960
1003
|
* @param {Vector2} screenPos
|
|
961
1004
|
* @return {Vector2}
|
|
962
1005
|
* @memberof Draw */
|
|
963
1006
|
export function screenToWorld(screenPos: Vector2): Vector2;
|
|
964
1007
|
/** Convert from world to screen space coordinates
|
|
965
|
-
* - if calling outside of render, you may need to manually set mainCanvasSize
|
|
966
1008
|
* @param {Vector2} worldPos
|
|
967
1009
|
* @return {Vector2}
|
|
968
1010
|
* @memberof Draw */
|
|
@@ -977,42 +1019,25 @@ declare module "littlejs.esm" {
|
|
|
977
1019
|
* @param {Boolean} [mirror=0] - If true image is flipped along the Y axis
|
|
978
1020
|
* @param {Color} [additiveColor=Color(0,0,0,0)] - Additive color to be applied
|
|
979
1021
|
* @param {Boolean} [useWebGL=glEnable] - Use accelerated WebGL rendering
|
|
1022
|
+
* @param {Boolean} [screenSpace=0] - If true the pos and size are in screen space
|
|
980
1023
|
* @memberof Draw */
|
|
981
|
-
export function drawTile(pos: Vector2, size?: Vector2, tileIndex?: number, tileSize?: Vector2, color?: Color, angle?: number, mirror?: boolean, additiveColor?: Color, useWebGL?: boolean): void;
|
|
1024
|
+
export function drawTile(pos: Vector2, size?: Vector2, tileIndex?: number, tileSize?: Vector2, color?: Color, angle?: number, mirror?: boolean, additiveColor?: Color, useWebGL?: boolean, screenSpace?: boolean): void;
|
|
982
1025
|
/** Draw colored rect centered on pos
|
|
983
1026
|
* @param {Vector2} pos
|
|
984
1027
|
* @param {Vector2} [size=Vector2(1,1)]
|
|
985
1028
|
* @param {Color} [color=Color()]
|
|
986
1029
|
* @param {Number} [angle=0]
|
|
987
1030
|
* @param {Boolean} [useWebGL=glEnable]
|
|
1031
|
+
* @param {Boolean} [screenSpace=0]
|
|
988
1032
|
* @memberof Draw */
|
|
989
|
-
export function drawRect(pos: Vector2, size?: Vector2, color?: Color, angle?: number, useWebGL?: boolean): void;
|
|
990
|
-
/** Draw textured tile centered on pos in screen space
|
|
991
|
-
* @param {Vector2} pos - Center of the tile
|
|
992
|
-
* @param {Vector2} [size=Vector2(1,1)] - Size of the tile
|
|
993
|
-
* @param {Number} [tileIndex=-1] - Tile index to use, negative is untextured
|
|
994
|
-
* @param {Vector2} [tileSize=tileSizeDefault] - Tile size in source pixels
|
|
995
|
-
* @param {Color} [color=Color()]
|
|
996
|
-
* @param {Number} [angle=0]
|
|
997
|
-
* @param {Boolean} [mirror=0]
|
|
998
|
-
* @param {Color} [additiveColor=Color(0,0,0,0)]
|
|
999
|
-
* @param {Boolean} [useWebGL=glEnable]
|
|
1000
|
-
* @memberof Draw */
|
|
1001
|
-
export function drawTileScreenSpace(pos: Vector2, size?: Vector2, tileIndex?: number, tileSize?: Vector2, color?: Color, angle?: number, mirror?: boolean, additiveColor?: Color, useWebGL?: boolean): void;
|
|
1002
|
-
/** Draw colored rectangle in screen space
|
|
1003
|
-
* @param {Vector2} pos
|
|
1004
|
-
* @param {Vector2} [size=Vector2(1,1)]
|
|
1005
|
-
* @param {Color} [color=Color()]
|
|
1006
|
-
* @param {Number} [angle=0]
|
|
1007
|
-
* @param {Boolean} [useWebGL=glEnable]
|
|
1008
|
-
* @memberof Draw */
|
|
1009
|
-
export function drawRectScreenSpace(pos: Vector2, size?: Vector2, color?: Color, angle?: number, useWebGL?: boolean): void;
|
|
1033
|
+
export function drawRect(pos: Vector2, size?: Vector2, color?: Color, angle?: number, useWebGL?: boolean, screenSpace?: boolean): void;
|
|
1010
1034
|
/** Draw colored line between two points
|
|
1011
1035
|
* @param {Vector2} posA
|
|
1012
1036
|
* @param {Vector2} posB
|
|
1013
1037
|
* @param {Number} [thickness=.1]
|
|
1014
1038
|
* @param {Color} [color=Color()]
|
|
1015
1039
|
* @param {Boolean} [useWebGL=glEnable]
|
|
1040
|
+
* @param {Boolean} [screenSpace=0]
|
|
1016
1041
|
* @memberof Draw */
|
|
1017
1042
|
export function drawLine(posA: Vector2, posB: Vector2, thickness?: number, color?: Color, useWebGL?: boolean): void;
|
|
1018
1043
|
/** Draw directly to a 2d canvas context in world space
|
|
@@ -1022,8 +1047,9 @@ declare module "littlejs.esm" {
|
|
|
1022
1047
|
* @param {Boolean} mirror
|
|
1023
1048
|
* @param {Function} drawFunction
|
|
1024
1049
|
* @param {CanvasRenderingContext2D} [context=mainContext]
|
|
1050
|
+
* @param {Boolean} [screenSpace=0]
|
|
1025
1051
|
* @memberof Draw */
|
|
1026
|
-
export function drawCanvas2D(pos: Vector2, size: Vector2, angle: number, mirror: boolean, drawFunction: Function, context?: CanvasRenderingContext2D): void;
|
|
1052
|
+
export function drawCanvas2D(pos: Vector2, size: Vector2, angle: number, mirror: boolean, drawFunction: Function, context?: CanvasRenderingContext2D, screenSpace?: boolean): void;
|
|
1027
1053
|
/** Enable normal or additive blend mode
|
|
1028
1054
|
* @param {Boolean} [additive=0]
|
|
1029
1055
|
* @param {Boolean} [useWebGL=glEnable]
|
|
@@ -1082,20 +1108,20 @@ declare module "littlejs.esm" {
|
|
|
1082
1108
|
paddingSize: Vector2;
|
|
1083
1109
|
startTileIndex: number;
|
|
1084
1110
|
context: CanvasRenderingContext2D;
|
|
1085
|
-
/** Draw text in
|
|
1111
|
+
/** Draw text in world space using the image font
|
|
1086
1112
|
* @param {String} text
|
|
1087
1113
|
* @param {Vector2} pos
|
|
1088
|
-
* @param {Number} [scale
|
|
1114
|
+
* @param {Number} [scale=.25]
|
|
1089
1115
|
* @param {Boolean} [center]
|
|
1090
1116
|
*/
|
|
1091
|
-
|
|
1092
|
-
/** Draw text in
|
|
1117
|
+
drawText(text: string, pos: Vector2, scale?: number, center?: boolean): void;
|
|
1118
|
+
/** Draw text in screen space using the image font
|
|
1093
1119
|
* @param {String} text
|
|
1094
1120
|
* @param {Vector2} pos
|
|
1095
|
-
* @param {Number} [scale
|
|
1121
|
+
* @param {Number} [scale=4]
|
|
1096
1122
|
* @param {Boolean} [center]
|
|
1097
1123
|
*/
|
|
1098
|
-
|
|
1124
|
+
drawTextScreen(text: string, pos: Vector2, scale?: number, center?: boolean): void;
|
|
1099
1125
|
}
|
|
1100
1126
|
/** Returns true if fullscreen mode is active
|
|
1101
1127
|
* @return {Boolean}
|
|
@@ -1221,6 +1247,7 @@ declare module "littlejs.esm" {
|
|
|
1221
1247
|
range: number;
|
|
1222
1248
|
/** @property {Number} - At what percentage of range should it start tapering off */
|
|
1223
1249
|
taper: number;
|
|
1250
|
+
/** @property {Number} - How much to randomize frequency each time sound plays */
|
|
1224
1251
|
randomness: any;
|
|
1225
1252
|
cachedSamples: any[];
|
|
1226
1253
|
/** Play the sound
|