angry-pixel 2.0.15 → 2.0.16
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/index.cjs.js +1 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +164 -59
- 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.
|
|
@@ -2526,10 +2661,30 @@ interface SpriteRendererOptions {
|
|
|
2526
2661
|
scale: Vector2;
|
|
2527
2662
|
width: number;
|
|
2528
2663
|
height: number;
|
|
2664
|
+
tiled: Vector2;
|
|
2529
2665
|
}
|
|
2530
2666
|
/**
|
|
2531
2667
|
* @public
|
|
2532
2668
|
* @category Components
|
|
2669
|
+
* @example
|
|
2670
|
+
* ```js
|
|
2671
|
+
* spriteRenderer.image = this.assetManager.getImage("image.png");
|
|
2672
|
+
* spriteRenderer.width = 1920;
|
|
2673
|
+
* spriteRenderer.height = 1080;
|
|
2674
|
+
* spriteRenderer.offset = new Vector2(0, 0);
|
|
2675
|
+
* spriteRenderer.flipHorizontally = false;
|
|
2676
|
+
* spriteRenderer.flipVertically = false;
|
|
2677
|
+
* spriteRenderer.rotation = 0;
|
|
2678
|
+
* spriteRenderer.opacity = 1;
|
|
2679
|
+
* spriteRenderer.maskColor = "#FF0000";
|
|
2680
|
+
* spriteRenderer.maskColorMix = 0;
|
|
2681
|
+
* spriteRenderer.tintColor = "#00FF00";
|
|
2682
|
+
* spriteRenderer.layer = "Default";
|
|
2683
|
+
* spriteRenderer.slice = {x: 0, y:0, width: 1920, height: 1080};
|
|
2684
|
+
* spriteRenderer.scale = new Vector2(1, 1);
|
|
2685
|
+
* spriteRenderer.tiled = new Vector2(1, 1);
|
|
2686
|
+
* spriteRenderer.smooth = false;
|
|
2687
|
+
* ```
|
|
2533
2688
|
*/
|
|
2534
2689
|
declare class SpriteRenderer {
|
|
2535
2690
|
/** The render layer */
|
|
@@ -2562,6 +2717,8 @@ declare class SpriteRenderer {
|
|
|
2562
2717
|
width: number;
|
|
2563
2718
|
/** Overwrite the original image height */
|
|
2564
2719
|
height: number;
|
|
2720
|
+
/** Enable tiled draw mode */
|
|
2721
|
+
tiled: Vector2;
|
|
2565
2722
|
/** @internal */
|
|
2566
2723
|
_renderData: SpriteRenderData;
|
|
2567
2724
|
constructor(options?: Partial<SpriteRendererOptions>);
|
|
@@ -3178,63 +3335,6 @@ declare class InputManager {
|
|
|
3178
3335
|
constructor();
|
|
3179
3336
|
}
|
|
3180
3337
|
|
|
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
3338
|
/**
|
|
3239
3339
|
* Abstract class which can be used to create Systems.\
|
|
3240
3340
|
* It includes the following dependencies: EntityManager, AssetManager, SceneManager, TimeManager, InputManager, CollisionRepository.
|
|
@@ -3256,7 +3356,12 @@ declare abstract class GameSystem implements System {
|
|
|
3256
3356
|
protected readonly timeManager: TimeManager;
|
|
3257
3357
|
protected readonly inputManager: InputManager;
|
|
3258
3358
|
protected readonly collisionRepository: CollisionRepository;
|
|
3359
|
+
protected readonly gameConfig: GameConfig;
|
|
3259
3360
|
onUpdate(): void;
|
|
3361
|
+
onCreate(): void;
|
|
3362
|
+
onEnabled(): void;
|
|
3363
|
+
onDisabled(): void;
|
|
3364
|
+
onDestroy(): void;
|
|
3260
3365
|
}
|
|
3261
3366
|
|
|
3262
3367
|
/**
|
|
@@ -3313,4 +3418,4 @@ declare const Symbols: {
|
|
|
3313
3418
|
TimeManager: symbol;
|
|
3314
3419
|
};
|
|
3315
3420
|
|
|
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 };
|
|
3421
|
+
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 };
|