@thewhateverapp/tile-sdk 0.15.3 → 0.15.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.
Files changed (54) hide show
  1. package/dist/bridge/TileBridge.d.ts +29 -0
  2. package/dist/bridge/TileBridge.d.ts.map +1 -1
  3. package/dist/bridge/TileBridge.js +78 -0
  4. package/dist/excalibur/index.d.ts +48 -0
  5. package/dist/excalibur/index.d.ts.map +1 -0
  6. package/dist/excalibur/index.js +51 -0
  7. package/dist/react/ExcaliburGame.d.ts +109 -0
  8. package/dist/react/ExcaliburGame.d.ts.map +1 -0
  9. package/dist/react/ExcaliburGame.js +215 -0
  10. package/dist/react/index.js +3 -3
  11. package/dist/scene/index.d.ts +3 -41
  12. package/dist/scene/index.d.ts.map +1 -1
  13. package/dist/scene/index.js +1 -49
  14. package/dist/spec/schema.d.ts +12 -12
  15. package/package.json +7 -7
  16. package/dist/pixi/index.d.ts +0 -43
  17. package/dist/pixi/index.d.ts.map +0 -1
  18. package/dist/pixi/index.js +0 -46
  19. package/dist/react/PixiGame.d.ts +0 -138
  20. package/dist/react/PixiGame.d.ts.map +0 -1
  21. package/dist/react/PixiGame.js +0 -237
  22. package/dist/scene/SceneContext.d.ts +0 -173
  23. package/dist/scene/SceneContext.d.ts.map +0 -1
  24. package/dist/scene/SceneContext.js +0 -89
  25. package/dist/scene/SceneFromJson.d.ts +0 -34
  26. package/dist/scene/SceneFromJson.d.ts.map +0 -1
  27. package/dist/scene/SceneFromJson.js +0 -97
  28. package/dist/scene/SceneRenderer.d.ts +0 -29
  29. package/dist/scene/SceneRenderer.d.ts.map +0 -1
  30. package/dist/scene/SceneRenderer.js +0 -312
  31. package/dist/scene/camera/CameraController.d.ts +0 -6
  32. package/dist/scene/camera/CameraController.d.ts.map +0 -1
  33. package/dist/scene/camera/CameraController.js +0 -90
  34. package/dist/scene/components/ComponentRunner.d.ts +0 -22
  35. package/dist/scene/components/ComponentRunner.d.ts.map +0 -1
  36. package/dist/scene/components/ComponentRunner.js +0 -210
  37. package/dist/scene/effects/GlowFilter.d.ts +0 -38
  38. package/dist/scene/effects/GlowFilter.d.ts.map +0 -1
  39. package/dist/scene/effects/GlowFilter.js +0 -40
  40. package/dist/scene/effects/ParticleSystem.d.ts +0 -52
  41. package/dist/scene/effects/ParticleSystem.d.ts.map +0 -1
  42. package/dist/scene/effects/ParticleSystem.js +0 -107
  43. package/dist/scene/entities/EntityGraphics.d.ts +0 -26
  44. package/dist/scene/entities/EntityGraphics.d.ts.map +0 -1
  45. package/dist/scene/entities/EntityGraphics.js +0 -226
  46. package/dist/scene/input/InputManager.d.ts +0 -18
  47. package/dist/scene/input/InputManager.d.ts.map +0 -1
  48. package/dist/scene/input/InputManager.js +0 -86
  49. package/dist/scene/physics/PhysicsEngine.d.ts +0 -15
  50. package/dist/scene/physics/PhysicsEngine.d.ts.map +0 -1
  51. package/dist/scene/physics/PhysicsEngine.js +0 -260
  52. package/dist/scene/timeline/TimelineExecutor.d.ts +0 -6
  53. package/dist/scene/timeline/TimelineExecutor.d.ts.map +0 -1
  54. package/dist/scene/timeline/TimelineExecutor.js +0 -241
@@ -1 +0,0 @@
1
- {"version":3,"file":"GlowFilter.d.ts","sourceRoot":"","sources":["../../../src/scene/effects/GlowFilter.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,WAAgB;;;;;;EAe1D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAO/C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtF"}
@@ -1,40 +0,0 @@
1
- 'use client';
2
- /**
3
- * Parse color string to number
4
- */
5
- export function parseColor(color) {
6
- return parseInt(color.replace('#', ''), 16);
7
- }
8
- /**
9
- * Create glow filter options
10
- * Returns options compatible with @pixi/filter-glow GlowFilter
11
- */
12
- export function createGlowOptions(options = {}) {
13
- const { color = '#ffffff', strength = 1, blur = 4, quality = 0.1, } = options;
14
- return {
15
- color: parseColor(color),
16
- outerStrength: strength,
17
- innerStrength: 0,
18
- distance: blur * 2,
19
- quality,
20
- };
21
- }
22
- /**
23
- * Check if glow filter is available
24
- * Returns true if @pixi/filter-glow is installed
25
- */
26
- export function isGlowFilterAvailable() {
27
- try {
28
- // Dynamic import check
29
- return typeof window !== 'undefined';
30
- }
31
- catch {
32
- return false;
33
- }
34
- }
35
- /**
36
- * Create a CSS text-shadow style for glow effect (fallback)
37
- */
38
- export function createGlowShadow(color, strength, blur) {
39
- return `0 0 ${blur}px ${color}, 0 0 ${blur * 2}px ${color}`;
40
- }
@@ -1,52 +0,0 @@
1
- import type { EmitterGeometry } from '@thewhateverapp/scene-sdk';
2
- /**
3
- * Particle representation
4
- */
5
- export interface Particle {
6
- x: number;
7
- y: number;
8
- velocityX: number;
9
- velocityY: number;
10
- life: number;
11
- maxLife: number;
12
- scale: number;
13
- scaleStart: number;
14
- scaleEnd: number;
15
- color: number;
16
- alpha: number;
17
- }
18
- /**
19
- * Particle emitter state
20
- */
21
- export interface ParticleEmitter {
22
- /** Particles in this emitter */
23
- particles: Particle[];
24
- /** Emitter configuration */
25
- config: EmitterGeometry;
26
- /** Position */
27
- x: number;
28
- y: number;
29
- /** Time since last emission */
30
- timeSinceEmit: number;
31
- /** Whether emitter is active */
32
- active: boolean;
33
- }
34
- /**
35
- * Create a new particle emitter
36
- */
37
- export declare function createEmitter(config: EmitterGeometry, x: number, y: number): ParticleEmitter;
38
- /**
39
- * Update particle emitter
40
- * @param emitter The emitter to update
41
- * @param deltaMs Time since last update in milliseconds
42
- */
43
- export declare function updateEmitter(emitter: ParticleEmitter, deltaMs: number): void;
44
- /**
45
- * Draw particles to a Graphics object
46
- */
47
- export declare function drawParticles(graphics: import('pixi.js').Graphics, emitter: ParticleEmitter): void;
48
- /**
49
- * Burst emit multiple particles at once
50
- */
51
- export declare function burstEmit(emitter: ParticleEmitter, count: number): void;
52
- //# sourceMappingURL=ParticleSystem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ParticleSystem.d.ts","sourceRoot":"","sources":["../../../src/scene/effects/ParticleSystem.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,4BAA4B;IAC5B,MAAM,EAAE,eAAe,CAAC;IACxB,eAAe;IACf,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,eAAe,EACvB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,eAAe,CASjB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAoC7E;AAyCD;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,OAAO,SAAS,EAAE,QAAQ,EACpC,OAAO,EAAE,eAAe,GACvB,IAAI,CAQN;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAIvE"}
@@ -1,107 +0,0 @@
1
- 'use client';
2
- /**
3
- * Create a new particle emitter
4
- */
5
- export function createEmitter(config, x, y) {
6
- return {
7
- particles: [],
8
- config,
9
- x,
10
- y,
11
- timeSinceEmit: 0,
12
- active: true,
13
- };
14
- }
15
- /**
16
- * Update particle emitter
17
- * @param emitter The emitter to update
18
- * @param deltaMs Time since last update in milliseconds
19
- */
20
- export function updateEmitter(emitter, deltaMs) {
21
- const { config, particles } = emitter;
22
- // Update existing particles
23
- for (let i = particles.length - 1; i >= 0; i--) {
24
- const particle = particles[i];
25
- // Update life
26
- particle.life -= deltaMs;
27
- if (particle.life <= 0) {
28
- particles.splice(i, 1);
29
- continue;
30
- }
31
- // Update position
32
- particle.x += particle.velocityX * (deltaMs / 1000);
33
- particle.y += particle.velocityY * (deltaMs / 1000);
34
- // Update scale
35
- const lifeRatio = particle.life / particle.maxLife;
36
- particle.scale = particle.scaleStart + (particle.scaleEnd - particle.scaleStart) * (1 - lifeRatio);
37
- // Update alpha (fade out)
38
- particle.alpha = lifeRatio;
39
- }
40
- // Emit new particles
41
- if (emitter.active) {
42
- const emitInterval = 1000 / config.rate;
43
- emitter.timeSinceEmit += deltaMs;
44
- while (emitter.timeSinceEmit >= emitInterval) {
45
- emitter.timeSinceEmit -= emitInterval;
46
- emitParticle(emitter);
47
- }
48
- }
49
- }
50
- /**
51
- * Emit a single particle
52
- */
53
- function emitParticle(emitter) {
54
- const { config, x, y, particles } = emitter;
55
- // Calculate random velocity
56
- const speed = randomRange(config.speed.min, config.speed.max);
57
- const angle = config.angle
58
- ? randomRange(config.angle.min, config.angle.max) * (Math.PI / 180)
59
- : Math.random() * Math.PI * 2;
60
- const velocityX = Math.cos(angle) * speed;
61
- const velocityY = Math.sin(angle) * speed;
62
- // Calculate scale
63
- const scaleStart = config.scale?.start ?? 1;
64
- const scaleEnd = config.scale?.end ?? 0;
65
- // Pick random color
66
- const colors = config.colors ?? ['#ffffff'];
67
- const colorStr = colors[Math.floor(Math.random() * colors.length)];
68
- const color = parseInt(colorStr.replace('#', ''), 16);
69
- particles.push({
70
- x,
71
- y,
72
- velocityX,
73
- velocityY,
74
- life: config.lifetime,
75
- maxLife: config.lifetime,
76
- scale: scaleStart,
77
- scaleStart,
78
- scaleEnd,
79
- color,
80
- alpha: 1,
81
- });
82
- }
83
- /**
84
- * Draw particles to a Graphics object
85
- */
86
- export function drawParticles(graphics, emitter) {
87
- graphics.clear();
88
- for (const particle of emitter.particles) {
89
- graphics.beginFill(particle.color, particle.alpha);
90
- graphics.drawCircle(particle.x, particle.y, 3 * particle.scale);
91
- graphics.endFill();
92
- }
93
- }
94
- /**
95
- * Burst emit multiple particles at once
96
- */
97
- export function burstEmit(emitter, count) {
98
- for (let i = 0; i < count; i++) {
99
- emitParticle(emitter);
100
- }
101
- }
102
- /**
103
- * Generate random number in range
104
- */
105
- function randomRange(min, max) {
106
- return min + Math.random() * (max - min);
107
- }
@@ -1,26 +0,0 @@
1
- /**
2
- * EntityGraphics - Imperative pixi.js graphics creation for entities
3
- *
4
- * This module creates and updates pixi objects directly without React reconciler.
5
- */
6
- import * as PIXI from 'pixi.js';
7
- import type { EntityState } from '../SceneContext.js';
8
- /**
9
- * Container for entity graphics
10
- */
11
- export interface EntityGraphics {
12
- container: PIXI.Container;
13
- graphics: PIXI.Graphics | null;
14
- text: PIXI.Text | null;
15
- sprite: PIXI.Sprite | null;
16
- debugGraphics: PIXI.Graphics | null;
17
- }
18
- /**
19
- * Create pixi graphics for an entity
20
- */
21
- export declare function createEntityGraphics(state: EntityState, debug?: boolean): EntityGraphics;
22
- /**
23
- * Update entity graphics position and state
24
- */
25
- export declare function updateEntityGraphics(entityGraphics: EntityGraphics, state: EntityState): void;
26
- //# sourceMappingURL=EntityGraphics.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EntityGraphics.d.ts","sourceRoot":"","sources":["../../../src/scene/entities/EntityGraphics.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAWtD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC;IAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC/B,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;CACrC;AASD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,GAAE,OAAe,GAAG,cAAc,CA8F/F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAoB7F"}
@@ -1,226 +0,0 @@
1
- 'use client';
2
- /**
3
- * EntityGraphics - Imperative pixi.js graphics creation for entities
4
- *
5
- * This module creates and updates pixi objects directly without React reconciler.
6
- */
7
- import * as PIXI from 'pixi.js';
8
- /**
9
- * Parse hex color string to number
10
- */
11
- function parseColor(color) {
12
- return parseInt(color.replace('#', ''), 16);
13
- }
14
- /**
15
- * Create pixi graphics for an entity
16
- */
17
- export function createEntityGraphics(state, debug = false) {
18
- const container = new PIXI.Container();
19
- let graphics = null;
20
- let text = null;
21
- let sprite = null;
22
- let debugGraphics = null;
23
- const { entity } = state;
24
- const kind = entity.kind;
25
- // Parse colors
26
- const fillColor = parseColor(state.fill ?? entity.render?.fill ?? '#ffffff');
27
- const strokeColor = entity.render?.stroke ? parseColor(entity.render.stroke) : undefined;
28
- const strokeWidth = entity.render?.strokeWidth ?? 0;
29
- switch (kind) {
30
- case 'rect': {
31
- const geom = entity.geom;
32
- graphics = new PIXI.Graphics();
33
- drawRect(graphics, geom, fillColor, strokeColor, strokeWidth);
34
- container.addChild(graphics);
35
- if (debug) {
36
- debugGraphics = new PIXI.Graphics();
37
- drawDebugBounds(debugGraphics, geom);
38
- container.addChild(debugGraphics);
39
- }
40
- break;
41
- }
42
- case 'circle': {
43
- const geom = entity.geom;
44
- graphics = new PIXI.Graphics();
45
- drawCircle(graphics, geom, fillColor, strokeColor, strokeWidth);
46
- container.addChild(graphics);
47
- break;
48
- }
49
- case 'poly': {
50
- const geom = entity.geom;
51
- graphics = new PIXI.Graphics();
52
- drawPoly(graphics, geom, fillColor, strokeColor, strokeWidth);
53
- container.addChild(graphics);
54
- break;
55
- }
56
- case 'line': {
57
- const geom = entity.geom;
58
- graphics = new PIXI.Graphics();
59
- drawLine(graphics, geom, strokeColor ?? fillColor);
60
- container.addChild(graphics);
61
- break;
62
- }
63
- case 'text': {
64
- const geom = entity.geom;
65
- text = createTextElement(geom, fillColor);
66
- container.addChild(text);
67
- break;
68
- }
69
- case 'sprite': {
70
- const geom = entity.geom;
71
- // For now, draw a placeholder since we don't have texture loading
72
- graphics = new PIXI.Graphics();
73
- drawSpritePlaceholder(graphics, geom);
74
- container.addChild(graphics);
75
- break;
76
- }
77
- case 'emitter': {
78
- const geom = entity.geom;
79
- graphics = new PIXI.Graphics();
80
- drawEmitterMarker(graphics, fillColor);
81
- container.addChild(graphics);
82
- break;
83
- }
84
- case 'group':
85
- // Groups are just containers
86
- break;
87
- default:
88
- console.warn(`Unknown entity kind: ${kind}`);
89
- }
90
- // Set initial position
91
- container.x = state.x;
92
- container.y = state.y;
93
- container.rotation = state.rotation;
94
- container.scale.set(state.scaleX, state.scaleY);
95
- container.alpha = state.alpha;
96
- return { container, graphics, text, sprite, debugGraphics };
97
- }
98
- /**
99
- * Update entity graphics position and state
100
- */
101
- export function updateEntityGraphics(entityGraphics, state) {
102
- const { container, graphics } = entityGraphics;
103
- // Update transform
104
- container.x = state.x;
105
- container.y = state.y;
106
- container.rotation = state.rotation;
107
- container.scale.set(state.scaleX, state.scaleY);
108
- container.alpha = state.alpha;
109
- // If fill color changed, redraw (for dynamic color changes)
110
- if (graphics && state.entity.kind === 'rect') {
111
- const geom = state.entity.geom;
112
- const fillColor = parseColor(state.fill ?? state.entity.render?.fill ?? '#ffffff');
113
- const strokeColor = state.entity.render?.stroke ? parseColor(state.entity.render.stroke) : undefined;
114
- const strokeWidth = state.entity.render?.strokeWidth ?? 0;
115
- graphics.clear();
116
- drawRect(graphics, geom, fillColor, strokeColor, strokeWidth);
117
- }
118
- }
119
- /**
120
- * Draw a rectangle
121
- */
122
- function drawRect(g, geom, fillColor, strokeColor, strokeWidth = 0) {
123
- if (strokeColor !== undefined && strokeWidth > 0) {
124
- g.lineStyle(strokeWidth, strokeColor);
125
- }
126
- g.beginFill(fillColor);
127
- const anchorX = geom.w / 2;
128
- const anchorY = geom.h / 2;
129
- if (geom.cornerRadius && geom.cornerRadius > 0) {
130
- g.drawRoundedRect(-anchorX, -anchorY, geom.w, geom.h, geom.cornerRadius);
131
- }
132
- else {
133
- g.drawRect(-anchorX, -anchorY, geom.w, geom.h);
134
- }
135
- g.endFill();
136
- }
137
- /**
138
- * Draw a circle
139
- */
140
- function drawCircle(g, geom, fillColor, strokeColor, strokeWidth = 0) {
141
- if (strokeColor !== undefined && strokeWidth > 0) {
142
- g.lineStyle(strokeWidth, strokeColor);
143
- }
144
- g.beginFill(fillColor);
145
- g.drawCircle(0, 0, geom.r);
146
- g.endFill();
147
- }
148
- /**
149
- * Draw a polygon
150
- */
151
- function drawPoly(g, geom, fillColor, strokeColor, strokeWidth = 0) {
152
- if (strokeColor !== undefined && strokeWidth > 0) {
153
- g.lineStyle(strokeWidth, strokeColor);
154
- }
155
- g.beginFill(fillColor);
156
- const points = geom.points;
157
- if (points.length < 3)
158
- return;
159
- g.moveTo(points[0][0], points[0][1]);
160
- for (let i = 1; i < points.length; i++) {
161
- g.lineTo(points[i][0], points[i][1]);
162
- }
163
- g.closePath();
164
- g.endFill();
165
- }
166
- /**
167
- * Draw a line
168
- */
169
- function drawLine(g, geom, strokeColor) {
170
- g.lineStyle(geom.lineWidth ?? 2, strokeColor);
171
- const points = geom.points;
172
- if (points.length < 2)
173
- return;
174
- g.moveTo(points[0][0], points[0][1]);
175
- for (let i = 1; i < points.length; i++) {
176
- g.lineTo(points[i][0], points[i][1]);
177
- }
178
- }
179
- /**
180
- * Create a text element
181
- */
182
- function createTextElement(geom, fillColor) {
183
- const style = new PIXI.TextStyle({
184
- fontFamily: geom.fontFamily ?? 'Arial',
185
- fontSize: geom.fontSize ?? 16,
186
- fontWeight: (geom.fontWeight ?? 'normal'),
187
- fill: fillColor,
188
- align: (geom.align ?? 'center'),
189
- });
190
- const text = new PIXI.Text(geom.text, style);
191
- text.anchor.set(0.5, 0.5);
192
- return text;
193
- }
194
- /**
195
- * Draw sprite placeholder (for missing sprites)
196
- */
197
- function drawSpritePlaceholder(g, geom) {
198
- const w = geom.w ?? 32;
199
- const h = geom.h ?? 32;
200
- g.beginFill(0x888888);
201
- g.drawRect(-w / 2, -h / 2, w, h);
202
- g.endFill();
203
- // Draw X to indicate missing sprite
204
- g.lineStyle(2, 0xff0000);
205
- g.moveTo(-w / 2, -h / 2);
206
- g.lineTo(w / 2, h / 2);
207
- g.moveTo(w / 2, -h / 2);
208
- g.lineTo(-w / 2, h / 2);
209
- }
210
- /**
211
- * Draw emitter marker
212
- */
213
- function drawEmitterMarker(g, fillColor) {
214
- g.beginFill(fillColor, 0.3);
215
- g.drawCircle(0, 0, 10);
216
- g.endFill();
217
- g.lineStyle(1, fillColor);
218
- g.drawCircle(0, 0, 15);
219
- }
220
- /**
221
- * Draw debug bounds
222
- */
223
- function drawDebugBounds(g, geom) {
224
- g.lineStyle(1, 0x00ff00, 0.5);
225
- g.drawRect(-geom.w / 2, -geom.h / 2, geom.w, geom.h);
226
- }
@@ -1,18 +0,0 @@
1
- import type { SceneContextValue } from '../SceneContext.js';
2
- /**
3
- * Hook to manage keyboard and touch input
4
- */
5
- export declare function useInputManager(context: SceneContextValue): void;
6
- /**
7
- * Check if jump is currently pressed
8
- */
9
- export declare function isJumpPressed(context: SceneContextValue): boolean;
10
- /**
11
- * Check if a specific key is pressed
12
- */
13
- export declare function isKeyPressed(context: SceneContextValue, key: string): boolean;
14
- /**
15
- * Check if touch/click is active
16
- */
17
- export declare function isTouching(context: SceneContextValue): boolean;
18
- //# sourceMappingURL=InputManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InputManager.d.ts","sourceRoot":"","sources":["../../../src/scene/input/InputManager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,iBAAiB,QA2EzD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAEjE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAE7E;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAE9D"}
@@ -1,86 +0,0 @@
1
- 'use client';
2
- import { useEffect } from 'react';
3
- /**
4
- * Hook to manage keyboard and touch input
5
- */
6
- export function useInputManager(context) {
7
- const { input } = context;
8
- useEffect(() => {
9
- const inputState = input.current;
10
- // Keyboard event handlers
11
- const handleKeyDown = (e) => {
12
- const key = e.key;
13
- const code = e.code;
14
- // Track all keys
15
- inputState.keys[key] = true;
16
- inputState.keys[code] = true;
17
- // Jump keys: Space, ArrowUp, W
18
- if (key === ' ' || key === 'ArrowUp' || key === 'w' || key === 'W') {
19
- inputState.jumpPressed = true;
20
- }
21
- };
22
- const handleKeyUp = (e) => {
23
- const key = e.key;
24
- const code = e.code;
25
- // Track all keys
26
- inputState.keys[key] = false;
27
- inputState.keys[code] = false;
28
- // Jump keys: Space, ArrowUp, W
29
- if (key === ' ' || key === 'ArrowUp' || key === 'w' || key === 'W') {
30
- inputState.jumpPressed = false;
31
- }
32
- };
33
- // Touch event handlers
34
- const handleTouchStart = (e) => {
35
- inputState.touching = true;
36
- inputState.jumpPressed = true;
37
- };
38
- const handleTouchEnd = (e) => {
39
- inputState.touching = false;
40
- inputState.jumpPressed = false;
41
- };
42
- // Mouse event handlers (for desktop click)
43
- const handleMouseDown = (e) => {
44
- inputState.touching = true;
45
- inputState.jumpPressed = true;
46
- };
47
- const handleMouseUp = (e) => {
48
- inputState.touching = false;
49
- inputState.jumpPressed = false;
50
- };
51
- // Add event listeners
52
- window.addEventListener('keydown', handleKeyDown);
53
- window.addEventListener('keyup', handleKeyUp);
54
- window.addEventListener('touchstart', handleTouchStart, { passive: true });
55
- window.addEventListener('touchend', handleTouchEnd, { passive: true });
56
- window.addEventListener('mousedown', handleMouseDown);
57
- window.addEventListener('mouseup', handleMouseUp);
58
- // Cleanup
59
- return () => {
60
- window.removeEventListener('keydown', handleKeyDown);
61
- window.removeEventListener('keyup', handleKeyUp);
62
- window.removeEventListener('touchstart', handleTouchStart);
63
- window.removeEventListener('touchend', handleTouchEnd);
64
- window.removeEventListener('mousedown', handleMouseDown);
65
- window.removeEventListener('mouseup', handleMouseUp);
66
- };
67
- }, [input]);
68
- }
69
- /**
70
- * Check if jump is currently pressed
71
- */
72
- export function isJumpPressed(context) {
73
- return context.input.current.jumpPressed;
74
- }
75
- /**
76
- * Check if a specific key is pressed
77
- */
78
- export function isKeyPressed(context, key) {
79
- return context.input.current.keys[key] ?? false;
80
- }
81
- /**
82
- * Check if touch/click is active
83
- */
84
- export function isTouching(context) {
85
- return context.input.current.touching;
86
- }
@@ -1,15 +0,0 @@
1
- import Matter from 'matter-js';
2
- import type { SceneContextValue } from '../SceneContext.js';
3
- /**
4
- * Hook to initialize and run the physics engine
5
- */
6
- export declare function usePhysicsEngine(context: SceneContextValue, width: number, height: number): void;
7
- /**
8
- * Apply impulse to a body
9
- */
10
- export declare function applyImpulse(body: Matter.Body, impulseX: number, impulseY: number): void;
11
- /**
12
- * Set velocity on a body
13
- */
14
- export declare function setVelocity(body: Matter.Body, velocityX: number, velocityY: number): void;
15
- //# sourceMappingURL=PhysicsEngine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PhysicsEngine.d.ts","sourceRoot":"","sources":["../../../src/scene/physics/PhysicsEngine.tsx"],"names":[],"mappings":"AAGA,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAe,MAAM,oBAAoB,CAAC;AAqEzE;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,iBAAiB,EAC1B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,QA+Gf;AA2GD;;GAEG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,QAMjB;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,QAGlB"}