bonkjs 0.2.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.
Files changed (88) hide show
  1. package/README.md +94 -0
  2. package/dist/audio/AudioManager.d.ts +105 -0
  3. package/dist/audio/AudioManager.d.ts.map +1 -0
  4. package/dist/audio/AudioSource.d.ts +69 -0
  5. package/dist/audio/AudioSource.d.ts.map +1 -0
  6. package/dist/audio/index.d.ts +3 -0
  7. package/dist/audio/index.d.ts.map +1 -0
  8. package/dist/bonkjs.js +4307 -0
  9. package/dist/bonkjs.js.map +1 -0
  10. package/dist/devtools/Tweaker.d.ts +61 -0
  11. package/dist/devtools/Tweaker.d.ts.map +1 -0
  12. package/dist/devtools/TweakerOverlay.d.ts +66 -0
  13. package/dist/devtools/TweakerOverlay.d.ts.map +1 -0
  14. package/dist/devtools/index.d.ts +3 -0
  15. package/dist/devtools/index.d.ts.map +1 -0
  16. package/dist/devtools/tweaker-styles.d.ts +5 -0
  17. package/dist/devtools/tweaker-styles.d.ts.map +1 -0
  18. package/dist/devtools/types.d.ts +37 -0
  19. package/dist/devtools/types.d.ts.map +1 -0
  20. package/dist/index.d.ts +13 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/input/Input.d.ts +114 -0
  23. package/dist/input/Input.d.ts.map +1 -0
  24. package/dist/input/Keys.d.ts +63 -0
  25. package/dist/input/Keys.d.ts.map +1 -0
  26. package/dist/input/index.d.ts +3 -0
  27. package/dist/input/index.d.ts.map +1 -0
  28. package/dist/math/index.d.ts +2 -0
  29. package/dist/math/index.d.ts.map +1 -0
  30. package/dist/math/vec2.d.ts +27 -0
  31. package/dist/math/vec2.d.ts.map +1 -0
  32. package/dist/physics/CollisionLayers.d.ts +25 -0
  33. package/dist/physics/CollisionLayers.d.ts.map +1 -0
  34. package/dist/physics/MatterPhysicsWorld.d.ts +24 -0
  35. package/dist/physics/MatterPhysicsWorld.d.ts.map +1 -0
  36. package/dist/physics/PhysicsWorld.d.ts +101 -0
  37. package/dist/physics/PhysicsWorld.d.ts.map +1 -0
  38. package/dist/physics/RigidBody.d.ts +72 -0
  39. package/dist/physics/RigidBody.d.ts.map +1 -0
  40. package/dist/physics/index.d.ts +6 -0
  41. package/dist/physics/index.d.ts.map +1 -0
  42. package/dist/render/AnimatedSprite.d.ts +87 -0
  43. package/dist/render/AnimatedSprite.d.ts.map +1 -0
  44. package/dist/render/Camera.d.ts +76 -0
  45. package/dist/render/Camera.d.ts.map +1 -0
  46. package/dist/render/PixiRenderer.d.ts +80 -0
  47. package/dist/render/PixiRenderer.d.ts.map +1 -0
  48. package/dist/render/Renderer.d.ts +151 -0
  49. package/dist/render/Renderer.d.ts.map +1 -0
  50. package/dist/render/Sprite.d.ts +49 -0
  51. package/dist/render/Sprite.d.ts.map +1 -0
  52. package/dist/render/index.d.ts +6 -0
  53. package/dist/render/index.d.ts.map +1 -0
  54. package/dist/runtime/EventSystem.d.ts +38 -0
  55. package/dist/runtime/EventSystem.d.ts.map +1 -0
  56. package/dist/runtime/Game.d.ts +59 -0
  57. package/dist/runtime/Game.d.ts.map +1 -0
  58. package/dist/runtime/Scheduler.d.ts +50 -0
  59. package/dist/runtime/Scheduler.d.ts.map +1 -0
  60. package/dist/runtime/Time.d.ts +30 -0
  61. package/dist/runtime/Time.d.ts.map +1 -0
  62. package/dist/runtime/Transform.d.ts +47 -0
  63. package/dist/runtime/Transform.d.ts.map +1 -0
  64. package/dist/runtime/index.d.ts +6 -0
  65. package/dist/runtime/index.d.ts.map +1 -0
  66. package/dist/types.d.ts +54 -0
  67. package/dist/types.d.ts.map +1 -0
  68. package/dist/ui/UIElement.d.ts +211 -0
  69. package/dist/ui/UIElement.d.ts.map +1 -0
  70. package/dist/ui/UIManager.d.ts +102 -0
  71. package/dist/ui/UIManager.d.ts.map +1 -0
  72. package/dist/ui/index.d.ts +11 -0
  73. package/dist/ui/index.d.ts.map +1 -0
  74. package/dist/ui/layout/UIHBox.d.ts +42 -0
  75. package/dist/ui/layout/UIHBox.d.ts.map +1 -0
  76. package/dist/ui/layout/UIVBox.d.ts +52 -0
  77. package/dist/ui/layout/UIVBox.d.ts.map +1 -0
  78. package/dist/ui/primitives/UIButton.d.ts +77 -0
  79. package/dist/ui/primitives/UIButton.d.ts.map +1 -0
  80. package/dist/ui/primitives/UIImage.d.ts +54 -0
  81. package/dist/ui/primitives/UIImage.d.ts.map +1 -0
  82. package/dist/ui/primitives/UIPanel.d.ts +71 -0
  83. package/dist/ui/primitives/UIPanel.d.ts.map +1 -0
  84. package/dist/ui/primitives/UIText.d.ts +57 -0
  85. package/dist/ui/primitives/UIText.d.ts.map +1 -0
  86. package/dist/ui/types.d.ts +138 -0
  87. package/dist/ui/types.d.ts.map +1 -0
  88. package/package.json +54 -0
@@ -0,0 +1,59 @@
1
+ import { Renderer, RendererConfig } from '../render/Renderer';
2
+ import { PhysicsWorld } from '../physics/PhysicsWorld';
3
+ import { RigidBody, RigidBodyConfig as RBConfig } from '../physics/RigidBody';
4
+ import { Transform } from './Transform';
5
+ import { Vector2 } from '../types';
6
+ /** Game configuration */
7
+ export interface GameConfig {
8
+ physics?: {
9
+ gravity?: Vector2;
10
+ enabled?: boolean;
11
+ };
12
+ }
13
+ type UpdateCallback = () => void;
14
+ export declare class Game {
15
+ readonly renderer: Renderer;
16
+ readonly physics: PhysicsWorld | null;
17
+ private fixedUpdateCallbacks;
18
+ private updateCallbacks;
19
+ private lateUpdateCallbacks;
20
+ private running;
21
+ private paused;
22
+ private animFrameId;
23
+ private lastTime;
24
+ private fixedAccumulator;
25
+ private readonly maxDeltaTime;
26
+ /** Body ID → RigidBody for collision routing */
27
+ private registeredBodies;
28
+ private physicsCleanup;
29
+ constructor(config?: GameConfig);
30
+ /** Initialize the renderer and input system. Returns the canvas. */
31
+ init(config?: Partial<RendererConfig>): Promise<HTMLCanvasElement>;
32
+ /** Register a callback for fixed-timestep updates (physics). */
33
+ onFixedUpdate(cb: UpdateCallback): () => void;
34
+ /** Register a callback for per-frame updates. */
35
+ onUpdate(cb: UpdateCallback): () => void;
36
+ /** Register a callback for late updates (after main update). */
37
+ onLateUpdate(cb: UpdateCallback): () => void;
38
+ /** Register a RigidBody for collision routing. */
39
+ registerBody(rb: RigidBody): void;
40
+ /** Unregister a RigidBody from collision routing. */
41
+ unregisterBody(rb: RigidBody): void;
42
+ /** Convenience: create a RigidBody and auto-register it. */
43
+ createBody(transform: Transform, config: RBConfig): RigidBody;
44
+ /** Start the game loop. */
45
+ start(): void;
46
+ /** Stop the game loop. */
47
+ stop(): void;
48
+ /** Pause the game (loop continues but updates are skipped). */
49
+ pause(): void;
50
+ /** Resume a paused game. */
51
+ resume(): void;
52
+ /** Clean up all resources. */
53
+ destroy(): void;
54
+ private loop;
55
+ private setupCollisionRouting;
56
+ private routeCollision;
57
+ }
58
+ export {};
59
+ //# sourceMappingURL=Game.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Game.d.ts","sourceRoot":"","sources":["../../src/runtime/Game.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,yBAAyB,CAAC;AACjC,OAAO,+BAA+B,CAAC;AAKvC,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,IAAI,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,yBAAyB;AACzB,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED,KAAK,cAAc,GAAG,MAAM,IAAI,CAAC;AAEjC,qBAAa,IAAI;IACf,QAAQ,CAAC,QAAQ,EAAE,QAAQ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,CAAC,IAAI,CA0CV;IAEF,OAAO,CAAC,qBAAqB;IAgB7B,OAAO,CAAC,cAAc;CA6BvB"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Coroutine scheduler for game logic.
3
+ * Provides generator-based async operations that integrate with the game loop.
4
+ */
5
+ /** Coroutine handle for controlling execution */
6
+ export interface CoroutineHandle {
7
+ id: number;
8
+ cancel: () => void;
9
+ readonly isRunning: boolean;
10
+ }
11
+ /** Yield instruction types */
12
+ export type YieldInstruction = {
13
+ type: 'frames';
14
+ count: number;
15
+ } | {
16
+ type: 'seconds';
17
+ duration: number;
18
+ } | {
19
+ type: 'until';
20
+ predicate: () => boolean;
21
+ } | {
22
+ type: 'coroutine';
23
+ generator: Generator<YieldInstruction, void, void>;
24
+ };
25
+ /** Wait for a number of frames */
26
+ export declare function waitFrames(count: number): YieldInstruction;
27
+ /** Wait for a duration in seconds (respects Time.timeScale) */
28
+ export declare function wait(seconds: number): YieldInstruction;
29
+ /** Wait until a condition is true */
30
+ export declare function waitUntil(predicate: () => boolean): YieldInstruction;
31
+ /** Wait for another coroutine to complete */
32
+ export declare function waitForCoroutine(generator: Generator<YieldInstruction, void, void>): YieldInstruction;
33
+ export declare class Scheduler {
34
+ private coroutines;
35
+ /** Start a new coroutine */
36
+ start(generator: Generator<YieldInstruction, void, void>): CoroutineHandle;
37
+ /** Cancel a running coroutine */
38
+ cancel(id: number): void;
39
+ /** Cancel all coroutines */
40
+ cancelAll(): void;
41
+ /** Update all coroutines (called each frame) */
42
+ update(): void;
43
+ /** Advance a coroutine to its next yield point */
44
+ private advanceCoroutine;
45
+ /** Get number of running coroutines */
46
+ get count(): number;
47
+ }
48
+ /** Global scheduler instance */
49
+ export declare const GlobalScheduler: Scheduler;
50
+ //# sourceMappingURL=Scheduler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scheduler.d.ts","sourceRoot":"","sources":["../../src/runtime/Scheduler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,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kD;IAClD,OAAO,CAAC,gBAAgB;IAgDxB,uCAAuC;IACvC,IAAI,KAAK,IAAI,MAAM,CAElB;CACF;AAED,gCAAgC;AAChC,eAAO,MAAM,eAAe,WAAkB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Time management for the game loop.
3
+ * Provides delta time, elapsed time, and time scaling.
4
+ */
5
+ export declare class Time {
6
+ /** Time since last frame in seconds */
7
+ static deltaTime: number;
8
+ /** Unscaled time since last frame */
9
+ static unscaledDeltaTime: number;
10
+ /** Total elapsed time since game start */
11
+ static time: number;
12
+ /** Unscaled total elapsed time */
13
+ static unscaledTime: number;
14
+ /** Fixed timestep for physics (1/60 second) */
15
+ static readonly fixedDeltaTime: number;
16
+ /** Time scale for slow-mo or pause effects */
17
+ static timeScale: number;
18
+ /** Frame count since game start */
19
+ static frameCount: number;
20
+ /** Current frames per second */
21
+ static fps: number;
22
+ private static fpsAccumulator;
23
+ private static fpsFrameCount;
24
+ private static lastFpsUpdate;
25
+ /** Update time values (called by WorldManager) */
26
+ static update(dt: number): void;
27
+ /** Reset all time values */
28
+ static reset(): void;
29
+ }
30
+ //# sourceMappingURL=Time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Time.d.ts","sourceRoot":"","sources":["../../src/runtime/Time.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,qBAAa,IAAI;IACf,uCAAuC;IACvC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAK;IAE7B,qCAAqC;IACrC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAK;IAErC,0CAA0C;IAC1C,MAAM,CAAC,IAAI,EAAE,MAAM,CAAK;IAExB,kCAAkC;IAClC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAK;IAEhC,+CAA+C;IAC/C,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAU;IAEhD,8CAA8C;IAC9C,MAAM,CAAC,SAAS,EAAE,MAAM,CAAK;IAE7B,mCAAmC;IACnC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAK;IAE9B,gCAAgC;IAChC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAM;IAExB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAa;IAC1C,OAAO,CAAC,MAAM,CAAC,aAAa,CAAa;IACzC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAa;IAEzC,kDAAkD;IAClD,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAiB/B,4BAA4B;IAC5B,MAAM,CAAC,KAAK,IAAI,IAAI;CAWrB"}
@@ -0,0 +1,47 @@
1
+ import { Vector2, TransformJson } from '../types';
2
+ export declare class Transform {
3
+ /** Position in world space */
4
+ position: Vector2;
5
+ /** Rotation in degrees */
6
+ rotation: number;
7
+ /** Scale factor */
8
+ scale: Vector2;
9
+ /** Z-index for render ordering (higher = on top) */
10
+ zIndex: number;
11
+ /** Parent transform for hierarchical positioning */
12
+ parent: Transform | null;
13
+ /** Child transforms */
14
+ private children;
15
+ constructor(data?: Partial<TransformJson>);
16
+ /** Get world position (accounting for parent transforms) */
17
+ get worldPosition(): Vector2;
18
+ /** Set world position */
19
+ set worldPosition(value: Vector2);
20
+ /** Get world rotation */
21
+ get worldRotation(): number;
22
+ /** Set world rotation */
23
+ set worldRotation(value: number);
24
+ /** Get world scale */
25
+ get worldScale(): Vector2;
26
+ /** Add a child transform */
27
+ addChild(child: Transform): void;
28
+ /** Remove a child transform */
29
+ removeChild(child: Transform): void;
30
+ /** Get all children */
31
+ getChildren(): readonly Transform[];
32
+ /** Get forward direction vector */
33
+ get forward(): Vector2;
34
+ /** Get right direction vector */
35
+ get right(): Vector2;
36
+ /** Translate by offset */
37
+ translate(x: number, y: number): void;
38
+ /** Rotate by degrees */
39
+ rotate(degrees: number): void;
40
+ /** Look at a target position */
41
+ lookAt(target: Vector2): void;
42
+ /** Convert to JSON */
43
+ toJSON(): TransformJson;
44
+ /** Create from JSON */
45
+ static fromJSON(json: TransformJson): Transform;
46
+ }
47
+ //# sourceMappingURL=Transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../src/runtime/Transform.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,qBAAa,SAAS;IACpB,8BAA8B;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAElB,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IAEjB,mBAAmB;IACnB,KAAK,EAAE,OAAO,CAAC;IAEf,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IAEf,oDAAoD;IACpD,MAAM,EAAE,SAAS,GAAG,IAAI,CAAQ;IAEhC,uBAAuB;IACvB,OAAO,CAAC,QAAQ,CAAmB;gBAEvB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC;IAOzC,4DAA4D;IAC5D,IAAI,aAAa,IAAI,OAAO,CAiB3B;IAED,yBAAyB;IACzB,IAAI,aAAa,CAAC,KAAK,EAAE,OAAO,EAoB/B;IAED,yBAAyB;IACzB,IAAI,aAAa,IAAI,MAAM,CAG1B;IAED,yBAAyB;IACzB,IAAI,aAAa,CAAC,KAAK,EAAE,MAAM,EAM9B;IAED,sBAAsB;IACtB,IAAI,UAAU,IAAI,OAAO,CAIxB;IAED,4BAA4B;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAQhC,+BAA+B;IAC/B,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAQnC,uBAAuB;IACvB,WAAW,IAAI,SAAS,SAAS,EAAE;IAInC,mCAAmC;IACnC,IAAI,OAAO,IAAI,OAAO,CAGrB;IAED,iCAAiC;IACjC,IAAI,KAAK,IAAI,OAAO,CAGnB;IAED,0BAA0B;IAC1B,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAKrC,wBAAwB;IACxB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI7B,gCAAgC;IAChC,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAM7B,sBAAsB;IACtB,MAAM,IAAI,aAAa;IASvB,uBAAuB;IACvB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS;CAGhD"}
@@ -0,0 +1,6 @@
1
+ export { Game, type GameConfig } from './Game';
2
+ export { Time } from './Time';
3
+ export { Scheduler, GlobalScheduler, waitFrames, wait, waitUntil, waitForCoroutine, type CoroutineHandle, type YieldInstruction, } from './Scheduler';
4
+ export { EventEmitter, GlobalEvents, EngineEvents, type EventCallback, } from './EventSystem';
5
+ export { Transform } from './Transform';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EACL,SAAS,EACT,eAAe,EACf,UAAU,EACV,IAAI,EACJ,SAAS,EACT,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,KAAK,aAAa,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Shared type definitions for Bonk Engine.
3
+ */
4
+ /** 2D vector as tuple [x, y] */
5
+ export type Vector2 = [number, number];
6
+ /** 2D vector with optional z for layering */
7
+ export type Vector3 = [number, number, number];
8
+ /** RGBA color as tuple [r, g, b, a] with values 0-1 */
9
+ export type Color = [number, number, number, number];
10
+ /** Hex color string */
11
+ export type HexColor = string;
12
+ /** Color can be specified as hex or RGBA tuple */
13
+ export type ColorValue = string | Color;
14
+ /** Configuration for an axis (e.g., horizontal, vertical) */
15
+ export interface AxisConfig {
16
+ /** Keys that contribute -1 to this axis */
17
+ negative: string[];
18
+ /** Keys that contribute +1 to this axis */
19
+ positive: string[];
20
+ /** Smoothing factor (0 = instant, higher = smoother). Default: 10 */
21
+ smoothing?: number;
22
+ }
23
+ /** Configuration for a button (e.g., jump, fire) */
24
+ export interface ButtonConfig {
25
+ /** Keys that trigger this button. Use "Mouse0", "Mouse1", "Mouse2" for mouse buttons */
26
+ keys: string[];
27
+ }
28
+ /** Full input configuration */
29
+ export interface InputConfig {
30
+ axes: Record<string, AxisConfig>;
31
+ buttons: Record<string, ButtonConfig>;
32
+ }
33
+ /** Transform data for positioning */
34
+ export interface TransformJson {
35
+ position: Vector2;
36
+ rotation: number;
37
+ scale: Vector2;
38
+ zIndex?: number;
39
+ }
40
+ /** Physics body types */
41
+ export type BodyType = 'dynamic' | 'static' | 'kinematic';
42
+ /** Collider shapes */
43
+ export type ColliderShape = {
44
+ type: 'box';
45
+ width: number;
46
+ height: number;
47
+ } | {
48
+ type: 'circle';
49
+ radius: number;
50
+ } | {
51
+ type: 'polygon';
52
+ vertices: Vector2[];
53
+ };
54
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,gCAAgC;AAChC,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEvC,6CAA6C;AAC7C,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C,uDAAuD;AACvD,MAAM,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAErD,uBAAuB;AACv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/**
5
+ * Abstract base class for all UI elements.
6
+ *
7
+ * Subclasses must:
8
+ * 1. Call super() with config
9
+ * 2. Create their PixiJS displayObject in constructor
10
+ * 3. Override measureContent() to return intrinsic size
11
+ * 4. Optionally override update() for per-frame logic
12
+ */
13
+ export declare abstract class UIElement {
14
+ /** Unique identifier for this element */
15
+ readonly id: string;
16
+ /** Human-readable name for debugging */
17
+ name: string;
18
+ /**
19
+ * Anchor point determines where the element attaches to its parent/screen.
20
+ *
21
+ * The anchor affects both:
22
+ * 1. Which point on the parent/screen we measure from
23
+ * 2. Which point on this element is placed at that location
24
+ *
25
+ * Example: anchor='bottom-right' means:
26
+ * - Reference the parent's bottom-right corner
27
+ * - Place this element's bottom-right corner there
28
+ * - Offset moves the element up and left (into the parent)
29
+ */
30
+ anchor: UIAnchor;
31
+ /**
32
+ * Pixel offset from the anchor point.
33
+ * Positive values move right/down from the anchor.
34
+ */
35
+ offset: Vector2;
36
+ /**
37
+ * Requested size in pixels [width, height].
38
+ * 0 = auto-size to content (uses measureContent())
39
+ */
40
+ size: Vector2;
41
+ /**
42
+ * Computed position after layout pass (screen coordinates).
43
+ * Set by parent or UIManager during layout().
44
+ */
45
+ protected computedPosition: Vector2;
46
+ /**
47
+ * Computed size after layout pass.
48
+ * Either explicit size or measureContent() result.
49
+ */
50
+ protected computedSize: Vector2;
51
+ /** Whether this element is visible */
52
+ visible: boolean;
53
+ /** Opacity (0-1) */
54
+ alpha: number;
55
+ /** Render order within parent (higher = on top) */
56
+ zIndex: number;
57
+ /** Parent element (null for root elements) */
58
+ parent: UIElement | null;
59
+ /** Child elements */
60
+ protected children: UIElement[];
61
+ /**
62
+ * The PixiJS container for this element.
63
+ * Subclasses add their visual content (Graphics, Text, Sprite) to this.
64
+ */
65
+ protected displayObject: Container;
66
+ /**
67
+ * Whether layout needs to be recalculated.
68
+ * Set to true when properties change that affect layout.
69
+ */
70
+ protected layoutDirty: boolean;
71
+ constructor(config?: UIElementConfig);
72
+ /**
73
+ * Called when the element is first added to the UI hierarchy.
74
+ * Override to perform one-time initialization.
75
+ */
76
+ awake(): void;
77
+ /**
78
+ * Called every frame.
79
+ * Override for per-frame logic (animations, state updates).
80
+ */
81
+ update(): void;
82
+ /**
83
+ * Called when the element is removed from the UI hierarchy.
84
+ * Override to clean up resources.
85
+ */
86
+ onDestroy(): void;
87
+ /**
88
+ * Add a child element.
89
+ */
90
+ addChild(child: UIElement): void;
91
+ /**
92
+ * Remove a child element.
93
+ */
94
+ removeChild(child: UIElement): void;
95
+ /**
96
+ * Remove all children.
97
+ */
98
+ removeAllChildren(): void;
99
+ /**
100
+ * Get all children.
101
+ */
102
+ getChildren(): readonly UIElement[];
103
+ /**
104
+ * Get the PixiJS display object.
105
+ * Used by UIManager to add to render tree.
106
+ */
107
+ getDisplayObject(): Container;
108
+ /**
109
+ * Mark this element and its ancestors as needing layout recalculation.
110
+ */
111
+ markLayoutDirty(): void;
112
+ /**
113
+ * Measure the intrinsic content size.
114
+ * Override in subclasses to return the natural size of the content.
115
+ *
116
+ * Examples:
117
+ * - UIText: Returns the text bounds
118
+ * - UIImage: Returns the image dimensions
119
+ * - UIPanel: Returns size needed to contain children + padding
120
+ *
121
+ * @returns [width, height] in pixels
122
+ */
123
+ protected measureContent(): Vector2;
124
+ /**
125
+ * Compute layout for this element and its children.
126
+ * Called by UIManager each frame on root elements.
127
+ *
128
+ * @param viewport - The available space (screen or parent bounds)
129
+ */
130
+ layout(viewport: {
131
+ width: number;
132
+ height: number;
133
+ }): void;
134
+ /**
135
+ * Layout child elements.
136
+ * Override in VBox/HBox to implement custom layout logic.
137
+ */
138
+ protected layoutChildren(viewport: {
139
+ width: number;
140
+ height: number;
141
+ }): void;
142
+ /**
143
+ * Compute position based on anchor point and offset.
144
+ *
145
+ * The anchor system works like this:
146
+ * ┌─────────────────────────────────────────┐
147
+ * │ (0,0) (w/2,0) (w,0) │
148
+ * │ top-left top-center top-right │
149
+ * │ │
150
+ * │ (0,h/2) (w/2,h/2) (w,h/2) │
151
+ * │ center-left center center-right │
152
+ * │ │
153
+ * │ (0,h) (w/2,h) (w,h) │
154
+ * │ bottom-left bottom-center bottom-right │
155
+ * └─────────────────────────────────────────┘
156
+ */
157
+ protected computeAnchoredPosition(viewport: {
158
+ width: number;
159
+ height: number;
160
+ }): Vector2;
161
+ /**
162
+ * Get the world/screen position of this element.
163
+ *
164
+ * For nested elements, computedPosition is in LOCAL coordinates (relative to parent).
165
+ * This method walks up the parent chain to compute the absolute screen position.
166
+ *
167
+ * Example:
168
+ * - Panel at screen position (600, 400)
169
+ * - Button at local position (10, 10)
170
+ * - Button's world position = (610, 410)
171
+ */
172
+ getWorldPosition(): Vector2;
173
+ /**
174
+ * Check if a screen point is inside this element's bounds.
175
+ * Uses world position for accurate hit testing of nested elements.
176
+ */
177
+ containsPoint(point: Vector2): boolean;
178
+ /**
179
+ * Find the topmost element at a screen point.
180
+ * Searches children first (in reverse z-order) then self.
181
+ */
182
+ hitTest(point: Vector2): UIElement | null;
183
+ /** Get computed position after layout */
184
+ getComputedPosition(): Vector2;
185
+ /**
186
+ * Offset the computed position after layout.
187
+ * Used by layout containers (UIPanel) to adjust child positions for padding.
188
+ * This keeps computedPosition in sync with displayObject.position.
189
+ */
190
+ offsetComputedPosition(dx: number, dy: number): void;
191
+ /**
192
+ * Set the computed position directly.
193
+ * Used by layout containers (UIVBox, UIHBox) that completely override child positioning.
194
+ * Also updates the displayObject position.
195
+ */
196
+ setComputedPosition(x: number, y: number): void;
197
+ /** Get computed size after layout */
198
+ getComputedSize(): Vector2;
199
+ /** Get computed bounds as {x, y, width, height} */
200
+ getComputedBounds(): {
201
+ x: number;
202
+ y: number;
203
+ width: number;
204
+ height: number;
205
+ };
206
+ /**
207
+ * Destroy this element and all children.
208
+ */
209
+ destroy(): void;
210
+ }
211
+ //# sourceMappingURL=UIElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UIElement.d.ts","sourceRoot":"","sources":["../../src/ui/UIElement.ts"],"names":[],"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;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAW5E;;OAEG;IACH,OAAO,IAAI,IAAI;CAkBhB"}
@@ -0,0 +1,102 @@
1
+ import { Renderer } from '../render/Renderer';
2
+ import { UIPointerEvent } from './types';
3
+ import { UIElement } from './UIElement';
4
+ /**
5
+ * Interface for elements that can receive pointer events.
6
+ * Implemented by UIButton and other interactive elements.
7
+ */
8
+ export interface UIInteractive {
9
+ /** Called when pointer enters element bounds */
10
+ onPointerEnter?(event: UIPointerEvent): void;
11
+ /** Called when pointer exits element bounds */
12
+ onPointerExit?(event: UIPointerEvent): void;
13
+ /** Called when pointer button is pressed on element */
14
+ onPointerDown?(event: UIPointerEvent): void;
15
+ /** Called when pointer button is released on element */
16
+ onPointerUp?(event: UIPointerEvent): void;
17
+ }
18
+ export declare class UIManager {
19
+ /** Root UI elements (not parented to other UI elements) */
20
+ private roots;
21
+ /** Reference to the renderer for viewport size */
22
+ private renderer;
23
+ /** Currently hovered element */
24
+ private hoveredElement;
25
+ /** Currently pressed element (mouse button held) */
26
+ private pressedElement;
27
+ /** Whether the UI system is active */
28
+ private active;
29
+ constructor(renderer: Renderer);
30
+ /**
31
+ * Add a root UI element.
32
+ * Root elements are positioned relative to the screen.
33
+ */
34
+ addRoot(element: UIElement): void;
35
+ /**
36
+ * Remove a root UI element.
37
+ */
38
+ removeRoot(element: UIElement): void;
39
+ /**
40
+ * Get all root elements.
41
+ */
42
+ getRoots(): readonly UIElement[];
43
+ /**
44
+ * Process input events for the UI.
45
+ * Call this BEFORE game input processing.
46
+ *
47
+ * @returns true if UI consumed the input (game should ignore it)
48
+ */
49
+ processInput(): boolean;
50
+ /**
51
+ * Hit test all root elements.
52
+ * Returns the topmost element at the given point.
53
+ */
54
+ private hitTestAll;
55
+ /**
56
+ * Create a pointer event object.
57
+ */
58
+ private createPointerEvent;
59
+ /**
60
+ * Update all UI elements.
61
+ * Call once per frame.
62
+ */
63
+ update(): void;
64
+ /**
65
+ * Recursively update an element and its children.
66
+ */
67
+ private updateElement;
68
+ /**
69
+ * Run layout pass on all root elements.
70
+ * Call once per frame after update.
71
+ */
72
+ layout(): void;
73
+ /**
74
+ * Enable or disable the UI system.
75
+ */
76
+ setActive(active: boolean): void;
77
+ /**
78
+ * Check if the UI system is active.
79
+ */
80
+ isActive(): boolean;
81
+ /**
82
+ * Destroy the UI manager and all root elements.
83
+ */
84
+ destroy(): void;
85
+ /**
86
+ * Find a UI element by ID.
87
+ */
88
+ findById(id: string): UIElement | null;
89
+ /**
90
+ * Recursively search for an element by ID.
91
+ */
92
+ private findByIdInTree;
93
+ /**
94
+ * Find a UI element by name.
95
+ */
96
+ findByName(name: string): UIElement | null;
97
+ /**
98
+ * Recursively search for an element by name.
99
+ */
100
+ private findByNameInTree;
101
+ }
102
+ //# sourceMappingURL=UIManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UIManager.d.ts","sourceRoot":"","sources":["../../src/ui/UIManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,gDAAgD;IAChD,cAAc,CAAC,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IAC7C,+CAA+C;IAC/C,aAAa,CAAC,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5C,uDAAuD;IACvD,aAAa,CAAC,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5C,wDAAwD;IACxD,WAAW,CAAC,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CAC3C;AAcD,qBAAa,SAAS;IACpB,2DAA2D;IAC3D,OAAO,CAAC,KAAK,CAAmB;IAEhC,kDAAkD;IAClD,OAAO,CAAC,QAAQ,CAAW;IAE3B,gCAAgC;IAChC,OAAO,CAAC,cAAc,CAA0B;IAEhD,oDAAoD;IACpD,OAAO,CAAC,cAAc,CAA0B;IAEhD,sCAAsC;IACtC,OAAO,CAAC,MAAM,CAAiB;gBAEnB,QAAQ,EAAE,QAAQ;IAM9B;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;IAejC;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;IAapC;;OAEG;IACH,QAAQ,IAAI,SAAS,SAAS,EAAE;IAMhC;;;;;OAKG;IACH,YAAY,IAAI,OAAO;IAsDvB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAUlB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;;OAGG;IACH,MAAM,IAAI,IAAI;IAQd;;OAEG;IACH,OAAO,CAAC,aAAa;IAOrB;;;OAGG;IACH,MAAM,IAAI,IAAI;IAYd;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAIhC;;OAEG;IACH,QAAQ,IAAI,OAAO;IAInB;;OAEG;IACH,OAAO,IAAI,IAAI;IAYf;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAQtC;;OAEG;IACH,OAAO,CAAC,cAAc;IAStB;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAQ1C;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAQzB"}
@@ -0,0 +1,11 @@
1
+ export * from './types';
2
+ export { UIElement } from './UIElement';
3
+ export { UIManager } from './UIManager';
4
+ export type { UIInteractive } from './UIManager';
5
+ export { UIText } from './primitives/UIText';
6
+ export { UIImage } from './primitives/UIImage';
7
+ export { UIPanel } from './primitives/UIPanel';
8
+ export { UIButton } from './primitives/UIButton';
9
+ export { UIVBox } from './layout/UIVBox';
10
+ export { UIHBox } from './layout/UIHBox';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { UIElement } from '../UIElement';
2
+ import { Vector2 } from '../../types';
3
+ import { UIPadding, UILayoutAlign, UILayoutContainerConfig } from '../types';
4
+ export declare class UIHBox extends UIElement {
5
+ /** Space between children in pixels */
6
+ private _gap;
7
+ /** Inner padding [top, right, bottom, left] */
8
+ private _padding;
9
+ /** Cross-axis (vertical) alignment of children */
10
+ private _align;
11
+ constructor(config?: UILayoutContainerConfig);
12
+ /** Get gap between children */
13
+ get gap(): number;
14
+ /** Set gap between children */
15
+ set gap(value: number);
16
+ /** Get padding */
17
+ get padding(): UIPadding;
18
+ /** Set padding [top, right, bottom, left] */
19
+ set padding(value: UIPadding);
20
+ /** Get alignment */
21
+ get align(): UILayoutAlign;
22
+ /** Set alignment */
23
+ set align(value: UILayoutAlign);
24
+ /**
25
+ * Measure content size (sum of child widths + gaps + padding).
26
+ *
27
+ * ┌───────────────────────────────────────────────────────────┐
28
+ * │ pl │ Child1 │ gap │ Child2 │ gap │ Child3 │ pr │
29
+ * └───────────────────────────────────────────────────────────┘
30
+ * └─────────────────────────────────────┘
31
+ * content area
32
+ */
33
+ protected measureContent(): Vector2;
34
+ /**
35
+ * Layout children horizontally with gaps.
36
+ */
37
+ protected layoutChildren(viewport: {
38
+ width: number;
39
+ height: number;
40
+ }): void;
41
+ }
42
+ //# sourceMappingURL=UIHBox.d.ts.map