@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.
- package/demos/fluid-simple.html +22 -0
- package/demos/fluid.html +37 -0
- package/demos/index.html +2 -0
- package/demos/js/blob.js +18 -5
- package/demos/js/fluid-simple.js +253 -0
- package/demos/js/fluid.js +527 -0
- package/demos/js/tde/accretiondisk.js +64 -11
- package/demos/js/tde/blackholescene.js +2 -2
- package/demos/js/tde/config.js +2 -2
- package/demos/js/tde/index.js +152 -27
- package/demos/js/tde/lensedstarfield.js +32 -25
- package/demos/js/tde/tdestar.js +78 -98
- package/demos/js/tde/tidalstream.js +23 -7
- package/docs/README.md +230 -222
- package/docs/api/FluidSystem.md +173 -0
- package/docs/concepts/architecture-overview.md +204 -204
- package/docs/concepts/rendering-pipeline.md +279 -279
- package/docs/concepts/two-layer-architecture.md +229 -229
- package/docs/fluid-dynamics.md +97 -0
- package/docs/getting-started/first-game.md +354 -354
- package/docs/getting-started/installation.md +175 -157
- package/docs/modules/collision/README.md +2 -2
- package/docs/modules/fluent/README.md +6 -6
- package/docs/modules/game/README.md +303 -303
- package/docs/modules/isometric-camera.md +2 -2
- package/docs/modules/isometric.md +1 -1
- package/docs/modules/painter/README.md +328 -328
- package/docs/modules/particle/README.md +3 -3
- package/docs/modules/shapes/README.md +221 -221
- package/docs/modules/shapes/base/euclidian.md +123 -123
- package/docs/modules/shapes/base/shape.md +262 -262
- package/docs/modules/shapes/base/transformable.md +243 -243
- package/docs/modules/state/README.md +2 -2
- package/docs/modules/util/README.md +1 -1
- package/docs/modules/util/camera3d.md +3 -3
- package/docs/modules/util/scene3d.md +1 -1
- package/package.json +3 -1
- package/readme.md +19 -5
- package/src/collision/collision.js +75 -0
- package/src/game/index.js +2 -1
- package/src/game/pipeline.js +3 -3
- package/src/game/systems/FluidSystem.js +835 -0
- package/src/game/systems/index.js +11 -0
- package/src/game/ui/button.js +39 -18
- package/src/game/ui/cursor.js +14 -0
- package/src/game/ui/fps.js +12 -4
- package/src/game/ui/index.js +2 -0
- package/src/game/ui/stepper.js +549 -0
- package/src/game/ui/theme.js +121 -0
- package/src/game/ui/togglebutton.js +9 -3
- package/src/game/ui/tooltip.js +11 -4
- package/src/math/fluid.js +507 -0
- package/src/math/index.js +2 -0
- package/src/mixins/anchor.js +17 -7
- package/src/motion/tweenetik.js +16 -0
- package/src/shapes/index.js +1 -0
- package/src/util/camera3d.js +218 -12
- package/types/fluent.d.ts +361 -0
- package/types/game.d.ts +303 -0
- package/types/index.d.ts +144 -5
- package/types/math.d.ts +361 -0
- package/types/motion.d.ts +271 -0
- package/types/particle.d.ts +373 -0
- package/types/shapes.d.ts +107 -9
- package/types/util.d.ts +353 -0
- package/types/webgl.d.ts +109 -0
- package/disk_example.png +0 -0
- package/tde.png +0 -0
package/src/game/ui/button.js
CHANGED
|
@@ -4,10 +4,16 @@
|
|
|
4
4
|
* A basic UI Button GameObject that combines a Rectangle shape
|
|
5
5
|
* and a Text label using a Group. It supports hover and press
|
|
6
6
|
* states, and fires an optional onClick callback when clicked.
|
|
7
|
+
*
|
|
8
|
+
* Theme: Terminal × Vercel aesthetic
|
|
9
|
+
* - Dark transparent backgrounds
|
|
10
|
+
* - Neon green accents (#0f0)
|
|
11
|
+
* - Inverted colors on hover
|
|
7
12
|
***************************************************************/
|
|
8
13
|
|
|
9
14
|
import { Group, Rectangle, TextShape, Shape } from "../../shapes";
|
|
10
15
|
import { GameObject } from "../objects/go";
|
|
16
|
+
import { UI_THEME } from "./theme.js";
|
|
11
17
|
|
|
12
18
|
/**
|
|
13
19
|
* Button - A clickable UI element as a GameObject.
|
|
@@ -56,15 +62,15 @@ export class Button extends GameObject {
|
|
|
56
62
|
* @param {Function} [options.onRelease=null] - Callback to invoke upon button release.
|
|
57
63
|
* @param {string} [options.anchor] - Optional anchor for positioning (e.g. "top-left").
|
|
58
64
|
* @param {number} [options.padding] - Extra padding if using anchor.
|
|
59
|
-
* @param {string} [options.colorDefaultBg="
|
|
60
|
-
* @param {string} [options.colorDefaultStroke="
|
|
61
|
-
* @param {string} [options.colorDefaultText="#
|
|
62
|
-
* @param {string} [options.colorHoverBg="#
|
|
63
|
-
* @param {string} [options.colorHoverStroke="#
|
|
64
|
-
* @param {string} [options.colorHoverText="#
|
|
65
|
-
* @param {string} [options.colorPressedBg="#
|
|
66
|
-
* @param {string} [options.colorPressedStroke="#
|
|
67
|
-
* @param {string} [options.colorPressedText="#
|
|
65
|
+
* @param {string} [options.colorDefaultBg="rgba(0,0,0,0.85)"] - Background color in default state.
|
|
66
|
+
* @param {string} [options.colorDefaultStroke="rgba(0,255,0,0.4)"] - Stroke color in default state.
|
|
67
|
+
* @param {string} [options.colorDefaultText="#0f0"] - Text color in default state.
|
|
68
|
+
* @param {string} [options.colorHoverBg="#0f0"] - Background color in hover state (inverted).
|
|
69
|
+
* @param {string} [options.colorHoverStroke="#0f0"] - Stroke color in hover state.
|
|
70
|
+
* @param {string} [options.colorHoverText="#000"] - Text color in hover state (inverted).
|
|
71
|
+
* @param {string} [options.colorPressedBg="#0c0"] - Background color in pressed state.
|
|
72
|
+
* @param {string} [options.colorPressedStroke="#0f0"] - Stroke color in pressed state.
|
|
73
|
+
* @param {string} [options.colorPressedText="#000"] - Text color in pressed state.
|
|
68
74
|
* @param {...any} rest - Additional properties passed to the superclass.
|
|
69
75
|
*/
|
|
70
76
|
constructor(game, options = {}) {
|
|
@@ -89,15 +95,16 @@ export class Button extends GameObject {
|
|
|
89
95
|
onPressed = null,
|
|
90
96
|
onRelease = null,
|
|
91
97
|
padding = 10,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
// Terminal × Vercel theme: dark bg, green accents, inverted hover
|
|
99
|
+
colorDefaultBg = UI_THEME.button.default.bg,
|
|
100
|
+
colorDefaultStroke = UI_THEME.button.default.stroke,
|
|
101
|
+
colorDefaultText = UI_THEME.button.default.text,
|
|
102
|
+
colorHoverBg = UI_THEME.button.hover.bg,
|
|
103
|
+
colorHoverStroke = UI_THEME.button.hover.stroke,
|
|
104
|
+
colorHoverText = UI_THEME.button.hover.text,
|
|
105
|
+
colorPressedBg = UI_THEME.button.pressed.bg,
|
|
106
|
+
colorPressedStroke = UI_THEME.button.pressed.stroke,
|
|
107
|
+
colorPressedText = UI_THEME.button.pressed.text,
|
|
101
108
|
} = options;
|
|
102
109
|
|
|
103
110
|
// Basic position and sizing
|
|
@@ -386,6 +393,20 @@ export class Button extends GameObject {
|
|
|
386
393
|
this._boundsDirty = true;
|
|
387
394
|
}
|
|
388
395
|
|
|
396
|
+
/**
|
|
397
|
+
* Get the bounding box of this Button for hit testing.
|
|
398
|
+
* Required for the event system to work properly.
|
|
399
|
+
* @returns {{x: number, y: number, width: number, height: number}} Bounds object
|
|
400
|
+
*/
|
|
401
|
+
getBounds() {
|
|
402
|
+
return {
|
|
403
|
+
x: this.x,
|
|
404
|
+
y: this.y,
|
|
405
|
+
width: this.width,
|
|
406
|
+
height: this.height,
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
|
|
389
410
|
/**
|
|
390
411
|
* Render the Button each frame by drawing the underlying Group.
|
|
391
412
|
*/
|
package/src/game/ui/cursor.js
CHANGED
|
@@ -6,6 +6,20 @@ import { GameObject } from "../objects/go.js";
|
|
|
6
6
|
* A GameObject that replaces the native mouse pointer with a custom shape.
|
|
7
7
|
* - Provide a normal shape (e.g. small Circle or custom icon).
|
|
8
8
|
* - Optionally provide a pressed shape to show while the mouse/touch is down.
|
|
9
|
+
*
|
|
10
|
+
* Theme: Terminal × Vercel aesthetic
|
|
11
|
+
* For best results, use shapes with terminal green (#0f0) outlines:
|
|
12
|
+
*
|
|
13
|
+
* ```js
|
|
14
|
+
* const normalCursor = new Circle(0, 0, 8, {
|
|
15
|
+
* stroke: "#0f0",
|
|
16
|
+
* lineWidth: 2
|
|
17
|
+
* });
|
|
18
|
+
* const pressedCursor = new Circle(0, 0, 6, {
|
|
19
|
+
* fill: "#0f0"
|
|
20
|
+
* });
|
|
21
|
+
* const cursor = new Cursor(game, normalCursor, pressedCursor);
|
|
22
|
+
* ```
|
|
9
23
|
*
|
|
10
24
|
* Usage:
|
|
11
25
|
* const cursor = new Cursor(game, normalShape, pressedShape);
|
package/src/game/ui/fps.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Text } from "../objects";
|
|
2
|
+
import { UI_THEME } from "./theme.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* FPSCounter - A simple text object displaying frames per second
|
|
6
|
+
*
|
|
7
|
+
* Theme: Terminal × Vercel aesthetic
|
|
8
|
+
* - Neon green monospace text
|
|
9
|
+
* - Subtle flicker effect on update
|
|
10
|
+
*
|
|
5
11
|
* @extends Text
|
|
6
12
|
*/
|
|
7
13
|
export class FPSCounter extends Text {
|
|
@@ -9,17 +15,19 @@ export class FPSCounter extends Text {
|
|
|
9
15
|
* Create an FPS counter
|
|
10
16
|
* @param {Game} game - The main game instance
|
|
11
17
|
* @param {Object} [options={}] - Configuration options
|
|
18
|
+
* @param {string} [options.color="#0f0"] - Text color (default: terminal green)
|
|
19
|
+
* @param {string} [options.font="11px monospace"] - Font style
|
|
12
20
|
*/
|
|
13
21
|
constructor(game, options = {}) {
|
|
14
|
-
//
|
|
22
|
+
// Terminal × Vercel theme: green monospace text
|
|
15
23
|
super(game, "0 FPS", {
|
|
16
24
|
x: 0,
|
|
17
25
|
y: 0,
|
|
18
|
-
font:
|
|
19
|
-
color:
|
|
26
|
+
font: UI_THEME.fonts.small,
|
|
27
|
+
color: UI_THEME.colors.neonGreen,
|
|
20
28
|
align: "center",
|
|
21
29
|
baseline: "middle",
|
|
22
|
-
debug:false,
|
|
30
|
+
debug: false,
|
|
23
31
|
...options, // This will override defaults with user provided values
|
|
24
32
|
});
|
|
25
33
|
|
package/src/game/ui/index.js
CHANGED