@zylem/game-lib 0.5.1 → 0.6.0
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/LICENSE +21 -0
- package/dist/behaviors.d.ts +1 -3
- package/dist/behaviors.js.map +1 -1
- package/dist/blueprints-BOCc3Wve.d.ts +26 -0
- package/dist/{camera-Dk-fOVZE.d.ts → camera-CpbDr4-V.d.ts} +19 -45
- package/dist/camera.d.ts +2 -2
- package/dist/camera.js +217 -113
- package/dist/camera.js.map +1 -1
- package/dist/{core-C2mjetAd.d.ts → core-CZhozNRH.d.ts} +77 -42
- package/dist/core.d.ts +6 -5
- package/dist/core.js +1676 -695
- package/dist/core.js.map +1 -1
- package/dist/entities-BAxfJOkk.d.ts +307 -0
- package/dist/entities.d.ts +4 -267
- package/dist/entities.js +213 -90
- package/dist/entities.js.map +1 -1
- package/dist/entity-Bq_eNEDI.d.ts +28 -0
- package/dist/{entity-bQElAdpo.d.ts → entity-COvRtFNG.d.ts} +68 -20
- package/dist/main.d.ts +88 -12
- package/dist/main.js +1811 -810
- package/dist/main.js.map +1 -1
- package/dist/{stage-CrmY7V0i.d.ts → stage-types-CD21XoIU.d.ts} +90 -39
- package/dist/stage.d.ts +40 -20
- package/dist/stage.js +1210 -674
- package/dist/stage.js.map +1 -1
- package/package.json +10 -10
- package/dist/entity-spawner-DNnLYnZq.d.ts +0 -11
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { G as GameEntity, U as UpdateContext, l as GameEntityOptions, d as DestroyContext, e as BaseNode, T as TexturePath, V as Vec3, M as MaterialOptions } from './entity-COvRtFNG.js';
|
|
2
|
+
import { Vector3, Sprite, Color, Vector2, Object3D } from 'three';
|
|
3
|
+
import RAPIER__default, { World } from '@dimforge/rapier3d-compat';
|
|
4
|
+
import { E as Entity } from './entity-Bq_eNEDI.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Interface for entities that handle collision events.
|
|
8
|
+
*/
|
|
9
|
+
interface CollisionHandlerDelegate {
|
|
10
|
+
handlePostCollision(params: any): boolean;
|
|
11
|
+
handleIntersectionEvent(params: any): void;
|
|
12
|
+
}
|
|
13
|
+
declare class ZylemWorld implements Entity<ZylemWorld> {
|
|
14
|
+
type: string;
|
|
15
|
+
world: World;
|
|
16
|
+
collisionMap: Map<string, GameEntity<any>>;
|
|
17
|
+
collisionBehaviorMap: Map<string, GameEntity<any>>;
|
|
18
|
+
_removalMap: Map<string, GameEntity<any>>;
|
|
19
|
+
static loadPhysics(gravity: Vector3): Promise<RAPIER__default.World>;
|
|
20
|
+
constructor(world: World);
|
|
21
|
+
addEntity(entity: any): void;
|
|
22
|
+
setForRemoval(entity: any): void;
|
|
23
|
+
destroyEntity(entity: GameEntity<any>): void;
|
|
24
|
+
setup(): void;
|
|
25
|
+
update(params: UpdateContext<any>): void;
|
|
26
|
+
updatePostCollisionBehaviors(delta: number): void;
|
|
27
|
+
updateColliders(delta: number): void;
|
|
28
|
+
destroy(): void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type SpriteImage = {
|
|
32
|
+
name: string;
|
|
33
|
+
file: string;
|
|
34
|
+
};
|
|
35
|
+
type SpriteAnimation = {
|
|
36
|
+
name: string;
|
|
37
|
+
frames: string[];
|
|
38
|
+
speed: number | number[];
|
|
39
|
+
loop: boolean;
|
|
40
|
+
};
|
|
41
|
+
type ZylemSpriteOptions = GameEntityOptions & {
|
|
42
|
+
images?: SpriteImage[];
|
|
43
|
+
animations?: SpriteAnimation[];
|
|
44
|
+
size?: Vector3;
|
|
45
|
+
collisionSize?: Vector3;
|
|
46
|
+
};
|
|
47
|
+
declare const SPRITE_TYPE: unique symbol;
|
|
48
|
+
declare class ZylemSprite extends GameEntity<ZylemSpriteOptions> {
|
|
49
|
+
static type: symbol;
|
|
50
|
+
protected sprites: Sprite[];
|
|
51
|
+
protected spriteMap: Map<string, number>;
|
|
52
|
+
protected currentSpriteIndex: number;
|
|
53
|
+
protected animations: Map<string, any>;
|
|
54
|
+
protected currentAnimation: any;
|
|
55
|
+
protected currentAnimationFrame: string;
|
|
56
|
+
protected currentAnimationIndex: number;
|
|
57
|
+
protected currentAnimationTime: number;
|
|
58
|
+
constructor(options?: ZylemSpriteOptions);
|
|
59
|
+
create(): this;
|
|
60
|
+
protected createSpritesFromImages(images: SpriteImage[]): void;
|
|
61
|
+
protected createAnimations(animations: SpriteAnimation[]): void;
|
|
62
|
+
setSprite(key: string): void;
|
|
63
|
+
setAnimation(name: string, delta: number): void;
|
|
64
|
+
spriteUpdate(params: UpdateContext<ZylemSpriteOptions>): Promise<void>;
|
|
65
|
+
spriteDestroy(params: DestroyContext<ZylemSpriteOptions>): Promise<void>;
|
|
66
|
+
buildInfo(): Record<string, any>;
|
|
67
|
+
}
|
|
68
|
+
type SpriteOptions = BaseNode | Partial<ZylemSpriteOptions>;
|
|
69
|
+
declare function sprite(...args: Array<SpriteOptions>): Promise<ZylemSprite>;
|
|
70
|
+
|
|
71
|
+
type ZylemSphereOptions = GameEntityOptions & {
|
|
72
|
+
radius?: number;
|
|
73
|
+
};
|
|
74
|
+
declare const SPHERE_TYPE: unique symbol;
|
|
75
|
+
declare class ZylemSphere extends GameEntity<ZylemSphereOptions> {
|
|
76
|
+
static type: symbol;
|
|
77
|
+
constructor(options?: ZylemSphereOptions);
|
|
78
|
+
buildInfo(): Record<string, any>;
|
|
79
|
+
}
|
|
80
|
+
type SphereOptions = BaseNode | Partial<ZylemSphereOptions>;
|
|
81
|
+
declare function sphere(...args: Array<SphereOptions>): Promise<ZylemSphere>;
|
|
82
|
+
|
|
83
|
+
type ZylemRectOptions = GameEntityOptions & {
|
|
84
|
+
width?: number;
|
|
85
|
+
height?: number;
|
|
86
|
+
fillColor?: Color | string | null;
|
|
87
|
+
strokeColor?: Color | string | null;
|
|
88
|
+
strokeWidth?: number;
|
|
89
|
+
radius?: number;
|
|
90
|
+
padding?: number;
|
|
91
|
+
stickToViewport?: boolean;
|
|
92
|
+
screenPosition?: Vector2;
|
|
93
|
+
zDistance?: number;
|
|
94
|
+
anchor?: Vector2;
|
|
95
|
+
bounds?: {
|
|
96
|
+
screen?: {
|
|
97
|
+
x: number;
|
|
98
|
+
y: number;
|
|
99
|
+
width: number;
|
|
100
|
+
height: number;
|
|
101
|
+
};
|
|
102
|
+
world?: {
|
|
103
|
+
left: number;
|
|
104
|
+
right: number;
|
|
105
|
+
top: number;
|
|
106
|
+
bottom: number;
|
|
107
|
+
z?: number;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
declare const RECT_TYPE: unique symbol;
|
|
112
|
+
declare class ZylemRect extends GameEntity<ZylemRectOptions> {
|
|
113
|
+
static type: symbol;
|
|
114
|
+
private _sprite;
|
|
115
|
+
private _mesh;
|
|
116
|
+
private _texture;
|
|
117
|
+
private _canvas;
|
|
118
|
+
private _ctx;
|
|
119
|
+
private _cameraRef;
|
|
120
|
+
private _lastCanvasW;
|
|
121
|
+
private _lastCanvasH;
|
|
122
|
+
constructor(options?: ZylemRectOptions);
|
|
123
|
+
private createSprite;
|
|
124
|
+
private redrawRect;
|
|
125
|
+
private roundedRectPath;
|
|
126
|
+
private toCssColor;
|
|
127
|
+
private rectSetup;
|
|
128
|
+
private rectUpdate;
|
|
129
|
+
private updateStickyTransform;
|
|
130
|
+
private worldToScreen;
|
|
131
|
+
private computeScreenBoundsFromOptions;
|
|
132
|
+
updateRect(options?: Partial<Pick<ZylemRectOptions, 'width' | 'height' | 'fillColor' | 'strokeColor' | 'strokeWidth' | 'radius'>>): void;
|
|
133
|
+
buildInfo(): Record<string, any>;
|
|
134
|
+
}
|
|
135
|
+
type RectOptions = BaseNode | Partial<ZylemRectOptions>;
|
|
136
|
+
declare function rect(...args: Array<RectOptions>): Promise<ZylemRect>;
|
|
137
|
+
|
|
138
|
+
type ZylemTextOptions = GameEntityOptions & {
|
|
139
|
+
text?: string;
|
|
140
|
+
fontFamily?: string;
|
|
141
|
+
fontSize?: number;
|
|
142
|
+
fontColor?: Color | string;
|
|
143
|
+
backgroundColor?: Color | string | null;
|
|
144
|
+
padding?: number;
|
|
145
|
+
stickToViewport?: boolean;
|
|
146
|
+
screenPosition?: Vector2;
|
|
147
|
+
zDistance?: number;
|
|
148
|
+
};
|
|
149
|
+
declare const TEXT_TYPE: unique symbol;
|
|
150
|
+
declare class ZylemText extends GameEntity<ZylemTextOptions> {
|
|
151
|
+
static type: symbol;
|
|
152
|
+
private _sprite;
|
|
153
|
+
private _texture;
|
|
154
|
+
private _canvas;
|
|
155
|
+
private _ctx;
|
|
156
|
+
private _cameraRef;
|
|
157
|
+
private _lastCanvasW;
|
|
158
|
+
private _lastCanvasH;
|
|
159
|
+
constructor(options?: ZylemTextOptions);
|
|
160
|
+
create(): this;
|
|
161
|
+
private createSprite;
|
|
162
|
+
private measureAndResizeCanvas;
|
|
163
|
+
private drawCenteredText;
|
|
164
|
+
private updateTexture;
|
|
165
|
+
private redrawText;
|
|
166
|
+
private toCssColor;
|
|
167
|
+
private textSetup;
|
|
168
|
+
private textUpdate;
|
|
169
|
+
private getResolution;
|
|
170
|
+
private getScreenPixels;
|
|
171
|
+
private computeWorldExtents;
|
|
172
|
+
private updateSpriteScale;
|
|
173
|
+
private updateStickyTransform;
|
|
174
|
+
updateText(_text: string): void;
|
|
175
|
+
buildInfo(): Record<string, any>;
|
|
176
|
+
/**
|
|
177
|
+
* Dispose of Three.js resources when the entity is destroyed.
|
|
178
|
+
*/
|
|
179
|
+
private textDestroy;
|
|
180
|
+
}
|
|
181
|
+
type TextOptions = BaseNode | Partial<ZylemTextOptions>;
|
|
182
|
+
declare function text(...args: Array<TextOptions>): Promise<ZylemText>;
|
|
183
|
+
|
|
184
|
+
type ZylemBoxOptions = GameEntityOptions;
|
|
185
|
+
declare const BOX_TYPE: unique symbol;
|
|
186
|
+
declare class ZylemBox extends GameEntity<ZylemBoxOptions> {
|
|
187
|
+
static type: symbol;
|
|
188
|
+
constructor(options?: ZylemBoxOptions);
|
|
189
|
+
buildInfo(): Record<string, any>;
|
|
190
|
+
}
|
|
191
|
+
type BoxOptions = BaseNode | ZylemBoxOptions;
|
|
192
|
+
declare function box(...args: Array<BoxOptions>): Promise<ZylemBox>;
|
|
193
|
+
|
|
194
|
+
type ZylemPlaneOptions = GameEntityOptions & {
|
|
195
|
+
tile?: Vector2;
|
|
196
|
+
repeat?: Vector2;
|
|
197
|
+
texture?: TexturePath;
|
|
198
|
+
subdivisions?: number;
|
|
199
|
+
};
|
|
200
|
+
declare const PLANE_TYPE: unique symbol;
|
|
201
|
+
declare class ZylemPlane extends GameEntity<ZylemPlaneOptions> {
|
|
202
|
+
static type: symbol;
|
|
203
|
+
constructor(options?: ZylemPlaneOptions);
|
|
204
|
+
}
|
|
205
|
+
type PlaneOptions = BaseNode | Partial<ZylemPlaneOptions>;
|
|
206
|
+
declare function plane(...args: Array<PlaneOptions>): Promise<ZylemPlane>;
|
|
207
|
+
|
|
208
|
+
type OnHeldParams = {
|
|
209
|
+
delta: number;
|
|
210
|
+
self: ZylemZone;
|
|
211
|
+
visitor: GameEntity<any>;
|
|
212
|
+
heldTime: number;
|
|
213
|
+
globals: any;
|
|
214
|
+
};
|
|
215
|
+
type OnEnterParams = Pick<OnHeldParams, 'self' | 'visitor' | 'globals'>;
|
|
216
|
+
type OnExitParams = Pick<OnHeldParams, 'self' | 'visitor' | 'globals'>;
|
|
217
|
+
type ZylemZoneOptions = GameEntityOptions & {
|
|
218
|
+
size?: Vector3;
|
|
219
|
+
static?: boolean;
|
|
220
|
+
onEnter?: (params: OnEnterParams) => void;
|
|
221
|
+
onHeld?: (params: OnHeldParams) => void;
|
|
222
|
+
onExit?: (params: OnExitParams) => void;
|
|
223
|
+
};
|
|
224
|
+
declare const ZONE_TYPE: unique symbol;
|
|
225
|
+
declare class ZylemZone extends GameEntity<ZylemZoneOptions> implements CollisionHandlerDelegate {
|
|
226
|
+
static type: symbol;
|
|
227
|
+
private _enteredZone;
|
|
228
|
+
private _exitedZone;
|
|
229
|
+
private _zoneEntities;
|
|
230
|
+
constructor(options?: ZylemZoneOptions);
|
|
231
|
+
handlePostCollision({ delta }: {
|
|
232
|
+
delta: number;
|
|
233
|
+
}): boolean;
|
|
234
|
+
handleIntersectionEvent({ other, delta }: {
|
|
235
|
+
other: any;
|
|
236
|
+
delta: number;
|
|
237
|
+
}): void;
|
|
238
|
+
onEnter(callback: (params: OnEnterParams) => void): this;
|
|
239
|
+
onHeld(callback: (params: OnHeldParams) => void): this;
|
|
240
|
+
onExit(callback: (params: OnExitParams) => void): this;
|
|
241
|
+
entered(other: any): void;
|
|
242
|
+
exited(delta: number, key: string): void;
|
|
243
|
+
held(delta: number, other: any): void;
|
|
244
|
+
}
|
|
245
|
+
type ZoneOptions = BaseNode | Partial<ZylemZoneOptions>;
|
|
246
|
+
declare function zone(...args: Array<ZoneOptions>): Promise<ZylemZone>;
|
|
247
|
+
|
|
248
|
+
interface EntityLoaderDelegate {
|
|
249
|
+
load(): Promise<void>;
|
|
250
|
+
data(): any;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
type AnimationOptions = {
|
|
254
|
+
key: string;
|
|
255
|
+
pauseAtEnd?: boolean;
|
|
256
|
+
pauseAtPercentage?: number;
|
|
257
|
+
fadeToKey?: string;
|
|
258
|
+
fadeDuration?: number;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Interface for entities that provide custom debug information
|
|
263
|
+
*/
|
|
264
|
+
interface DebugInfoProvider {
|
|
265
|
+
getDebugInfo(): Record<string, any>;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
type AnimationObject = {
|
|
269
|
+
key?: string;
|
|
270
|
+
path: string;
|
|
271
|
+
};
|
|
272
|
+
type ZylemActorOptions = GameEntityOptions & {
|
|
273
|
+
static?: boolean;
|
|
274
|
+
animations?: AnimationObject[];
|
|
275
|
+
models?: string[];
|
|
276
|
+
scale?: Vec3;
|
|
277
|
+
material?: MaterialOptions;
|
|
278
|
+
};
|
|
279
|
+
declare const ACTOR_TYPE: unique symbol;
|
|
280
|
+
declare class ZylemActor extends GameEntity<ZylemActorOptions> implements EntityLoaderDelegate, DebugInfoProvider {
|
|
281
|
+
static type: symbol;
|
|
282
|
+
private _object;
|
|
283
|
+
private _animationDelegate;
|
|
284
|
+
private _modelFileNames;
|
|
285
|
+
private _assetLoader;
|
|
286
|
+
controlledRotation: boolean;
|
|
287
|
+
constructor(options?: ZylemActorOptions);
|
|
288
|
+
load(): Promise<void>;
|
|
289
|
+
data(): Promise<any>;
|
|
290
|
+
actorUpdate(params: UpdateContext<ZylemActorOptions>): Promise<void>;
|
|
291
|
+
/**
|
|
292
|
+
* Clean up actor resources including animations, models, and groups
|
|
293
|
+
*/
|
|
294
|
+
actorDestroy(): void;
|
|
295
|
+
private loadModels;
|
|
296
|
+
playAnimation(animationOptions: AnimationOptions): void;
|
|
297
|
+
get object(): Object3D | null;
|
|
298
|
+
/**
|
|
299
|
+
* Provide custom debug information for the actor
|
|
300
|
+
* This will be merged with the default debug information
|
|
301
|
+
*/
|
|
302
|
+
getDebugInfo(): Record<string, any>;
|
|
303
|
+
}
|
|
304
|
+
type ActorOptions = BaseNode | ZylemActorOptions;
|
|
305
|
+
declare function actor(...args: Array<ActorOptions>): Promise<ZylemActor>;
|
|
306
|
+
|
|
307
|
+
export { ACTOR_TYPE as A, BOX_TYPE as B, PLANE_TYPE as P, RECT_TYPE as R, SPRITE_TYPE as S, TEXT_TYPE as T, ZylemBox as Z, sprite as a, box as b, actor as c, SPHERE_TYPE as d, ZONE_TYPE as e, ZylemWorld as f, ZylemSprite as g, ZylemSphere as h, ZylemRect as i, ZylemText as j, ZylemPlane as k, ZylemZone as l, ZylemActor as m, plane as p, rect as r, sphere as s, text as t, zone as z };
|
package/dist/entities.d.ts
CHANGED
|
@@ -1,269 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
export { Z as ZylemBox, c as actor, b as box, p as plane, r as rect, s as sphere, a as sprite, t as text, z as zone } from './entities-BAxfJOkk.js';
|
|
2
|
+
import './entity-COvRtFNG.js';
|
|
3
|
+
import 'three';
|
|
3
4
|
import '@dimforge/rapier3d-compat';
|
|
4
5
|
import 'bitecs';
|
|
5
|
-
|
|
6
|
-
interface EntityLoaderDelegate {
|
|
7
|
-
load(): Promise<void>;
|
|
8
|
-
data(): any;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
type AnimationOptions = {
|
|
12
|
-
key: string;
|
|
13
|
-
pauseAtEnd?: boolean;
|
|
14
|
-
pauseAtPercentage?: number;
|
|
15
|
-
fadeToKey?: string;
|
|
16
|
-
fadeDuration?: number;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Interface for entities that provide custom debug information
|
|
21
|
-
*/
|
|
22
|
-
interface DebugInfoProvider {
|
|
23
|
-
getDebugInfo(): Record<string, any>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
type AnimationObject = {
|
|
27
|
-
key?: string;
|
|
28
|
-
path: string;
|
|
29
|
-
};
|
|
30
|
-
type ZylemActorOptions = GameEntityOptions & {
|
|
31
|
-
static?: boolean;
|
|
32
|
-
animations?: AnimationObject[];
|
|
33
|
-
models?: string[];
|
|
34
|
-
scale?: Vec3;
|
|
35
|
-
material?: MaterialOptions;
|
|
36
|
-
};
|
|
37
|
-
declare class ZylemActor extends GameEntity<ZylemActorOptions> implements EntityLoaderDelegate, DebugInfoProvider {
|
|
38
|
-
static type: symbol;
|
|
39
|
-
private _object;
|
|
40
|
-
private _animationDelegate;
|
|
41
|
-
private _modelFileNames;
|
|
42
|
-
private _assetLoader;
|
|
43
|
-
controlledRotation: boolean;
|
|
44
|
-
constructor(options?: ZylemActorOptions);
|
|
45
|
-
load(): Promise<void>;
|
|
46
|
-
data(): Promise<any>;
|
|
47
|
-
actorUpdate(params: UpdateContext<ZylemActorOptions>): Promise<void>;
|
|
48
|
-
private loadModels;
|
|
49
|
-
playAnimation(animationOptions: AnimationOptions): void;
|
|
50
|
-
get object(): Object3D | null;
|
|
51
|
-
/**
|
|
52
|
-
* Provide custom debug information for the actor
|
|
53
|
-
* This will be merged with the default debug information
|
|
54
|
-
*/
|
|
55
|
-
getDebugInfo(): Record<string, any>;
|
|
56
|
-
}
|
|
57
|
-
type ActorOptions = BaseNode | ZylemActorOptions;
|
|
58
|
-
declare function actor(...args: Array<ActorOptions>): Promise<ZylemActor>;
|
|
59
|
-
|
|
60
|
-
type ZylemBoxOptions = GameEntityOptions;
|
|
61
|
-
declare class ZylemBox extends GameEntity<ZylemBoxOptions> {
|
|
62
|
-
static type: symbol;
|
|
63
|
-
constructor(options?: ZylemBoxOptions);
|
|
64
|
-
buildInfo(): Record<string, any>;
|
|
65
|
-
}
|
|
66
|
-
type BoxOptions = BaseNode | ZylemBoxOptions;
|
|
67
|
-
declare function box(...args: Array<BoxOptions>): Promise<ZylemBox>;
|
|
68
|
-
|
|
69
|
-
type ZylemPlaneOptions = GameEntityOptions & {
|
|
70
|
-
tile?: Vector2;
|
|
71
|
-
repeat?: Vector2;
|
|
72
|
-
texture?: TexturePath;
|
|
73
|
-
subdivisions?: number;
|
|
74
|
-
};
|
|
75
|
-
declare class ZylemPlane extends GameEntity<ZylemPlaneOptions> {
|
|
76
|
-
static type: symbol;
|
|
77
|
-
constructor(options?: ZylemPlaneOptions);
|
|
78
|
-
}
|
|
79
|
-
type PlaneOptions = BaseNode | Partial<ZylemPlaneOptions>;
|
|
80
|
-
declare function plane(...args: Array<PlaneOptions>): Promise<ZylemPlane>;
|
|
81
|
-
|
|
82
|
-
type ZylemSphereOptions = GameEntityOptions & {
|
|
83
|
-
radius?: number;
|
|
84
|
-
};
|
|
85
|
-
declare class ZylemSphere extends GameEntity<ZylemSphereOptions> {
|
|
86
|
-
static type: symbol;
|
|
87
|
-
constructor(options?: ZylemSphereOptions);
|
|
88
|
-
buildInfo(): Record<string, any>;
|
|
89
|
-
}
|
|
90
|
-
type SphereOptions = BaseNode | Partial<ZylemSphereOptions>;
|
|
91
|
-
declare function sphere(...args: Array<SphereOptions>): Promise<ZylemSphere>;
|
|
92
|
-
|
|
93
|
-
type SpriteImage = {
|
|
94
|
-
name: string;
|
|
95
|
-
file: string;
|
|
96
|
-
};
|
|
97
|
-
type SpriteAnimation = {
|
|
98
|
-
name: string;
|
|
99
|
-
frames: string[];
|
|
100
|
-
speed: number | number[];
|
|
101
|
-
loop: boolean;
|
|
102
|
-
};
|
|
103
|
-
type ZylemSpriteOptions = GameEntityOptions & {
|
|
104
|
-
images?: SpriteImage[];
|
|
105
|
-
animations?: SpriteAnimation[];
|
|
106
|
-
size?: Vector3;
|
|
107
|
-
collisionSize?: Vector3;
|
|
108
|
-
};
|
|
109
|
-
declare class ZylemSprite extends GameEntity<ZylemSpriteOptions> {
|
|
110
|
-
static type: symbol;
|
|
111
|
-
protected sprites: Sprite[];
|
|
112
|
-
protected spriteMap: Map<string, number>;
|
|
113
|
-
protected currentSpriteIndex: number;
|
|
114
|
-
protected animations: Map<string, any>;
|
|
115
|
-
protected currentAnimation: any;
|
|
116
|
-
protected currentAnimationFrame: string;
|
|
117
|
-
protected currentAnimationIndex: number;
|
|
118
|
-
protected currentAnimationTime: number;
|
|
119
|
-
constructor(options?: ZylemSpriteOptions);
|
|
120
|
-
protected createSpritesFromImages(images: SpriteImage[]): void;
|
|
121
|
-
protected createAnimations(animations: SpriteAnimation[]): void;
|
|
122
|
-
setSprite(key: string): void;
|
|
123
|
-
setAnimation(name: string, delta: number): void;
|
|
124
|
-
spriteUpdate(params: UpdateContext<ZylemSpriteOptions>): Promise<void>;
|
|
125
|
-
spriteDestroy(params: DestroyContext<ZylemSpriteOptions>): Promise<void>;
|
|
126
|
-
buildInfo(): Record<string, any>;
|
|
127
|
-
}
|
|
128
|
-
type SpriteOptions = BaseNode | Partial<ZylemSpriteOptions>;
|
|
129
|
-
declare function sprite(...args: Array<SpriteOptions>): Promise<ZylemSprite>;
|
|
130
|
-
|
|
131
|
-
interface CollisionHandlerDelegate {
|
|
132
|
-
handlePostCollision(params: any): boolean;
|
|
133
|
-
handleIntersectionEvent(params: any): void;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
type OnHeldParams = {
|
|
137
|
-
delta: number;
|
|
138
|
-
self: ZylemZone;
|
|
139
|
-
visitor: GameEntity<any>;
|
|
140
|
-
heldTime: number;
|
|
141
|
-
globals: any;
|
|
142
|
-
};
|
|
143
|
-
type OnEnterParams = Pick<OnHeldParams, 'self' | 'visitor' | 'globals'>;
|
|
144
|
-
type OnExitParams = Pick<OnHeldParams, 'self' | 'visitor' | 'globals'>;
|
|
145
|
-
type ZylemZoneOptions = GameEntityOptions & {
|
|
146
|
-
size?: Vector3;
|
|
147
|
-
static?: boolean;
|
|
148
|
-
onEnter?: (params: OnEnterParams) => void;
|
|
149
|
-
onHeld?: (params: OnHeldParams) => void;
|
|
150
|
-
onExit?: (params: OnExitParams) => void;
|
|
151
|
-
};
|
|
152
|
-
declare class ZylemZone extends GameEntity<ZylemZoneOptions> implements CollisionHandlerDelegate {
|
|
153
|
-
static type: symbol;
|
|
154
|
-
private _enteredZone;
|
|
155
|
-
private _exitedZone;
|
|
156
|
-
private _zoneEntities;
|
|
157
|
-
constructor(options?: ZylemZoneOptions);
|
|
158
|
-
handlePostCollision({ delta }: {
|
|
159
|
-
delta: number;
|
|
160
|
-
}): boolean;
|
|
161
|
-
handleIntersectionEvent({ other, delta }: {
|
|
162
|
-
other: any;
|
|
163
|
-
delta: number;
|
|
164
|
-
}): void;
|
|
165
|
-
onEnter(callback: (params: OnEnterParams) => void): this;
|
|
166
|
-
onHeld(callback: (params: OnHeldParams) => void): this;
|
|
167
|
-
onExit(callback: (params: OnExitParams) => void): this;
|
|
168
|
-
entered(other: any): void;
|
|
169
|
-
exited(delta: number, key: string): void;
|
|
170
|
-
held(delta: number, other: any): void;
|
|
171
|
-
}
|
|
172
|
-
type ZoneOptions = BaseNode | Partial<ZylemZoneOptions>;
|
|
173
|
-
declare function zone(...args: Array<ZoneOptions>): Promise<ZylemZone>;
|
|
174
|
-
|
|
175
|
-
type ZylemTextOptions = GameEntityOptions & {
|
|
176
|
-
text?: string;
|
|
177
|
-
fontFamily?: string;
|
|
178
|
-
fontSize?: number;
|
|
179
|
-
fontColor?: Color | string;
|
|
180
|
-
backgroundColor?: Color | string | null;
|
|
181
|
-
padding?: number;
|
|
182
|
-
stickToViewport?: boolean;
|
|
183
|
-
screenPosition?: Vector2;
|
|
184
|
-
zDistance?: number;
|
|
185
|
-
};
|
|
186
|
-
declare class ZylemText extends GameEntity<ZylemTextOptions> {
|
|
187
|
-
static type: symbol;
|
|
188
|
-
private _sprite;
|
|
189
|
-
private _texture;
|
|
190
|
-
private _canvas;
|
|
191
|
-
private _ctx;
|
|
192
|
-
private _cameraRef;
|
|
193
|
-
private _lastCanvasW;
|
|
194
|
-
private _lastCanvasH;
|
|
195
|
-
constructor(options?: ZylemTextOptions);
|
|
196
|
-
private createSprite;
|
|
197
|
-
private measureAndResizeCanvas;
|
|
198
|
-
private drawCenteredText;
|
|
199
|
-
private updateTexture;
|
|
200
|
-
private redrawText;
|
|
201
|
-
private toCssColor;
|
|
202
|
-
private textSetup;
|
|
203
|
-
private textUpdate;
|
|
204
|
-
private getResolution;
|
|
205
|
-
private getScreenPixels;
|
|
206
|
-
private computeWorldExtents;
|
|
207
|
-
private updateSpriteScale;
|
|
208
|
-
private updateStickyTransform;
|
|
209
|
-
updateText(_text: string): void;
|
|
210
|
-
buildInfo(): Record<string, any>;
|
|
211
|
-
}
|
|
212
|
-
type TextOptions = BaseNode | Partial<ZylemTextOptions>;
|
|
213
|
-
declare function text(...args: Array<TextOptions>): Promise<ZylemText>;
|
|
214
|
-
|
|
215
|
-
type ZylemRectOptions = GameEntityOptions & {
|
|
216
|
-
width?: number;
|
|
217
|
-
height?: number;
|
|
218
|
-
fillColor?: Color | string | null;
|
|
219
|
-
strokeColor?: Color | string | null;
|
|
220
|
-
strokeWidth?: number;
|
|
221
|
-
radius?: number;
|
|
222
|
-
padding?: number;
|
|
223
|
-
stickToViewport?: boolean;
|
|
224
|
-
screenPosition?: Vector2;
|
|
225
|
-
zDistance?: number;
|
|
226
|
-
anchor?: Vector2;
|
|
227
|
-
bounds?: {
|
|
228
|
-
screen?: {
|
|
229
|
-
x: number;
|
|
230
|
-
y: number;
|
|
231
|
-
width: number;
|
|
232
|
-
height: number;
|
|
233
|
-
};
|
|
234
|
-
world?: {
|
|
235
|
-
left: number;
|
|
236
|
-
right: number;
|
|
237
|
-
top: number;
|
|
238
|
-
bottom: number;
|
|
239
|
-
z?: number;
|
|
240
|
-
};
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
declare class ZylemRect extends GameEntity<ZylemRectOptions> {
|
|
244
|
-
static type: symbol;
|
|
245
|
-
private _sprite;
|
|
246
|
-
private _mesh;
|
|
247
|
-
private _texture;
|
|
248
|
-
private _canvas;
|
|
249
|
-
private _ctx;
|
|
250
|
-
private _cameraRef;
|
|
251
|
-
private _lastCanvasW;
|
|
252
|
-
private _lastCanvasH;
|
|
253
|
-
constructor(options?: ZylemRectOptions);
|
|
254
|
-
private createSprite;
|
|
255
|
-
private redrawRect;
|
|
256
|
-
private roundedRectPath;
|
|
257
|
-
private toCssColor;
|
|
258
|
-
private rectSetup;
|
|
259
|
-
private rectUpdate;
|
|
260
|
-
private updateStickyTransform;
|
|
261
|
-
private worldToScreen;
|
|
262
|
-
private computeScreenBoundsFromOptions;
|
|
263
|
-
updateRect(options?: Partial<Pick<ZylemRectOptions, 'width' | 'height' | 'fillColor' | 'strokeColor' | 'strokeWidth' | 'radius'>>): void;
|
|
264
|
-
buildInfo(): Record<string, any>;
|
|
265
|
-
}
|
|
266
|
-
type RectOptions = BaseNode | Partial<ZylemRectOptions>;
|
|
267
|
-
declare function rect(...args: Array<RectOptions>): Promise<ZylemRect>;
|
|
268
|
-
|
|
269
|
-
export { ZylemBox, actor, box, plane, rect, sphere, sprite, text, zone };
|
|
6
|
+
import './entity-Bq_eNEDI.js';
|