angry-pixel 2.1.3 → 2.1.5
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/README.md +10 -9
- package/lib/index.cjs.js +1 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +145 -82
- 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
|
@@ -720,14 +720,6 @@ type SearchResult<T extends Component> = {
|
|
|
720
720
|
entity: Entity;
|
|
721
721
|
component: T;
|
|
722
722
|
};
|
|
723
|
-
/**
|
|
724
|
-
* This type represents a search criteria object used to filter components when searching for entities.\
|
|
725
|
-
* It defines a set of key-value pairs where the keys correspond to component properties\
|
|
726
|
-
* and the values are the criteria to match against those properties.
|
|
727
|
-
* @public
|
|
728
|
-
* @category Entity-Component-System
|
|
729
|
-
*/
|
|
730
|
-
type SearchCriteria = Record<string, any>;
|
|
731
723
|
/**
|
|
732
724
|
* This type represents an Entity Archetype, which defines a template for creating entities with a specific set of components.\
|
|
733
725
|
* It specifies which components should be attached to the entity, whether the entity should be enabled/disabled,\
|
|
@@ -860,8 +852,8 @@ type SystemGroup = string | number | symbol;
|
|
|
860
852
|
* const entityWithSprite = entityManager.getEntityForComponent(spriteRenderer);
|
|
861
853
|
*
|
|
862
854
|
* // Update component data
|
|
863
|
-
* entityManager.updateComponentData(entity, Transform, {
|
|
864
|
-
* position
|
|
855
|
+
* entityManager.updateComponentData(entity, Transform, (component) => {
|
|
856
|
+
* component.position = new Vector2(200, 200);
|
|
865
857
|
* });
|
|
866
858
|
*
|
|
867
859
|
* // Create parent-child relationship
|
|
@@ -883,7 +875,7 @@ type SystemGroup = string | number | symbol;
|
|
|
883
875
|
* // do something with the component and entity
|
|
884
876
|
* })
|
|
885
877
|
*
|
|
886
|
-
* const searchResult = entityManager.search(Enemy,
|
|
878
|
+
* const searchResult = entityManager.search(Enemy, (component) => component.status === "alive");
|
|
887
879
|
* searchResult.forEach(({component, entity}) => {
|
|
888
880
|
* // do something with the component and entity
|
|
889
881
|
* })
|
|
@@ -965,13 +957,18 @@ declare class EntityManager {
|
|
|
965
957
|
removeEntity(entity: Entity): void;
|
|
966
958
|
/**
|
|
967
959
|
* Removes all Entities and all their Components
|
|
960
|
+
* @param preserveComponentType Optional component type to preserve entities that have this component
|
|
968
961
|
* @public
|
|
969
962
|
* @example
|
|
970
963
|
* ```js
|
|
964
|
+
* // Remove all entities
|
|
971
965
|
* entityManager.removeAllEntities();
|
|
966
|
+
*
|
|
967
|
+
* // Remove all entities except those that have a SpriteRenderer component
|
|
968
|
+
* entityManager.removeAllEntities(SpriteRenderer);
|
|
972
969
|
* ```
|
|
973
970
|
*/
|
|
974
|
-
removeAllEntities(): void;
|
|
971
|
+
removeAllEntities(preserveComponentType?: ComponentType): void;
|
|
975
972
|
/**
|
|
976
973
|
* If the Entity exists, returns TRUE, otherwise it returns FALSE
|
|
977
974
|
* @param entity
|
|
@@ -1159,14 +1156,16 @@ declare class EntityManager {
|
|
|
1159
1156
|
* Updates the data of a component instance
|
|
1160
1157
|
* @param entity The entity
|
|
1161
1158
|
* @param componentType The component type
|
|
1162
|
-
* @param
|
|
1159
|
+
* @param updateCallback The callback to update the component
|
|
1163
1160
|
* @public
|
|
1164
1161
|
* @example
|
|
1165
1162
|
* ```js
|
|
1166
|
-
* entityManager.updateComponentData(entity, Transform,
|
|
1163
|
+
* entityManager.updateComponentData(entity, Transform, (component) => {
|
|
1164
|
+
* component.position = new Vector2(100, 100);
|
|
1165
|
+
* });
|
|
1167
1166
|
* ```
|
|
1168
1167
|
*/
|
|
1169
|
-
updateComponentData<T extends Component = Component>(entity: Entity, componentType: ComponentType<T>,
|
|
1168
|
+
updateComponentData<T extends Component = Component>(entity: Entity, componentType: ComponentType<T>, updateCallback: (component: T) => void): void;
|
|
1170
1169
|
/**
|
|
1171
1170
|
* Searches for and returns an entity for the component instance
|
|
1172
1171
|
* @param component The component instance
|
|
@@ -1279,11 +1278,11 @@ declare class EntityManager {
|
|
|
1279
1278
|
/**
|
|
1280
1279
|
* Performs a search for entities given a component type.\
|
|
1281
1280
|
* This method returns a collection of objects of type SearchResult, which has the entity found, and the instance of the component.\
|
|
1282
|
-
* This search can be filtered by passing as a second argument
|
|
1281
|
+
* This search can be filtered by passing as a second argument a filter function.\
|
|
1283
1282
|
* The third argument determines if disabled entities or components are included in the search result,\its default value is FALSE.
|
|
1284
1283
|
* @param componentType The component class
|
|
1285
|
-
* @param
|
|
1286
|
-
* @param includeDisabled TRUE to incluide disabled entities and components
|
|
1284
|
+
* @param filter The filter function
|
|
1285
|
+
* @param includeDisabled TRUE to incluide disabled entities and components. Default is FALSE.
|
|
1287
1286
|
* @returns SearchResult
|
|
1288
1287
|
* @public
|
|
1289
1288
|
* @example
|
|
@@ -1295,26 +1294,27 @@ declare class EntityManager {
|
|
|
1295
1294
|
* ```
|
|
1296
1295
|
* @example
|
|
1297
1296
|
* ```js
|
|
1298
|
-
* const searchResult = entityManager.search(Enemy,
|
|
1297
|
+
* const searchResult = entityManager.search(Enemy, (component) => component.status === "alive");
|
|
1299
1298
|
* searchResult.forEach(({component, entity}) => {
|
|
1300
1299
|
* // do something with the component and entity
|
|
1301
1300
|
* })
|
|
1302
1301
|
* ```
|
|
1303
1302
|
* @example
|
|
1304
1303
|
* ```js
|
|
1305
|
-
*
|
|
1304
|
+
* // include disabled entities and components
|
|
1305
|
+
* const searchResult = entityManager.search(Enemy, (component) => component.status === "dead", true);
|
|
1306
1306
|
* searchResult.forEach(({component, entity}) => {
|
|
1307
1307
|
* // do something with the component and entity
|
|
1308
1308
|
* })
|
|
1309
1309
|
* ```
|
|
1310
1310
|
*/
|
|
1311
|
-
search<T extends Component>(componentType: ComponentType<T>,
|
|
1311
|
+
search<T extends Component>(componentType: ComponentType<T>, filter?: (component: T, entity?: Entity) => boolean, includeDisabled?: boolean): SearchResult<T>[];
|
|
1312
1312
|
/**
|
|
1313
1313
|
* Performs a search for entities given a component type.\
|
|
1314
1314
|
* This method returns a collection of objects of type SearchResult, which has the entity found, and the instance of the component.\
|
|
1315
1315
|
* The second argument determines if disabled entities or components are included in the search result,\its default value is FALSE.
|
|
1316
1316
|
* @param componentType The component class
|
|
1317
|
-
* @param includeDisabled TRUE to incluide disabled entities and components
|
|
1317
|
+
* @param includeDisabled TRUE to incluide disabled entities and components. Default is FALSE.
|
|
1318
1318
|
* @returns SearchResult
|
|
1319
1319
|
* @public
|
|
1320
1320
|
* @example
|
|
@@ -1326,6 +1326,7 @@ declare class EntityManager {
|
|
|
1326
1326
|
* ```
|
|
1327
1327
|
* @example
|
|
1328
1328
|
* ```js
|
|
1329
|
+
* // include disabled entities and components
|
|
1329
1330
|
* const searchResult = entityManager.search(Enemy, true);
|
|
1330
1331
|
* searchResult.forEach(({component, entity}) => {
|
|
1331
1332
|
* // do something with the component and entity
|
|
@@ -1352,7 +1353,7 @@ declare class EntityManager {
|
|
|
1352
1353
|
* The third argument determines if disabled entities or components are included in the search result,\its default value is FALSE.
|
|
1353
1354
|
* @param parent The parent entity
|
|
1354
1355
|
* @param componentType The component class
|
|
1355
|
-
* @param includeDisabled TRUE to incluide disabled entities and components
|
|
1356
|
+
* @param includeDisabled TRUE to incluide disabled entities and components. Default is FALSE.
|
|
1356
1357
|
* @returns SearchResult
|
|
1357
1358
|
* @public
|
|
1358
1359
|
* @example
|
|
@@ -1946,6 +1947,66 @@ declare class TimeManager {
|
|
|
1946
1947
|
clearAllIntervals(): void;
|
|
1947
1948
|
}
|
|
1948
1949
|
|
|
1950
|
+
/**
|
|
1951
|
+
* Manages scene loading, transitions and lifecycle.\
|
|
1952
|
+
* Provides methods to register scenes, load scenes by name, and handles the opening scene.\
|
|
1953
|
+
* Ensures proper cleanup between scene transitions and maintains scene state.
|
|
1954
|
+
* @public
|
|
1955
|
+
* @category Managers
|
|
1956
|
+
* @example
|
|
1957
|
+
* ```js
|
|
1958
|
+
* this.sceneManager.loadScene("MainScene");
|
|
1959
|
+
* ```
|
|
1960
|
+
*/
|
|
1961
|
+
declare class SceneManager {
|
|
1962
|
+
private readonly systemManager;
|
|
1963
|
+
private readonly systemFactory;
|
|
1964
|
+
private readonly entityManager;
|
|
1965
|
+
private readonly assetManager;
|
|
1966
|
+
private readonly timeManager;
|
|
1967
|
+
private readonly scenes;
|
|
1968
|
+
private openingSceneName;
|
|
1969
|
+
private currentSceneName;
|
|
1970
|
+
private sceneNameToBeLoaded;
|
|
1971
|
+
private _loadingScene;
|
|
1972
|
+
private _sceneLoadedThisFrame;
|
|
1973
|
+
private preserveEntitiesWithComponent;
|
|
1974
|
+
/** @internal */
|
|
1975
|
+
constructor(systemManager: SystemManager, systemFactory: CreateSystemService, entityManager: EntityManager, assetManager: AssetManager, timeManager: TimeManager);
|
|
1976
|
+
/**
|
|
1977
|
+
* Adds a scene to the SceneManager
|
|
1978
|
+
* @param sceneType The scene class
|
|
1979
|
+
* @param name The name of the scene
|
|
1980
|
+
* @param openingScene Whether the scene is the opening scene
|
|
1981
|
+
* @public
|
|
1982
|
+
*/
|
|
1983
|
+
addScene(sceneType: SceneType, name: string, openingScene?: boolean): void;
|
|
1984
|
+
/**
|
|
1985
|
+
* Loads a scene
|
|
1986
|
+
* @param name The name of the scene
|
|
1987
|
+
* @param preserveEntitiesWithComponent Optional component type to preserve entities that have this component
|
|
1988
|
+
* @public
|
|
1989
|
+
*/
|
|
1990
|
+
loadScene(name: string, preserveEntitiesWithComponent?: ComponentType): void;
|
|
1991
|
+
/**
|
|
1992
|
+
* Loads the opening scene
|
|
1993
|
+
* @public
|
|
1994
|
+
*/
|
|
1995
|
+
loadOpeningScene(): void;
|
|
1996
|
+
/**
|
|
1997
|
+
* Returns true if the scene is loading
|
|
1998
|
+
* @public
|
|
1999
|
+
*/
|
|
2000
|
+
get loadingScene(): boolean;
|
|
2001
|
+
/**
|
|
2002
|
+
* Returns true if the scene was loaded this frame
|
|
2003
|
+
* @public
|
|
2004
|
+
*/
|
|
2005
|
+
get sceneLoadedThisFrame(): boolean;
|
|
2006
|
+
/** @internal */
|
|
2007
|
+
update(): void;
|
|
2008
|
+
private destroyCurrentScene;
|
|
2009
|
+
}
|
|
1949
2010
|
/**
|
|
1950
2011
|
* This type represents a scene class
|
|
1951
2012
|
* @public
|
|
@@ -1969,14 +2030,14 @@ type SceneType<T extends Scene = Scene> = {
|
|
|
1969
2030
|
* this.assetManager.loadImage("image.png");
|
|
1970
2031
|
* }
|
|
1971
2032
|
*
|
|
1972
|
-
*
|
|
2033
|
+
* registerSystems() {
|
|
1973
2034
|
* this.systems.push(
|
|
1974
2035
|
* SomeSystem,
|
|
1975
2036
|
* AnotherSystem
|
|
1976
2037
|
* );
|
|
1977
2038
|
* }
|
|
1978
2039
|
*
|
|
1979
|
-
*
|
|
2040
|
+
* createEntities() {
|
|
1980
2041
|
* this.entityManager.createEntity([
|
|
1981
2042
|
* SomeComponent,
|
|
1982
2043
|
* AnotherComponent
|
|
@@ -1990,43 +2051,33 @@ declare abstract class Scene {
|
|
|
1990
2051
|
protected readonly assetManager: AssetManager;
|
|
1991
2052
|
systems: SystemType[];
|
|
1992
2053
|
constructor(entityManager: EntityManager, assetManager: AssetManager);
|
|
1993
|
-
|
|
2054
|
+
/**
|
|
2055
|
+
* Override this method to register the systems that will be executed in the scene
|
|
2056
|
+
* @public
|
|
2057
|
+
*/
|
|
2058
|
+
registerSystems(): void;
|
|
2059
|
+
/**
|
|
2060
|
+
* Override this method to load the assets needed for the scene
|
|
2061
|
+
* @public
|
|
2062
|
+
*/
|
|
1994
2063
|
loadAssets(): void;
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
private readonly assetManager;
|
|
2013
|
-
private readonly timeManager;
|
|
2014
|
-
private readonly scenes;
|
|
2015
|
-
private openingSceneName;
|
|
2016
|
-
private currentSceneName;
|
|
2017
|
-
private sceneNameToBeLoaded;
|
|
2018
|
-
private _loadingScene;
|
|
2019
|
-
private _sceneLoadedThisFrame;
|
|
2020
|
-
/** @internal */
|
|
2021
|
-
constructor(systemManager: SystemManager, systemFactory: CreateSystemService, entityManager: EntityManager, assetManager: AssetManager, timeManager: TimeManager);
|
|
2022
|
-
addScene(sceneType: SceneType, name: string, openingScene?: boolean): void;
|
|
2023
|
-
loadScene(name: string): void;
|
|
2024
|
-
loadOpeningScene(): void;
|
|
2025
|
-
get loadingScene(): boolean;
|
|
2026
|
-
get sceneLoadedThisFrame(): boolean;
|
|
2027
|
-
/** @internal */
|
|
2028
|
-
update(): void;
|
|
2029
|
-
private destroyCurrentScene;
|
|
2064
|
+
/**
|
|
2065
|
+
* Override this method to create the entities needed for the scene
|
|
2066
|
+
* @public
|
|
2067
|
+
*/
|
|
2068
|
+
createEntities(): void;
|
|
2069
|
+
/**
|
|
2070
|
+
* Adds a system to the scene
|
|
2071
|
+
* @param system The system to add
|
|
2072
|
+
* @public
|
|
2073
|
+
*/
|
|
2074
|
+
protected addSystem(system: SystemType): void;
|
|
2075
|
+
/**
|
|
2076
|
+
* Adds multiple systems to the scene
|
|
2077
|
+
* @param systems The systems to add
|
|
2078
|
+
* @public
|
|
2079
|
+
*/
|
|
2080
|
+
protected addSystems(systems: SystemType[]): void;
|
|
2030
2081
|
}
|
|
2031
2082
|
|
|
2032
2083
|
/**
|
|
@@ -2120,6 +2171,7 @@ declare class Game {
|
|
|
2120
2171
|
* const walkAnimation = new Animation({
|
|
2121
2172
|
* image: "walk.png",
|
|
2122
2173
|
* slice: { size: new Vector2(32, 32) },
|
|
2174
|
+
* frames: [0, 1, 2, 3, 4, 5],
|
|
2123
2175
|
* fps: 12,
|
|
2124
2176
|
* loop: true
|
|
2125
2177
|
* });
|
|
@@ -2127,6 +2179,7 @@ declare class Game {
|
|
|
2127
2179
|
* const idleAnimation = new Animation({
|
|
2128
2180
|
* image: "idle.png",
|
|
2129
2181
|
* slice: { size: new Vector2(32, 32) },
|
|
2182
|
+
* frames: [6, 7, 8, 9]
|
|
2130
2183
|
* fps: 8,
|
|
2131
2184
|
* loop: true
|
|
2132
2185
|
* });
|
|
@@ -2158,6 +2211,7 @@ interface AnimatorOptions {
|
|
|
2158
2211
|
* const walkAnimation = new Animation({
|
|
2159
2212
|
* image: "walk.png",
|
|
2160
2213
|
* slice: { size: new Vector2(32, 32) },
|
|
2214
|
+
* frames: [0, 1, 2, 3, 4, 5],
|
|
2161
2215
|
* fps: 12,
|
|
2162
2216
|
* loop: true
|
|
2163
2217
|
* });
|
|
@@ -2165,6 +2219,7 @@ interface AnimatorOptions {
|
|
|
2165
2219
|
* const idleAnimation = new Animation({
|
|
2166
2220
|
* image: "idle.png",
|
|
2167
2221
|
* slice: { size: new Vector2(32, 32) },
|
|
2222
|
+
* frames: [6, 7, 8, 9],
|
|
2168
2223
|
* fps: 8,
|
|
2169
2224
|
* loop: true
|
|
2170
2225
|
* });
|
|
@@ -2203,6 +2258,7 @@ declare class Animator {
|
|
|
2203
2258
|
* const walkAnimation = new Animation({
|
|
2204
2259
|
* image: "walk.png",
|
|
2205
2260
|
* slice: { size: new Vector2(32, 32) },
|
|
2261
|
+
* frames: [0, 1, 2, 3, 4, 5],
|
|
2206
2262
|
* fps: 12,
|
|
2207
2263
|
* loop: true
|
|
2208
2264
|
* });
|
|
@@ -2210,6 +2266,7 @@ declare class Animator {
|
|
|
2210
2266
|
* const idleAnimation = new Animation({
|
|
2211
2267
|
* image: "idle.png",
|
|
2212
2268
|
* slice: { size: new Vector2(32, 32) },
|
|
2269
|
+
* frames: [6, 7, 8, 9],
|
|
2213
2270
|
* fps: 8,
|
|
2214
2271
|
* loop: true
|
|
2215
2272
|
* });
|
|
@@ -2246,6 +2303,7 @@ interface AnimationOptions {
|
|
|
2246
2303
|
* const walkAnimation = new Animation({
|
|
2247
2304
|
* image: "walk.png",
|
|
2248
2305
|
* slice: { size: new Vector2(32, 32) },
|
|
2306
|
+
* frames: [0, 1, 2, 3, 4, 5],
|
|
2249
2307
|
* fps: 12,
|
|
2250
2308
|
* loop: true
|
|
2251
2309
|
* });
|
|
@@ -2253,6 +2311,7 @@ interface AnimationOptions {
|
|
|
2253
2311
|
* const idleAnimation = new Animation({
|
|
2254
2312
|
* image: "idle.png",
|
|
2255
2313
|
* slice: { size: new Vector2(32, 32) },
|
|
2314
|
+
* frames: [6, 7, 8, 9],
|
|
2256
2315
|
* fps: 8,
|
|
2257
2316
|
* loop: true
|
|
2258
2317
|
* });
|
|
@@ -2305,6 +2364,8 @@ interface AudioPlayerOptions {
|
|
|
2305
2364
|
action: AudioPlayerAction;
|
|
2306
2365
|
/** The audio source to play. */
|
|
2307
2366
|
audioSource: HTMLAudioElement | string;
|
|
2367
|
+
/** TRUE If the audio source should stop on scene transition, FALSE otherwise. Default is TRUE. */
|
|
2368
|
+
stopOnSceneTransition: boolean;
|
|
2308
2369
|
/** TRUE If the playback rate is fixed to the TimeManager time scale, default FALSE */
|
|
2309
2370
|
fixedToTimeScale: boolean;
|
|
2310
2371
|
/** TRUE If the audio source should loop. */
|
|
@@ -2332,6 +2393,8 @@ declare class AudioPlayer {
|
|
|
2332
2393
|
action: AudioPlayerAction;
|
|
2333
2394
|
/** The audio source to play. */
|
|
2334
2395
|
audioSource: HTMLAudioElement | string;
|
|
2396
|
+
/** TRUE If the audio source should stop on scene transition, FALSE otherwise. Default is TRUE. */
|
|
2397
|
+
stopOnSceneTransition: boolean;
|
|
2335
2398
|
/** TRUE If the playback rate is fixed to the TimeManager time scale, default FALSE */
|
|
2336
2399
|
fixedToTimeScale: boolean;
|
|
2337
2400
|
/** TRUE If the audio source should loop. */
|
|
@@ -3135,7 +3198,7 @@ declare enum RenderDataType {
|
|
|
3135
3198
|
Mask = 3,
|
|
3136
3199
|
Geometric = 4,
|
|
3137
3200
|
Video = 5,
|
|
3138
|
-
|
|
3201
|
+
Darkness = 6
|
|
3139
3202
|
}
|
|
3140
3203
|
interface CameraData {
|
|
3141
3204
|
depth: number;
|
|
@@ -3170,7 +3233,7 @@ interface MaskRenderData extends RenderData {
|
|
|
3170
3233
|
opacity: number;
|
|
3171
3234
|
}
|
|
3172
3235
|
|
|
3173
|
-
interface
|
|
3236
|
+
interface DarknessRenderData extends RenderData {
|
|
3174
3237
|
color: string;
|
|
3175
3238
|
height: number;
|
|
3176
3239
|
opacity: number;
|
|
@@ -3409,8 +3472,8 @@ interface LightRendererOptions {
|
|
|
3409
3472
|
* The LightRenderer component is used to render a light effect on the screen.\
|
|
3410
3473
|
* It supports a circular light source with a specified radius and intensity.\
|
|
3411
3474
|
* The light can be optionally smoothed for a softer edge effect.\
|
|
3412
|
-
* This component requires a
|
|
3413
|
-
* as it works by illuminating areas within the
|
|
3475
|
+
* This component requires a DarknessRenderer component to be present in the scene to function properly,
|
|
3476
|
+
* as it works by illuminating areas within the darkness mask.\
|
|
3414
3477
|
* @public
|
|
3415
3478
|
* @category Components
|
|
3416
3479
|
* @example
|
|
@@ -3428,7 +3491,7 @@ declare class LightRenderer {
|
|
|
3428
3491
|
radius: number;
|
|
3429
3492
|
/** Smooth */
|
|
3430
3493
|
smooth: boolean;
|
|
3431
|
-
/**
|
|
3494
|
+
/** Darkness render layer */
|
|
3432
3495
|
layer: string;
|
|
3433
3496
|
/** Light intensitry between 0 and 1 */
|
|
3434
3497
|
intensity: number;
|
|
@@ -3559,12 +3622,12 @@ declare class MaskRenderer {
|
|
|
3559
3622
|
}
|
|
3560
3623
|
|
|
3561
3624
|
/**
|
|
3562
|
-
*
|
|
3625
|
+
* DarknessRenderer component configuration
|
|
3563
3626
|
* @public
|
|
3564
3627
|
* @category Components Configuration
|
|
3565
3628
|
* @example
|
|
3566
3629
|
* ```js
|
|
3567
|
-
* const
|
|
3630
|
+
* const darknessRenderer = new DarknessRenderer({
|
|
3568
3631
|
* width: 100,
|
|
3569
3632
|
* height: 50,
|
|
3570
3633
|
* color: "#000000",
|
|
@@ -3573,7 +3636,7 @@ declare class MaskRenderer {
|
|
|
3573
3636
|
* });
|
|
3574
3637
|
* ```
|
|
3575
3638
|
*/
|
|
3576
|
-
interface
|
|
3639
|
+
interface DarknessRendererOptions {
|
|
3577
3640
|
width: number;
|
|
3578
3641
|
height: number;
|
|
3579
3642
|
color: string;
|
|
@@ -3581,15 +3644,15 @@ interface ShadowRendererOptions {
|
|
|
3581
3644
|
layer: string;
|
|
3582
3645
|
}
|
|
3583
3646
|
/**
|
|
3584
|
-
* The
|
|
3585
|
-
* It supports a rectangular
|
|
3586
|
-
* This component works in conjunction with LightRenderer components in the scene - the
|
|
3587
|
-
* block and be affected by any lights that intersect with it
|
|
3647
|
+
* The DarknessRenderer component is used to render a darkness effect on the screen.\
|
|
3648
|
+
* It supports a rectangular darkness mask with configurable width, height, color, opacity, and render layer.\
|
|
3649
|
+
* This component works in conjunction with LightRenderer components in the scene - the darkness will
|
|
3650
|
+
* block and be affected by any lights that intersect with it.
|
|
3588
3651
|
* @public
|
|
3589
3652
|
* @category Components
|
|
3590
3653
|
* @example
|
|
3591
3654
|
* ```js
|
|
3592
|
-
* const
|
|
3655
|
+
* const darknessRenderer = new DarknessRenderer({
|
|
3593
3656
|
* width: 100,
|
|
3594
3657
|
* height: 50,
|
|
3595
3658
|
* color: "#000000",
|
|
@@ -3598,22 +3661,22 @@ interface ShadowRendererOptions {
|
|
|
3598
3661
|
* });
|
|
3599
3662
|
* ```
|
|
3600
3663
|
*/
|
|
3601
|
-
declare class
|
|
3602
|
-
/**
|
|
3664
|
+
declare class DarknessRenderer {
|
|
3665
|
+
/** Darkness rectangle width */
|
|
3603
3666
|
width: number;
|
|
3604
|
-
/**
|
|
3667
|
+
/** Darkness height */
|
|
3605
3668
|
height: number;
|
|
3606
|
-
/**
|
|
3669
|
+
/** Darkness color */
|
|
3607
3670
|
color: string;
|
|
3608
|
-
/**
|
|
3671
|
+
/** Darkness opacity between 0 and 1 */
|
|
3609
3672
|
opacity: number;
|
|
3610
3673
|
/** The render layer */
|
|
3611
3674
|
layer: string;
|
|
3612
3675
|
/** @internal */
|
|
3613
3676
|
_boundingBox: Rectangle;
|
|
3614
3677
|
/** @internal */
|
|
3615
|
-
_renderData:
|
|
3616
|
-
constructor(options?: Partial<
|
|
3678
|
+
_renderData: DarknessRenderData;
|
|
3679
|
+
constructor(options?: Partial<DarknessRendererOptions>);
|
|
3617
3680
|
}
|
|
3618
3681
|
|
|
3619
3682
|
/**
|
|
@@ -4788,4 +4851,4 @@ declare const BuiltInDependencyIdentifiers: {
|
|
|
4788
4851
|
TimeManager: symbol;
|
|
4789
4852
|
};
|
|
4790
4853
|
|
|
4791
|
-
export { Animation, type AnimationOptions, type AnimationSlice, Animator, type AnimatorOptions, type Archetype, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, type AudioPlayerState, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, BuiltInDependencyIdentifiers, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, type DependencyName, type DependencyType, type DisabledComponent, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, InputManager, type IntervalOptions, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, type PlaySfxOptions, Polygon, PolygonCollider, type PolygonColliderOptions, type PropertyKey, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, Scene, SceneManager, type SceneType, type
|
|
4854
|
+
export { Animation, type AnimationOptions, type AnimationSlice, Animator, type AnimatorOptions, type Archetype, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, type AudioPlayerState, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, BuiltInDependencyIdentifiers, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, DarknessRenderer, type DarknessRendererOptions, type DependencyName, type DependencyType, type DisabledComponent, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, InputManager, type IntervalOptions, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, type PlaySfxOptions, Polygon, PolygonCollider, type PolygonColliderOptions, type PropertyKey, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, Scene, SceneManager, type SceneType, type SearchResult, type Shape, type Slice, SpriteRenderer, type SpriteRendererOptions, 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, debugRenderLayer, decorate, defaultRenderLayer, defaultTextureAtlasOptions, degreesToRadians, disableComponent, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, playSfx, radiansToDegrees, randomFloat, randomInt, range, rgbToHex, stopSfx };
|