@zylem/game-lib 0.3.15 → 0.3.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/dist/.vite/manifest.json +595 -2
- package/dist/actions.d.ts +4 -0
- package/dist/actions.js +10 -0
- package/dist/behaviors.d.ts +3 -0
- package/dist/behaviors.js +8 -0
- package/dist/camera.d.ts +3 -0
- package/dist/camera.js +6 -0
- package/dist/core.d.ts +5 -0
- package/dist/core.js +11 -0
- package/dist/entities.d.ts +8 -0
- package/dist/entities.js +19 -0
- package/dist/lib/actions/behaviors/actions.js +35 -0
- package/dist/lib/actions/behaviors/boundaries/boundary.d.ts +1 -1
- package/dist/lib/actions/behaviors/boundaries/boundary.js +40 -0
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-collision.js +100 -0
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.js +37 -0
- package/dist/lib/actions/behaviors/ricochet/ricochet.d.ts +2 -0
- package/dist/lib/actions/behaviors/ricochet/ricochet.js +6 -0
- package/dist/lib/actions/capabilities/moveable.js +108 -0
- package/dist/lib/actions/capabilities/rotatable.js +82 -0
- package/dist/lib/actions/capabilities/transformable.js +9 -0
- package/dist/lib/actions/global-change.js +40 -0
- package/dist/lib/camera/camera.js +19 -0
- package/dist/lib/camera/fixed-2d.js +30 -0
- package/dist/lib/camera/perspective.js +10 -0
- package/dist/lib/camera/third-person.js +42 -0
- package/dist/lib/camera/zylem-camera.js +145 -0
- package/dist/lib/collision/collision-builder.js +46 -0
- package/dist/lib/collision/collision-delegate.js +6 -0
- package/dist/lib/collision/utils.js +24 -0
- package/dist/lib/collision/world.js +77 -0
- package/dist/lib/core/base-node.js +58 -0
- package/dist/lib/core/entity-asset-loader.js +57 -0
- package/dist/lib/core/lifecycle-base.js +20 -0
- package/dist/lib/core/preset-shader.js +30 -0
- package/dist/lib/core/three-addons/Timer.js +103 -0
- package/dist/lib/core/utility.js +20 -0
- package/dist/lib/core/vessel.js +23 -0
- package/dist/lib/debug/console/console-state.js +11 -0
- package/dist/lib/debug/debug-state.js +40 -0
- package/dist/lib/entities/actor.js +125 -0
- package/dist/lib/entities/box.js +68 -0
- package/dist/lib/entities/builder.js +79 -0
- package/dist/lib/entities/create.js +31 -0
- package/dist/lib/entities/delegates/animation.js +58 -0
- package/dist/lib/entities/delegates/debug.js +72 -0
- package/dist/lib/entities/delegates/loader.js +19 -0
- package/dist/lib/entities/destroy.js +15 -0
- package/dist/lib/entities/entity.js +116 -0
- package/dist/lib/entities/plane.js +81 -0
- package/dist/lib/entities/rect.js +160 -0
- package/dist/lib/entities/sphere.js +68 -0
- package/dist/lib/entities/sprite.js +118 -0
- package/dist/lib/entities/text.js +111 -0
- package/dist/lib/entities/zone.js +103 -0
- package/dist/lib/game/game-state.js +17 -0
- package/dist/lib/game/game.js +157 -0
- package/dist/lib/game/zylem-game.js +107 -0
- package/dist/lib/graphics/geometries/XZPlaneGeometry.js +34 -0
- package/dist/lib/graphics/material.js +64 -0
- package/dist/lib/graphics/mesh.js +14 -0
- package/dist/lib/graphics/render-pass.js +56 -0
- package/dist/lib/graphics/shaders/fragment/debug.glsl.js +23 -0
- package/dist/lib/graphics/shaders/fragment/fire.glsl.js +52 -0
- package/dist/lib/graphics/shaders/fragment/standard.glsl.js +11 -0
- package/dist/lib/graphics/shaders/fragment/stars.glsl.js +44 -0
- package/dist/lib/graphics/shaders/vertex/debug.glsl.js +15 -0
- package/dist/lib/graphics/shaders/vertex/object-shader.glsl.js +11 -0
- package/dist/lib/graphics/shaders/vertex/standard.glsl.js +9 -0
- package/dist/lib/graphics/zylem-scene.js +89 -0
- package/dist/lib/input/gamepad-provider.js +58 -0
- package/dist/lib/input/input-manager.js +70 -0
- package/dist/lib/input/keyboard-provider.js +120 -0
- package/dist/lib/stage/debug-entity-cursor.js +53 -0
- package/dist/lib/stage/entity-spawner.js +27 -0
- package/dist/lib/stage/stage-debug-delegate.js +100 -0
- package/dist/lib/stage/stage-state.js +36 -0
- package/dist/lib/stage/stage.js +58 -0
- package/dist/lib/stage/zylem-stage.js +279 -0
- package/dist/lib/systems/transformable.system.js +43 -0
- package/dist/main.d.ts +4 -14
- package/dist/main.js +54 -45933
- package/dist/stage.d.ts +3 -0
- package/dist/stage.js +6 -0
- package/package.json +35 -1
- package/dist/lib/actions/behaviors/index.d.ts +0 -1
- package/dist/main.cjs +0 -4023
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { createWorld as l, addEntity as c, addComponent as u, removeEntity as f } from "bitecs";
|
|
2
|
+
import { Vector3 as o, Vector2 as p } from "three";
|
|
3
|
+
import { ZylemWorld as d } from "../collision/world.js";
|
|
4
|
+
import { ZylemScene as m } from "../graphics/zylem-scene.js";
|
|
5
|
+
import { setStageBackgroundColor as y, setStageBackgroundImage as g, setStageVariables as b, resetStageVariables as w } from "./stage-state.js";
|
|
6
|
+
import { ZylemBlueColor as E } from "../core/utility.js";
|
|
7
|
+
import { debugState as a } from "../debug/debug-state.js";
|
|
8
|
+
import { getGlobalState as h } from "../game/game-state.js";
|
|
9
|
+
import { LifeCycleBase as v } from "../core/lifecycle-base.js";
|
|
10
|
+
import S from "../systems/transformable.system.js";
|
|
11
|
+
import { BaseNode as M } from "../core/base-node.js";
|
|
12
|
+
import { nanoid as C } from "nanoid";
|
|
13
|
+
import { ZylemCamera as _ } from "../camera/zylem-camera.js";
|
|
14
|
+
import { Perspectives as k } from "../camera/perspective.js";
|
|
15
|
+
import { CameraWrapper as B } from "../camera/camera.js";
|
|
16
|
+
import { StageDebugDelegate as I } from "./stage-debug-delegate.js";
|
|
17
|
+
import { GameEntity as O } from "../entities/entity.js";
|
|
18
|
+
const P = "Stage";
|
|
19
|
+
class K extends v {
|
|
20
|
+
type = P;
|
|
21
|
+
state = {
|
|
22
|
+
backgroundColor: E,
|
|
23
|
+
backgroundImage: null,
|
|
24
|
+
inputs: {
|
|
25
|
+
p1: ["gamepad-1", "keyboard"],
|
|
26
|
+
p2: ["gamepad-2", "keyboard"]
|
|
27
|
+
},
|
|
28
|
+
gravity: new o(0, 0, 0),
|
|
29
|
+
variables: {},
|
|
30
|
+
entities: []
|
|
31
|
+
};
|
|
32
|
+
gravity;
|
|
33
|
+
world;
|
|
34
|
+
scene;
|
|
35
|
+
children = [];
|
|
36
|
+
_childrenMap = /* @__PURE__ */ new Map();
|
|
37
|
+
_removalMap = /* @__PURE__ */ new Map();
|
|
38
|
+
pendingEntities = [];
|
|
39
|
+
pendingPromises = [];
|
|
40
|
+
isLoaded = !1;
|
|
41
|
+
_debugMap = /* @__PURE__ */ new Map();
|
|
42
|
+
entityAddedHandlers = [];
|
|
43
|
+
ecs = l();
|
|
44
|
+
testSystem = null;
|
|
45
|
+
transformSystem = null;
|
|
46
|
+
debugDelegate = null;
|
|
47
|
+
uuid;
|
|
48
|
+
wrapperRef = null;
|
|
49
|
+
camera;
|
|
50
|
+
cameraRef = null;
|
|
51
|
+
/**
|
|
52
|
+
* Create a new stage.
|
|
53
|
+
* @param options Stage options: partial config, camera, and initial entities or factories
|
|
54
|
+
*/
|
|
55
|
+
constructor(e = []) {
|
|
56
|
+
super(), this.world = null, this.scene = null, this.uuid = C();
|
|
57
|
+
const { config: t, entities: i, asyncEntities: s, camera: r } = this.parseOptions(e);
|
|
58
|
+
this.camera = r, this.children = i, this.pendingEntities = s, this.saveState({
|
|
59
|
+
backgroundColor: t.backgroundColor ?? this.state.backgroundColor,
|
|
60
|
+
backgroundImage: t.backgroundImage ?? this.state.backgroundImage,
|
|
61
|
+
inputs: t.inputs ?? this.state.inputs,
|
|
62
|
+
gravity: t.gravity ?? this.state.gravity,
|
|
63
|
+
variables: t.variables ?? this.state.variables,
|
|
64
|
+
entities: []
|
|
65
|
+
}), this.gravity = t.gravity ?? new o(0, 0, 0);
|
|
66
|
+
const n = this;
|
|
67
|
+
window.onresize = function() {
|
|
68
|
+
n.resize(window.innerWidth, window.innerHeight);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
parseOptions(e) {
|
|
72
|
+
let t = {};
|
|
73
|
+
const i = [], s = [];
|
|
74
|
+
let r;
|
|
75
|
+
for (const n of e)
|
|
76
|
+
this.isCameraWrapper(n) ? r = n : this.isBaseNode(n) ? i.push(n) : this.isEntityInput(n) ? s.push(n) : this.isZylemStageConfig(n) && (t = { ...t, ...n });
|
|
77
|
+
return { config: t, entities: i, asyncEntities: s, camera: r };
|
|
78
|
+
}
|
|
79
|
+
isZylemStageConfig(e) {
|
|
80
|
+
return e && typeof e == "object" && !(e instanceof M) && !(e instanceof B);
|
|
81
|
+
}
|
|
82
|
+
isBaseNode(e) {
|
|
83
|
+
return e && typeof e == "object" && typeof e.create == "function";
|
|
84
|
+
}
|
|
85
|
+
isCameraWrapper(e) {
|
|
86
|
+
return e && typeof e == "object" && e.constructor.name === "CameraWrapper";
|
|
87
|
+
}
|
|
88
|
+
isEntityInput(e) {
|
|
89
|
+
return e ? !!(this.isBaseNode(e) || typeof e == "function" || typeof e == "object" && typeof e.then == "function") : !1;
|
|
90
|
+
}
|
|
91
|
+
isThenable(e) {
|
|
92
|
+
return !!e && typeof e.then == "function";
|
|
93
|
+
}
|
|
94
|
+
handleEntityImmediatelyOrQueue(e) {
|
|
95
|
+
this.isLoaded ? this.spawnEntity(e) : this.children.push(e);
|
|
96
|
+
}
|
|
97
|
+
handlePromiseWithSpawnOnResolve(e) {
|
|
98
|
+
this.isLoaded ? e.then((t) => this.spawnEntity(t)).catch((t) => console.error("Failed to build async entity", t)) : this.pendingPromises.push(e);
|
|
99
|
+
}
|
|
100
|
+
saveState(e) {
|
|
101
|
+
this.state = e;
|
|
102
|
+
}
|
|
103
|
+
setState() {
|
|
104
|
+
const { backgroundColor: e, backgroundImage: t } = this.state;
|
|
105
|
+
y(e), g(t), b(this.state.variables ?? {});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Load and initialize the stage's scene and world.
|
|
109
|
+
* @param id DOM element id for the renderer container
|
|
110
|
+
* @param camera Optional camera override
|
|
111
|
+
*/
|
|
112
|
+
async load(e, t) {
|
|
113
|
+
this.setState();
|
|
114
|
+
const i = t || (this.camera ? this.camera.cameraRef : this.createDefaultCamera());
|
|
115
|
+
this.cameraRef = i, this.scene = new m(e, i, this.state);
|
|
116
|
+
const s = await d.loadPhysics(this.gravity ?? new o(0, 0, 0));
|
|
117
|
+
this.world = new d(s), this.scene.setup();
|
|
118
|
+
for (let r of this.children)
|
|
119
|
+
this.spawnEntity(r);
|
|
120
|
+
if (this.pendingEntities.length && (this.enqueue(...this.pendingEntities), this.pendingEntities = []), this.pendingPromises.length) {
|
|
121
|
+
for (const r of this.pendingPromises)
|
|
122
|
+
r.then((n) => this.spawnEntity(n)).catch((n) => console.error("Failed to resolve pending stage entity", n));
|
|
123
|
+
this.pendingPromises = [];
|
|
124
|
+
}
|
|
125
|
+
this.transformSystem = S(this), this.isLoaded = !0;
|
|
126
|
+
}
|
|
127
|
+
createDefaultCamera() {
|
|
128
|
+
const e = window.innerWidth, t = window.innerHeight, i = new p(e, t);
|
|
129
|
+
return new _(k.ThirdPerson, i);
|
|
130
|
+
}
|
|
131
|
+
_setup(e) {
|
|
132
|
+
if (!this.scene || !this.world) {
|
|
133
|
+
this.logMissingEntities();
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
a.on && (this.debugDelegate = new I(this));
|
|
137
|
+
}
|
|
138
|
+
_update(e) {
|
|
139
|
+
const { delta: t } = e;
|
|
140
|
+
if (!this.scene || !this.world) {
|
|
141
|
+
this.logMissingEntities();
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
this.world.update(e), this.transformSystem(this.ecs), this._childrenMap.forEach((i, s) => {
|
|
145
|
+
i.nodeUpdate({
|
|
146
|
+
...e,
|
|
147
|
+
me: i
|
|
148
|
+
}), i.markedForRemoval && this.removeEntityByUuid(i.uuid);
|
|
149
|
+
}), this.scene.update({ delta: t });
|
|
150
|
+
}
|
|
151
|
+
outOfLoop() {
|
|
152
|
+
this.debugUpdate();
|
|
153
|
+
}
|
|
154
|
+
/** Update debug overlays and helpers if enabled. */
|
|
155
|
+
debugUpdate() {
|
|
156
|
+
a.on && this.debugDelegate?.update();
|
|
157
|
+
}
|
|
158
|
+
/** Cleanup owned resources when the stage is destroyed. */
|
|
159
|
+
_destroy(e) {
|
|
160
|
+
this._childrenMap.forEach((t) => {
|
|
161
|
+
try {
|
|
162
|
+
t.nodeDestroy({ me: t, globals: h() });
|
|
163
|
+
} catch {
|
|
164
|
+
}
|
|
165
|
+
}), this._childrenMap.clear(), this._removalMap.clear(), this._debugMap.clear(), this.world?.destroy(), this.scene?.destroy(), this.debugDelegate?.dispose(), this.isLoaded = !1, this.world = null, this.scene = null, this.cameraRef = null, w();
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Create, register, and add an entity to the scene/world.
|
|
169
|
+
* Safe to call only after `load` when scene/world exist.
|
|
170
|
+
*/
|
|
171
|
+
async spawnEntity(e) {
|
|
172
|
+
if (!this.scene || !this.world)
|
|
173
|
+
return;
|
|
174
|
+
const t = e.create(), i = c(this.ecs);
|
|
175
|
+
if (t.eid = i, this.scene.addEntity(t), e.behaviors)
|
|
176
|
+
for (let s of e.behaviors) {
|
|
177
|
+
u(this.ecs, s.component, t.eid);
|
|
178
|
+
const r = Object.keys(s.values);
|
|
179
|
+
for (const n of r)
|
|
180
|
+
s.component[n][t.eid] = s.values[n];
|
|
181
|
+
}
|
|
182
|
+
t.colliderDesc && this.world.addEntity(t), e.nodeSetup({
|
|
183
|
+
me: e,
|
|
184
|
+
globals: h(),
|
|
185
|
+
camera: this.scene.zylemCamera
|
|
186
|
+
}), this.addEntityToStage(t);
|
|
187
|
+
}
|
|
188
|
+
buildEntityState(e) {
|
|
189
|
+
return e instanceof O ? { ...e.buildInfo() } : {
|
|
190
|
+
uuid: e.uuid,
|
|
191
|
+
name: e.name,
|
|
192
|
+
eid: e.eid
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
/** Add the entity to internal maps and notify listeners. */
|
|
196
|
+
addEntityToStage(e) {
|
|
197
|
+
this._childrenMap.set(e.eid, e), a.on && this._debugMap.set(e.uuid, e);
|
|
198
|
+
for (const t of this.entityAddedHandlers)
|
|
199
|
+
try {
|
|
200
|
+
t(e);
|
|
201
|
+
} catch (i) {
|
|
202
|
+
console.error("onEntityAdded handler failed", i);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Subscribe to entity-added events.
|
|
207
|
+
* @param callback Invoked for each entity when added
|
|
208
|
+
* @param options.replayExisting If true and stage already loaded, replays existing entities
|
|
209
|
+
* @returns Unsubscribe function
|
|
210
|
+
*/
|
|
211
|
+
onEntityAdded(e, t) {
|
|
212
|
+
return this.entityAddedHandlers.push(e), t?.replayExisting && this.isLoaded && this._childrenMap.forEach((i) => {
|
|
213
|
+
try {
|
|
214
|
+
e(i);
|
|
215
|
+
} catch (s) {
|
|
216
|
+
console.error("onEntityAdded replay failed", s);
|
|
217
|
+
}
|
|
218
|
+
}), () => {
|
|
219
|
+
this.entityAddedHandlers = this.entityAddedHandlers.filter((i) => i !== e);
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Remove an entity and its resources by its UUID.
|
|
224
|
+
* @returns true if removed, false if not found or stage not ready
|
|
225
|
+
*/
|
|
226
|
+
removeEntityByUuid(e) {
|
|
227
|
+
if (!this.scene || !this.world)
|
|
228
|
+
return !1;
|
|
229
|
+
const i = this.world.collisionMap.get(e) ?? this._debugMap.get(e);
|
|
230
|
+
if (!i)
|
|
231
|
+
return !1;
|
|
232
|
+
this.world.destroyEntity(i), i.group ? this.scene.scene.remove(i.group) : i.mesh && this.scene.scene.remove(i.mesh), f(this.ecs, i.eid);
|
|
233
|
+
let s = null;
|
|
234
|
+
return this._childrenMap.forEach((r, n) => {
|
|
235
|
+
r.uuid === e && (s = n);
|
|
236
|
+
}), s !== null && this._childrenMap.delete(s), this._debugMap.delete(e), !0;
|
|
237
|
+
}
|
|
238
|
+
/** Get an entity by its name; returns null if not found. */
|
|
239
|
+
getEntityByName(e) {
|
|
240
|
+
const i = Object.entries(Object.fromEntries(this._childrenMap)).map((s) => s[1]).find((s) => s.name === e);
|
|
241
|
+
return i || console.warn(`Entity ${e} not found`), i ?? null;
|
|
242
|
+
}
|
|
243
|
+
logMissingEntities() {
|
|
244
|
+
console.warn("Zylem world or scene is null");
|
|
245
|
+
}
|
|
246
|
+
/** Resize renderer viewport. */
|
|
247
|
+
resize(e, t) {
|
|
248
|
+
this.scene && this.scene.updateRenderer(e, t);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Enqueue items to be spawned. Items can be:
|
|
252
|
+
* - BaseNode instances (immediate or deferred until load)
|
|
253
|
+
* - Factory functions returning BaseNode or Promise<BaseNode>
|
|
254
|
+
* - Promises resolving to BaseNode
|
|
255
|
+
*/
|
|
256
|
+
enqueue(...e) {
|
|
257
|
+
for (const t of e)
|
|
258
|
+
if (t) {
|
|
259
|
+
if (this.isBaseNode(t)) {
|
|
260
|
+
this.handleEntityImmediatelyOrQueue(t);
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
if (typeof t == "function") {
|
|
264
|
+
try {
|
|
265
|
+
const i = t();
|
|
266
|
+
this.isBaseNode(i) ? this.handleEntityImmediatelyOrQueue(i) : this.isThenable(i) && this.handlePromiseWithSpawnOnResolve(i);
|
|
267
|
+
} catch (i) {
|
|
268
|
+
console.error("Error executing entity factory", i);
|
|
269
|
+
}
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
this.isThenable(t) && this.handlePromiseWithSpawnOnResolve(t);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
export {
|
|
277
|
+
P as STAGE_TYPE,
|
|
278
|
+
K as ZylemStage
|
|
279
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineComponent as s, defineQuery as Q, defineSystem as R, Types as e } from "bitecs";
|
|
2
|
+
import { Quaternion as v } from "three";
|
|
3
|
+
const n = s({
|
|
4
|
+
x: e.f32,
|
|
5
|
+
y: e.f32,
|
|
6
|
+
z: e.f32
|
|
7
|
+
}), i = s({
|
|
8
|
+
x: e.f32,
|
|
9
|
+
y: e.f32,
|
|
10
|
+
z: e.f32,
|
|
11
|
+
w: e.f32
|
|
12
|
+
}), k = s({
|
|
13
|
+
x: e.f32,
|
|
14
|
+
y: e.f32,
|
|
15
|
+
z: e.f32
|
|
16
|
+
});
|
|
17
|
+
function E(y) {
|
|
18
|
+
const c = Q([n, i]), f = y._childrenMap;
|
|
19
|
+
return R((r) => {
|
|
20
|
+
const m = c(r);
|
|
21
|
+
if (f === void 0)
|
|
22
|
+
return r;
|
|
23
|
+
for (const [u, p] of f) {
|
|
24
|
+
const o = m[u], t = p;
|
|
25
|
+
if (t === void 0 || !t?.body || t.markedForRemoval)
|
|
26
|
+
continue;
|
|
27
|
+
const { x, y: d, z } = t.body.translation();
|
|
28
|
+
if (n.x[o] = x, n.y[o] = d, n.z[o] = z, t.group ? t.group.position.set(n.x[o], n.y[o], n.z[o]) : t.mesh && t.mesh.position.set(n.x[o], n.y[o], n.z[o]), t.controlledRotation)
|
|
29
|
+
continue;
|
|
30
|
+
const { x: l, y: g, z: h, w } = t.body.rotation();
|
|
31
|
+
i.x[o] = l, i.y[o] = g, i.z[o] = h, i.w[o] = w;
|
|
32
|
+
const a = new v(i.x[o], i.y[o], i.z[o], i.w[o]);
|
|
33
|
+
t.group ? t.group.setRotationFromQuaternion(a) : t.mesh && t.mesh.setRotationFromQuaternion(a);
|
|
34
|
+
}
|
|
35
|
+
return r;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
E as default,
|
|
40
|
+
n as position,
|
|
41
|
+
i as rotation,
|
|
42
|
+
k as scale
|
|
43
|
+
};
|
package/dist/main.d.ts
CHANGED
|
@@ -15,26 +15,16 @@ export { plane } from './lib/entities/plane';
|
|
|
15
15
|
export { zone } from './lib/entities/zone';
|
|
16
16
|
export { actor } from './lib/entities/actor';
|
|
17
17
|
export { text } from './lib/entities/text';
|
|
18
|
+
export { rect } from './lib/entities/rect';
|
|
18
19
|
export { ZylemBox } from './lib/entities/box';
|
|
19
20
|
export { makeMoveable } from './lib/actions/capabilities/moveable';
|
|
20
21
|
export { makeRotatable } from './lib/actions/capabilities/rotatable';
|
|
21
22
|
export { makeTransformable } from './lib/actions/capabilities/transformable';
|
|
22
|
-
export
|
|
23
|
+
export { ricochet2DInBounds } from './lib/actions/behaviors/ricochet/ricochet-2d-in-bounds';
|
|
24
|
+
export { ricochet2DCollision } from './lib/actions/behaviors/ricochet/ricochet-2d-collision';
|
|
25
|
+
export { boundary2d } from './lib/actions/behaviors/boundaries/boundary';
|
|
23
26
|
export { destroy } from './lib/entities/destroy';
|
|
24
27
|
export { Howl } from 'howler';
|
|
25
28
|
export * as THREE from 'three';
|
|
26
29
|
export * as RAPIER from '@dimforge/rapier3d-compat';
|
|
27
30
|
export { globalChange, globalChanges, variableChange, variableChanges } from './lib/actions/global-change';
|
|
28
|
-
declare const Zylem: {
|
|
29
|
-
Util: {
|
|
30
|
-
wait(delay: number, callback: Function): void;
|
|
31
|
-
actionOnPress: (isPressed: boolean, callback: Function) => void;
|
|
32
|
-
actionOnRelease: (isPressed: boolean, callback: Function) => void;
|
|
33
|
-
actionWithCooldown: ({ timer, immediate }: {
|
|
34
|
-
timer: number;
|
|
35
|
-
immediate?: boolean;
|
|
36
|
-
}, callback: Function, update: Function) => void;
|
|
37
|
-
actionWithThrottle: (timer: number, callback: Function) => void;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export { Zylem };
|