angry-pixel 2.0.15 → 2.0.17
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/lib/broadPhaseWorker.cjs.js +2 -0
- package/lib/broadPhaseWorker.cjs.js.map +1 -0
- package/lib/broadPhaseWorker.esm.js +2 -0
- package/lib/broadPhaseWorker.esm.js.map +1 -0
- package/lib/broadPhaseWorker.js +2 -0
- package/lib/broadPhaseWorker.js.map +1 -0
- package/lib/index.cjs.js +1 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +304 -119
- package/lib/index.esm.js +1 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -247,6 +247,7 @@ declare class Vector2 {
|
|
|
247
247
|
* ```
|
|
248
248
|
*/
|
|
249
249
|
static round(out: Vector2, a: Vector2): Vector2;
|
|
250
|
+
toString(): string;
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
/**
|
|
@@ -1226,6 +1227,138 @@ declare class AssetManager {
|
|
|
1226
1227
|
private createAsset;
|
|
1227
1228
|
}
|
|
1228
1229
|
|
|
1230
|
+
type IntervalOptions = {
|
|
1231
|
+
callback: () => void;
|
|
1232
|
+
delay: number;
|
|
1233
|
+
times?: number;
|
|
1234
|
+
executeImmediately?: boolean;
|
|
1235
|
+
};
|
|
1236
|
+
/**
|
|
1237
|
+
* Manages the properties associated with time.
|
|
1238
|
+
* @public
|
|
1239
|
+
* @category Managers
|
|
1240
|
+
* @example
|
|
1241
|
+
* ```js
|
|
1242
|
+
* // using deltaTime to increment a timer
|
|
1243
|
+
* this.timer += this.timeManager.deltaTime;
|
|
1244
|
+
*
|
|
1245
|
+
* // using physicsDeltaTime within a physics component to move the object it belongs to
|
|
1246
|
+
* this.transform.position.x += speed * this.timeManager.physicsDeltaTime;
|
|
1247
|
+
*
|
|
1248
|
+
* // stop all time-related interactions by setting the scale to zero
|
|
1249
|
+
* this.timeManager.timeScale = 0;
|
|
1250
|
+
*
|
|
1251
|
+
* // set an interval that will be cleared after being called 5 times
|
|
1252
|
+
* const intervalId = timeManager.setInterval({
|
|
1253
|
+
* callback: () => console.log("Will be called 5 times!"),
|
|
1254
|
+
* delay: 1000,
|
|
1255
|
+
* times: 5,
|
|
1256
|
+
* });
|
|
1257
|
+
*
|
|
1258
|
+
* // set an interval that will be called indefinitely
|
|
1259
|
+
* const intervalId = timeManager.setInterval({
|
|
1260
|
+
* callback: () => console.log("Will be called indefinitely!"),
|
|
1261
|
+
* delay: 1000,
|
|
1262
|
+
* });
|
|
1263
|
+
*
|
|
1264
|
+
* // set an interval that will be called immediately and indefinitely
|
|
1265
|
+
* const intervalId = timeManager.setInterval({
|
|
1266
|
+
* callback: () => console.log("Will be called immediately and indefinitely!"),
|
|
1267
|
+
* delay: 1000,
|
|
1268
|
+
* executeImmediately: true,
|
|
1269
|
+
* });
|
|
1270
|
+
*
|
|
1271
|
+
* // clear the interval with the given id
|
|
1272
|
+
* this.timeManager.clearInterval(intervalId);
|
|
1273
|
+
* ```
|
|
1274
|
+
*/
|
|
1275
|
+
declare class TimeManager {
|
|
1276
|
+
/** @internal */
|
|
1277
|
+
readonly fixedGameFramerate: number;
|
|
1278
|
+
/** @internal */
|
|
1279
|
+
readonly fixedGameDeltaTime: number;
|
|
1280
|
+
/** @internal */
|
|
1281
|
+
readonly fixedPhysicsFramerate: number;
|
|
1282
|
+
/** @internal */
|
|
1283
|
+
readonly fixedPhysicsDeltaTime: number;
|
|
1284
|
+
/**
|
|
1285
|
+
* The scale on which time passes. The default value is 1.\
|
|
1286
|
+
* For example, if set to 2, the time will run at twice the speed.\
|
|
1287
|
+
* If set to 0.5, it will run at half the speed.\
|
|
1288
|
+
* If set to 0, everything associated with the time will stop.
|
|
1289
|
+
*/
|
|
1290
|
+
timeScale: number;
|
|
1291
|
+
/** The time difference, in seconds, between the last frame of and the current frame recorded by the browser. */
|
|
1292
|
+
browserDeltaTime: number;
|
|
1293
|
+
/** The time difference, in seconds, between the last frame and the current frame, unaffected by the scale. */
|
|
1294
|
+
unscaledDeltaTime: number;
|
|
1295
|
+
/** The time difference, in seconds, between the last physics frame and the current one, unaffected by the scale. */
|
|
1296
|
+
unscaledPhysicsDeltaTime: number;
|
|
1297
|
+
private maxDeltaTime;
|
|
1298
|
+
private thenForGame;
|
|
1299
|
+
private thenForPhysics;
|
|
1300
|
+
private thenForRender;
|
|
1301
|
+
private lastIntervalId;
|
|
1302
|
+
private intervals;
|
|
1303
|
+
/** The time difference, in seconds, between the last frame and the current frame. */
|
|
1304
|
+
get deltaTime(): number;
|
|
1305
|
+
/** The time difference, in seconds, between the last physics frame and the current one. */
|
|
1306
|
+
get physicsDeltaTime(): number;
|
|
1307
|
+
/** The browser delta time affected by time scale. */
|
|
1308
|
+
get renderDeltaTime(): number;
|
|
1309
|
+
constructor({ physicsFramerate }: GameConfig);
|
|
1310
|
+
/** @internal */
|
|
1311
|
+
updateForRender(time: number): void;
|
|
1312
|
+
/** @internal */
|
|
1313
|
+
updateForGame(time: number): void;
|
|
1314
|
+
/** @internal */
|
|
1315
|
+
updateForPhysics(time: number): void;
|
|
1316
|
+
/** @internal */
|
|
1317
|
+
updateIntervals(): void;
|
|
1318
|
+
/**
|
|
1319
|
+
* Sets a timer which executes a function repeatedly at a fixed time interval.\
|
|
1320
|
+
* If `times` is provided, the interval will be cleared after the function has been called that many times.\
|
|
1321
|
+
* But if `times` is not provided, the interval will continue until it is cleared.\
|
|
1322
|
+
* If `executeImmediately` is set to true, the function will be called immediately after the interval is set.\
|
|
1323
|
+
* Intervals are cleared when loading a new scene.
|
|
1324
|
+
* @param intervalOptions
|
|
1325
|
+
* @returns intervalId
|
|
1326
|
+
* @example
|
|
1327
|
+
* ```ts
|
|
1328
|
+
* const intervalId = timeManager.setInterval({
|
|
1329
|
+
* callback: () => console.log("Will be called 5 times!"),
|
|
1330
|
+
* delay: 1000,
|
|
1331
|
+
* times: 5,
|
|
1332
|
+
* });
|
|
1333
|
+
* ```
|
|
1334
|
+
* @example
|
|
1335
|
+
* ```ts
|
|
1336
|
+
* const intervalId = timeManager.setInterval({
|
|
1337
|
+
* callback: () => console.log("Will be called indefinitely!"),
|
|
1338
|
+
* delay: 1000,
|
|
1339
|
+
* });
|
|
1340
|
+
* ```
|
|
1341
|
+
* @example
|
|
1342
|
+
* ```ts
|
|
1343
|
+
* const intervalId = timeManager.setInterval({
|
|
1344
|
+
* callback: () => console.log("Will be called immediately and indefinitely!"),
|
|
1345
|
+
* delay: 1000,
|
|
1346
|
+
* executeImmediately: true,
|
|
1347
|
+
* });
|
|
1348
|
+
* ```
|
|
1349
|
+
*/
|
|
1350
|
+
setInterval({ callback, delay, times, executeImmediately }: IntervalOptions): number;
|
|
1351
|
+
/**
|
|
1352
|
+
* Clears the interval with the given id.
|
|
1353
|
+
* @param intervalId
|
|
1354
|
+
*/
|
|
1355
|
+
clearInterval(intervalId: number): void;
|
|
1356
|
+
/**
|
|
1357
|
+
* Clears all intervals.
|
|
1358
|
+
*/
|
|
1359
|
+
clearAllIntervals(): void;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1229
1362
|
/**
|
|
1230
1363
|
* This type represents a scene class
|
|
1231
1364
|
* @public
|
|
@@ -1284,6 +1417,7 @@ declare class SceneManager {
|
|
|
1284
1417
|
private readonly systemFactory;
|
|
1285
1418
|
private readonly entityManager;
|
|
1286
1419
|
private readonly assetManager;
|
|
1420
|
+
private readonly timeManager;
|
|
1287
1421
|
private readonly scenes;
|
|
1288
1422
|
private openingSceneName;
|
|
1289
1423
|
private currentSceneName;
|
|
@@ -1291,7 +1425,7 @@ declare class SceneManager {
|
|
|
1291
1425
|
private _loadingScene;
|
|
1292
1426
|
private _sceneLoadedThisFrame;
|
|
1293
1427
|
/** @internal */
|
|
1294
|
-
constructor(systemManager: SystemManager, systemFactory: CreateSystemService, entityManager: EntityManager, assetManager: AssetManager);
|
|
1428
|
+
constructor(systemManager: SystemManager, systemFactory: CreateSystemService, entityManager: EntityManager, assetManager: AssetManager, timeManager: TimeManager);
|
|
1295
1429
|
addScene(sceneType: SceneType, name: string, openingScene?: boolean): void;
|
|
1296
1430
|
loadScene(name: string): void;
|
|
1297
1431
|
loadOpeningScene(): void;
|
|
@@ -2236,6 +2370,7 @@ interface SpriteRenderData extends RenderData {
|
|
|
2236
2370
|
maskColor?: string;
|
|
2237
2371
|
maskColorMix?: number;
|
|
2238
2372
|
tintColor?: string;
|
|
2373
|
+
tiled?: Vector2;
|
|
2239
2374
|
}
|
|
2240
2375
|
/**
|
|
2241
2376
|
* Cut the image based on straight coordinates starting from the top left downward.
|
|
@@ -2265,21 +2400,27 @@ declare enum TextOrientation {
|
|
|
2265
2400
|
RightCenter = 3
|
|
2266
2401
|
}
|
|
2267
2402
|
interface TextRenderData extends RenderData {
|
|
2403
|
+
color: string;
|
|
2404
|
+
flipHorizontally: boolean;
|
|
2405
|
+
flipVertically: boolean;
|
|
2268
2406
|
font: FontFace | string;
|
|
2269
|
-
text: string;
|
|
2270
2407
|
fontSize: number;
|
|
2271
|
-
|
|
2272
|
-
lineSeparation: number;
|
|
2408
|
+
lineHeight: number;
|
|
2273
2409
|
letterSpacing: number;
|
|
2410
|
+
opacity: number;
|
|
2274
2411
|
orientation: TextOrientation;
|
|
2275
2412
|
rotation: number;
|
|
2276
|
-
|
|
2413
|
+
shadow?: {
|
|
2414
|
+
color: string;
|
|
2415
|
+
offset: Vector2;
|
|
2416
|
+
opacity: number;
|
|
2417
|
+
};
|
|
2277
2418
|
smooth: boolean;
|
|
2278
|
-
|
|
2419
|
+
text: string;
|
|
2420
|
+
textureAtlas: {
|
|
2279
2421
|
charRanges: number[];
|
|
2280
2422
|
fontSize: number;
|
|
2281
|
-
|
|
2282
|
-
spacing: Vector2;
|
|
2423
|
+
spacing: number;
|
|
2283
2424
|
};
|
|
2284
2425
|
}
|
|
2285
2426
|
|
|
@@ -2526,10 +2667,30 @@ interface SpriteRendererOptions {
|
|
|
2526
2667
|
scale: Vector2;
|
|
2527
2668
|
width: number;
|
|
2528
2669
|
height: number;
|
|
2670
|
+
tiled: Vector2;
|
|
2529
2671
|
}
|
|
2530
2672
|
/**
|
|
2531
2673
|
* @public
|
|
2532
2674
|
* @category Components
|
|
2675
|
+
* @example
|
|
2676
|
+
* ```js
|
|
2677
|
+
* spriteRenderer.image = this.assetManager.getImage("image.png");
|
|
2678
|
+
* spriteRenderer.width = 1920;
|
|
2679
|
+
* spriteRenderer.height = 1080;
|
|
2680
|
+
* spriteRenderer.offset = new Vector2(0, 0);
|
|
2681
|
+
* spriteRenderer.flipHorizontally = false;
|
|
2682
|
+
* spriteRenderer.flipVertically = false;
|
|
2683
|
+
* spriteRenderer.rotation = 0;
|
|
2684
|
+
* spriteRenderer.opacity = 1;
|
|
2685
|
+
* spriteRenderer.maskColor = "#FF0000";
|
|
2686
|
+
* spriteRenderer.maskColorMix = 0;
|
|
2687
|
+
* spriteRenderer.tintColor = "#00FF00";
|
|
2688
|
+
* spriteRenderer.layer = "Default";
|
|
2689
|
+
* spriteRenderer.slice = {x: 0, y:0, width: 1920, height: 1080};
|
|
2690
|
+
* spriteRenderer.scale = new Vector2(1, 1);
|
|
2691
|
+
* spriteRenderer.tiled = new Vector2(1, 1);
|
|
2692
|
+
* spriteRenderer.smooth = false;
|
|
2693
|
+
* ```
|
|
2533
2694
|
*/
|
|
2534
2695
|
declare class SpriteRenderer {
|
|
2535
2696
|
/** The render layer */
|
|
@@ -2562,6 +2723,8 @@ declare class SpriteRenderer {
|
|
|
2562
2723
|
width: number;
|
|
2563
2724
|
/** Overwrite the original image height */
|
|
2564
2725
|
height: number;
|
|
2726
|
+
/** Enable tiled draw mode */
|
|
2727
|
+
tiled: Vector2;
|
|
2565
2728
|
/** @internal */
|
|
2566
2729
|
_renderData: SpriteRenderData;
|
|
2567
2730
|
constructor(options?: Partial<SpriteRendererOptions>);
|
|
@@ -2572,86 +2735,160 @@ declare class SpriteRenderer {
|
|
|
2572
2735
|
* @category Components
|
|
2573
2736
|
*/
|
|
2574
2737
|
interface TextRendererOptions {
|
|
2575
|
-
|
|
2576
|
-
|
|
2738
|
+
/** The text color */
|
|
2739
|
+
color: string;
|
|
2740
|
+
/** Flip the text horizontally */
|
|
2741
|
+
flipHorizontally: boolean;
|
|
2742
|
+
/** Flip the text vertically */
|
|
2743
|
+
flipVertically: boolean;
|
|
2744
|
+
/** The font family to use */
|
|
2577
2745
|
font: FontFace | string;
|
|
2746
|
+
/** The size of the font in pixels. */
|
|
2578
2747
|
fontSize: number;
|
|
2579
|
-
|
|
2748
|
+
/** The height of the invisible box where the text is rendered */
|
|
2580
2749
|
height: number;
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2750
|
+
/** The render layer */
|
|
2751
|
+
layer: string;
|
|
2752
|
+
/** The space between chars in pixels */
|
|
2584
2753
|
letterSpacing: number;
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2754
|
+
/** The height of the line in pixels. Default value is equal to the font size */
|
|
2755
|
+
lineHeight: number;
|
|
2756
|
+
/** X-axis and Y-axis offset */
|
|
2757
|
+
offset: Vector2;
|
|
2758
|
+
/** Change the opacity between 1 and 0 */
|
|
2588
2759
|
opacity: number;
|
|
2760
|
+
/** Direction in which the text will be rendered. */
|
|
2589
2761
|
orientation: TextOrientation;
|
|
2590
|
-
|
|
2591
|
-
|
|
2762
|
+
/** Text rotation in radians */
|
|
2763
|
+
rotation: number;
|
|
2764
|
+
/** Smoothing pixels (not recommended for bitmap fonts) */
|
|
2765
|
+
smooth: boolean;
|
|
2766
|
+
/** Shadow text configuration */
|
|
2767
|
+
shadow?: {
|
|
2768
|
+
/** Shadow text color */
|
|
2769
|
+
color: string;
|
|
2770
|
+
/** Shadow text offset in pixels */
|
|
2771
|
+
offset: Vector2;
|
|
2772
|
+
/** Shadow text opacity */
|
|
2773
|
+
opacity: number;
|
|
2774
|
+
};
|
|
2775
|
+
/** The text to render */
|
|
2776
|
+
text: string;
|
|
2777
|
+
/** The texture atlas configuration */
|
|
2778
|
+
textureAtlas: {
|
|
2779
|
+
/** Range of characters covered by the component defined in number pairs.
|
|
2780
|
+
* The default value is [32, 126, 161, 255], this means that the component
|
|
2781
|
+
* will render characters from 32 to 126 and from 161 to 255. */
|
|
2782
|
+
charRanges?: number[];
|
|
2783
|
+
/** The size of the font in pixels for bitmap fonts. */
|
|
2784
|
+
fontSize?: number;
|
|
2785
|
+
/** Spacing in pixels to correct badly sliced characters. */
|
|
2786
|
+
spacing?: number;
|
|
2787
|
+
};
|
|
2788
|
+
/** The width of the invisible box where the text is rendered */
|
|
2789
|
+
width: number;
|
|
2592
2790
|
}
|
|
2593
2791
|
/**
|
|
2594
2792
|
* The TextRenderer component allows to render text using font families, colors, and other configuration options.
|
|
2595
2793
|
* @public
|
|
2596
2794
|
* @category Components
|
|
2795
|
+
* @example
|
|
2796
|
+
* ```typescript
|
|
2797
|
+
* const textRenderer = new TextRenderer({
|
|
2798
|
+
* text: "Hello World!",
|
|
2799
|
+
* color: "#FFFFFF",
|
|
2800
|
+
* fontSize: 24,
|
|
2801
|
+
* font: "Arial",
|
|
2802
|
+
* width: 1920,
|
|
2803
|
+
* height: 32,
|
|
2804
|
+
* layer: "TextLayer",
|
|
2805
|
+
* });
|
|
2806
|
+
* ```
|
|
2597
2807
|
* @example
|
|
2598
|
-
* ```
|
|
2599
|
-
*
|
|
2600
|
-
*
|
|
2601
|
-
*
|
|
2602
|
-
*
|
|
2603
|
-
*
|
|
2604
|
-
*
|
|
2605
|
-
*
|
|
2606
|
-
*
|
|
2607
|
-
*
|
|
2608
|
-
*
|
|
2609
|
-
*
|
|
2610
|
-
*
|
|
2611
|
-
*
|
|
2612
|
-
*
|
|
2613
|
-
*
|
|
2614
|
-
*
|
|
2615
|
-
*
|
|
2808
|
+
* ```typescript
|
|
2809
|
+
* const textRenderer = new TextRenderer({
|
|
2810
|
+
* text: "Hello World!",
|
|
2811
|
+
* color: "#FFFFFF",
|
|
2812
|
+
* fontSize: 24,
|
|
2813
|
+
* width: 1920,
|
|
2814
|
+
* height: 32,
|
|
2815
|
+
* opacity: 1,
|
|
2816
|
+
* layer: "TextLayer",
|
|
2817
|
+
* orientation: TextOrientation.RightCenter,
|
|
2818
|
+
* shadow: {
|
|
2819
|
+
* color: "#00FF00",
|
|
2820
|
+
* offset: new Vector2(3, -3),
|
|
2821
|
+
* opacity: 0.5,
|
|
2822
|
+
* },
|
|
2823
|
+
* textureAtlas: {
|
|
2824
|
+
* charRanges: [32, 126, 161, 255, 0x3040, 0x309f],
|
|
2825
|
+
* fontSize: 64,
|
|
2826
|
+
* spacing: 4,
|
|
2827
|
+
* },
|
|
2828
|
+
* font: "Arial",
|
|
2829
|
+
* flipHorizontally: false,
|
|
2830
|
+
* flipVertically: false,
|
|
2831
|
+
* letterSpacing: 0,
|
|
2832
|
+
* lineHeight: 24,
|
|
2833
|
+
* offset: new Vector2(0, 0),
|
|
2834
|
+
* rotation: 0,
|
|
2835
|
+
* smooth: false,
|
|
2836
|
+
* });
|
|
2616
2837
|
* ```
|
|
2617
2838
|
*/
|
|
2618
2839
|
declare class TextRenderer {
|
|
2619
|
-
/** The
|
|
2620
|
-
|
|
2621
|
-
/**
|
|
2622
|
-
|
|
2840
|
+
/** The text color */
|
|
2841
|
+
color: string;
|
|
2842
|
+
/** Flip the text horizontally */
|
|
2843
|
+
flipHorizontally: boolean;
|
|
2844
|
+
/** Flip the text vertically */
|
|
2845
|
+
flipVertically: boolean;
|
|
2623
2846
|
/** The font family to use */
|
|
2624
2847
|
font: FontFace | string;
|
|
2625
2848
|
/** The size of the font in pixels. */
|
|
2626
2849
|
fontSize: number;
|
|
2627
|
-
/** The width of the invisible box where the text is rendered */
|
|
2628
|
-
width: number;
|
|
2629
2850
|
/** The height of the invisible box where the text is rendered */
|
|
2630
2851
|
height: number;
|
|
2631
|
-
/**
|
|
2632
|
-
|
|
2633
|
-
/** The text color */
|
|
2634
|
-
color: string;
|
|
2635
|
-
/** The separation between lines in pixels */
|
|
2636
|
-
lineSeparation: number;
|
|
2852
|
+
/** The render layer */
|
|
2853
|
+
layer: string;
|
|
2637
2854
|
/** The space between chars in pixels */
|
|
2638
2855
|
letterSpacing: number;
|
|
2639
|
-
/**
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
/** Smoothing pixels (not recommended for bitmap fonts) */
|
|
2644
|
-
smooth: boolean;
|
|
2645
|
-
/** Text rotation in radians */
|
|
2646
|
-
rotation: number;
|
|
2856
|
+
/** The height of the line in pixels. Default value is equal to the font size */
|
|
2857
|
+
lineHeight: number;
|
|
2858
|
+
/** X-axis and Y-axis offset */
|
|
2859
|
+
offset: Vector2;
|
|
2647
2860
|
/** Change the opacity between 1 and 0 */
|
|
2648
2861
|
opacity: number;
|
|
2649
2862
|
/** Direction in which the text will be rendered. */
|
|
2650
2863
|
orientation: TextOrientation;
|
|
2651
|
-
/**
|
|
2652
|
-
|
|
2653
|
-
/**
|
|
2654
|
-
|
|
2864
|
+
/** Text rotation in radians */
|
|
2865
|
+
rotation: number;
|
|
2866
|
+
/** Shadow text configuration */
|
|
2867
|
+
shadow: {
|
|
2868
|
+
/** Shadow text color */
|
|
2869
|
+
color: string;
|
|
2870
|
+
/** Shadow text offset in pixels */
|
|
2871
|
+
offset: Vector2;
|
|
2872
|
+
/** Shadow text opacity */
|
|
2873
|
+
opacity: number;
|
|
2874
|
+
};
|
|
2875
|
+
/** Smoothing pixels (not recommended for bitmap fonts) */
|
|
2876
|
+
smooth: boolean;
|
|
2877
|
+
/** The text to render */
|
|
2878
|
+
text: string;
|
|
2879
|
+
/** The texture atlas configuration */
|
|
2880
|
+
textureAtlas: {
|
|
2881
|
+
/** Range of characters covered by the component defined in number pairs.
|
|
2882
|
+
* The default value is [32, 126, 161, 255], this means that the component
|
|
2883
|
+
* will render characters from 32 to 126 and from 161 to 255. */
|
|
2884
|
+
charRanges?: number[];
|
|
2885
|
+
/** The size of the font in pixels for bitmap fonts. */
|
|
2886
|
+
fontSize?: number;
|
|
2887
|
+
/** Spacing in pixels to correct badly sliced characters. */
|
|
2888
|
+
spacing?: number;
|
|
2889
|
+
};
|
|
2890
|
+
/** The width of the invisible box where the text is rendered */
|
|
2891
|
+
width: number;
|
|
2655
2892
|
/** @internal */
|
|
2656
2893
|
_renderData: TextRenderData;
|
|
2657
2894
|
constructor(options?: Partial<TextRendererOptions>);
|
|
@@ -3178,63 +3415,6 @@ declare class InputManager {
|
|
|
3178
3415
|
constructor();
|
|
3179
3416
|
}
|
|
3180
3417
|
|
|
3181
|
-
/**
|
|
3182
|
-
* Manages the properties associated with time.
|
|
3183
|
-
* @public
|
|
3184
|
-
* @category Managers
|
|
3185
|
-
* @example
|
|
3186
|
-
* ```js
|
|
3187
|
-
* // using deltaTime to increment a timer
|
|
3188
|
-
* this.timer += this.timeManager.deltaTime;
|
|
3189
|
-
*
|
|
3190
|
-
* // using physicsDeltaTime within a physics component to move the object it belongs to
|
|
3191
|
-
* this.transform.position.x += speed * this.timeManager.physicsDeltaTime;
|
|
3192
|
-
*
|
|
3193
|
-
* // stop all time-related interactions by setting the scale to zero
|
|
3194
|
-
* this.timeManager.timeScale = 0;
|
|
3195
|
-
* ```
|
|
3196
|
-
*/
|
|
3197
|
-
declare class TimeManager {
|
|
3198
|
-
/** @internal */
|
|
3199
|
-
readonly fixedGameFramerate: number;
|
|
3200
|
-
/** @internal */
|
|
3201
|
-
readonly fixedGameDeltaTime: number;
|
|
3202
|
-
/** @internal */
|
|
3203
|
-
readonly fixedPhysicsFramerate: number;
|
|
3204
|
-
/** @internal */
|
|
3205
|
-
readonly fixedPhysicsDeltaTime: number;
|
|
3206
|
-
/**
|
|
3207
|
-
* The scale on which time passes. The default value is 1.\
|
|
3208
|
-
* For example, if set to 2, the time will run at twice the speed.\
|
|
3209
|
-
* If set to 0.5, it will run at half the speed.\
|
|
3210
|
-
* If set to 0, everything associated with the time will stop.
|
|
3211
|
-
*/
|
|
3212
|
-
timeScale: number;
|
|
3213
|
-
/** The time difference, in seconds, between the last frame of and the current frame recorded by the browser. */
|
|
3214
|
-
browserDeltaTime: number;
|
|
3215
|
-
/** The time difference, in seconds, between the last frame and the current frame, unaffected by the scale. */
|
|
3216
|
-
unscaledDeltaTime: number;
|
|
3217
|
-
/** The time difference, in seconds, between the last physics frame and the current one, unaffected by the scale. */
|
|
3218
|
-
unscaledPhysicsDeltaTime: number;
|
|
3219
|
-
private maxDeltaTime;
|
|
3220
|
-
private thenForGame;
|
|
3221
|
-
private thenForPhysics;
|
|
3222
|
-
private thenForRender;
|
|
3223
|
-
/** The time difference, in seconds, between the last frame and the current frame. */
|
|
3224
|
-
get deltaTime(): number;
|
|
3225
|
-
/** The time difference, in seconds, between the last physics frame and the current one. */
|
|
3226
|
-
get physicsDeltaTime(): number;
|
|
3227
|
-
/** The browser delta time affected by time scale. */
|
|
3228
|
-
get renderDeltaTime(): number;
|
|
3229
|
-
constructor({ physicsFramerate }: GameConfig);
|
|
3230
|
-
/** @internal */
|
|
3231
|
-
updateForRender(time: number): void;
|
|
3232
|
-
/** @internal */
|
|
3233
|
-
updateForGame(time: number): void;
|
|
3234
|
-
/** @internal */
|
|
3235
|
-
updateForPhysics(time: number): void;
|
|
3236
|
-
}
|
|
3237
|
-
|
|
3238
3418
|
/**
|
|
3239
3419
|
* Abstract class which can be used to create Systems.\
|
|
3240
3420
|
* It includes the following dependencies: EntityManager, AssetManager, SceneManager, TimeManager, InputManager, CollisionRepository.
|
|
@@ -3256,7 +3436,12 @@ declare abstract class GameSystem implements System {
|
|
|
3256
3436
|
protected readonly timeManager: TimeManager;
|
|
3257
3437
|
protected readonly inputManager: InputManager;
|
|
3258
3438
|
protected readonly collisionRepository: CollisionRepository;
|
|
3439
|
+
protected readonly gameConfig: GameConfig;
|
|
3259
3440
|
onUpdate(): void;
|
|
3441
|
+
onCreate(): void;
|
|
3442
|
+
onEnabled(): void;
|
|
3443
|
+
onDisabled(): void;
|
|
3444
|
+
onDestroy(): void;
|
|
3260
3445
|
}
|
|
3261
3446
|
|
|
3262
3447
|
/**
|
|
@@ -3313,4 +3498,4 @@ declare const Symbols: {
|
|
|
3313
3498
|
TimeManager: symbol;
|
|
3314
3499
|
};
|
|
3315
3500
|
|
|
3316
|
-
export { Animation, type AnimationSlice, Animator, type AnimatorOptions, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, Children, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, type DependencyName, type DependencyType, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, InputManager, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, Parent, Polygon, PolygonCollider, type PolygonColliderOptions, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, Scene, SceneManager, type SceneType, type SearchCriteria, type SearchResult, ShadowRenderer, type ShadowRendererOptions, type Shape, type Slice, SpriteRenderer, type SpriteRendererOptions, Symbols, type System, type SystemGroup, SystemManager, type SystemType, TextOrientation, TextRenderer, type TextRendererOptions, type TiledChunk, type TiledLayer, type TiledObject, type TiledObjectLayer, type TiledProperty, type TiledTilemap, TiledWrapper, type TiledWrapperOptions, TilemapCollider, type TilemapColliderOptions, TilemapOrientation, TilemapRenderer, type TilemapRendererOptions, type Tileset, TimeManager, type TouchInteraction, TouchScreen, Transform, type TransformOptions, Vector2, type VibrationInput, VideoRenderer, type VideoRendererOptions, between, clamp, defaultRenderLayer, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, randomFloat, randomInt, range };
|
|
3501
|
+
export { Animation, type AnimationSlice, Animator, type AnimatorOptions, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, Children, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, type DependencyName, type DependencyType, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, InputManager, type IntervalOptions, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, Parent, Polygon, PolygonCollider, type PolygonColliderOptions, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, Scene, SceneManager, type SceneType, type SearchCriteria, type SearchResult, ShadowRenderer, type ShadowRendererOptions, type Shape, type Slice, SpriteRenderer, type SpriteRendererOptions, Symbols, type System, type SystemGroup, SystemManager, type SystemType, TextOrientation, TextRenderer, type TextRendererOptions, type TiledChunk, type TiledLayer, type TiledObject, type TiledObjectLayer, type TiledProperty, type TiledTilemap, TiledWrapper, type TiledWrapperOptions, TilemapCollider, type TilemapColliderOptions, TilemapOrientation, TilemapRenderer, type TilemapRendererOptions, type Tileset, TimeManager, type TouchInteraction, TouchScreen, Transform, type TransformOptions, Vector2, type VibrationInput, VideoRenderer, type VideoRendererOptions, between, clamp, defaultRenderLayer, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, randomFloat, randomInt, range };
|