@guinetik/gcanvas 1.0.0 → 1.0.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 (68) hide show
  1. package/demos/fluid-simple.html +22 -0
  2. package/demos/fluid.html +37 -0
  3. package/demos/index.html +2 -0
  4. package/demos/js/blob.js +18 -5
  5. package/demos/js/fluid-simple.js +253 -0
  6. package/demos/js/fluid.js +527 -0
  7. package/demos/js/tde/accretiondisk.js +64 -11
  8. package/demos/js/tde/blackholescene.js +2 -2
  9. package/demos/js/tde/config.js +2 -2
  10. package/demos/js/tde/index.js +152 -27
  11. package/demos/js/tde/lensedstarfield.js +32 -25
  12. package/demos/js/tde/tdestar.js +78 -98
  13. package/demos/js/tde/tidalstream.js +23 -7
  14. package/docs/README.md +230 -222
  15. package/docs/api/FluidSystem.md +173 -0
  16. package/docs/concepts/architecture-overview.md +204 -204
  17. package/docs/concepts/rendering-pipeline.md +279 -279
  18. package/docs/concepts/two-layer-architecture.md +229 -229
  19. package/docs/fluid-dynamics.md +97 -0
  20. package/docs/getting-started/first-game.md +354 -354
  21. package/docs/getting-started/installation.md +175 -157
  22. package/docs/modules/collision/README.md +2 -2
  23. package/docs/modules/fluent/README.md +6 -6
  24. package/docs/modules/game/README.md +303 -303
  25. package/docs/modules/isometric-camera.md +2 -2
  26. package/docs/modules/isometric.md +1 -1
  27. package/docs/modules/painter/README.md +328 -328
  28. package/docs/modules/particle/README.md +3 -3
  29. package/docs/modules/shapes/README.md +221 -221
  30. package/docs/modules/shapes/base/euclidian.md +123 -123
  31. package/docs/modules/shapes/base/shape.md +262 -262
  32. package/docs/modules/shapes/base/transformable.md +243 -243
  33. package/docs/modules/state/README.md +2 -2
  34. package/docs/modules/util/README.md +1 -1
  35. package/docs/modules/util/camera3d.md +3 -3
  36. package/docs/modules/util/scene3d.md +1 -1
  37. package/package.json +3 -1
  38. package/readme.md +19 -5
  39. package/src/collision/collision.js +75 -0
  40. package/src/game/index.js +2 -1
  41. package/src/game/pipeline.js +3 -3
  42. package/src/game/systems/FluidSystem.js +835 -0
  43. package/src/game/systems/index.js +11 -0
  44. package/src/game/ui/button.js +39 -18
  45. package/src/game/ui/cursor.js +14 -0
  46. package/src/game/ui/fps.js +12 -4
  47. package/src/game/ui/index.js +2 -0
  48. package/src/game/ui/stepper.js +549 -0
  49. package/src/game/ui/theme.js +121 -0
  50. package/src/game/ui/togglebutton.js +9 -3
  51. package/src/game/ui/tooltip.js +11 -4
  52. package/src/math/fluid.js +507 -0
  53. package/src/math/index.js +2 -0
  54. package/src/mixins/anchor.js +17 -7
  55. package/src/motion/tweenetik.js +16 -0
  56. package/src/shapes/index.js +1 -0
  57. package/src/util/camera3d.js +218 -12
  58. package/types/fluent.d.ts +361 -0
  59. package/types/game.d.ts +303 -0
  60. package/types/index.d.ts +144 -5
  61. package/types/math.d.ts +361 -0
  62. package/types/motion.d.ts +271 -0
  63. package/types/particle.d.ts +373 -0
  64. package/types/shapes.d.ts +107 -9
  65. package/types/util.d.ts +353 -0
  66. package/types/webgl.d.ts +109 -0
  67. package/disk_example.png +0 -0
  68. package/tde.png +0 -0
@@ -1,123 +1,123 @@
1
- # Euclidian
2
-
3
- > The root class defining spatial properties for all visual objects.
4
-
5
- **Module:** [shapes](../README.md) | **Extends:** `Loggable` | **Source:** `src/shapes/euclidian.js`
6
-
7
- ## Overview
8
-
9
- Euclidian is the foundation of all drawable objects in GCanvas. It defines the fundamental spatial contract: a 2D position and size. Before something becomes a shape, a renderable, or a transformable object, it first **exists in space**.
10
-
11
- This class is abstract and intended to be subclassed.
12
-
13
- ## Constructor
14
-
15
- ```js
16
- new Euclidian(options)
17
- ```
18
-
19
- ### Parameters
20
-
21
- | Parameter | Type | Default | Description |
22
- |-----------|------|---------|-------------|
23
- | `options` | `Object` | `{}` | Configuration options |
24
-
25
- ### Options
26
-
27
- | Option | Type | Default | Description |
28
- |--------|------|---------|-------------|
29
- | `x` | `number` | `0` | X position (center-based) |
30
- | `y` | `number` | `0` | Y position (center-based) |
31
- | `width` | `number` | `0` | Width in pixels |
32
- | `height` | `number` | `0` | Height in pixels |
33
- | `debug` | `boolean` | `false` | Enable debug visualization |
34
- | `debugColor` | `string` | `"#0f0"` | Debug outline color |
35
-
36
- ## Properties
37
-
38
- | Property | Type | Description |
39
- |----------|------|-------------|
40
- | `x` | `number` | X center position in canvas space |
41
- | `y` | `number` | Y center position in canvas space |
42
- | `width` | `number` | Width of the object (always ≥ 0) |
43
- | `height` | `number` | Height of the object (always ≥ 0) |
44
- | `debug` | `boolean` | Whether debug overlay is enabled |
45
- | `debugColor` | `string` | Color of the debug box outline |
46
-
47
- ## Coordinate System
48
-
49
- GCanvas uses a **center-based** coordinate system:
50
-
51
- ```
52
- ┌────────────────────────────────┐
53
- │ │
54
- │ (x, y) │
55
- │ ●───────────────┐ │
56
- │ │ │ │
57
- │ │ width │ │
58
- │ │ │ │
59
- │ └───────────────┘ │
60
- │ height │
61
- │ │
62
- └────────────────────────────────┘
63
- ```
64
-
65
- The `(x, y)` point is the **center** of the object, not the top-left corner.
66
-
67
- ## Example
68
-
69
- ```js
70
- import { Euclidian } from 'gcanvas';
71
-
72
- // Euclidian is abstract, but shows the basic spatial contract
73
- const spatial = {
74
- x: 100, // Center at x=100
75
- y: 100, // Center at y=100
76
- width: 50, // 50 pixels wide
77
- height: 30 // 30 pixels tall
78
- };
79
-
80
- // Top-left corner would be at (75, 85)
81
- // x - width/2 = 100 - 25 = 75
82
- // y - height/2 = 100 - 15 = 85
83
- ```
84
-
85
- ## Property Validation
86
-
87
- All properties are validated on set:
88
-
89
- ```js
90
- shape.x = 100; // Valid
91
- shape.x = null; // Throws Error: "Invalid property value: x null"
92
- shape.x = undefined; // Throws Error: "Invalid property value: x undefined"
93
- ```
94
-
95
- Width and height are clamped to be non-negative:
96
-
97
- ```js
98
- shape.width = -10; // Sets width to 0
99
- shape.height = -5; // Sets height to 0
100
- ```
101
-
102
- ## Inheritance
103
-
104
- ```
105
- Loggable
106
- └── Euclidian <── You are here
107
- └── Geometry2d
108
- └── Traceable
109
- └── Renderable
110
- └── Transformable
111
- └── Shape
112
- ```
113
-
114
- ## Related
115
-
116
- - [Geometry2d](./geometry2d.md) - Adds bounding boxes and constraints
117
- - [Shape Hierarchy](../hierarchy.md) - Full inheritance diagram
118
- - [Rendering Pipeline](../../../concepts/rendering-pipeline.md) - How shapes render
119
-
120
- ## See Also
121
-
122
- - [Shapes Module](../README.md)
123
- - [Renderable](./renderable.md)
1
+ # Euclidian
2
+
3
+ > The root class defining spatial properties for all visual objects.
4
+
5
+ **Module:** [shapes](../README.md) | **Extends:** `Loggable` | **Source:** `src/shapes/euclidian.js`
6
+
7
+ ## Overview
8
+
9
+ Euclidian is the foundation of all drawable objects in GCanvas. It defines the fundamental spatial contract: a 2D position and size. Before something becomes a shape, a renderable, or a transformable object, it first **exists in space**.
10
+
11
+ This class is abstract and intended to be subclassed.
12
+
13
+ ## Constructor
14
+
15
+ ```js
16
+ new Euclidian(options)
17
+ ```
18
+
19
+ ### Parameters
20
+
21
+ | Parameter | Type | Default | Description |
22
+ |-----------|------|---------|-------------|
23
+ | `options` | `Object` | `{}` | Configuration options |
24
+
25
+ ### Options
26
+
27
+ | Option | Type | Default | Description |
28
+ |--------|------|---------|-------------|
29
+ | `x` | `number` | `0` | X position (center-based) |
30
+ | `y` | `number` | `0` | Y position (center-based) |
31
+ | `width` | `number` | `0` | Width in pixels |
32
+ | `height` | `number` | `0` | Height in pixels |
33
+ | `debug` | `boolean` | `false` | Enable debug visualization |
34
+ | `debugColor` | `string` | `"#0f0"` | Debug outline color |
35
+
36
+ ## Properties
37
+
38
+ | Property | Type | Description |
39
+ |----------|------|-------------|
40
+ | `x` | `number` | X center position in canvas space |
41
+ | `y` | `number` | Y center position in canvas space |
42
+ | `width` | `number` | Width of the object (always ≥ 0) |
43
+ | `height` | `number` | Height of the object (always ≥ 0) |
44
+ | `debug` | `boolean` | Whether debug overlay is enabled |
45
+ | `debugColor` | `string` | Color of the debug box outline |
46
+
47
+ ## Coordinate System
48
+
49
+ GCanvas uses a **center-based** coordinate system:
50
+
51
+ ```
52
+ ┌────────────────────────────────┐
53
+ │ │
54
+ │ (x, y) │
55
+ │ ●───────────────┐ │
56
+ │ │ │ │
57
+ │ │ width │ │
58
+ │ │ │ │
59
+ │ └───────────────┘ │
60
+ │ height │
61
+ │ │
62
+ └────────────────────────────────┘
63
+ ```
64
+
65
+ The `(x, y)` point is the **center** of the object, not the top-left corner.
66
+
67
+ ## Example
68
+
69
+ ```js
70
+ import { Euclidian } from '@guinetik/gcanvas';
71
+
72
+ // Euclidian is abstract, but shows the basic spatial contract
73
+ const spatial = {
74
+ x: 100, // Center at x=100
75
+ y: 100, // Center at y=100
76
+ width: 50, // 50 pixels wide
77
+ height: 30 // 30 pixels tall
78
+ };
79
+
80
+ // Top-left corner would be at (75, 85)
81
+ // x - width/2 = 100 - 25 = 75
82
+ // y - height/2 = 100 - 15 = 85
83
+ ```
84
+
85
+ ## Property Validation
86
+
87
+ All properties are validated on set:
88
+
89
+ ```js
90
+ shape.x = 100; // Valid
91
+ shape.x = null; // Throws Error: "Invalid property value: x null"
92
+ shape.x = undefined; // Throws Error: "Invalid property value: x undefined"
93
+ ```
94
+
95
+ Width and height are clamped to be non-negative:
96
+
97
+ ```js
98
+ shape.width = -10; // Sets width to 0
99
+ shape.height = -5; // Sets height to 0
100
+ ```
101
+
102
+ ## Inheritance
103
+
104
+ ```
105
+ Loggable
106
+ └── Euclidian <── You are here
107
+ └── Geometry2d
108
+ └── Traceable
109
+ └── Renderable
110
+ └── Transformable
111
+ └── Shape
112
+ ```
113
+
114
+ ## Related
115
+
116
+ - [Geometry2d](./geometry2d.md) - Adds bounding boxes and constraints
117
+ - [Shape Hierarchy](../hierarchy.md) - Full inheritance diagram
118
+ - [Rendering Pipeline](../../../concepts/rendering-pipeline.md) - How shapes render
119
+
120
+ ## See Also
121
+
122
+ - [Shapes Module](../README.md)
123
+ - [Renderable](./renderable.md)