littlejsengine 1.11.17 → 1.12.6
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/box2d.wasm.js +630 -0
- package/dist/box2d.wasm.wasm +0 -0
- package/dist/littlejs.d.ts +158 -81
- package/dist/littlejs.esm.js +882 -793
- package/dist/littlejs.esm.min.js +1 -1
- package/dist/littlejs.js +3048 -175
- package/dist/littlejs.min.js +1 -1
- package/dist/littlejs.release.js +3047 -172
- package/examples/box2d/game.js +82 -56
- package/examples/box2d/gameObjects.js +114 -107
- package/examples/box2d/index.html +2 -7
- package/examples/box2d/scenes.js +72 -78
- package/examples/box2d/tiles.png +0 -0
- package/examples/breakout/game.js +63 -28
- package/examples/breakout/gameObjects.js +45 -47
- package/examples/breakout/index.html +1 -5
- package/examples/breakoutTutorial/game.js +36 -29
- package/examples/breakoutTutorial/index.html +1 -3
- package/examples/empty/game.js +5 -2
- package/examples/empty/index.html +1 -3
- package/examples/htmlMenu/game.js +24 -15
- package/examples/htmlMenu/index.html +5 -7
- package/examples/index.html +24 -17
- package/examples/module/game.js +32 -34
- package/examples/module/index.html +1 -1
- package/examples/particles/index.html +27 -22
- package/examples/platformer/game.js +62 -45
- package/examples/platformer/gameCharacter.js +42 -34
- package/examples/platformer/gameEffects.js +82 -75
- package/examples/platformer/gameLevel.js +67 -38
- package/examples/platformer/{gameLevelData.js → gameLevelData.json} +1 -11
- package/examples/platformer/gameObjects.js +70 -64
- package/examples/platformer/gamePlayer.js +12 -7
- package/examples/platformer/index.html +1 -9
- package/examples/puzzle/game.js +59 -40
- package/examples/puzzle/index.html +1 -3
- package/examples/shorts/base.html +3 -2
- package/examples/shorts/box2d.js +46 -0
- package/examples/shorts/box2dCar.js +49 -0
- package/examples/shorts/particles.js +1 -1
- package/examples/shorts/platformer.js +1 -1
- package/examples/shorts/postProcess.js +45 -0
- package/examples/shorts/tileLayer.js +5 -6
- package/examples/shorts/tiles.png +0 -0
- package/examples/shorts/uiSystem.js +39 -0
- package/examples/starter/game.js +9 -10
- package/examples/starter/index.html +13 -13
- package/examples/stress/index.html +44 -44
- package/examples/typescript/build.js +17 -18
- package/examples/typescript/game.js +32 -34
- package/examples/typescript/game.ts +32 -34
- package/examples/typescript/index.html +1 -1
- package/examples/uiSystem/game.js +34 -31
- package/examples/uiSystem/index.html +1 -5
- package/package.json +1 -1
- package/plugins/box2d.js +28 -30
- package/plugins/pluginExport.js +2 -3
- package/plugins/uiSystem.js +9 -3
- package/reference.md +29 -27
- package/src/engine.js +10 -11
- package/src/engineAudio.js +24 -15
- package/src/engineBuild.js +25 -8
- package/src/engineDebug.js +1 -3
- package/src/engineExport.js +3 -6
- package/src/engineInput.js +6 -4
- package/src/engineObject.js +18 -14
- package/src/engineSettings.js +6 -6
- package/src/engineTileLayer.js +179 -96
- package/src/engineUtilities.js +16 -0
- package/src/engineWebGL.js +13 -1
- package/examples/typescript/build/dist/littlejs.esm.js +0 -4834
- package/examples/typescript/build/examples/typescript/build.js +0 -24
- package/examples/typescript/build/examples/typescript/game.js +0 -102
|
Binary file
|
package/dist/littlejs.d.ts
CHANGED
|
@@ -72,7 +72,7 @@ declare module "littlejsengine" {
|
|
|
72
72
|
* @param {Array<string>} [imageSources=[]] - List of images to load
|
|
73
73
|
* @param {HTMLElement} [rootElement] - Root element to attach to, the document body by default
|
|
74
74
|
* @memberof Engine */
|
|
75
|
-
export function engineInit(gameInit: Function | (() => Promise<any>), gameUpdate: Function, gameUpdatePost: Function, gameRender: Function, gameRenderPost: Function, imageSources?: Array<string>, rootElement?: HTMLElement): void
|
|
75
|
+
export function engineInit(gameInit: Function | (() => Promise<any>), gameUpdate: Function, gameUpdatePost: Function, gameRender: Function, gameRenderPost: Function, imageSources?: Array<string>, rootElement?: HTMLElement): Promise<void>;
|
|
76
76
|
/** Update each engine object, remove destroyed objects, and update time
|
|
77
77
|
* @memberof Engine */
|
|
78
78
|
export function engineObjectsUpdate(): void;
|
|
@@ -254,7 +254,7 @@ declare module "littlejsengine" {
|
|
|
254
254
|
* @default Vector2()
|
|
255
255
|
* @memberof Settings */
|
|
256
256
|
export let canvasFixedSize: Vector2;
|
|
257
|
-
/** Use nearest neighbor scaling
|
|
257
|
+
/** Use nearest neighbor canvas scaling for more pixelated look
|
|
258
258
|
* - Must be set before startup to take effect
|
|
259
259
|
* - If enabled sets css image-rendering:pixelated
|
|
260
260
|
* @type {boolean}
|
|
@@ -327,11 +327,11 @@ declare module "littlejsengine" {
|
|
|
327
327
|
* @default
|
|
328
328
|
* @memberof Settings */
|
|
329
329
|
export let objectMaxSpeed: number;
|
|
330
|
-
/** How much gravity to apply to objects
|
|
331
|
-
* @type {
|
|
330
|
+
/** How much gravity to apply to objects, negative Y is down
|
|
331
|
+
* @type {Vector2}
|
|
332
332
|
* @default
|
|
333
333
|
* @memberof Settings */
|
|
334
|
-
export let gravity:
|
|
334
|
+
export let gravity: Vector2;
|
|
335
335
|
/** Scales emit rate of particles, useful for low graphics mode (0 disables particle emitters)
|
|
336
336
|
* @type {number}
|
|
337
337
|
* @default
|
|
@@ -506,10 +506,10 @@ declare module "littlejsengine" {
|
|
|
506
506
|
* @param {number} speed
|
|
507
507
|
* @memberof Settings */
|
|
508
508
|
export function setObjectMaxSpeed(speed: number): void;
|
|
509
|
-
/** Set how much gravity to apply to objects
|
|
510
|
-
* @param {
|
|
509
|
+
/** Set how much gravity to apply to objects
|
|
510
|
+
* @param {Vector2} newGravity
|
|
511
511
|
* @memberof Settings */
|
|
512
|
-
export function setGravity(newGravity:
|
|
512
|
+
export function setGravity(newGravity: Vector2): void;
|
|
513
513
|
/** Set to scales emit rate of particles
|
|
514
514
|
* @param {number} scale
|
|
515
515
|
* @memberof Settings */
|
|
@@ -719,6 +719,11 @@ declare module "littlejsengine" {
|
|
|
719
719
|
* @return {string}
|
|
720
720
|
* @memberof Utilities */
|
|
721
721
|
export function formatTime(t: number): string;
|
|
722
|
+
/** Fetches a JSON file from a URL and returns the parsed JSON object. Must be used with await!
|
|
723
|
+
* @param {string} url - URL of JSON file
|
|
724
|
+
* @return {Promise<object>}
|
|
725
|
+
* @memberof Utilities */
|
|
726
|
+
export function fetchJSON(url: string): Promise<object>;
|
|
722
727
|
/** Random global functions
|
|
723
728
|
* @namespace Random */
|
|
724
729
|
/** Returns a random value between the two values passed in
|
|
@@ -785,6 +790,11 @@ declare module "littlejsengine" {
|
|
|
785
790
|
/** Randomly returns either -1 or 1 deterministically
|
|
786
791
|
* @return {number} */
|
|
787
792
|
sign(): number;
|
|
793
|
+
/** Returns a seeded random value between the two values passed in with a random sign
|
|
794
|
+
* @param {number} [valueA]
|
|
795
|
+
* @param {number} [valueB]
|
|
796
|
+
* @return {number} */
|
|
797
|
+
floatSign(valueA?: number, valueB?: number): number;
|
|
788
798
|
}
|
|
789
799
|
/**
|
|
790
800
|
* 2D Vector object with vector math library
|
|
@@ -1549,33 +1559,24 @@ declare module "littlejsengine" {
|
|
|
1549
1559
|
/** Clears all input
|
|
1550
1560
|
* @memberof Input */
|
|
1551
1561
|
export function clearInput(): void;
|
|
1552
|
-
/**
|
|
1553
|
-
*
|
|
1554
|
-
*
|
|
1555
|
-
* - Tracks mouse buttons, position, and wheel
|
|
1556
|
-
* - Tracks multiple analog gamepads
|
|
1557
|
-
* - Touch input is handled as mouse input
|
|
1558
|
-
* - Virtual gamepad for touch devices
|
|
1559
|
-
* @namespace Input
|
|
1560
|
-
*/
|
|
1561
|
-
/** Returns true if device key is down
|
|
1562
|
-
* @param {string|number} key
|
|
1563
|
-
* @param {number} [device]
|
|
1562
|
+
/** Returns true if mouse button is down
|
|
1563
|
+
* @function
|
|
1564
|
+
* @param {number} button
|
|
1564
1565
|
* @return {boolean}
|
|
1565
1566
|
* @memberof Input */
|
|
1566
|
-
export function mouseIsDown(
|
|
1567
|
-
/** Returns true if
|
|
1568
|
-
* @
|
|
1569
|
-
* @param {number}
|
|
1567
|
+
export function mouseIsDown(button: number): boolean;
|
|
1568
|
+
/** Returns true if mouse button was pressed
|
|
1569
|
+
* @function
|
|
1570
|
+
* @param {number} button
|
|
1570
1571
|
* @return {boolean}
|
|
1571
1572
|
* @memberof Input */
|
|
1572
|
-
export function mouseWasPressed(
|
|
1573
|
-
/** Returns true if
|
|
1574
|
-
* @
|
|
1575
|
-
* @param {number}
|
|
1573
|
+
export function mouseWasPressed(button: number): boolean;
|
|
1574
|
+
/** Returns true if mouse button was released
|
|
1575
|
+
* @function
|
|
1576
|
+
* @param {number} button
|
|
1576
1577
|
* @return {boolean}
|
|
1577
1578
|
* @memberof Input */
|
|
1578
|
-
export function mouseWasReleased(
|
|
1579
|
+
export function mouseWasReleased(button: number): boolean;
|
|
1579
1580
|
/** Mouse pos in world space
|
|
1580
1581
|
* @type {Vector2}
|
|
1581
1582
|
* @memberof Input */
|
|
@@ -1650,13 +1651,13 @@ declare module "littlejsengine" {
|
|
|
1650
1651
|
export class Sound {
|
|
1651
1652
|
/** Create a sound object and cache the zzfx samples for later use
|
|
1652
1653
|
* @param {Array} zzfxSound - Array of zzfx parameters, ex. [.5,.5]
|
|
1653
|
-
* @param {number} [range=soundDefaultRange] - World space max range of sound
|
|
1654
|
+
* @param {number} [range=soundDefaultRange] - World space max range of sound
|
|
1654
1655
|
* @param {number} [taper=soundDefaultTaper] - At what percentage of range should it start tapering
|
|
1655
1656
|
*/
|
|
1656
1657
|
constructor(zzfxSound: any[], range?: number, taper?: number);
|
|
1657
|
-
/** @property {number} - World space max range of sound
|
|
1658
|
+
/** @property {number} - World space max range of sound */
|
|
1658
1659
|
range: number;
|
|
1659
|
-
/** @property {number} - At what percentage of range should it start tapering
|
|
1660
|
+
/** @property {number} - At what percentage of range should it start tapering */
|
|
1660
1661
|
taper: number;
|
|
1661
1662
|
/** @property {number} - How much to randomize frequency each time sound plays */
|
|
1662
1663
|
randomness: any;
|
|
@@ -1713,11 +1714,17 @@ declare module "littlejsengine" {
|
|
|
1713
1714
|
/** Create a sound object and cache the wave file for later use
|
|
1714
1715
|
* @param {string} filename - Filename of audio file to load
|
|
1715
1716
|
* @param {number} [randomness] - How much to randomize frequency each time sound plays
|
|
1716
|
-
* @param {number} [range=soundDefaultRange] - World space max range of sound
|
|
1717
|
-
* @param {number} [taper=soundDefaultTaper] - At what percentage of range should it start tapering
|
|
1717
|
+
* @param {number} [range=soundDefaultRange] - World space max range of sound
|
|
1718
|
+
* @param {number} [taper=soundDefaultTaper] - At what percentage of range should it start tapering
|
|
1718
1719
|
* @param {Function} [onloadCallback] - callback function to call when sound is loaded
|
|
1719
1720
|
*/
|
|
1720
1721
|
constructor(filename: string, randomness?: number, range?: number, taper?: number, onloadCallback?: Function);
|
|
1722
|
+
/** @property {Function} - callback function to call when sound is loaded */
|
|
1723
|
+
onloadCallback: Function;
|
|
1724
|
+
/** Loads a sound from a URL and decodes it into sample data. Must be used with await!
|
|
1725
|
+
* @param {string} filename
|
|
1726
|
+
* @return {Promise<void>} */
|
|
1727
|
+
loadSound(filename: string): Promise<void>;
|
|
1721
1728
|
}
|
|
1722
1729
|
/** Play an mp3, ogg, or wav audio from a local file or url
|
|
1723
1730
|
* @param {string} filename - Location of sound file to play
|
|
@@ -1885,7 +1892,7 @@ declare module "littlejsengine" {
|
|
|
1885
1892
|
/** @property {boolean} - Limit object speed using linear or circular math */
|
|
1886
1893
|
clampSpeedLinear: boolean;
|
|
1887
1894
|
/** @property {EngineObject} - Object we are standing on, if any */
|
|
1888
|
-
groundObject:
|
|
1895
|
+
groundObject: EngineObject | TileCollisionLayer;
|
|
1889
1896
|
/** @property {EngineObject} - Parent of object if in local space */
|
|
1890
1897
|
parent: any;
|
|
1891
1898
|
/** @property {Vector2} - Local position if child */
|
|
@@ -1967,42 +1974,27 @@ declare module "littlejsengine" {
|
|
|
1967
1974
|
* LittleJS Tile Layer System
|
|
1968
1975
|
* - Caches arrays of tiles to off screen canvas for fast rendering
|
|
1969
1976
|
* - Unlimited numbers of layers, allocates canvases as needed
|
|
1970
|
-
* - Interfaces with EngineObject for collision
|
|
1971
|
-
* - Collision layer is separate from visible layers
|
|
1972
|
-
* - It is recommended to have a visible layer that matches the collision
|
|
1973
1977
|
* - Tile layers can be drawn to using their context with canvas2d
|
|
1974
1978
|
* - Drawn directly to the main canvas without using WebGL
|
|
1979
|
+
* - Tile layers can also have collision with EngineObjects
|
|
1975
1980
|
* @namespace TileCollision
|
|
1976
1981
|
*/
|
|
1977
|
-
/**
|
|
1978
|
-
* @type {Array<
|
|
1979
|
-
* @memberof TileCollision */
|
|
1980
|
-
export let tileCollision: Array<number>;
|
|
1981
|
-
/** Size of the tile collision layer 2d grid
|
|
1982
|
-
* @type {Vector2}
|
|
1983
|
-
* @memberof TileCollision */
|
|
1984
|
-
export let tileCollisionSize: Vector2;
|
|
1985
|
-
/** Clear and initialize tile collision
|
|
1986
|
-
* @param {Vector2} size - width and height of tile collision 2d grid
|
|
1987
|
-
* @memberof TileCollision */
|
|
1988
|
-
export function initTileCollision(size: Vector2): void;
|
|
1989
|
-
/** Set tile collision data for a given cell in the grid
|
|
1990
|
-
* @param {Vector2} pos
|
|
1991
|
-
* @param {number} [data]
|
|
1982
|
+
/** Keep track of all tile layers with collision
|
|
1983
|
+
* @type {Array<TileCollisionLayer>}
|
|
1992
1984
|
* @memberof TileCollision */
|
|
1993
|
-
export
|
|
1985
|
+
export let tileCollisionLayers: Array<TileCollisionLayer>;
|
|
1994
1986
|
/** Get tile collision data for a given cell in the grid
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1987
|
+
* @param {Vector2} pos
|
|
1988
|
+
* @return {number}
|
|
1989
|
+
* @memberof TileCollision */
|
|
1998
1990
|
export function getTileCollisionData(pos: Vector2): number;
|
|
1999
|
-
/** Check if
|
|
1991
|
+
/** Check if a tile layer collides with another object
|
|
2000
1992
|
* @param {Vector2} pos
|
|
2001
1993
|
* @param {Vector2} [size=(0,0)]
|
|
2002
1994
|
* @param {EngineObject} [object]
|
|
2003
|
-
* @return {
|
|
1995
|
+
* @return {TileCollisionLayer}
|
|
2004
1996
|
* @memberof TileCollision */
|
|
2005
|
-
export function tileCollisionTest(pos: Vector2, size?: Vector2, object?: EngineObject):
|
|
1997
|
+
export function tileCollisionTest(pos: Vector2, size?: Vector2, object?: EngineObject): TileCollisionLayer;
|
|
2006
1998
|
/** Return the center of first tile hit, undefined if nothing was hit.
|
|
2007
1999
|
* This does not return the exact intersection, but the center of the tile hit.
|
|
2008
2000
|
* @param {Vector2} posStart
|
|
@@ -2012,7 +2004,7 @@ declare module "littlejsengine" {
|
|
|
2012
2004
|
* @memberof TileCollision */
|
|
2013
2005
|
export function tileCollisionRaycast(posStart: Vector2, posEnd: Vector2, object?: EngineObject): Vector2;
|
|
2014
2006
|
/**
|
|
2015
|
-
* Tile layer data object stores info about how to
|
|
2007
|
+
* Tile layer data object stores info about how to draw a tile
|
|
2016
2008
|
* @example
|
|
2017
2009
|
* // create tile layer data with tile index 0 and random orientation and color
|
|
2018
2010
|
* const tileIndex = 0;
|
|
@@ -2044,20 +2036,18 @@ declare module "littlejsengine" {
|
|
|
2044
2036
|
* - Each Tile layer is rendered to an off screen canvas
|
|
2045
2037
|
* - To allow dynamic modifications, layers are rendered using canvas 2d
|
|
2046
2038
|
* - Some devices like mobile phones are limited to 4k texture resolution
|
|
2047
|
-
* -
|
|
2039
|
+
* - For with 16x16 tiles this limits layers to 256x256 on mobile devices
|
|
2048
2040
|
* @extends EngineObject
|
|
2049
2041
|
* @example
|
|
2050
|
-
*
|
|
2051
|
-
* initTileCollision(vec2(200,100));
|
|
2052
|
-
* const tileLayer = new TileLayer();
|
|
2042
|
+
* const tileLayer = new TileLayer(vec2(), vec2(200,100));
|
|
2053
2043
|
*/
|
|
2054
2044
|
export class TileLayer extends EngineObject {
|
|
2055
2045
|
/** Create a tile layer object
|
|
2056
|
-
* @param {Vector2} [position=(0,0)]
|
|
2057
|
-
* @param {Vector2} [size=
|
|
2058
|
-
* @param {TileInfo} [tileInfo]
|
|
2059
|
-
* @param {Vector2} [scale=(1,1)]
|
|
2060
|
-
* @param {number} [renderOrder]
|
|
2046
|
+
* @param {Vector2} [position=(0,0)] - World space position
|
|
2047
|
+
* @param {Vector2} [size=(1,1)] - World space size
|
|
2048
|
+
* @param {TileInfo} [tileInfo] - Tile info for layer
|
|
2049
|
+
* @param {Vector2} [scale=(1,1)] - How much to scale this layer when rendered
|
|
2050
|
+
* @param {number} [renderOrder] - Objects are sorted by renderOrder
|
|
2061
2051
|
*/
|
|
2062
2052
|
constructor(position?: Vector2, size?: Vector2, tileInfo?: TileInfo, scale?: Vector2, renderOrder?: number);
|
|
2063
2053
|
/** @property {HTMLCanvasElement} - The canvas used by this tile layer */
|
|
@@ -2118,6 +2108,48 @@ declare module "littlejsengine" {
|
|
|
2118
2108
|
* @param {number} [angle=0] */
|
|
2119
2109
|
drawRect(pos: Vector2, size?: Vector2, color?: Color, angle?: number): void;
|
|
2120
2110
|
}
|
|
2111
|
+
/**
|
|
2112
|
+
* Tile Collision Layer - a tile layer with collision
|
|
2113
|
+
* - adds collision data and functions to TileLayer
|
|
2114
|
+
* - there can be multiple tile collision layers
|
|
2115
|
+
* - tile collison layers should not overlap each other
|
|
2116
|
+
* @extends TileLayer
|
|
2117
|
+
*/
|
|
2118
|
+
export class TileCollisionLayer extends TileLayer {
|
|
2119
|
+
/** Create a tile layer object
|
|
2120
|
+
* @param {Vector2} [position=(0,0)] - World space position
|
|
2121
|
+
* @param {Vector2} [size=(0,0)] - World space size
|
|
2122
|
+
* @param {TileInfo} [tileInfo] - Tile info for layer
|
|
2123
|
+
* @param {number} [renderOrder] - Objects are sorted by renderOrder
|
|
2124
|
+
*/
|
|
2125
|
+
constructor(position?: Vector2, size?: Vector2, tileInfo?: TileInfo, renderOrder?: number);
|
|
2126
|
+
/** @property {Array<number>} - The tile collision grid */
|
|
2127
|
+
collisionData: any[];
|
|
2128
|
+
/** Clear and initialize tile collision to new size
|
|
2129
|
+
* @param {Vector2} size - width and height of tile collision 2d grid */
|
|
2130
|
+
initCollision(size: Vector2): void;
|
|
2131
|
+
/** Set tile collision data for a given cell in the grid
|
|
2132
|
+
* @param {Vector2} pos
|
|
2133
|
+
* @param {number} [data] */
|
|
2134
|
+
setCollisionData(pos: Vector2, data?: number): void;
|
|
2135
|
+
/** Get tile collision data for a given cell in the grid
|
|
2136
|
+
* @param {Vector2} pos
|
|
2137
|
+
* @return {number} */
|
|
2138
|
+
getCollisionData(pos: Vector2): number;
|
|
2139
|
+
/** Check if collision with another object should occur
|
|
2140
|
+
* @param {Vector2} pos
|
|
2141
|
+
* @param {Vector2} [size=(0,0)]
|
|
2142
|
+
* @param {EngineObject} [object]
|
|
2143
|
+
* @return {boolean} */
|
|
2144
|
+
collisionTest(pos: Vector2, size?: Vector2, object?: EngineObject): boolean;
|
|
2145
|
+
/** Return the center of first tile hit, undefined if nothing was hit.
|
|
2146
|
+
* This does not return the exact intersection, but the center of the tile hit.
|
|
2147
|
+
* @param {Vector2} posStart
|
|
2148
|
+
* @param {Vector2} posEnd
|
|
2149
|
+
* @param {EngineObject} [object]
|
|
2150
|
+
* @return {Vector2} */
|
|
2151
|
+
collisionRaycast(posStart: Vector2, posEnd: Vector2, object?: EngineObject): Vector2;
|
|
2152
|
+
}
|
|
2121
2153
|
/**
|
|
2122
2154
|
* LittleJS Particle System
|
|
2123
2155
|
*/
|
|
@@ -2330,6 +2362,15 @@ declare module "littlejsengine" {
|
|
|
2330
2362
|
renderIcon(pos: Vector2, size: number): void;
|
|
2331
2363
|
storageKey(): string;
|
|
2332
2364
|
}
|
|
2365
|
+
/**
|
|
2366
|
+
* LittleJS Newgrounds API
|
|
2367
|
+
* - NewgroundsMedal extends Medal with Newgrounds API functionality
|
|
2368
|
+
* - Call new NewgroundsPlugin() to setup Newgrounds
|
|
2369
|
+
* - Uses CryptoJS for encryption if optional cipher is provided
|
|
2370
|
+
* - Keeps connection alive and logs views
|
|
2371
|
+
* - Functions to interact with scoreboards
|
|
2372
|
+
* - Functions to unlock medals
|
|
2373
|
+
*/
|
|
2333
2374
|
/** Global Newgrounds object
|
|
2334
2375
|
* @type {NewgroundsPlugin}
|
|
2335
2376
|
* @memberof Medal */
|
|
@@ -2387,6 +2428,12 @@ declare module "littlejsengine" {
|
|
|
2387
2428
|
*/
|
|
2388
2429
|
export class NewgroundsMedal extends Medal {
|
|
2389
2430
|
}
|
|
2431
|
+
/**
|
|
2432
|
+
* LittleJS Post Processing Plugin
|
|
2433
|
+
* - Supports shadertoy style post processing shaders
|
|
2434
|
+
* - call new new PostProcessPlugin() to setup post processing
|
|
2435
|
+
* - can be enabled to pass other canvases through a final shader
|
|
2436
|
+
*/
|
|
2390
2437
|
/** Global Post Process plugin object
|
|
2391
2438
|
* @type {PostProcessPlugin} */
|
|
2392
2439
|
export let postProcess: PostProcessPlugin;
|
|
@@ -2409,6 +2456,9 @@ declare module "littlejsengine" {
|
|
|
2409
2456
|
/** @property {boolean} - Should overlay canvas be included in post processing */
|
|
2410
2457
|
includeOverlay: boolean;
|
|
2411
2458
|
}
|
|
2459
|
+
/**
|
|
2460
|
+
* LittleJS ZzFXM Plugin
|
|
2461
|
+
*/
|
|
2412
2462
|
/**
|
|
2413
2463
|
* Music Object - Stores a zzfx music track for later use
|
|
2414
2464
|
*
|
|
@@ -2452,6 +2502,15 @@ declare module "littlejsengine" {
|
|
|
2452
2502
|
*/
|
|
2453
2503
|
playMusic(volume?: number, loop?: boolean): AudioBufferSourceNode;
|
|
2454
2504
|
}
|
|
2505
|
+
/**
|
|
2506
|
+
* LittleJS User Interface Plugin
|
|
2507
|
+
* - call new UISystemPlugin() to setup the UI system
|
|
2508
|
+
* - Nested Menus
|
|
2509
|
+
* - Text
|
|
2510
|
+
* - Buttons
|
|
2511
|
+
* - Checkboxes
|
|
2512
|
+
* - Images
|
|
2513
|
+
*/
|
|
2455
2514
|
/** Global UI system plugin object
|
|
2456
2515
|
* @type {UISystemPlugin} */
|
|
2457
2516
|
export let uiSystem: UISystemPlugin;
|
|
@@ -2543,6 +2602,8 @@ declare module "littlejsengine" {
|
|
|
2543
2602
|
lineWidth: number;
|
|
2544
2603
|
/** @property {string} */
|
|
2545
2604
|
font: string;
|
|
2605
|
+
/** @property {number} - override for text height */
|
|
2606
|
+
textHeight: any;
|
|
2546
2607
|
/** @property {boolean} */
|
|
2547
2608
|
visible: boolean;
|
|
2548
2609
|
/** @property {Array<UIObject>} */
|
|
@@ -2662,22 +2723,38 @@ declare module "littlejsengine" {
|
|
|
2662
2723
|
text: string;
|
|
2663
2724
|
handleColor: Color;
|
|
2664
2725
|
}
|
|
2726
|
+
/**
|
|
2727
|
+
* LittleJS Box2D Physics Plugin
|
|
2728
|
+
* - Box2dObject extends EngineObject with Box2D physics
|
|
2729
|
+
* - Call box2dInit() before engineInit() to enable
|
|
2730
|
+
* - You will also need to include box2d.wasm.js
|
|
2731
|
+
* - Uses a super fast web assembly port of Box2D
|
|
2732
|
+
* - More info: https://github.com/kripken/box2d.js
|
|
2733
|
+
* - Functions to create polygon, circle, and edge shapes
|
|
2734
|
+
* - Contact begin and end callbacks
|
|
2735
|
+
* - Wraps b2Vec2 type to/from Vector2
|
|
2736
|
+
* - Raycasting and querying
|
|
2737
|
+
* - Every type of joint
|
|
2738
|
+
* - Debug physics drawing
|
|
2739
|
+
* @namespace Box2D
|
|
2740
|
+
*/
|
|
2665
2741
|
/** Global Box2d Plugin object
|
|
2666
|
-
* @type {Box2dPlugin}
|
|
2742
|
+
* @type {Box2dPlugin}
|
|
2743
|
+
* @memberof Box2D */
|
|
2667
2744
|
export let box2d: Box2dPlugin;
|
|
2668
2745
|
/** Enable Box2D debug drawing
|
|
2669
2746
|
* @type {boolean}
|
|
2670
|
-
* @default
|
|
2747
|
+
* @default
|
|
2748
|
+
* @memberof Box2D */
|
|
2671
2749
|
export let box2dDebug: boolean;
|
|
2672
|
-
/**
|
|
2673
|
-
* @param {
|
|
2674
|
-
* @
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
* @
|
|
2678
|
-
* @
|
|
2679
|
-
|
|
2680
|
-
export function box2dEngineInit(gameInit: Function | (() => Promise<any>), gameUpdate: Function, gameUpdatePost: Function, gameRender: Function, gameRenderPost: Function, imageSources?: Array<string>, rootElement?: HTMLElement): void;
|
|
2750
|
+
/** Enable Box2D debug drawing
|
|
2751
|
+
* @param {boolean} enable
|
|
2752
|
+
* @memberof Box2D */
|
|
2753
|
+
export function box2dSetDebug(enable: boolean): void;
|
|
2754
|
+
/** Box2d Init - Call with await before starting LittleJS to init box2d
|
|
2755
|
+
* @return {Promise<Box2dPlugin>}
|
|
2756
|
+
* @memberof Box2D */
|
|
2757
|
+
export function box2dInit(): Promise<Box2dPlugin>;
|
|
2681
2758
|
/**
|
|
2682
2759
|
* Box2D Global Object
|
|
2683
2760
|
* - Wraps Box2d world and provides global functions
|