littlejsengine 1.15.3 → 1.15.8

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.
@@ -266,7 +266,7 @@ declare module "littlejsengine" {
266
266
  * @memberof Debug */
267
267
  export function debugOverlap(posA: Vector2, sizeA: Vector2, posB: Vector2, sizeB: Vector2, color?: Color | string, time?: number, screenSpace?: boolean): void;
268
268
  /** Draw a debug axis aligned bounding box in world space
269
- * @param {string} text
269
+ * @param {string|number} text
270
270
  * @param {Vector2} pos
271
271
  * @param {number} [size]
272
272
  * @param {Color|string} [color]
@@ -275,7 +275,7 @@ declare module "littlejsengine" {
275
275
  * @param {string} [font]
276
276
  * @param {boolean} [screenSpace]
277
277
  * @memberof Debug */
278
- export function debugText(text: string, pos: Vector2, size?: number, color?: Color | string, time?: number, angle?: number, font?: string, screenSpace?: boolean): void;
278
+ export function debugText(text: string | number, pos: Vector2, size?: number, color?: Color | string, time?: number, angle?: number, font?: string, screenSpace?: boolean): void;
279
279
  /** Clear all debug primitives in the list
280
280
  * @memberof Debug */
281
281
  export function debugClear(): void;
@@ -661,6 +661,10 @@ declare module "littlejsengine" {
661
661
  * @param {boolean} enable
662
662
  * @memberof Settings */
663
663
  export function setTouchGamepadCenterButton(enable: boolean): void;
664
+ /** Set number of buttons on touch gamepad (0-4), if 1 also acts as right analog stick
665
+ * @param {number} count
666
+ * @memberof Settings */
667
+ export function setTouchGamepadButtonCount(count: number): void;
664
668
  /** Set if touch gamepad should be analog stick or 8 way dpad
665
669
  * @param {boolean} analog
666
670
  * @memberof Settings */
@@ -1023,6 +1027,10 @@ declare module "littlejsengine" {
1023
1027
  * @param {number} [y] - Y axis location
1024
1028
  * @return {Vector2} */
1025
1029
  set(x?: number, y?: number): Vector2;
1030
+ /** Sets this vector from another vector and returns self
1031
+ * @param {Vector2} v - other vector
1032
+ * @return {Vector2} */
1033
+ setFrom(v: Vector2): Vector2;
1026
1034
  /** Returns a new vector that is a copy of this
1027
1035
  * @return {Vector2} */
1028
1036
  copy(): Vector2;
@@ -1114,6 +1122,9 @@ declare module "littlejsengine" {
1114
1122
  /** Returns the area this vector covers as a rectangle
1115
1123
  * @return {number} */
1116
1124
  area(): number;
1125
+ /** Returns true if this vector is (0,0)
1126
+ * @return {boolean} */
1127
+ isZero(): boolean;
1117
1128
  /** Returns a new vector that is p percent between this and the vector passed in
1118
1129
  * @param {Vector2} v - other vector
1119
1130
  * @param {number} percent
@@ -1163,6 +1174,10 @@ declare module "littlejsengine" {
1163
1174
  * @param {number} [a] - alpha
1164
1175
  * @return {Color} */
1165
1176
  set(r?: number, g?: number, b?: number, a?: number): Color;
1177
+ /** Sets this color from another color and returns self
1178
+ * @param {Color} c - other color
1179
+ * @return {Color} */
1180
+ setFrom(c: Color): Color;
1166
1181
  /** Returns a new color that is a copy of this
1167
1182
  * @return {Color} */
1168
1183
  copy(): Color;
@@ -1430,7 +1445,7 @@ declare module "littlejsengine" {
1430
1445
  padding: number;
1431
1446
  /** @property {TextureInfo} - The texture info for this tile */
1432
1447
  textureInfo: TextureInfo;
1433
- /** @property {float} - Shrinks tile by this many pixels to prevent neighbors bleeding */
1448
+ /** @property {number} - Shrinks tile by this many pixels to prevent neighbors bleeding */
1434
1449
  bleedScale: number;
1435
1450
  /** Returns a copy of this tile offset by a vector
1436
1451
  * @param {Vector2} offset - Offset to apply in pixels
@@ -1663,7 +1678,7 @@ declare module "littlejsengine" {
1663
1678
  export function drawCanvas2D(pos: Vector2, size: Vector2, angle?: number, mirror?: boolean, drawFunction?: Canvas2DDrawFunction, screenSpace?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
1664
1679
  /** Draw text on main canvas in world space
1665
1680
  * Automatically splits new lines into rows
1666
- * @param {string} text
1681
+ * @param {string|number} text
1667
1682
  * @param {Vector2} pos
1668
1683
  * @param {number} [size]
1669
1684
  * @param {Color} [color=(1,1,1,1)]
@@ -1676,10 +1691,10 @@ declare module "littlejsengine" {
1676
1691
  * @param {number} [angle]
1677
1692
  * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=drawContext]
1678
1693
  * @memberof Draw */
1679
- export function drawText(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, fontStyle?: string, maxWidth?: number, angle?: number, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
1694
+ 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;
1680
1695
  /** Draw text on overlay canvas in world space
1681
1696
  * Automatically splits new lines into rows
1682
- * @param {string} text
1697
+ * @param {string|number} text
1683
1698
  * @param {Vector2} pos
1684
1699
  * @param {number} [size]
1685
1700
  * @param {Color} [color=(1,1,1,1)]
@@ -1691,10 +1706,10 @@ declare module "littlejsengine" {
1691
1706
  * @param {number} [maxWidth]
1692
1707
  * @param {number} [angle]
1693
1708
  * @memberof Draw */
1694
- export function drawTextOverlay(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, fontStyle?: string, maxWidth?: number, angle?: number): void;
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;
1695
1710
  /** Draw text on overlay canvas in screen space
1696
1711
  * Automatically splits new lines into rows
1697
- * @param {string} text
1712
+ * @param {string|number} text
1698
1713
  * @param {Vector2} pos
1699
1714
  * @param {number} [size]
1700
1715
  * @param {Color} [color=(1,1,1,1)]
@@ -1707,7 +1722,7 @@ declare module "littlejsengine" {
1707
1722
  * @param {number} [angle]
1708
1723
  * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
1709
1724
  * @memberof Draw */
1710
- export function drawTextScreen(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, fontStyle?: string, maxWidth?: number, angle?: number, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
1725
+ 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;
1711
1726
  /** Enable normal or additive blend mode
1712
1727
  * @param {boolean} [additive]
1713
1728
  * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context]
@@ -1742,28 +1757,28 @@ declare module "littlejsengine" {
1742
1757
  tileSize: Vector2;
1743
1758
  paddingSize: Vector2;
1744
1759
  /** Draw text in world space using the image font
1745
- * @param {string} text
1760
+ * @param {string|number} text
1746
1761
  * @param {Vector2} pos
1747
1762
  * @param {number} [scale=.25]
1748
1763
  * @param {boolean} [center]
1749
1764
  * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=drawContext]
1750
1765
  */
1751
- drawText(text: string, pos: Vector2, scale?: number, center?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
1766
+ drawText(text: string | number, pos: Vector2, scale?: number, center?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
1752
1767
  /** Draw text on overlay canvas in world space using the image font
1753
- * @param {string} text
1768
+ * @param {string|number} text
1754
1769
  * @param {Vector2} pos
1755
1770
  * @param {number} [scale]
1756
1771
  * @param {boolean} [center]
1757
1772
  */
1758
- drawTextOverlay(text: string, pos: Vector2, scale?: number, center?: boolean): void;
1773
+ drawTextOverlay(text: string | number, pos: Vector2, scale?: number, center?: boolean): void;
1759
1774
  /** Draw text on overlay canvas in screen space using the image font
1760
- * @param {string} text
1775
+ * @param {string|number} text
1761
1776
  * @param {Vector2} pos
1762
1777
  * @param {number} [scale]
1763
1778
  * @param {boolean} [center]
1764
1779
  * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=drawContext]
1765
1780
  */
1766
- drawTextScreen(text: string, pos: Vector2, scale?: number, center?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
1781
+ drawTextScreen(text: string | number, pos: Vector2, scale?: number, center?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
1767
1782
  }
1768
1783
  /** Returns true if fullscreen mode is active
1769
1784
  * @return {boolean}
@@ -1776,7 +1791,7 @@ declare module "littlejsengine" {
1776
1791
  * @param {string} [cursorStyle] - CSS cursor style (auto, none, crosshair, etc)
1777
1792
  * @memberof Draw */
1778
1793
  export function setCursor(cursorStyle?: string): void;
1779
- /** Get the camera's visible area in world space
1794
+ /** Get the size of the camera window in world space
1780
1795
  * @return {Vector2}
1781
1796
  * @memberof Draw */
1782
1797
  export function getCameraSize(): Vector2;
@@ -1910,15 +1925,6 @@ declare module "littlejsengine" {
1910
1925
  export let glPositionData: any;
1911
1926
  export let glColorData: any;
1912
1927
  export let glBatchCount: any;
1913
- /**
1914
- * LittleJS Input System
1915
- * - Tracks keyboard down, pressed, and released
1916
- * - Tracks mouse buttons, position, and wheel
1917
- * - Tracks multiple analog gamepads
1918
- * - Touch input is handled as mouse input
1919
- * - Virtual gamepad for touch devices
1920
- * @namespace Input
1921
- */
1922
1928
  /** Returns true if device key is down
1923
1929
  * @param {string|number} key
1924
1930
  * @param {number} [device]
@@ -1938,6 +1944,10 @@ declare module "littlejsengine" {
1938
1944
  * @memberof Input */
1939
1945
  export function keyWasReleased(key: string | number, device?: number): boolean;
1940
1946
  /** Returns input vector from arrow keys or WASD if enabled
1947
+ * @param {string} [up]
1948
+ * @param {string} [down]
1949
+ * @param {string} [left]
1950
+ * @param {string} [right]
1941
1951
  * @return {Vector2}
1942
1952
  * @memberof Input */
1943
1953
  export function keyDirection(up?: string, down?: string, left?: string, right?: string): Vector2;
@@ -1970,6 +1980,15 @@ declare module "littlejsengine" {
1970
1980
  * @return {boolean}
1971
1981
  * @memberof Input */
1972
1982
  export function mouseWasReleased(button: number): boolean;
1983
+ /**
1984
+ * LittleJS Input System
1985
+ * - Tracks keyboard down, pressed, and released
1986
+ * - Tracks mouse buttons, position, and wheel
1987
+ * - Tracks multiple analog gamepads
1988
+ * - Touch input is handled as mouse input
1989
+ * - Virtual gamepad for touch devices
1990
+ * @namespace Input
1991
+ */
1973
1992
  /** Mouse pos in world space
1974
1993
  * @type {Vector2}
1975
1994
  * @memberof Input */
@@ -2002,6 +2021,10 @@ declare module "littlejsengine" {
2002
2021
  * @type {boolean}
2003
2022
  * @memberof Input */
2004
2023
  export let inputPreventDefault: boolean;
2024
+ /** Primary gamepad index, automatically set to first gamepad with input
2025
+ * @type {number}
2026
+ * @memberof Input */
2027
+ export let gamepadPrimary: number;
2005
2028
  /** Prevents input continuing to the default browser handling
2006
2029
  * This is useful to disable for html menus so the browser can handle input normally
2007
2030
  * @param {boolean} preventDefault
@@ -2031,7 +2054,16 @@ declare module "littlejsengine" {
2031
2054
  * @return {Vector2}
2032
2055
  * @memberof Input */
2033
2056
  export function gamepadStick(stick: number, gamepad?: number): Vector2;
2034
- export function gamepadsUpdate(): void;
2057
+ /** Returns gamepad dpad value
2058
+ * @param {number} [gamepad]
2059
+ * @return {Vector2}
2060
+ * @memberof Input */
2061
+ export function gamepadDpad(gamepad?: number): Vector2;
2062
+ /** Returns true if passed in gamepad is connected
2063
+ * @param {number} [gamepad]
2064
+ * @return {boolean}
2065
+ * @memberof Input */
2066
+ export function gamepadConnected(gamepad?: number): boolean;
2035
2067
  /** Pulse the vibration hardware if it exists
2036
2068
  * @param {number|Array} [pattern] - single value in ms or vibration interval array
2037
2069
  * @memberof Input */
@@ -2414,7 +2446,7 @@ declare module "littlejsengine" {
2414
2446
  collideRaycast: boolean;
2415
2447
  /** Update the object transform, called automatically by engine even when paused */
2416
2448
  updateTransforms(): void;
2417
- /** Update the object physics, called automatically by engine once each frame */
2449
+ /** Update the object physics, called automatically by engine once each frame. Can be overridden to stop or change how physics works for an object. */
2418
2450
  updatePhysics(): void;
2419
2451
  /** Update the object, called automatically by engine once each frame. Does nothing by default. */
2420
2452
  update(): void;
@@ -2526,7 +2558,7 @@ declare module "littlejsengine" {
2526
2558
  * @return {TileCollisionLayer}
2527
2559
  * @memberof TileLayers */
2528
2560
  export function tileCollisionTest(pos: Vector2, size?: Vector2, object?: EngineObject, solidOnly?: boolean): TileCollisionLayer;
2529
- /** Return the exact position of the boudnary of first tile hit, undefined if nothing was hit.
2561
+ /** Return the exact position of the boundary of first tile hit, undefined if nothing was hit.
2530
2562
  * The point will be inside the colliding tile if it hits (may have a tiny shift)
2531
2563
  * @param {Vector2} posStart
2532
2564
  * @param {Vector2} posEnd
@@ -2720,7 +2752,7 @@ declare module "littlejsengine" {
2720
2752
  * @param {EngineObject} [object]
2721
2753
  * @return {boolean} */
2722
2754
  collisionTest(pos: Vector2, size?: Vector2, object?: EngineObject): boolean;
2723
- /** Return the exact position of the boudnary of first tile hit, undefined if nothing was hit.
2755
+ /** Return the exact position of the boundary of first tile hit, undefined if nothing was hit.
2724
2756
  * The point will be inside the colliding tile if it hits (may have a tiny shift)
2725
2757
  * @param {Vector2} posStart
2726
2758
  * @param {Vector2} posEnd
@@ -3103,17 +3135,31 @@ declare module "littlejsengine" {
3103
3135
  /**
3104
3136
  * LittleJS User Interface Plugin
3105
3137
  * - call new UISystemPlugin() to setup the UI system
3138
+ * - Gamepad and keyboard navigation support
3106
3139
  * - Nested Menus
3107
3140
  * - Text
3108
3141
  * - Buttons
3109
3142
  * - Checkboxes
3110
3143
  * - Images
3144
+ * - Scrollbars
3145
+ * - Video
3111
3146
  * @namespace UISystem
3112
3147
  */
3113
3148
  /** Global UI system plugin object
3114
3149
  * @type {UISystemPlugin}
3115
3150
  * @memberof UISystem */
3116
3151
  export let uiSystem: UISystemPlugin;
3152
+ /** Enable UI system debug drawing
3153
+ * 0=off, 1=normal, 2=show invisible
3154
+ * @type {number}
3155
+ * @default
3156
+ * @memberof UISystem */
3157
+ export let uiDebug: number;
3158
+ /** Enable UI system debug drawing
3159
+ * 0=off, 1=normal, 2=show invisible
3160
+ * @param {number|boolean} enable
3161
+ * @memberof UISystem */
3162
+ export function uiSetDebug(debugMode: any): void;
3117
3163
  /**
3118
3164
  * UI System Global Object
3119
3165
  * @memberof UISystem
@@ -3145,7 +3191,7 @@ declare module "littlejsengine" {
3145
3191
  /** @property {number} - Default rounded rect corner radius for UI elements */
3146
3192
  defaultCornerRadius: number;
3147
3193
  /** @property {number} - Default scale to use for fitting text to object */
3148
- defaultTextScale: number;
3194
+ defaultTextFitScale: number;
3149
3195
  /** @property {string} - Default font for UI elements */
3150
3196
  defaultFont: string;
3151
3197
  /** @property {Sound} - Default sound when interactive UI element is pressed */
@@ -3160,6 +3206,20 @@ declare module "littlejsengine" {
3160
3206
  defaultShadowBlur: number;
3161
3207
  /** @property {Vector2} - Offset of shadow blur */
3162
3208
  defaultShadowOffset: Vector2;
3209
+ /** @property {number} - If set ui coords will be renormalized to this canvas height */
3210
+ nativeHeight: number;
3211
+ /** @property {UIObject} - Object currently selected by navigation (gamepad or keyboard) */
3212
+ navigationObject: any;
3213
+ /** @property {number} - Gamepad index to use for UI navigation */
3214
+ navigationGamepadIndex: number;
3215
+ /** @property {Timer} - Cooldown timer for navigation inputs */
3216
+ navigationTimer: Timer;
3217
+ /** @property {number} - Time between navigation inputs in seconds */
3218
+ navigationDelay: number;
3219
+ /** @property {boolean} - should the navigation be horizontal, vertical, or both? */
3220
+ navigationDirection: number;
3221
+ /** @property {boolean} - True if user last used navigation instead of mouse */
3222
+ navigationMode: boolean;
3163
3223
  /** @property {Array<UIObject>} - List of all UI elements */
3164
3224
  uiObjects: any[];
3165
3225
  /** @property {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} - Context to render UI elements to */
@@ -3170,8 +3230,8 @@ declare module "littlejsengine" {
3170
3230
  hoverObject: any;
3171
3231
  /** @property {UIObject} - Hover object at start of update */
3172
3232
  lastHoverObject: any;
3173
- /** @property {number} - If set ui coords will be renormalized to this canvas height */
3174
- nativeHeight: number;
3233
+ /** @property {UIObject} - Current confirm menu being shown */
3234
+ confirmDialog: any;
3175
3235
  /** Draw a rectangle to the UI context
3176
3236
  * @param {Vector2} pos
3177
3237
  * @param {Vector2} size
@@ -3196,8 +3256,11 @@ declare module "littlejsengine" {
3196
3256
  * @param {TileInfo} tileInfo
3197
3257
  * @param {Color} [color=uiSystem.defaultColor]
3198
3258
  * @param {number} [angle]
3199
- * @param {boolean} [mirror] */
3200
- drawTile(pos: Vector2, size: Vector2, tileInfo: TileInfo, color?: Color, angle?: number, mirror?: boolean): void;
3259
+ * @param {boolean} [mirror]
3260
+ * @param {Color} [shadowColor]
3261
+ * @param {number} [shadowBlur]
3262
+ * @param {Color} [shadowOffset] */
3263
+ drawTile(pos: Vector2, size: Vector2, tileInfo: TileInfo, color?: Color, angle?: number, mirror?: boolean, shadowColor?: Color, shadowBlur?: number, shadowOffset?: Color): void;
3201
3264
  /** Draw text to the UI context
3202
3265
  * @param {string} text
3203
3266
  * @param {Vector2} pos
@@ -3210,8 +3273,10 @@ declare module "littlejsengine" {
3210
3273
  * @param {string} [fontStyle]
3211
3274
  * @param {boolean} [applyMaxWidth=true]
3212
3275
  * @param {Vector2} [textShadow]
3213
- */
3214
- drawText(text: string, pos: Vector2, size: Vector2, color?: Color, lineWidth?: number, lineColor?: Color, align?: string, font?: string, fontStyle?: string, applyMaxWidth?: boolean, textShadow?: Vector2): void;
3276
+ * @param {Color} [shadowColor]
3277
+ * @param {number} [shadowBlur]
3278
+ * @param {Color} [shadowOffset] */
3279
+ drawText(text: string, pos: Vector2, size: Vector2, color?: Color, lineWidth?: number, lineColor?: Color, align?: string, font?: string, fontStyle?: string, applyMaxWidth?: boolean, textShadow?: Vector2, shadowColor?: Color, shadowBlur?: number, shadowOffset?: Color): void;
3215
3280
  /**
3216
3281
  * @callback DragAndDropCallback - Callback for drag and drop events
3217
3282
  * @param {DragEvent} event - The drag event
@@ -3222,16 +3287,37 @@ declare module "littlejsengine" {
3222
3287
  * @param {DragAndDropCallback} [onDrop] - when a file is dropped
3223
3288
  * @param {DragAndDropCallback} [onDragEnter] - when a file is dragged onto the window
3224
3289
  * @param {DragAndDropCallback} [onDragLeave] - when a file is dragged off the window
3225
- * @param {DragAndDropCallback} [onDragOver] - continously when dragging over */
3290
+ * @param {DragAndDropCallback} [onDragOver] - continuously when dragging over */
3226
3291
  setupDragAndDrop(onDrop?: (event: DragEvent) => any, onDragEnter?: (event: DragEvent) => any, onDragLeave?: (event: DragEvent) => any, onDragOver?: (event: DragEvent) => any): void;
3227
3292
  /** Convert a screen space position to native UI position
3228
3293
  * @param {Vector2} pos
3229
- * @return {Vector2}
3230
- */
3294
+ * @return {Vector2} */
3231
3295
  screenToNative(pos: Vector2): Vector2;
3232
3296
  /** Destroy and remove all objects
3233
3297
  * @memberof Engine */
3234
3298
  destroyObjects(): void;
3299
+ /** Get all navigable UI objects sorted by navigationIndex
3300
+ * @return {Array<UIObject>} */
3301
+ getNavigableObjects(): Array<UIObject>;
3302
+ /** Get navigation direction from gamepad or keyboard
3303
+ * @return {number} */
3304
+ getNavigationDirection(): number;
3305
+ /** Get other axis navigation direction from gamepad or keyboard
3306
+ * @return {Vector2} */
3307
+ getNavigationOtherDirection(): Vector2;
3308
+ /** Get if navigation button was pressed from gamepad or keyboard
3309
+ * @return {boolean} */
3310
+ getNavigationWasPressed(): boolean;
3311
+ /** Show a confirmation dialog with Yes/No buttons
3312
+ * Centers the dialog on the screen with darkened background
3313
+ * @param {string} [text] - The message to display
3314
+ * @param {Function} [yesCallback] - Called when Yes is clicked
3315
+ * @param {Function} [noCallback] - Called when No is clicked
3316
+ * @param {Vector2} [size] - Size of the confirmation dialog
3317
+ * @param {string} [exitKey] - Key that can exit the menu
3318
+ * @return {UIObject} The confirmation menu object
3319
+ */
3320
+ showConfirmDialog(text?: string, yesCallback?: Function, noCallback?: Function, size?: Vector2, exitKey?: string): UIObject;
3235
3321
  }
3236
3322
  /**
3237
3323
  * UI Object - Base level object for all UI elements
@@ -3279,7 +3365,13 @@ declare module "littlejsengine" {
3279
3365
  /** @property {number} - Override for text height */
3280
3366
  textHeight: any;
3281
3367
  /** @property {number} - Scale text to fit in the object */
3282
- textScale: number;
3368
+ textFitScale: number;
3369
+ /** @property {Vector2} - How much to offset the text shadow or undefined */
3370
+ textShadow: any;
3371
+ /** @property {number} - Color for text line drawing */
3372
+ textLineColor: Color;
3373
+ /** @property {number} - Width for text line drawing */
3374
+ textLineWidth: number;
3283
3375
  /** @property {boolean} - Should this object be drawn */
3284
3376
  visible: boolean;
3285
3377
  /** @property {Array<UIObject>} - A list of this object's children */
@@ -3306,39 +3398,49 @@ declare module "littlejsengine" {
3306
3398
  shadowBlur: number;
3307
3399
  /** @property {Vector2} - Offset of shadow blur */
3308
3400
  shadowOffset: Vector2;
3309
- /** @property {Vector2} - How much to offset the text shadow or undefined */
3310
- textShadow: any;
3401
+ /** @property {number} - Optional navigation order index, lower values are selected first */
3402
+ navigationIndex: any;
3403
+ /** @property {boolean} - Should this be auto selected by navigation? Must also have valid navigation index. */
3404
+ navigationAutoSelect: boolean;
3311
3405
  /** Add a child UIObject to this object
3312
- * @param {UIObject} child
3313
- */
3406
+ * @param {UIObject} child */
3314
3407
  addChild(child: UIObject): void;
3315
3408
  /** Remove a child UIObject from this object
3316
- * @param {UIObject} child
3317
- */
3409
+ * @param {UIObject} child */
3318
3410
  removeChild(child: UIObject): void;
3319
3411
  /** Destroy this object, destroy its children, detach its parent, and mark it for removal */
3320
3412
  destroy(): void;
3321
3413
  destroyed: number;
3322
3414
  /** Check if the mouse is overlapping a box in screen space
3323
- * @return {boolean} - True if overlapping
3324
- */
3415
+ * @return {boolean} - True if overlapping */
3325
3416
  isMouseOverlapping(): boolean;
3326
3417
  /** Update the object, called automatically by plugin once each frame */
3327
3418
  update(): void;
3328
3419
  /** Render the object, called automatically by plugin once each frame */
3329
3420
  render(): void;
3330
- /** Special update when object is not visible */
3331
- updateInvisible(): void;
3332
3421
  /** Get the size for text with overrides and scale
3333
- * @return {Vector2}
3334
- */
3422
+ * @return {Vector2} */
3335
3423
  getTextSize(): Vector2;
3424
+ /** Called when the navigation button is pressed on this object */
3425
+ navigatePressed(): void;
3336
3426
  /** @return {boolean} - Is the mouse hovering over this element */
3337
3427
  isHoverObject(): boolean;
3338
3428
  /** @return {boolean} - Is the mouse held onto this element */
3339
3429
  isActiveObject(): boolean;
3340
- /** Called each frame when object updates */
3430
+ /** @return {boolean} - Is the gamepad or keyboard navigation object */
3431
+ isNavigationObject(): boolean;
3432
+ /** @return {boolean} - Can it be interacted with */
3433
+ isInteractive(): boolean;
3434
+ /** Returns string containing info about this object for debugging
3435
+ * @return {string} */
3436
+ toString(): string;
3437
+ /** Called if uiDebug is enabled
3438
+ * @param {boolean} visible */
3439
+ renderDebug(visible?: boolean): void;
3440
+ /** Called each frame before object updates */
3341
3441
  onUpdate(): void;
3442
+ /** Called each frame before object renders */
3443
+ onRender(): void;
3342
3444
  /** Called when the mouse enters the object */
3343
3445
  onEnter(): void;
3344
3446
  /** Called when the mouse leaves the object */
@@ -3404,6 +3506,8 @@ declare module "littlejsengine" {
3404
3506
  * @param {Color} [color=uiSystem.defaultButtonColor]
3405
3507
  */
3406
3508
  constructor(pos?: Vector2, size?: Vector2, text?: string, color?: Color);
3509
+ /** @property {Vector2} - Text offset for the button */
3510
+ textOffset: Vector2;
3407
3511
  text: string;
3408
3512
  }
3409
3513
  /**
@@ -3464,7 +3568,7 @@ declare module "littlejsengine" {
3464
3568
  * @param {number} [volume=1] - Volume percent scaled by global volume (0-1)
3465
3569
  */
3466
3570
  constructor(pos?: Vector2, size?: Vector2, src: string, autoplay?: boolean, loop?: boolean, volume?: number);
3467
- /** @property {float} - The video volume */
3571
+ /** @property {number} - The video volume */
3468
3572
  volume: number;
3469
3573
  /** @property {HTMLVideoElement} - The video player */
3470
3574
  video: HTMLVideoElement;
@@ -3477,7 +3581,7 @@ declare module "littlejsengine" {
3477
3581
  stop(): void;
3478
3582
  /** Check if video is currently loading
3479
3583
  * @return {boolean} */
3480
- isLoadng(): boolean;
3584
+ isLoading(): boolean;
3481
3585
  /** Check if video is currently paused
3482
3586
  * @return {boolean} */
3483
3587
  isPaused(): boolean;