littlejsengine 1.15.8 → 1.16.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.
- package/dist/littlejs.d.ts +87 -85
- package/dist/littlejs.esm.js +578 -532
- package/dist/littlejs.esm.min.js +1 -1
- package/dist/littlejs.js +562 -521
- package/dist/littlejs.min.js +1 -1
- package/dist/littlejs.release.js +485 -444
- package/examples/box2d/game.js +2 -2
- package/examples/breakout/game.js +3 -3
- package/examples/electron/game.js +1 -2
- package/examples/electron/index.html +2 -2
- package/examples/htmlMenu/game.js +0 -1
- package/examples/index.html +1 -1
- package/examples/module/game.js +1 -2
- package/examples/particles/index.html +1 -1
- package/examples/platformer/game.js +11 -4
- package/examples/puzzle/game.js +2 -2
- package/examples/shorts/base.html +3 -4
- package/examples/shorts/box2dPool.js +2 -2
- package/examples/shorts/empty.js +1 -1
- package/examples/shorts/{systemFont.js → fontImage.js} +3 -3
- package/examples/shorts/fps.js +1 -1
- package/examples/shorts/helloWorld.js +2 -2
- package/examples/shorts/nineSlice.js +2 -2
- package/examples/shorts/slidingPuzzle.js +1 -1
- package/examples/shorts/uiSystem.js +1 -1
- package/examples/starter/game.js +1 -2
- package/examples/starter/index.html +2 -3
- package/examples/stress/index.html +1 -1
- package/examples/typescript/game.js +1 -2
- package/examples/typescript/game.ts +1 -2
- package/examples/uiSystem/game.js +4 -7
- package/package.json +1 -1
- package/plugins/box2d.js +8 -8
- package/plugins/drawUtilities.js +6 -6
- package/plugins/postProcess.js +13 -20
- package/plugins/uiSystem.js +15 -3
- package/reference.md +4 -6
- package/src/engine.js +240 -53
- package/src/engineAudio.js +3 -3
- package/src/engineBuild.js +0 -1
- package/src/engineDebug.js +78 -78
- package/src/engineDraw.js +107 -109
- package/src/engineExport.js +16 -11
- package/src/engineInput.js +14 -2
- package/src/engineMedals.js +3 -3
- package/src/engineObject.js +4 -2
- package/src/engineParticles.js +8 -6
- package/src/engineRelease.js +1 -1
- package/src/engineSettings.js +44 -30
- package/src/engineTileLayer.js +6 -6
- package/src/engineUtilities.js +2 -10
- package/src/engineWebGL.js +6 -5
- package/src/engineSplash.js +0 -173
package/dist/littlejs.d.ts
CHANGED
|
@@ -133,6 +133,7 @@ declare module "littlejsengine" {
|
|
|
133
133
|
* @memberof Engine */
|
|
134
134
|
export function engineInit(gameInit: GameInitCallback, gameUpdate: GameCallback, gameUpdatePost: GameCallback, gameRender: GameCallback, gameRenderPost: GameCallback, imageSources?: Array<string>, rootElement?: HTMLElement): Promise<void>;
|
|
135
135
|
/** Update each engine object, remove destroyed objects, and update time
|
|
136
|
+
* can be called manually if objects need to be updated outside of main loop
|
|
136
137
|
* @memberof Engine */
|
|
137
138
|
export function engineObjectsUpdate(): void;
|
|
138
139
|
/** Destroy and remove all objects
|
|
@@ -198,7 +199,7 @@ declare module "littlejsengine" {
|
|
|
198
199
|
* @type {boolean}
|
|
199
200
|
* @default
|
|
200
201
|
* @memberof Debug */
|
|
201
|
-
export let
|
|
202
|
+
export let debugWatermark: boolean;
|
|
202
203
|
/** Asserts if the expression is false, does nothing in release builds
|
|
203
204
|
* Halts execution if the assert fails and throws an error
|
|
204
205
|
* @param {boolean} assert
|
|
@@ -348,6 +349,18 @@ declare module "littlejsengine" {
|
|
|
348
349
|
* @default Vector2(1920,1080)
|
|
349
350
|
* @memberof Settings */
|
|
350
351
|
export let canvasMaxSize: Vector2;
|
|
352
|
+
/** Minimum aspect ratio of the canvas (width/height), unused if 0
|
|
353
|
+
* Can be used with canvasMaxAspect to limit aspect ratio
|
|
354
|
+
* @type {number}
|
|
355
|
+
* @default
|
|
356
|
+
* @memberof Settings */
|
|
357
|
+
export let canvasMinAspect: number;
|
|
358
|
+
/** Maximum aspect ratio of the canvas (width/height), unused if 0
|
|
359
|
+
* Can be used with canvasMinAspect to limit aspect ratio
|
|
360
|
+
* @type {number}
|
|
361
|
+
* @default
|
|
362
|
+
* @memberof Settings */
|
|
363
|
+
export let canvasMaxAspect: number;
|
|
351
364
|
/** Fixed size of the canvas, if enabled canvas size never changes
|
|
352
365
|
* - you may also need to set mainCanvasSize if using screen space coords in startup
|
|
353
366
|
* @type {Vector2}
|
|
@@ -360,13 +373,6 @@ declare module "littlejsengine" {
|
|
|
360
373
|
* @default
|
|
361
374
|
* @memberof Settings */
|
|
362
375
|
export let canvasPixelated: boolean;
|
|
363
|
-
/** Use nearest canvas scaling for more pixelated look
|
|
364
|
-
* - If enabled sets css image-rendering:pixelated
|
|
365
|
-
* - This defaults to false because text looks better with smoothing
|
|
366
|
-
* @type {boolean}
|
|
367
|
-
* @default
|
|
368
|
-
* @memberof Settings */
|
|
369
|
-
export let overlayCanvasPixelated: boolean;
|
|
370
376
|
/** Disables texture filtering for crisper pixel art
|
|
371
377
|
* @type {boolean}
|
|
372
378
|
* @default
|
|
@@ -391,12 +397,17 @@ declare module "littlejsengine" {
|
|
|
391
397
|
* @type {Vector2}
|
|
392
398
|
* @default Vector2(16,16)
|
|
393
399
|
* @memberof Settings */
|
|
394
|
-
export let
|
|
395
|
-
/**
|
|
400
|
+
export let tileDefaultSize: Vector2;
|
|
401
|
+
/** Default padding pixels around tiles
|
|
402
|
+
* @type {number}
|
|
403
|
+
* @default
|
|
404
|
+
* @memberof Settings */
|
|
405
|
+
export let tileDefaultPadding: number;
|
|
406
|
+
/** Default amount of pixels smaller to draw tiles to prevent neighbor bleeding
|
|
396
407
|
* @type {number}
|
|
397
408
|
* @default
|
|
398
409
|
* @memberof Settings */
|
|
399
|
-
export let
|
|
410
|
+
export let tileDefaultBleed: number;
|
|
400
411
|
/** Enable physics solver for collisions between objects
|
|
401
412
|
* @type {boolean}
|
|
402
413
|
* @default
|
|
@@ -557,21 +568,22 @@ declare module "littlejsengine" {
|
|
|
557
568
|
* @param {Vector2} size
|
|
558
569
|
* @memberof Settings */
|
|
559
570
|
export function setCanvasMaxSize(size: Vector2): void;
|
|
571
|
+
/** Set minimum aspect ratio of the canvas (width/height), unused if 0
|
|
572
|
+
* @param {number} aspect
|
|
573
|
+
* @memberof Settings */
|
|
574
|
+
export function setCanvasMinAspect(aspect: number): void;
|
|
575
|
+
/** Set maximum aspect ratio of the canvas (width/height), unused if 0
|
|
576
|
+
* @param {number} aspect
|
|
577
|
+
* @memberof Settings */
|
|
578
|
+
export function setCanvasMaxAspect(aspect: number): void;
|
|
560
579
|
/** Set fixed size of the canvas
|
|
561
580
|
* @param {Vector2} size
|
|
562
581
|
* @memberof Settings */
|
|
563
582
|
export function setCanvasFixedSize(size: Vector2): void;
|
|
564
583
|
/** Use nearest scaling algorithm for canvas for more pixelated look
|
|
565
|
-
* - If enabled sets css image-rendering:pixelated
|
|
566
584
|
* @param {boolean} pixelated
|
|
567
585
|
* @memberof Settings */
|
|
568
586
|
export function setCanvasPixelated(pixelated: boolean): void;
|
|
569
|
-
/** Use nearest scaling algorithm for canvas for more pixelated look
|
|
570
|
-
* - If enabled sets css image-rendering:pixelated
|
|
571
|
-
* - This defaults to false because text looks better with smoothing
|
|
572
|
-
* @param {boolean} pixelated
|
|
573
|
-
* @memberof Settings */
|
|
574
|
-
export function setOverlayCanvasPixelated(pixelated: boolean): void;
|
|
575
587
|
/** Disables texture filtering for crisper pixel art
|
|
576
588
|
* @param {boolean} pixelated
|
|
577
589
|
* @memberof Settings */
|
|
@@ -595,11 +607,15 @@ declare module "littlejsengine" {
|
|
|
595
607
|
/** Set default size of tiles in pixels
|
|
596
608
|
* @param {Vector2} size
|
|
597
609
|
* @memberof Settings */
|
|
598
|
-
export function
|
|
599
|
-
/**
|
|
600
|
-
* @param {number}
|
|
610
|
+
export function setTileDefaultSize(size: Vector2): void;
|
|
611
|
+
/** Default padding pixels around tiles
|
|
612
|
+
* @param {number} padding
|
|
613
|
+
* @memberof Settings */
|
|
614
|
+
export function setTileDefaultPadding(padding: number): void;
|
|
615
|
+
/** Default amount of pixels smaller to draw tiles to prevent neighbor bleeding
|
|
616
|
+
* @param {number} bleed
|
|
601
617
|
* @memberof Settings */
|
|
602
|
-
export function
|
|
618
|
+
export function setTileDefaultBleed(bleed: number): void;
|
|
603
619
|
/** Set if collisions between objects are enabled
|
|
604
620
|
* @param {boolean} enable
|
|
605
621
|
* @memberof Settings */
|
|
@@ -716,7 +732,7 @@ declare module "littlejsengine" {
|
|
|
716
732
|
/** Set if watermark with FPS should be shown
|
|
717
733
|
* @param {boolean} show
|
|
718
734
|
* @memberof Debug */
|
|
719
|
-
export function
|
|
735
|
+
export function setDebugWatermark(show: boolean): void;
|
|
720
736
|
/** Set key code used to toggle debug mode, Esc by default
|
|
721
737
|
* @param {string} key
|
|
722
738
|
* @memberof Debug */
|
|
@@ -1411,7 +1427,7 @@ declare module "littlejsengine" {
|
|
|
1411
1427
|
* - This can take vecs or floats for easier use and conversion
|
|
1412
1428
|
* - If an index is passed in, the tile size and index will determine the position
|
|
1413
1429
|
* @param {Vector2|number} [pos=0] - Position of the tile in pixels, or tile index
|
|
1414
|
-
* @param {Vector2|number} [size
|
|
1430
|
+
* @param {Vector2|number} [size] - Size of tile in pixels
|
|
1415
1431
|
* @param {number} [textureIndex] - Texture index to use
|
|
1416
1432
|
* @param {number} [padding] - How many pixels padding around tiles
|
|
1417
1433
|
* @return {TileInfo}
|
|
@@ -1428,13 +1444,13 @@ declare module "littlejsengine" {
|
|
|
1428
1444
|
*/
|
|
1429
1445
|
export class TileInfo {
|
|
1430
1446
|
/** Create a tile info object
|
|
1431
|
-
* @param {Vector2} [pos=(0,0)]
|
|
1432
|
-
* @param {Vector2} [size
|
|
1433
|
-
* @param {number} [textureIndex]
|
|
1434
|
-
* @param {number} [padding]
|
|
1435
|
-
* @param {number} [
|
|
1447
|
+
* @param {Vector2} [pos=(0,0)] - Top left corner of tile in pixels
|
|
1448
|
+
* @param {Vector2} [size] - Size of tile in pixels
|
|
1449
|
+
* @param {number} [textureIndex] - Texture index to use
|
|
1450
|
+
* @param {number} [padding] - How many pixels padding around tiles
|
|
1451
|
+
* @param {number} [bleed] - How many pixels smaller to draw tiles
|
|
1436
1452
|
*/
|
|
1437
|
-
constructor(pos?: Vector2, size?: Vector2, textureIndex?: number, padding?: number,
|
|
1453
|
+
constructor(pos?: Vector2, size?: Vector2, textureIndex?: number, padding?: number, bleed?: number);
|
|
1438
1454
|
/** @property {Vector2} - Top left corner of tile in pixels */
|
|
1439
1455
|
pos: Vector2;
|
|
1440
1456
|
/** @property {Vector2} - Size of tile in pixels */
|
|
@@ -1446,7 +1462,7 @@ declare module "littlejsengine" {
|
|
|
1446
1462
|
/** @property {TextureInfo} - The texture info for this tile */
|
|
1447
1463
|
textureInfo: TextureInfo;
|
|
1448
1464
|
/** @property {number} - Shrinks tile by this many pixels to prevent neighbors bleeding */
|
|
1449
|
-
|
|
1465
|
+
bleed: number;
|
|
1450
1466
|
/** Returns a copy of this tile offset by a vector
|
|
1451
1467
|
* @param {Vector2} offset - Offset to apply in pixels
|
|
1452
1468
|
* @return {TileInfo}
|
|
@@ -1503,7 +1519,6 @@ declare module "littlejsengine" {
|
|
|
1503
1519
|
* There are 3 canvas/contexts available to draw to...
|
|
1504
1520
|
* mainCanvas - 2D background canvas, non WebGL stuff like tile layers are drawn here.
|
|
1505
1521
|
* glCanvas - Used by the accelerated WebGL batch rendering system.
|
|
1506
|
-
* overlayCanvas - Another 2D canvas that appears on top of the other 2 canvases.
|
|
1507
1522
|
*
|
|
1508
1523
|
* The WebGL rendering system is very fast with some caveats...
|
|
1509
1524
|
* - Switching blend modes (additive) or textures causes another draw call which is expensive in excess
|
|
@@ -1528,14 +1543,22 @@ declare module "littlejsengine" {
|
|
|
1528
1543
|
* @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D}
|
|
1529
1544
|
* @memberof Draw */
|
|
1530
1545
|
export let drawContext: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
1531
|
-
/**
|
|
1532
|
-
* @type {
|
|
1546
|
+
/** Offscreen canvas that can be used for image processing
|
|
1547
|
+
* @type {OffscreenCanvas}
|
|
1533
1548
|
* @memberof Draw */
|
|
1534
|
-
export let
|
|
1535
|
-
/**
|
|
1536
|
-
* @type {
|
|
1549
|
+
export let workCanvas: OffscreenCanvas;
|
|
1550
|
+
/** Offscreen canvas that can be used for image processing
|
|
1551
|
+
* @type {OffscreenCanvasRenderingContext2D}
|
|
1552
|
+
* @memberof Draw */
|
|
1553
|
+
export let workContext: OffscreenCanvasRenderingContext2D;
|
|
1554
|
+
/** Offscreen canvas with willReadFrequently that can be used for image processing
|
|
1555
|
+
* @type {OffscreenCanvas}
|
|
1556
|
+
* @memberof Draw */
|
|
1557
|
+
export let workReadCanvas: OffscreenCanvas;
|
|
1558
|
+
/** Offscreen canvas with willReadFrequently that can be used for image processing
|
|
1559
|
+
* @type {OffscreenCanvasRenderingContext2D}
|
|
1537
1560
|
* @memberof Draw */
|
|
1538
|
-
export let
|
|
1561
|
+
export let workReadContext: OffscreenCanvasRenderingContext2D;
|
|
1539
1562
|
/** The size of the main canvas (and other secondary canvases)
|
|
1540
1563
|
* @type {Vector2}
|
|
1541
1564
|
* @memberof Draw */
|
|
@@ -1692,22 +1715,7 @@ declare module "littlejsengine" {
|
|
|
1692
1715
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=drawContext]
|
|
1693
1716
|
* @memberof Draw */
|
|
1694
1717
|
export function drawText(text: string | number, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, fontStyle?: string, maxWidth?: number, angle?: number, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1695
|
-
/** Draw text
|
|
1696
|
-
* Automatically splits new lines into rows
|
|
1697
|
-
* @param {string|number} text
|
|
1698
|
-
* @param {Vector2} pos
|
|
1699
|
-
* @param {number} [size]
|
|
1700
|
-
* @param {Color} [color=(1,1,1,1)]
|
|
1701
|
-
* @param {number} [lineWidth]
|
|
1702
|
-
* @param {Color} [lineColor=(0,0,0,1)]
|
|
1703
|
-
* @param {CanvasTextAlign} [textAlign='center']
|
|
1704
|
-
* @param {string} [font=fontDefault]
|
|
1705
|
-
* @param {string} [fontStyle]
|
|
1706
|
-
* @param {number} [maxWidth]
|
|
1707
|
-
* @param {number} [angle]
|
|
1708
|
-
* @memberof Draw */
|
|
1709
|
-
export function drawTextOverlay(text: string | number, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, fontStyle?: string, maxWidth?: number, angle?: number): void;
|
|
1710
|
-
/** Draw text on overlay canvas in screen space
|
|
1718
|
+
/** Draw text in screen space
|
|
1711
1719
|
* Automatically splits new lines into rows
|
|
1712
1720
|
* @param {string|number} text
|
|
1713
1721
|
* @param {Vector2} pos
|
|
@@ -1720,7 +1728,7 @@ declare module "littlejsengine" {
|
|
|
1720
1728
|
* @param {string} [fontStyle]
|
|
1721
1729
|
* @param {number} [maxWidth]
|
|
1722
1730
|
* @param {number} [angle]
|
|
1723
|
-
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=
|
|
1731
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
|
|
1724
1732
|
* @memberof Draw */
|
|
1725
1733
|
export function drawTextScreen(text: string | number, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, fontStyle?: string, maxWidth?: number, angle?: number, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1726
1734
|
/** Enable normal or additive blend mode
|
|
@@ -1728,8 +1736,8 @@ declare module "littlejsengine" {
|
|
|
1728
1736
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context]
|
|
1729
1737
|
* @memberof Draw */
|
|
1730
1738
|
export function setBlendMode(additive?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1731
|
-
/** Combines
|
|
1732
|
-
* This is necessary for things like
|
|
1739
|
+
/** Combines LittleJS canvases onto the main canvas
|
|
1740
|
+
* This is necessary for things like screenshots and video
|
|
1733
1741
|
* @memberof Draw */
|
|
1734
1742
|
export function combineCanvases(): void;
|
|
1735
1743
|
export let engineFontImage: any;
|
|
@@ -1764,14 +1772,7 @@ declare module "littlejsengine" {
|
|
|
1764
1772
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=drawContext]
|
|
1765
1773
|
*/
|
|
1766
1774
|
drawText(text: string | number, pos: Vector2, scale?: number, center?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1767
|
-
/** Draw text
|
|
1768
|
-
* @param {string|number} text
|
|
1769
|
-
* @param {Vector2} pos
|
|
1770
|
-
* @param {number} [scale]
|
|
1771
|
-
* @param {boolean} [center]
|
|
1772
|
-
*/
|
|
1773
|
-
drawTextOverlay(text: string | number, pos: Vector2, scale?: number, center?: boolean): void;
|
|
1774
|
-
/** Draw text on overlay canvas in screen space using the image font
|
|
1775
|
+
/** Draw text in screen space using the image font
|
|
1775
1776
|
* @param {string|number} text
|
|
1776
1777
|
* @param {Vector2} pos
|
|
1777
1778
|
* @param {number} [scale]
|
|
@@ -1807,7 +1808,7 @@ declare module "littlejsengine" {
|
|
|
1807
1808
|
* - Supports shadertoy style post processing shaders via plugin
|
|
1808
1809
|
* @namespace WebGL
|
|
1809
1810
|
*/
|
|
1810
|
-
/** The WebGL canvas which appears
|
|
1811
|
+
/** The WebGL canvas which appears below the main canvas
|
|
1811
1812
|
* @type {HTMLCanvasElement}
|
|
1812
1813
|
* @memberof WebGL */
|
|
1813
1814
|
export let glCanvas: HTMLCanvasElement;
|
|
@@ -2172,12 +2173,12 @@ declare module "littlejsengine" {
|
|
|
2172
2173
|
isLoaded(): boolean;
|
|
2173
2174
|
}
|
|
2174
2175
|
/**
|
|
2175
|
-
* Sound Wave Object -
|
|
2176
|
-
* - this can be used to play wave, mp3, and ogg files
|
|
2176
|
+
* Sound Wave Object - Loads and stores an audio file for later use
|
|
2177
|
+
* - this can be used to load and play wave, mp3, and ogg files
|
|
2177
2178
|
* @extends Sound
|
|
2178
2179
|
* @memberof Audio
|
|
2179
2180
|
* @example
|
|
2180
|
-
* //
|
|
2181
|
+
* // load an audio asset file
|
|
2181
2182
|
* const sound_example = new SoundWave('sound.mp3');
|
|
2182
2183
|
*
|
|
2183
2184
|
* // play the sound
|
|
@@ -2503,11 +2504,12 @@ declare module "littlejsengine" {
|
|
|
2503
2504
|
/** Get the direction of the mirror
|
|
2504
2505
|
* @return {number} -1 if this.mirror is true, or 1 if not mirrored */
|
|
2505
2506
|
getMirrorSign(): number;
|
|
2506
|
-
/** Attaches a child to this with a
|
|
2507
|
+
/** Attaches a child to this with a local transform, returns child for chaining
|
|
2507
2508
|
* @param {EngineObject} child
|
|
2508
2509
|
* @param {Vector2} [localPos=(0,0)]
|
|
2509
|
-
* @param {number} [localAngle]
|
|
2510
|
-
|
|
2510
|
+
* @param {number} [localAngle]
|
|
2511
|
+
* @return {EngineObject} The child object added */
|
|
2512
|
+
addChild(child: EngineObject, localPos?: Vector2, localAngle?: number): EngineObject;
|
|
2511
2513
|
/** Removes a child from this one
|
|
2512
2514
|
* @param {EngineObject} child */
|
|
2513
2515
|
removeChild(child: EngineObject): void;
|
|
@@ -2721,8 +2723,8 @@ declare module "littlejsengine" {
|
|
|
2721
2723
|
* @param {Vector2} layerPos - Local position in array
|
|
2722
2724
|
* @return {TileLayerData} */
|
|
2723
2725
|
getData(layerPos: Vector2): TileLayerData;
|
|
2724
|
-
/** @type {[HTMLCanvasElement|OffscreenCanvas, CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D, Vector2, Vector2, number]} */
|
|
2725
|
-
savedRenderSettings: [HTMLCanvasElement | OffscreenCanvas, CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, Vector2, Vector2, number];
|
|
2726
|
+
/** @type {[HTMLCanvasElement|OffscreenCanvas, CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D, Vector2, Vector2, number, Color]} */
|
|
2727
|
+
savedRenderSettings: [HTMLCanvasElement | OffscreenCanvas, CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, Vector2, Vector2, number, Color];
|
|
2726
2728
|
}
|
|
2727
2729
|
/**
|
|
2728
2730
|
* Tile Collision Layer - a tile layer with collision
|
|
@@ -3071,13 +3073,12 @@ declare module "littlejsengine" {
|
|
|
3071
3073
|
export class PostProcessPlugin {
|
|
3072
3074
|
/** Create global post processing shader
|
|
3073
3075
|
* @param {string} shaderCode
|
|
3074
|
-
* @param {boolean} [includeOverlay]
|
|
3075
3076
|
* @param {boolean} [includeMainCanvas]
|
|
3076
3077
|
* @example
|
|
3077
3078
|
* // create the post process plugin object
|
|
3078
3079
|
* new PostProcessPlugin(shaderCode);
|
|
3079
3080
|
*/
|
|
3080
|
-
constructor(shaderCode: string,
|
|
3081
|
+
constructor(shaderCode: string, includeMainCanvas?: boolean);
|
|
3081
3082
|
/** @property {WebGLProgram} - Shader for post processing */
|
|
3082
3083
|
shader: any;
|
|
3083
3084
|
/** @property {WebGLTexture} - Texture for post processing */
|
|
@@ -3172,6 +3173,8 @@ declare module "littlejsengine" {
|
|
|
3172
3173
|
* new UISystemPlugin;
|
|
3173
3174
|
*/
|
|
3174
3175
|
constructor(context?: CanvasRenderingContext2D);
|
|
3176
|
+
/** @property {boolean} - Activate when mouse is pressed down instead of clicked */
|
|
3177
|
+
activateOnPress: boolean;
|
|
3175
3178
|
/** @property {Color} - Default fill color for UI elements */
|
|
3176
3179
|
defaultColor: Color;
|
|
3177
3180
|
/** @property {Color} - Default outline color for UI elements */
|
|
@@ -3210,8 +3213,6 @@ declare module "littlejsengine" {
|
|
|
3210
3213
|
nativeHeight: number;
|
|
3211
3214
|
/** @property {UIObject} - Object currently selected by navigation (gamepad or keyboard) */
|
|
3212
3215
|
navigationObject: any;
|
|
3213
|
-
/** @property {number} - Gamepad index to use for UI navigation */
|
|
3214
|
-
navigationGamepadIndex: number;
|
|
3215
3216
|
/** @property {Timer} - Cooldown timer for navigation inputs */
|
|
3216
3217
|
navigationTimer: Timer;
|
|
3217
3218
|
/** @property {number} - Time between navigation inputs in seconds */
|
|
@@ -3402,9 +3403,10 @@ declare module "littlejsengine" {
|
|
|
3402
3403
|
navigationIndex: any;
|
|
3403
3404
|
/** @property {boolean} - Should this be auto selected by navigation? Must also have valid navigation index. */
|
|
3404
3405
|
navigationAutoSelect: boolean;
|
|
3405
|
-
/** Add a child UIObject to this object
|
|
3406
|
-
* @param {UIObject} child
|
|
3407
|
-
|
|
3406
|
+
/** Add a child UIObject to this object, returns child for chaining
|
|
3407
|
+
* @param {UIObject} child
|
|
3408
|
+
* @return {UIObject} The child object added */
|
|
3409
|
+
addChild(child: UIObject): UIObject;
|
|
3408
3410
|
/** Remove a child UIObject from this object
|
|
3409
3411
|
* @param {UIObject} child */
|
|
3410
3412
|
removeChild(child: UIObject): void;
|
|
@@ -4556,8 +4558,8 @@ declare module "littlejsengine" {
|
|
|
4556
4558
|
* - Nine slice and three slice drawing
|
|
4557
4559
|
* @namespace DrawUtilities
|
|
4558
4560
|
*/
|
|
4559
|
-
/** Draw a scalable nine-slice UI element to the
|
|
4560
|
-
* This function can not apply color because it draws using the
|
|
4561
|
+
/** Draw a scalable nine-slice UI element to the main canvas in screen space
|
|
4562
|
+
* This function can not apply color because it draws using the 2d context
|
|
4561
4563
|
* @param {Vector2} pos - Screen space position
|
|
4562
4564
|
* @param {Vector2} size - Screen space size
|
|
4563
4565
|
* @param {TileInfo} startTile - Starting tile for the nine-slice pattern
|
|
@@ -4581,8 +4583,8 @@ declare module "littlejsengine" {
|
|
|
4581
4583
|
* @param {CanvasRenderingContext2D} [context] - Canvas context to use
|
|
4582
4584
|
* @memberof DrawUtilities */
|
|
4583
4585
|
export function drawThreeSlice(pos: Vector2, size: Vector2, startTile: TileInfo, color?: Color, borderSize?: number, additiveColor?: Color, extraSpace?: number, angle?: number, useWebGL?: boolean, screenSpace?: boolean, context?: CanvasRenderingContext2D): void;
|
|
4584
|
-
/** Draw a scalable three-slice UI element to the
|
|
4585
|
-
* This function can not apply color because it draws using the
|
|
4586
|
+
/** Draw a scalable three-slice UI element to the main canvas in screen space
|
|
4587
|
+
* This function can not apply color because it draws using the 2d context
|
|
4586
4588
|
* @param {Vector2} pos - Screen space position
|
|
4587
4589
|
* @param {Vector2} size - Screen space size
|
|
4588
4590
|
* @param {TileInfo} startTile - Starting tile for the three-slice pattern
|