littlejsengine 1.15.9 → 1.16.2
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 +154 -158
- package/dist/littlejs.esm.js +573 -570
- package/dist/littlejs.esm.min.js +1 -1
- package/dist/littlejs.js +553 -553
- package/dist/littlejs.min.js +1 -1
- package/dist/littlejs.release.js +392 -396
- package/examples/box2d/game.js +1 -1
- package/examples/box2d/gameObjects.js +5 -5
- 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/logo.png +0 -0
- package/examples/logo2.png +0 -0
- package/examples/module/game.js +1 -2
- package/examples/particles/index.html +1 -1
- package/examples/platformer/game.js +4 -4
- package/examples/platformer/gameEffects.js +1 -1
- package/examples/puzzle/game.js +2 -2
- package/examples/shorts/base.html +4 -3
- 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/starter/game.js +1 -2
- package/examples/starter/index.html +3 -2
- package/examples/stress/index.html +1 -1
- package/examples/typescript/game.js +1 -2
- package/examples/typescript/game.ts +1 -2
- 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 +16 -4
- package/reference.md +9 -11
- package/src/engine.js +40 -54
- package/src/engineAudio.js +5 -7
- package/src/engineBuild.js +1 -0
- package/src/engineDebug.js +163 -161
- package/src/engineDraw.js +108 -130
- package/src/engineExport.js +20 -17
- package/src/engineInput.js +4 -7
- package/src/engineMath.js +1201 -0
- package/src/engineMedals.js +7 -7
- package/src/engineObject.js +5 -4
- package/src/engineRelease.js +2 -4
- package/src/engineSettings.js +22 -32
- package/src/engineTileLayer.js +9 -10
- package/src/engineUtilities.js +34 -1187
- package/src/engineWebGL.js +13 -15
package/dist/littlejs.d.ts
CHANGED
|
@@ -199,7 +199,7 @@ declare module "littlejsengine" {
|
|
|
199
199
|
* @type {boolean}
|
|
200
200
|
* @default
|
|
201
201
|
* @memberof Debug */
|
|
202
|
-
export let
|
|
202
|
+
export let debugWatermark: boolean;
|
|
203
203
|
/** Asserts if the expression is false, does nothing in release builds
|
|
204
204
|
* Halts execution if the assert fails and throws an error
|
|
205
205
|
* @param {boolean} assert
|
|
@@ -283,37 +283,20 @@ declare module "littlejsengine" {
|
|
|
283
283
|
/** Trigger debug system to take a screenshot
|
|
284
284
|
* @memberof Debug */
|
|
285
285
|
export function debugScreenshot(): void;
|
|
286
|
-
/** Save a canvas to disk
|
|
287
|
-
* @param {HTMLCanvasElement|OffscreenCanvas} canvas
|
|
288
|
-
* @param {string} [filename]
|
|
289
|
-
* @param {string} [type]
|
|
290
|
-
* @memberof Debug */
|
|
291
|
-
export function debugSaveCanvas(canvas: HTMLCanvasElement | OffscreenCanvas, filename?: string, type?: string): void;
|
|
292
|
-
/** Save a text file to disk
|
|
293
|
-
* @param {string} text
|
|
294
|
-
* @param {string} [filename]
|
|
295
|
-
* @param {string} [type]
|
|
296
|
-
* @memberof Debug */
|
|
297
|
-
export function debugSaveText(text: string, filename?: string, type?: string): void;
|
|
298
|
-
/** Save a data url to disk
|
|
299
|
-
* @param {string} dataURL
|
|
300
|
-
* @param {string} filename
|
|
301
|
-
* @memberof Debug */
|
|
302
|
-
export function debugSaveDataURL(dataURL: string, filename: string): void;
|
|
303
286
|
/** Breaks on all asserts/errors, hides the canvas, and shows message in plain text
|
|
304
287
|
* This is a good function to call at the start of your game to catch all errors
|
|
305
288
|
* In release builds this function has no effect
|
|
306
289
|
* @memberof Debug */
|
|
307
290
|
export function debugShowErrors(): void;
|
|
308
|
-
/** Check if video capture is active
|
|
309
|
-
* @memberof Debug */
|
|
310
|
-
export function debugVideoCaptureIsActive(): boolean;
|
|
311
291
|
/** Start capturing video
|
|
312
292
|
* @memberof Debug */
|
|
313
293
|
export function debugVideoCaptureStart(): void;
|
|
314
294
|
/** Stop capturing video and save to disk
|
|
315
295
|
* @memberof Debug */
|
|
316
296
|
export function debugVideoCaptureStop(): void;
|
|
297
|
+
/** Check if video capture is active
|
|
298
|
+
* @memberof Debug */
|
|
299
|
+
export function debugVideoCaptureIsActive(): boolean;
|
|
317
300
|
/**
|
|
318
301
|
* LittleJS Engine Settings
|
|
319
302
|
* - All settings for the engine are here
|
|
@@ -340,7 +323,7 @@ declare module "littlejsengine" {
|
|
|
340
323
|
* @default
|
|
341
324
|
* @memberof Settings */
|
|
342
325
|
export let canvasColorTiles: boolean;
|
|
343
|
-
/** Color to clear the canvas to before render
|
|
326
|
+
/** Color to clear the canvas to before render, does not clear if alpha is 0
|
|
344
327
|
* @type {Color}
|
|
345
328
|
* @memberof Draw */
|
|
346
329
|
export let canvasClearColor: Color;
|
|
@@ -373,13 +356,6 @@ declare module "littlejsengine" {
|
|
|
373
356
|
* @default
|
|
374
357
|
* @memberof Settings */
|
|
375
358
|
export let canvasPixelated: boolean;
|
|
376
|
-
/** Use nearest canvas scaling for more pixelated look
|
|
377
|
-
* - If enabled sets css image-rendering:pixelated
|
|
378
|
-
* - This defaults to false because text looks better with smoothing
|
|
379
|
-
* @type {boolean}
|
|
380
|
-
* @default
|
|
381
|
-
* @memberof Settings */
|
|
382
|
-
export let overlayCanvasPixelated: boolean;
|
|
383
359
|
/** Disables texture filtering for crisper pixel art
|
|
384
360
|
* @type {boolean}
|
|
385
361
|
* @default
|
|
@@ -404,12 +380,17 @@ declare module "littlejsengine" {
|
|
|
404
380
|
* @type {Vector2}
|
|
405
381
|
* @default Vector2(16,16)
|
|
406
382
|
* @memberof Settings */
|
|
407
|
-
export let
|
|
408
|
-
/**
|
|
383
|
+
export let tileDefaultSize: Vector2;
|
|
384
|
+
/** Default padding pixels around tiles
|
|
385
|
+
* @type {number}
|
|
386
|
+
* @default
|
|
387
|
+
* @memberof Settings */
|
|
388
|
+
export let tileDefaultPadding: number;
|
|
389
|
+
/** Default amount of pixels smaller to draw tiles to prevent neighbor bleeding
|
|
409
390
|
* @type {number}
|
|
410
391
|
* @default
|
|
411
392
|
* @memberof Settings */
|
|
412
|
-
export let
|
|
393
|
+
export let tileDefaultBleed: number;
|
|
413
394
|
/** Enable physics solver for collisions between objects
|
|
414
395
|
* @type {boolean}
|
|
415
396
|
* @default
|
|
@@ -562,7 +543,7 @@ declare module "littlejsengine" {
|
|
|
562
543
|
* @param {boolean} colorTiles
|
|
563
544
|
* @memberof Settings */
|
|
564
545
|
export function setCanvasColorTiles(colorTiles: boolean): void;
|
|
565
|
-
/** Set color to clear the canvas to before render
|
|
546
|
+
/** Set color to clear the canvas to before render, does not clear if alpha is 0
|
|
566
547
|
* @param {Color} color
|
|
567
548
|
* @memberof Settings */
|
|
568
549
|
export function setCanvasClearColor(color: Color): void;
|
|
@@ -583,16 +564,9 @@ declare module "littlejsengine" {
|
|
|
583
564
|
* @memberof Settings */
|
|
584
565
|
export function setCanvasFixedSize(size: Vector2): void;
|
|
585
566
|
/** Use nearest scaling algorithm for canvas for more pixelated look
|
|
586
|
-
* - If enabled sets css image-rendering:pixelated
|
|
587
567
|
* @param {boolean} pixelated
|
|
588
568
|
* @memberof Settings */
|
|
589
569
|
export function setCanvasPixelated(pixelated: boolean): void;
|
|
590
|
-
/** Use nearest scaling algorithm for canvas for more pixelated look
|
|
591
|
-
* - If enabled sets css image-rendering:pixelated
|
|
592
|
-
* - This defaults to false because text looks better with smoothing
|
|
593
|
-
* @param {boolean} pixelated
|
|
594
|
-
* @memberof Settings */
|
|
595
|
-
export function setOverlayCanvasPixelated(pixelated: boolean): void;
|
|
596
570
|
/** Disables texture filtering for crisper pixel art
|
|
597
571
|
* @param {boolean} pixelated
|
|
598
572
|
* @memberof Settings */
|
|
@@ -616,11 +590,15 @@ declare module "littlejsengine" {
|
|
|
616
590
|
/** Set default size of tiles in pixels
|
|
617
591
|
* @param {Vector2} size
|
|
618
592
|
* @memberof Settings */
|
|
619
|
-
export function
|
|
620
|
-
/**
|
|
621
|
-
* @param {number}
|
|
593
|
+
export function setTileDefaultSize(size: Vector2): void;
|
|
594
|
+
/** Default padding pixels around tiles
|
|
595
|
+
* @param {number} padding
|
|
596
|
+
* @memberof Settings */
|
|
597
|
+
export function setTileDefaultPadding(padding: number): void;
|
|
598
|
+
/** Default amount of pixels smaller to draw tiles to prevent neighbor bleeding
|
|
599
|
+
* @param {number} bleed
|
|
622
600
|
* @memberof Settings */
|
|
623
|
-
export function
|
|
601
|
+
export function setTileDefaultBleed(bleed: number): void;
|
|
624
602
|
/** Set if collisions between objects are enabled
|
|
625
603
|
* @param {boolean} enable
|
|
626
604
|
* @memberof Settings */
|
|
@@ -737,7 +715,7 @@ declare module "littlejsengine" {
|
|
|
737
715
|
/** Set if watermark with FPS should be shown
|
|
738
716
|
* @param {boolean} show
|
|
739
717
|
* @memberof Debug */
|
|
740
|
-
export function
|
|
718
|
+
export function setDebugWatermark(show: boolean): void;
|
|
741
719
|
/** Set key code used to toggle debug mode, Esc by default
|
|
742
720
|
* @param {string} key
|
|
743
721
|
* @memberof Debug */
|
|
@@ -749,105 +727,105 @@ declare module "littlejsengine" {
|
|
|
749
727
|
* - Color - holds a rgba color with some math functions
|
|
750
728
|
* - Timer - tracks time automatically
|
|
751
729
|
* - RandomGenerator - seeded random number generator
|
|
752
|
-
* @namespace
|
|
730
|
+
* @namespace Math
|
|
753
731
|
*/
|
|
754
732
|
/** The value of PI
|
|
755
733
|
* @type {number}
|
|
756
734
|
* @default Math.PI
|
|
757
|
-
* @memberof
|
|
735
|
+
* @memberof Math */
|
|
758
736
|
export const PI: number;
|
|
759
737
|
/** Returns absolute value of value passed in
|
|
760
738
|
* @param {number} value
|
|
761
739
|
* @return {number}
|
|
762
|
-
* @memberof
|
|
740
|
+
* @memberof Math */
|
|
763
741
|
export const abs: (x: number) => number;
|
|
764
742
|
/** Returns floored value of value passed in
|
|
765
743
|
* @param {number} value
|
|
766
744
|
* @return {number}
|
|
767
|
-
* @memberof
|
|
745
|
+
* @memberof Math */
|
|
768
746
|
export const floor: (x: number) => number;
|
|
769
747
|
/** Returns ceiled value of value passed in
|
|
770
748
|
* @param {number} value
|
|
771
749
|
* @return {number}
|
|
772
|
-
* @memberof
|
|
750
|
+
* @memberof Math */
|
|
773
751
|
export const ceil: (x: number) => number;
|
|
774
752
|
/** Returns rounded value passed in
|
|
775
753
|
* @param {number} value
|
|
776
754
|
* @return {number}
|
|
777
|
-
* @memberof
|
|
755
|
+
* @memberof Math */
|
|
778
756
|
export const round: (x: number) => number;
|
|
779
757
|
/** Returns lowest value passed in
|
|
780
758
|
* @param {...number} values
|
|
781
759
|
* @return {number}
|
|
782
|
-
* @memberof
|
|
760
|
+
* @memberof Math */
|
|
783
761
|
export const min: (...values: number[]) => number;
|
|
784
762
|
/** Returns highest value passed in
|
|
785
763
|
* @param {...number} values
|
|
786
764
|
* @return {number}
|
|
787
|
-
* @memberof
|
|
765
|
+
* @memberof Math */
|
|
788
766
|
export const max: (...values: number[]) => number;
|
|
789
767
|
/** Returns the sign of value passed in
|
|
790
768
|
* @param {number} value
|
|
791
769
|
* @return {number}
|
|
792
|
-
* @memberof
|
|
770
|
+
* @memberof Math */
|
|
793
771
|
export const sign: (x: number) => number;
|
|
794
772
|
/** Returns hypotenuse of values passed in
|
|
795
773
|
* @param {...number} values
|
|
796
774
|
* @return {number}
|
|
797
|
-
* @memberof
|
|
775
|
+
* @memberof Math */
|
|
798
776
|
export const hypot: (...values: number[]) => number;
|
|
799
777
|
/** Returns log2 of value passed in
|
|
800
778
|
* @param {number} value
|
|
801
779
|
* @return {number}
|
|
802
|
-
* @memberof
|
|
780
|
+
* @memberof Math */
|
|
803
781
|
export const log2: (x: number) => number;
|
|
804
782
|
/** Returns sin of value passed in
|
|
805
783
|
* @param {number} value
|
|
806
784
|
* @return {number}
|
|
807
|
-
* @memberof
|
|
785
|
+
* @memberof Math */
|
|
808
786
|
export const sin: (x: number) => number;
|
|
809
787
|
/** Returns cos of value passed in
|
|
810
788
|
* @param {number} value
|
|
811
789
|
* @return {number}
|
|
812
|
-
* @memberof
|
|
790
|
+
* @memberof Math */
|
|
813
791
|
export const cos: (x: number) => number;
|
|
814
792
|
/** Returns tan of value passed in
|
|
815
793
|
* @param {number} value
|
|
816
794
|
* @return {number}
|
|
817
|
-
* @memberof
|
|
795
|
+
* @memberof Math */
|
|
818
796
|
export const tan: (x: number) => number;
|
|
819
797
|
/** Returns atan2 of values passed in
|
|
820
798
|
* @param {number} y
|
|
821
799
|
* @param {number} x
|
|
822
800
|
* @return {number}
|
|
823
|
-
* @memberof
|
|
801
|
+
* @memberof Math */
|
|
824
802
|
export const atan2: (y: number, x: number) => number;
|
|
825
803
|
/** Returns first parm modulo the second param, but adjusted so negative numbers work as expected
|
|
826
804
|
* @param {number} dividend
|
|
827
805
|
* @param {number} [divisor]
|
|
828
806
|
* @return {number}
|
|
829
|
-
* @memberof
|
|
807
|
+
* @memberof Math */
|
|
830
808
|
export function mod(dividend: number, divisor?: number): number;
|
|
831
809
|
/** Clamps the value between max and min
|
|
832
810
|
* @param {number} value
|
|
833
811
|
* @param {number} [min]
|
|
834
812
|
* @param {number} [max]
|
|
835
813
|
* @return {number}
|
|
836
|
-
* @memberof
|
|
814
|
+
* @memberof Math */
|
|
837
815
|
export function clamp(value: number, min?: number, max?: number): number;
|
|
838
816
|
/** Returns what percentage the value is between valueA and valueB
|
|
839
817
|
* @param {number} value
|
|
840
818
|
* @param {number} valueA
|
|
841
819
|
* @param {number} valueB
|
|
842
820
|
* @return {number}
|
|
843
|
-
* @memberof
|
|
821
|
+
* @memberof Math */
|
|
844
822
|
export function percent(value: number, valueA: number, valueB: number): number;
|
|
845
823
|
/** Returns signed wrapped distance between the two values passed in
|
|
846
824
|
* @param {number} valueA
|
|
847
825
|
* @param {number} valueB
|
|
848
826
|
* @param {number} [wrapSize]
|
|
849
827
|
* @return {number}
|
|
850
|
-
* @memberof
|
|
828
|
+
* @memberof Math */
|
|
851
829
|
export function distanceWrap(valueA: number, valueB: number, wrapSize?: number): number;
|
|
852
830
|
/** Linearly interpolates between values passed in with wrapping
|
|
853
831
|
* @param {number} valueA
|
|
@@ -855,37 +833,37 @@ declare module "littlejsengine" {
|
|
|
855
833
|
* @param {number} percent
|
|
856
834
|
* @param {number} [wrapSize]
|
|
857
835
|
* @return {number}
|
|
858
|
-
* @memberof
|
|
836
|
+
* @memberof Math */
|
|
859
837
|
export function lerpWrap(valueA: number, valueB: number, percent: number, wrapSize?: number): number;
|
|
860
838
|
/** Returns signed wrapped distance between the two angles passed in
|
|
861
839
|
* @param {number} angleA
|
|
862
840
|
* @param {number} angleB
|
|
863
841
|
* @return {number}
|
|
864
|
-
* @memberof
|
|
842
|
+
* @memberof Math */
|
|
865
843
|
export function distanceAngle(angleA: number, angleB: number): number;
|
|
866
844
|
/** Linearly interpolates between the angles passed in with wrapping
|
|
867
845
|
* @param {number} angleA
|
|
868
846
|
* @param {number} angleB
|
|
869
847
|
* @param {number} percent
|
|
870
848
|
* @return {number}
|
|
871
|
-
* @memberof
|
|
849
|
+
* @memberof Math */
|
|
872
850
|
export function lerpAngle(angleA: number, angleB: number, percent: number): number;
|
|
873
851
|
/** Linearly interpolates between values passed in using percent
|
|
874
852
|
* @param {number} valueA
|
|
875
853
|
* @param {number} valueB
|
|
876
854
|
* @param {number} percent
|
|
877
855
|
* @return {number}
|
|
878
|
-
* @memberof
|
|
856
|
+
* @memberof Math */
|
|
879
857
|
export function lerp(valueA: number, valueB: number, percent: number): number;
|
|
880
858
|
/** Applies smoothstep function to the percentage value
|
|
881
859
|
* @param {number} percent
|
|
882
860
|
* @return {number}
|
|
883
|
-
* @memberof
|
|
861
|
+
* @memberof Math */
|
|
884
862
|
export function smoothStep(percent: number): number;
|
|
885
863
|
/** Returns the nearest power of two not less than the value
|
|
886
864
|
* @param {number} value
|
|
887
865
|
* @return {number}
|
|
888
|
-
* @memberof
|
|
866
|
+
* @memberof Math */
|
|
889
867
|
export function nearestPowerOfTwo(value: number): number;
|
|
890
868
|
/** Returns true if two axis aligned bounding boxes are overlapping
|
|
891
869
|
* this can be used for simple collision detection between objects
|
|
@@ -894,7 +872,7 @@ declare module "littlejsengine" {
|
|
|
894
872
|
* @param {Vector2} posB - Center of box B
|
|
895
873
|
* @param {Vector2} [sizeB=(0,0)] - Size of box B, uses a point if undefined
|
|
896
874
|
* @return {boolean} - True if overlapping
|
|
897
|
-
* @memberof
|
|
875
|
+
* @memberof Math */
|
|
898
876
|
export function isOverlapping(posA: Vector2, sizeA: Vector2, posB: Vector2, sizeB?: Vector2): boolean;
|
|
899
877
|
/** Returns true if a line segment is intersecting an axis aligned box
|
|
900
878
|
* @param {Vector2} start - Start of raycast
|
|
@@ -902,7 +880,7 @@ declare module "littlejsengine" {
|
|
|
902
880
|
* @param {Vector2} pos - Center of box
|
|
903
881
|
* @param {Vector2} size - Size of box
|
|
904
882
|
* @return {boolean} - True if intersecting
|
|
905
|
-
* @memberof
|
|
883
|
+
* @memberof Math */
|
|
906
884
|
export function isIntersecting(start: Vector2, end: Vector2, pos: Vector2, size: Vector2): boolean;
|
|
907
885
|
/** Returns an oscillating wave between 0 and amplitude with frequency of 1 Hz by default
|
|
908
886
|
* @param {number} [frequency] - Frequency of the wave in Hz
|
|
@@ -910,8 +888,17 @@ declare module "littlejsengine" {
|
|
|
910
888
|
* @param {number} [t=time] - Value to use for time of the wave
|
|
911
889
|
* @param {number} [offset] - Value to use for time offset of the wave
|
|
912
890
|
* @return {number} - Value waving between 0 and amplitude
|
|
913
|
-
* @memberof
|
|
891
|
+
* @memberof Math */
|
|
914
892
|
export function wave(frequency?: number, amplitude?: number, t?: number, offset?: number): number;
|
|
893
|
+
/**
|
|
894
|
+
* LittleJS Utility Classes and Functions
|
|
895
|
+
* - General purpose math library
|
|
896
|
+
* - Vector2 - fast, simple, easy 2D vector class
|
|
897
|
+
* - Color - holds a rgba color with some math functions
|
|
898
|
+
* - Timer - tracks time automatically
|
|
899
|
+
* - RandomGenerator - seeded random number generator
|
|
900
|
+
* @namespace Utilities
|
|
901
|
+
*/
|
|
915
902
|
/** Formats seconds to mm:ss style for display purposes
|
|
916
903
|
* @param {number} t - time in seconds
|
|
917
904
|
* @return {string}
|
|
@@ -922,6 +909,24 @@ declare module "littlejsengine" {
|
|
|
922
909
|
* @return {Promise<object>}
|
|
923
910
|
* @memberof Utilities */
|
|
924
911
|
export function fetchJSON(url: string): Promise<object>;
|
|
912
|
+
/** Save a text file to disk
|
|
913
|
+
* @param {string} text
|
|
914
|
+
* @param {string} [filename]
|
|
915
|
+
* @param {string} [type]
|
|
916
|
+
* @memberof Utilities */
|
|
917
|
+
export function saveText(text: string, filename?: string, type?: string): void;
|
|
918
|
+
/** Save a canvas to disk
|
|
919
|
+
* @param {HTMLCanvasElement|OffscreenCanvas} canvas
|
|
920
|
+
* @param {string} [filename]
|
|
921
|
+
* @param {string} [type]
|
|
922
|
+
* @memberof Utilities */
|
|
923
|
+
export function saveCanvas(canvas: HTMLCanvasElement | OffscreenCanvas, filename?: string, type?: string): void;
|
|
924
|
+
/** Save a data url to disk
|
|
925
|
+
* @param {string} url
|
|
926
|
+
* @param {string} [filename]
|
|
927
|
+
* @param {number} [revokeTime] - how long before revoking the url
|
|
928
|
+
* @memberof Utilities */
|
|
929
|
+
export function saveDataURL(url: string, filename?: string, revokeTime?: number): void;
|
|
925
930
|
/** Random global functions
|
|
926
931
|
* @namespace Random */
|
|
927
932
|
/** Returns a random value between the two values passed in
|
|
@@ -1324,7 +1329,7 @@ declare module "littlejsengine" {
|
|
|
1324
1329
|
* let a = vec2(0, 1); // vector with coordinates (0, 1)
|
|
1325
1330
|
* a = vec2(5); // set a to (5, 5)
|
|
1326
1331
|
* b = vec2(); // set b to (0, 0)
|
|
1327
|
-
* @memberof
|
|
1332
|
+
* @memberof Math */
|
|
1328
1333
|
export function vec2(x?: number, y?: number): Vector2;
|
|
1329
1334
|
/**
|
|
1330
1335
|
* Create a color object with RGBA values, white by default
|
|
@@ -1333,7 +1338,7 @@ declare module "littlejsengine" {
|
|
|
1333
1338
|
* @param {number} [b=1] - blue
|
|
1334
1339
|
* @param {number} [a=1] - alpha
|
|
1335
1340
|
* @return {Color}
|
|
1336
|
-
* @memberof
|
|
1341
|
+
* @memberof Math
|
|
1337
1342
|
*/
|
|
1338
1343
|
export function rgb(r?: number, g?: number, b?: number, a?: number): Color;
|
|
1339
1344
|
/**
|
|
@@ -1343,96 +1348,96 @@ declare module "littlejsengine" {
|
|
|
1343
1348
|
* @param {number} [l=1] - lightness
|
|
1344
1349
|
* @param {number} [a=1] - alpha
|
|
1345
1350
|
* @return {Color}
|
|
1346
|
-
* @memberof
|
|
1351
|
+
* @memberof Math */
|
|
1347
1352
|
export function hsl(h?: number, s?: number, l?: number, a?: number): Color;
|
|
1348
1353
|
/**
|
|
1349
1354
|
* Check if object is a valid Color
|
|
1350
1355
|
* @param {any} c
|
|
1351
1356
|
* @return {boolean}
|
|
1352
|
-
* @memberof
|
|
1357
|
+
* @memberof Math */
|
|
1353
1358
|
export function isColor(c: any): boolean;
|
|
1354
1359
|
/**
|
|
1355
1360
|
* Check if object is a valid Vector2
|
|
1356
1361
|
* @param {any} v
|
|
1357
1362
|
* @return {boolean}
|
|
1358
|
-
* @memberof
|
|
1363
|
+
* @memberof Math */
|
|
1359
1364
|
export function isVector2(v: any): boolean;
|
|
1360
1365
|
/**
|
|
1361
1366
|
* Check if object is a valid number, not NaN or undefined, but it may be infinite
|
|
1362
1367
|
* @param {any} n
|
|
1363
1368
|
* @return {boolean}
|
|
1364
|
-
* @memberof
|
|
1369
|
+
* @memberof Math */
|
|
1365
1370
|
export function isNumber(n: any): boolean;
|
|
1366
1371
|
/**
|
|
1367
1372
|
* Check if object is a valid string or can be converted to one
|
|
1368
1373
|
* @param {any} s
|
|
1369
1374
|
* @return {boolean}
|
|
1370
|
-
* @memberof
|
|
1375
|
+
* @memberof Math */
|
|
1371
1376
|
export function isString(s: any): boolean;
|
|
1372
1377
|
/**
|
|
1373
1378
|
* Check if object is an array
|
|
1374
1379
|
* @param {any} a
|
|
1375
1380
|
* @return {boolean}
|
|
1376
|
-
* @memberof
|
|
1381
|
+
* @memberof Math */
|
|
1377
1382
|
export function isArray(a: any): boolean;
|
|
1378
1383
|
/** Color - White #ffffff
|
|
1379
1384
|
* @type {Color}
|
|
1380
|
-
* @memberof
|
|
1385
|
+
* @memberof Math */
|
|
1381
1386
|
export const WHITE: Color;
|
|
1382
1387
|
/** Color - Clear White #757474ff with 0 alpha
|
|
1383
1388
|
* @type {Color}
|
|
1384
|
-
* @memberof
|
|
1389
|
+
* @memberof Math */
|
|
1385
1390
|
export const CLEAR_WHITE: Color;
|
|
1386
1391
|
/** Color - Black #000000
|
|
1387
1392
|
* @type {Color}
|
|
1388
|
-
* @memberof
|
|
1393
|
+
* @memberof Math */
|
|
1389
1394
|
export const BLACK: Color;
|
|
1390
1395
|
/** Color - Clear Black #000000 with 0 alpha
|
|
1391
1396
|
* @type {Color}
|
|
1392
|
-
* @memberof
|
|
1397
|
+
* @memberof Math */
|
|
1393
1398
|
export const CLEAR_BLACK: Color;
|
|
1394
1399
|
/** Color - Gray #808080
|
|
1395
1400
|
* @type {Color}
|
|
1396
|
-
* @memberof
|
|
1401
|
+
* @memberof Math */
|
|
1397
1402
|
export const GRAY: Color;
|
|
1398
1403
|
/** Color - Red #ff0000
|
|
1399
1404
|
* @type {Color}
|
|
1400
|
-
* @memberof
|
|
1405
|
+
* @memberof Math */
|
|
1401
1406
|
export const RED: Color;
|
|
1402
1407
|
/** Color - Orange #ff8000
|
|
1403
1408
|
* @type {Color}
|
|
1404
|
-
* @memberof
|
|
1409
|
+
* @memberof Math */
|
|
1405
1410
|
export const ORANGE: Color;
|
|
1406
1411
|
/** Color - Yellow #ffff00
|
|
1407
1412
|
* @type {Color}
|
|
1408
|
-
* @memberof
|
|
1413
|
+
* @memberof Math */
|
|
1409
1414
|
export const YELLOW: Color;
|
|
1410
1415
|
/** Color - Green #00ff00
|
|
1411
1416
|
* @type {Color}
|
|
1412
|
-
* @memberof
|
|
1417
|
+
* @memberof Math */
|
|
1413
1418
|
export const GREEN: Color;
|
|
1414
1419
|
/** Color - Cyan #00ffff
|
|
1415
1420
|
* @type {Color}
|
|
1416
|
-
* @memberof
|
|
1421
|
+
* @memberof Math */
|
|
1417
1422
|
export const CYAN: Color;
|
|
1418
1423
|
/** Color - Blue #0000ff
|
|
1419
1424
|
* @type {Color}
|
|
1420
|
-
* @memberof
|
|
1425
|
+
* @memberof Math */
|
|
1421
1426
|
export const BLUE: Color;
|
|
1422
1427
|
/** Color - Purple #8000ff
|
|
1423
1428
|
* @type {Color}
|
|
1424
|
-
* @memberof
|
|
1429
|
+
* @memberof Math */
|
|
1425
1430
|
export const PURPLE: Color;
|
|
1426
1431
|
/** Color - Magenta #ff00ff
|
|
1427
1432
|
* @type {Color}
|
|
1428
|
-
* @memberof
|
|
1433
|
+
* @memberof Math */
|
|
1429
1434
|
export const MAGENTA: Color;
|
|
1430
1435
|
/**
|
|
1431
1436
|
* Create a tile info object using a grid based system
|
|
1432
1437
|
* - This can take vecs or floats for easier use and conversion
|
|
1433
1438
|
* - If an index is passed in, the tile size and index will determine the position
|
|
1434
1439
|
* @param {Vector2|number} [pos=0] - Position of the tile in pixels, or tile index
|
|
1435
|
-
* @param {Vector2|number} [size
|
|
1440
|
+
* @param {Vector2|number} [size] - Size of tile in pixels
|
|
1436
1441
|
* @param {number} [textureIndex] - Texture index to use
|
|
1437
1442
|
* @param {number} [padding] - How many pixels padding around tiles
|
|
1438
1443
|
* @return {TileInfo}
|
|
@@ -1449,13 +1454,13 @@ declare module "littlejsengine" {
|
|
|
1449
1454
|
*/
|
|
1450
1455
|
export class TileInfo {
|
|
1451
1456
|
/** Create a tile info object
|
|
1452
|
-
* @param {Vector2} [pos=(0,0)]
|
|
1453
|
-
* @param {Vector2} [size
|
|
1454
|
-
* @param {number} [textureIndex]
|
|
1455
|
-
* @param {number} [padding]
|
|
1456
|
-
* @param {number} [
|
|
1457
|
+
* @param {Vector2} [pos=(0,0)] - Top left corner of tile in pixels
|
|
1458
|
+
* @param {Vector2} [size] - Size of tile in pixels
|
|
1459
|
+
* @param {number} [textureIndex] - Texture index to use
|
|
1460
|
+
* @param {number} [padding] - How many pixels padding around tiles
|
|
1461
|
+
* @param {number} [bleed] - How many pixels smaller to draw tiles
|
|
1457
1462
|
*/
|
|
1458
|
-
constructor(pos?: Vector2, size?: Vector2, textureIndex?: number, padding?: number,
|
|
1463
|
+
constructor(pos?: Vector2, size?: Vector2, textureIndex?: number, padding?: number, bleed?: number);
|
|
1459
1464
|
/** @property {Vector2} - Top left corner of tile in pixels */
|
|
1460
1465
|
pos: Vector2;
|
|
1461
1466
|
/** @property {Vector2} - Size of tile in pixels */
|
|
@@ -1467,7 +1472,7 @@ declare module "littlejsengine" {
|
|
|
1467
1472
|
/** @property {TextureInfo} - The texture info for this tile */
|
|
1468
1473
|
textureInfo: TextureInfo;
|
|
1469
1474
|
/** @property {number} - Shrinks tile by this many pixels to prevent neighbors bleeding */
|
|
1470
|
-
|
|
1475
|
+
bleed: number;
|
|
1471
1476
|
/** Returns a copy of this tile offset by a vector
|
|
1472
1477
|
* @param {Vector2} offset - Offset to apply in pixels
|
|
1473
1478
|
* @return {TileInfo}
|
|
@@ -1524,7 +1529,6 @@ declare module "littlejsengine" {
|
|
|
1524
1529
|
* There are 3 canvas/contexts available to draw to...
|
|
1525
1530
|
* mainCanvas - 2D background canvas, non WebGL stuff like tile layers are drawn here.
|
|
1526
1531
|
* glCanvas - Used by the accelerated WebGL batch rendering system.
|
|
1527
|
-
* overlayCanvas - Another 2D canvas that appears on top of the other 2 canvases.
|
|
1528
1532
|
*
|
|
1529
1533
|
* The WebGL rendering system is very fast with some caveats...
|
|
1530
1534
|
* - Switching blend modes (additive) or textures causes another draw call which is expensive in excess
|
|
@@ -1541,22 +1545,26 @@ declare module "littlejsengine" {
|
|
|
1541
1545
|
* @type {CanvasRenderingContext2D}
|
|
1542
1546
|
* @memberof Draw */
|
|
1543
1547
|
export let mainContext: CanvasRenderingContext2D;
|
|
1544
|
-
/** The default canvas to use for drawing, usually mainCanvas
|
|
1545
|
-
* @type {HTMLCanvasElement|OffscreenCanvas}
|
|
1546
|
-
* @memberof Draw */
|
|
1547
|
-
export let drawCanvas: HTMLCanvasElement | OffscreenCanvas;
|
|
1548
1548
|
/** The default 2d context to use for drawing, usually mainContext
|
|
1549
1549
|
* @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D}
|
|
1550
1550
|
* @memberof Draw */
|
|
1551
1551
|
export let drawContext: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
1552
|
-
/**
|
|
1553
|
-
* @type {
|
|
1552
|
+
/** Offscreen canvas that can be used for image processing
|
|
1553
|
+
* @type {OffscreenCanvas}
|
|
1554
1554
|
* @memberof Draw */
|
|
1555
|
-
export let
|
|
1556
|
-
/**
|
|
1557
|
-
* @type {
|
|
1555
|
+
export let workCanvas: OffscreenCanvas;
|
|
1556
|
+
/** Offscreen canvas that can be used for image processing
|
|
1557
|
+
* @type {OffscreenCanvasRenderingContext2D}
|
|
1558
|
+
* @memberof Draw */
|
|
1559
|
+
export let workContext: OffscreenCanvasRenderingContext2D;
|
|
1560
|
+
/** Offscreen canvas with willReadFrequently that can be used for image processing
|
|
1561
|
+
* @type {OffscreenCanvas}
|
|
1558
1562
|
* @memberof Draw */
|
|
1559
|
-
export let
|
|
1563
|
+
export let workReadCanvas: OffscreenCanvas;
|
|
1564
|
+
/** Offscreen canvas with willReadFrequently that can be used for image processing
|
|
1565
|
+
* @type {OffscreenCanvasRenderingContext2D}
|
|
1566
|
+
* @memberof Draw */
|
|
1567
|
+
export let workReadContext: OffscreenCanvasRenderingContext2D;
|
|
1560
1568
|
/** The size of the main canvas (and other secondary canvases)
|
|
1561
1569
|
* @type {Vector2}
|
|
1562
1570
|
* @memberof Draw */
|
|
@@ -1589,6 +1597,13 @@ declare module "littlejsengine" {
|
|
|
1589
1597
|
* @return {Vector2}
|
|
1590
1598
|
* @memberof Draw */
|
|
1591
1599
|
export function worldToScreenDelta(worldDelta: Vector2): Vector2;
|
|
1600
|
+
/** Convert screen space transform to world space
|
|
1601
|
+
* @param {Vector2} screenPos
|
|
1602
|
+
* @param {Vector2} screenSize
|
|
1603
|
+
* @param {number} [screenAngle]
|
|
1604
|
+
* @return {[Vector2, Vector2, number]} - [pos, size, angle]
|
|
1605
|
+
* @memberof Draw */
|
|
1606
|
+
export function screenToWorldTransform(screenPos: Vector2, screenSize: Vector2, screenAngle?: number): [Vector2, Vector2, number];
|
|
1592
1607
|
/** Draw textured tile centered in world space, with color applied if using WebGL
|
|
1593
1608
|
* @param {Vector2} pos - Center of the tile in world space
|
|
1594
1609
|
* @param {Vector2} [size=(1,1)] - Size of the tile in world space
|
|
@@ -1713,22 +1728,7 @@ declare module "littlejsengine" {
|
|
|
1713
1728
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=drawContext]
|
|
1714
1729
|
* @memberof Draw */
|
|
1715
1730
|
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;
|
|
1716
|
-
/** Draw text
|
|
1717
|
-
* Automatically splits new lines into rows
|
|
1718
|
-
* @param {string|number} text
|
|
1719
|
-
* @param {Vector2} pos
|
|
1720
|
-
* @param {number} [size]
|
|
1721
|
-
* @param {Color} [color=(1,1,1,1)]
|
|
1722
|
-
* @param {number} [lineWidth]
|
|
1723
|
-
* @param {Color} [lineColor=(0,0,0,1)]
|
|
1724
|
-
* @param {CanvasTextAlign} [textAlign='center']
|
|
1725
|
-
* @param {string} [font=fontDefault]
|
|
1726
|
-
* @param {string} [fontStyle]
|
|
1727
|
-
* @param {number} [maxWidth]
|
|
1728
|
-
* @param {number} [angle]
|
|
1729
|
-
* @memberof Draw */
|
|
1730
|
-
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;
|
|
1731
|
-
/** Draw text on overlay canvas in screen space
|
|
1731
|
+
/** Draw text in screen space
|
|
1732
1732
|
* Automatically splits new lines into rows
|
|
1733
1733
|
* @param {string|number} text
|
|
1734
1734
|
* @param {Vector2} pos
|
|
@@ -1741,7 +1741,7 @@ declare module "littlejsengine" {
|
|
|
1741
1741
|
* @param {string} [fontStyle]
|
|
1742
1742
|
* @param {number} [maxWidth]
|
|
1743
1743
|
* @param {number} [angle]
|
|
1744
|
-
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=
|
|
1744
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=drawContext]
|
|
1745
1745
|
* @memberof Draw */
|
|
1746
1746
|
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;
|
|
1747
1747
|
/** Enable normal or additive blend mode
|
|
@@ -1749,8 +1749,8 @@ declare module "littlejsengine" {
|
|
|
1749
1749
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context]
|
|
1750
1750
|
* @memberof Draw */
|
|
1751
1751
|
export function setBlendMode(additive?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1752
|
-
/** Combines
|
|
1753
|
-
* This is necessary for things like
|
|
1752
|
+
/** Combines LittleJS canvases onto the main canvas
|
|
1753
|
+
* This is necessary for things like screenshots and video
|
|
1754
1754
|
* @memberof Draw */
|
|
1755
1755
|
export function combineCanvases(): void;
|
|
1756
1756
|
export let engineFontImage: any;
|
|
@@ -1785,14 +1785,7 @@ declare module "littlejsengine" {
|
|
|
1785
1785
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=drawContext]
|
|
1786
1786
|
*/
|
|
1787
1787
|
drawText(text: string | number, pos: Vector2, scale?: number, center?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1788
|
-
/** Draw text
|
|
1789
|
-
* @param {string|number} text
|
|
1790
|
-
* @param {Vector2} pos
|
|
1791
|
-
* @param {number} [scale]
|
|
1792
|
-
* @param {boolean} [center]
|
|
1793
|
-
*/
|
|
1794
|
-
drawTextOverlay(text: string | number, pos: Vector2, scale?: number, center?: boolean): void;
|
|
1795
|
-
/** Draw text on overlay canvas in screen space using the image font
|
|
1788
|
+
/** Draw text in screen space using the image font
|
|
1796
1789
|
* @param {string|number} text
|
|
1797
1790
|
* @param {Vector2} pos
|
|
1798
1791
|
* @param {number} [scale]
|
|
@@ -1828,7 +1821,7 @@ declare module "littlejsengine" {
|
|
|
1828
1821
|
* - Supports shadertoy style post processing shaders via plugin
|
|
1829
1822
|
* @namespace WebGL
|
|
1830
1823
|
*/
|
|
1831
|
-
/** The WebGL canvas which appears
|
|
1824
|
+
/** The WebGL canvas which appears below the main canvas
|
|
1832
1825
|
* @type {HTMLCanvasElement}
|
|
1833
1826
|
* @memberof WebGL */
|
|
1834
1827
|
export let glCanvas: HTMLCanvasElement;
|
|
@@ -2193,12 +2186,12 @@ declare module "littlejsengine" {
|
|
|
2193
2186
|
isLoaded(): boolean;
|
|
2194
2187
|
}
|
|
2195
2188
|
/**
|
|
2196
|
-
* Sound Wave Object -
|
|
2197
|
-
* - this can be used to play wave, mp3, and ogg files
|
|
2189
|
+
* Sound Wave Object - Loads and stores an audio file for later use
|
|
2190
|
+
* - this can be used to load and play wave, mp3, and ogg files
|
|
2198
2191
|
* @extends Sound
|
|
2199
2192
|
* @memberof Audio
|
|
2200
2193
|
* @example
|
|
2201
|
-
* //
|
|
2194
|
+
* // load an audio asset file
|
|
2202
2195
|
* const sound_example = new SoundWave('sound.mp3');
|
|
2203
2196
|
*
|
|
2204
2197
|
* // play the sound
|
|
@@ -2524,11 +2517,12 @@ declare module "littlejsengine" {
|
|
|
2524
2517
|
/** Get the direction of the mirror
|
|
2525
2518
|
* @return {number} -1 if this.mirror is true, or 1 if not mirrored */
|
|
2526
2519
|
getMirrorSign(): number;
|
|
2527
|
-
/** Attaches a child to this with a
|
|
2520
|
+
/** Attaches a child to this with a local transform, returns child for chaining
|
|
2528
2521
|
* @param {EngineObject} child
|
|
2529
2522
|
* @param {Vector2} [localPos=(0,0)]
|
|
2530
|
-
* @param {number} [localAngle]
|
|
2531
|
-
|
|
2523
|
+
* @param {number} [localAngle]
|
|
2524
|
+
* @return {EngineObject} The child object added */
|
|
2525
|
+
addChild(child: EngineObject, localPos?: Vector2, localAngle?: number): EngineObject;
|
|
2532
2526
|
/** Removes a child from this one
|
|
2533
2527
|
* @param {EngineObject} child */
|
|
2534
2528
|
removeChild(child: EngineObject): void;
|
|
@@ -2742,8 +2736,8 @@ declare module "littlejsengine" {
|
|
|
2742
2736
|
* @param {Vector2} layerPos - Local position in array
|
|
2743
2737
|
* @return {TileLayerData} */
|
|
2744
2738
|
getData(layerPos: Vector2): TileLayerData;
|
|
2745
|
-
/** @type {[
|
|
2746
|
-
savedRenderSettings: [
|
|
2739
|
+
/** @type {[CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D, Vector2, Vector2, number, Color]} */
|
|
2740
|
+
savedRenderSettings: [CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, Vector2, Vector2, number, Color];
|
|
2747
2741
|
}
|
|
2748
2742
|
/**
|
|
2749
2743
|
* Tile Collision Layer - a tile layer with collision
|
|
@@ -3092,13 +3086,12 @@ declare module "littlejsengine" {
|
|
|
3092
3086
|
export class PostProcessPlugin {
|
|
3093
3087
|
/** Create global post processing shader
|
|
3094
3088
|
* @param {string} shaderCode
|
|
3095
|
-
* @param {boolean} [includeOverlay]
|
|
3096
3089
|
* @param {boolean} [includeMainCanvas]
|
|
3097
3090
|
* @example
|
|
3098
3091
|
* // create the post process plugin object
|
|
3099
3092
|
* new PostProcessPlugin(shaderCode);
|
|
3100
3093
|
*/
|
|
3101
|
-
constructor(shaderCode: string,
|
|
3094
|
+
constructor(shaderCode: string, includeMainCanvas?: boolean);
|
|
3102
3095
|
/** @property {WebGLProgram} - Shader for post processing */
|
|
3103
3096
|
shader: any;
|
|
3104
3097
|
/** @property {WebGLTexture} - Texture for post processing */
|
|
@@ -3193,6 +3186,8 @@ declare module "littlejsengine" {
|
|
|
3193
3186
|
* new UISystemPlugin;
|
|
3194
3187
|
*/
|
|
3195
3188
|
constructor(context?: CanvasRenderingContext2D);
|
|
3189
|
+
/** @property {boolean} - Activate when mouse is pressed down instead of clicked */
|
|
3190
|
+
activateOnPress: boolean;
|
|
3196
3191
|
/** @property {Color} - Default fill color for UI elements */
|
|
3197
3192
|
defaultColor: Color;
|
|
3198
3193
|
/** @property {Color} - Default outline color for UI elements */
|
|
@@ -3421,9 +3416,10 @@ declare module "littlejsengine" {
|
|
|
3421
3416
|
navigationIndex: any;
|
|
3422
3417
|
/** @property {boolean} - Should this be auto selected by navigation? Must also have valid navigation index. */
|
|
3423
3418
|
navigationAutoSelect: boolean;
|
|
3424
|
-
/** Add a child UIObject to this object
|
|
3425
|
-
* @param {UIObject} child
|
|
3426
|
-
|
|
3419
|
+
/** Add a child UIObject to this object, returns child for chaining
|
|
3420
|
+
* @param {UIObject} child
|
|
3421
|
+
* @return {UIObject} The child object added */
|
|
3422
|
+
addChild(child: UIObject): UIObject;
|
|
3427
3423
|
/** Remove a child UIObject from this object
|
|
3428
3424
|
* @param {UIObject} child */
|
|
3429
3425
|
removeChild(child: UIObject): void;
|
|
@@ -4575,8 +4571,8 @@ declare module "littlejsengine" {
|
|
|
4575
4571
|
* - Nine slice and three slice drawing
|
|
4576
4572
|
* @namespace DrawUtilities
|
|
4577
4573
|
*/
|
|
4578
|
-
/** Draw a scalable nine-slice UI element to the
|
|
4579
|
-
* This function can not apply color because it draws using the
|
|
4574
|
+
/** Draw a scalable nine-slice UI element to the main canvas in screen space
|
|
4575
|
+
* This function can not apply color because it draws using the 2d context
|
|
4580
4576
|
* @param {Vector2} pos - Screen space position
|
|
4581
4577
|
* @param {Vector2} size - Screen space size
|
|
4582
4578
|
* @param {TileInfo} startTile - Starting tile for the nine-slice pattern
|
|
@@ -4600,8 +4596,8 @@ declare module "littlejsengine" {
|
|
|
4600
4596
|
* @param {CanvasRenderingContext2D} [context] - Canvas context to use
|
|
4601
4597
|
* @memberof DrawUtilities */
|
|
4602
4598
|
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;
|
|
4603
|
-
/** Draw a scalable three-slice UI element to the
|
|
4604
|
-
* This function can not apply color because it draws using the
|
|
4599
|
+
/** Draw a scalable three-slice UI element to the main canvas in screen space
|
|
4600
|
+
* This function can not apply color because it draws using the 2d context
|
|
4605
4601
|
* @param {Vector2} pos - Screen space position
|
|
4606
4602
|
* @param {Vector2} size - Screen space size
|
|
4607
4603
|
* @param {TileInfo} startTile - Starting tile for the three-slice pattern
|