@arcane-engine/runtime 0.1.0 → 0.2.1

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 (47) hide show
  1. package/package.json +4 -2
  2. package/src/agent/protocol.ts +35 -1
  3. package/src/agent/types.ts +98 -13
  4. package/src/particles/emitter.test.ts +323 -0
  5. package/src/particles/emitter.ts +409 -0
  6. package/src/particles/index.ts +25 -0
  7. package/src/particles/types.ts +236 -0
  8. package/src/pathfinding/astar.ts +27 -0
  9. package/src/pathfinding/types.ts +39 -0
  10. package/src/physics/aabb.ts +55 -8
  11. package/src/rendering/animation.ts +73 -0
  12. package/src/rendering/audio.ts +29 -9
  13. package/src/rendering/camera.ts +28 -4
  14. package/src/rendering/input.ts +45 -9
  15. package/src/rendering/lighting.ts +29 -3
  16. package/src/rendering/loop.ts +16 -3
  17. package/src/rendering/sprites.ts +24 -1
  18. package/src/rendering/text.ts +52 -6
  19. package/src/rendering/texture.ts +22 -4
  20. package/src/rendering/tilemap.ts +36 -4
  21. package/src/rendering/types.ts +37 -19
  22. package/src/rendering/validate.ts +48 -3
  23. package/src/state/error.ts +21 -2
  24. package/src/state/observe.ts +40 -9
  25. package/src/state/prng.ts +88 -10
  26. package/src/state/query.ts +115 -15
  27. package/src/state/store.ts +42 -11
  28. package/src/state/transaction.ts +116 -12
  29. package/src/state/types.ts +31 -5
  30. package/src/systems/system.ts +77 -5
  31. package/src/systems/types.ts +52 -6
  32. package/src/testing/harness.ts +103 -5
  33. package/src/testing/mock-renderer.test.ts +16 -20
  34. package/src/tweening/chain.test.ts +191 -0
  35. package/src/tweening/chain.ts +103 -0
  36. package/src/tweening/easing.test.ts +134 -0
  37. package/src/tweening/easing.ts +288 -0
  38. package/src/tweening/helpers.test.ts +185 -0
  39. package/src/tweening/helpers.ts +166 -0
  40. package/src/tweening/index.ts +76 -0
  41. package/src/tweening/tween.test.ts +322 -0
  42. package/src/tweening/tween.ts +296 -0
  43. package/src/tweening/types.ts +134 -0
  44. package/src/ui/colors.ts +129 -0
  45. package/src/ui/index.ts +1 -0
  46. package/src/ui/primitives.ts +44 -5
  47. package/src/ui/types.ts +41 -2
package/src/ui/types.ts CHANGED
@@ -1,13 +1,26 @@
1
- /** RGBA color with 0-1 float components (matching sprite tint). */
1
+ /**
2
+ * RGBA color with 0.0-1.0 float components (matching sprite tint format).
3
+ * Use {@link rgb} to create from 0-255 integer values.
4
+ */
2
5
  export type Color = {
6
+ /** Red channel, 0.0 (none) to 1.0 (full). */
3
7
  r: number;
8
+ /** Green channel, 0.0 (none) to 1.0 (full). */
4
9
  g: number;
10
+ /** Blue channel, 0.0 (none) to 1.0 (full). */
5
11
  b: number;
12
+ /** Alpha channel, 0.0 (transparent) to 1.0 (opaque). */
6
13
  a: number;
7
14
  };
8
15
 
9
16
  /**
10
- * Create a Color from 0-255 RGB(A) values, auto-normalized to 0.0-1.0 range.
17
+ * Create a Color from 0-255 RGB(A) integer values, auto-normalized to 0.0-1.0 range.
18
+ *
19
+ * @param r - Red channel, 0-255.
20
+ * @param g - Green channel, 0-255.
21
+ * @param b - Blue channel, 0-255.
22
+ * @param a - Alpha channel, 0-255. Default: 255 (fully opaque).
23
+ * @returns Color with 0.0-1.0 float components.
11
24
  *
12
25
  * @example
13
26
  * rgb(255, 128, 0) // Orange, fully opaque
@@ -22,36 +35,62 @@ export function rgb(r: number, g: number, b: number, a: number = 255): Color {
22
35
  };
23
36
  }
24
37
 
38
+ /** Options for {@link drawRect}. */
25
39
  export type RectOptions = {
40
+ /** Fill color. Default: white `{ r: 1, g: 1, b: 1, a: 1 }`. */
26
41
  color?: Color;
42
+ /** Draw order layer. Default: 90 (below text, above game sprites). */
27
43
  layer?: number;
44
+ /** If true, x/y are screen pixels (HUD). If false, world units. Default: false. */
28
45
  screenSpace?: boolean;
29
46
  };
30
47
 
48
+ /** Options for {@link drawPanel}. */
31
49
  export type PanelOptions = {
50
+ /** Interior fill color. Default: dark semi-transparent `{ r: 0.1, g: 0.1, b: 0.15, a: 0.9 }`. */
32
51
  fillColor?: Color;
52
+ /** Border color. Default: gray `{ r: 0.5, g: 0.5, b: 0.5, a: 1 }`. */
33
53
  borderColor?: Color;
54
+ /** Border width in pixels. Default: 2. */
34
55
  borderWidth?: number;
56
+ /** Draw order layer. Default: 90. */
35
57
  layer?: number;
58
+ /** If true, x/y are screen pixels (HUD). If false, world units. Default: false. */
36
59
  screenSpace?: boolean;
37
60
  };
38
61
 
62
+ /** Options for {@link drawBar}. */
39
63
  export type BarOptions = {
64
+ /** Fill/foreground color (the filled portion). Default: green. */
40
65
  fillColor?: Color;
66
+ /** Background color (the empty portion). Default: dark red. */
41
67
  bgColor?: Color;
68
+ /** Optional border color. No border if omitted. */
42
69
  borderColor?: Color;
70
+ /** Border width in pixels. Default: 0 (no border). */
43
71
  borderWidth?: number;
72
+ /** Draw order layer. Default: 90. */
44
73
  layer?: number;
74
+ /** If true, x/y are screen pixels (HUD). If false, world units. Default: false. */
45
75
  screenSpace?: boolean;
46
76
  };
47
77
 
78
+ /** Options for {@link drawLabel}. */
48
79
  export type LabelOptions = {
80
+ /** Text color. Default: white. */
49
81
  textColor?: Color;
82
+ /** Background panel color. Default: dark semi-transparent. */
50
83
  bgColor?: Color;
84
+ /** Border color of the background panel. Default: gray. */
51
85
  borderColor?: Color;
86
+ /** Border width of the background panel in pixels. Default: 1. */
52
87
  borderWidth?: number;
88
+ /** Padding between text and panel edge in pixels. Default: 4. */
53
89
  padding?: number;
90
+ /** Text scale multiplier. Default: 1. */
54
91
  scale?: number;
92
+ /** Draw order layer. Default: 90. */
55
93
  layer?: number;
94
+ /** If true, x/y are screen pixels (HUD). If false, world units. Default: false. */
56
95
  screenSpace?: boolean;
57
96
  };