goudengine 0.0.832 → 0.0.834
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/README.md +26 -291
- package/dist/generated/index.g.d.ts +1 -1
- package/dist/generated/index.g.d.ts.map +1 -1
- package/dist/generated/index.g.js +3 -1
- package/dist/generated/index.g.js.map +1 -1
- package/dist/generated/node/index.g.d.ts +118 -8
- package/dist/generated/node/index.g.d.ts.map +1 -1
- package/dist/generated/node/index.g.js +241 -7
- package/dist/generated/node/index.g.js.map +1 -1
- package/dist/generated/types/engine.g.d.ts +182 -5
- package/dist/generated/types/engine.g.d.ts.map +1 -1
- package/dist/generated/types/input.g.d.ts +21 -0
- package/dist/generated/types/input.g.d.ts.map +1 -1
- package/dist/generated/types/input.g.js +26 -1
- package/dist/generated/types/input.g.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +3 -1
- package/dist/node/index.js.map +1 -1
- package/dist/shared/ecs.d.ts +12 -0
- package/dist/shared/ecs.d.ts.map +1 -0
- package/dist/shared/ecs.js +25 -0
- package/dist/shared/ecs.js.map +1 -0
- package/dist/web/generated/types/engine.g.d.ts +182 -5
- package/dist/web/generated/types/engine.g.d.ts.map +1 -1
- package/dist/web/generated/types/input.g.d.ts +21 -0
- package/dist/web/generated/types/input.g.d.ts.map +1 -1
- package/dist/web/generated/types/input.g.js +25 -0
- package/dist/web/generated/types/input.g.js.map +1 -1
- package/dist/web/generated/web/index.g.d.ts +76 -6
- package/dist/web/generated/web/index.g.d.ts.map +1 -1
- package/dist/web/generated/web/index.g.js +151 -6
- package/dist/web/generated/web/index.g.js.map +1 -1
- package/dist/web/shared/ecs.d.ts +12 -0
- package/dist/web/shared/ecs.d.ts.map +1 -0
- package/dist/web/shared/ecs.js +22 -0
- package/dist/web/shared/ecs.js.map +1 -0
- package/dist/web/web/index.d.ts +1 -0
- package/dist/web/web/index.d.ts.map +1 -1
- package/dist/web/web/index.js +1 -0
- package/dist/web/web/index.js.map +1 -1
- package/goud-engine-node.darwin-arm64.node +0 -0
- package/goud-engine-node.darwin-x64.node +0 -0
- package/goud-engine-node.linux-x64-gnu.node +0 -0
- package/goud-engine-node.win32-x64-msvc.node +0 -0
- package/index.d.ts +73 -2
- package/index.js +52 -52
- package/package.json +11 -2
- package/wasm/goud_engine.d.ts +125 -84
- package/wasm/goud_engine.js +92 -27
- package/wasm/goud_engine_bg.wasm +0 -0
- package/wasm/goud_engine_bg.wasm.d.ts +85 -82
package/README.md
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/goudengine)
|
|
4
4
|
|
|
5
|
-
> **Alpha**
|
|
5
|
+
> **Alpha** -- This SDK is under active development. APIs change frequently. [Report issues](https://github.com/aram-devdocs/GoudEngine/issues)
|
|
6
6
|
|
|
7
|
-
TypeScript bindings for GoudEngine with two targets: Node.js desktop (
|
|
8
|
-
and web browser (via wasm-bindgen). Published as `goudengine` on npm.
|
|
7
|
+
TypeScript bindings for GoudEngine with two targets: Node.js desktop (napi-rs) and web browser (wasm-bindgen).
|
|
9
8
|
|
|
10
9
|
## Installation
|
|
11
10
|
|
|
@@ -13,17 +12,17 @@ and web browser (via wasm-bindgen). Published as `goudengine` on npm.
|
|
|
13
12
|
npm install goudengine
|
|
14
13
|
```
|
|
15
14
|
|
|
16
|
-
##
|
|
15
|
+
## Quick Start
|
|
17
16
|
|
|
18
|
-
### Node.js
|
|
17
|
+
### Node.js
|
|
19
18
|
|
|
20
19
|
```typescript
|
|
21
|
-
import { GoudGame
|
|
20
|
+
import { GoudGame } from "goudengine";
|
|
22
21
|
|
|
23
22
|
const game = new GoudGame(800, 600, "My Game");
|
|
24
23
|
|
|
25
|
-
while (game.
|
|
26
|
-
|
|
24
|
+
while (!game.shouldClose()) {
|
|
25
|
+
game.beginFrame(0.2, 0.2, 0.2, 1.0);
|
|
27
26
|
// game logic here
|
|
28
27
|
game.endFrame();
|
|
29
28
|
}
|
|
@@ -31,306 +30,42 @@ while (game.isRunning()) {
|
|
|
31
30
|
game.destroy();
|
|
32
31
|
```
|
|
33
32
|
|
|
34
|
-
### Web
|
|
33
|
+
### Web
|
|
35
34
|
|
|
36
35
|
```typescript
|
|
37
|
-
import { GoudGame
|
|
36
|
+
import { GoudGame } from "goudengine/web";
|
|
38
37
|
|
|
39
38
|
const game = await GoudGame.create(800, 600, "My Game");
|
|
40
39
|
// same API as Node
|
|
41
40
|
```
|
|
42
41
|
|
|
43
|
-
##
|
|
44
|
-
|
|
45
|
-
Networking wrappers are available in both the Node and web builds.
|
|
46
|
-
|
|
47
|
-
- `goudengine/node`: host + client
|
|
48
|
-
- `goudengine/web`: WebSocket client only
|
|
49
|
-
|
|
50
|
-
Use `new NetworkManager(gameOrContext)` with `GoudGame` or `GoudContext`. `host()` and `connect()` return `NetworkEndpoint`. `connect()` stores the default peer ID, so clients can call `send(...)`. Host endpoints reply with `sendTo(...)`.
|
|
51
|
-
|
|
52
|
-
```typescript
|
|
53
|
-
import { GoudContext, NetworkManager, NetworkProtocol } from "goudengine/node";
|
|
54
|
-
|
|
55
|
-
const hostContext = new GoudContext();
|
|
56
|
-
const clientContext = new GoudContext();
|
|
57
|
-
|
|
58
|
-
const host = new NetworkManager(hostContext).host(NetworkProtocol.Tcp, 9000);
|
|
59
|
-
const client = new NetworkManager(clientContext).connect(
|
|
60
|
-
NetworkProtocol.Tcp,
|
|
61
|
-
"127.0.0.1",
|
|
62
|
-
9000,
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
client.send(Buffer.from("ping"));
|
|
66
|
-
|
|
67
|
-
while (true) {
|
|
68
|
-
host.poll();
|
|
69
|
-
client.poll();
|
|
70
|
-
|
|
71
|
-
const packet = host.receive();
|
|
72
|
-
if (!packet) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
host.sendTo(packet.peerId, Buffer.from("pong"));
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Browser note:
|
|
82
|
-
|
|
83
|
-
- On `goudengine/web`, use `NetworkProtocol.WebSocket`.
|
|
84
|
-
- Browser hosting is not supported.
|
|
85
|
-
- `connect()` returns before the socket is fully open, so poll until `peerCount() > 0` before sending.
|
|
86
|
-
|
|
87
|
-
Example:
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
import { GoudGame, NetworkManager, NetworkProtocol } from "goudengine/web";
|
|
91
|
-
|
|
92
|
-
const game = await GoudGame.create({ width: 800, height: 600, title: "Web Net" });
|
|
93
|
-
const endpoint = new NetworkManager(game).connect(
|
|
94
|
-
NetworkProtocol.WebSocket,
|
|
95
|
-
"ws://127.0.0.1:9001",
|
|
96
|
-
9001,
|
|
97
|
-
);
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Browser-specific limitations and workarounds are documented in the Web Platform Gotchas guide:
|
|
101
|
-
[`docs/src/guides/web-platform-gotchas.md`](../../docs/src/guides/web-platform-gotchas.md).
|
|
102
|
-
|
|
103
|
-
## Debugger Runtime
|
|
42
|
+
## Documentation
|
|
104
43
|
|
|
105
|
-
|
|
44
|
+
See the [Getting Started guide](../../docs/src/getting-started/typescript.md) for installation, Node vs Web differences, sprites, input, and examples.
|
|
106
45
|
|
|
107
|
-
|
|
108
|
-
import {
|
|
109
|
-
GoudContext,
|
|
110
|
-
parseDebuggerSnapshot,
|
|
111
|
-
} from "goudengine/node";
|
|
112
|
-
|
|
113
|
-
const ctx = new GoudContext({
|
|
114
|
-
debugger: {
|
|
115
|
-
enabled: true,
|
|
116
|
-
publishLocalAttach: true,
|
|
117
|
-
routeLabel: "ts-demo",
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
ctx.setDebuggerProfilingEnabled(true);
|
|
122
|
-
|
|
123
|
-
const snapshot = parseDebuggerSnapshot(ctx);
|
|
124
|
-
const manifestJson = ctx.getDebuggerManifestJson();
|
|
125
|
-
const memory = ctx.getMemorySummary();
|
|
126
|
-
|
|
127
|
-
ctx.setDebuggerSelectedEntity(42);
|
|
128
|
-
ctx.clearDebuggerSelectedEntity();
|
|
129
|
-
ctx.destroy();
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
The Node target also exposes pause, step, time-scale, debug-draw, input injection, capture, replay, and metrics methods on `GoudGame` and `GoudContext`. Capture, replay, and metrics stay Rust-owned and come back as raw artifact envelopes instead of TypeScript-specific debugger models.
|
|
133
|
-
|
|
134
|
-
`goudengine/web` does not expose the debugger runtime in this batch. The browser build throws an explicit unsupported error for these methods instead of silently no-oping.
|
|
135
|
-
|
|
136
|
-
See [`docs/src/guides/debugger-runtime.md`](../../docs/src/guides/debugger-runtime.md) for desktop-only scope, determinism limits, and the `goudengine-mcp` bridge workflow.
|
|
137
|
-
|
|
138
|
-
## Features
|
|
139
|
-
|
|
140
|
-
- 2D and 3D rendering with runtime renderer selection
|
|
141
|
-
- Entity Component System (ECS) with Transform2D, Sprite, and more
|
|
142
|
-
- Physics simulation (Rapier2D/3D): rigid bodies, colliders, raycasting, collision events
|
|
143
|
-
- Audio playback with per-channel volume (Music, SFX, Ambience, UI, Voice) and spatial audio
|
|
144
|
-
- Text rendering with TrueType/bitmap fonts, alignment, and word-wrapping
|
|
145
|
-
- Sprite animation with state machine controller, multi-layer blending, and tweening
|
|
146
|
-
- Scene management with transitions (instant, fade, custom)
|
|
147
|
-
- UI component system with hierarchical node tree
|
|
148
|
-
- Tiled map support for 2D worlds
|
|
149
|
-
- Input handling (keyboard, mouse)
|
|
150
|
-
- Dual targets: Node.js desktop (napi-rs) and web browser (wasm-bindgen)
|
|
151
|
-
- Structured error diagnostics with error codes and recovery hints
|
|
152
|
-
|
|
153
|
-
## Flappy Bird Example
|
|
154
|
-
|
|
155
|
-
A condensed Node.js version showing the core patterns — game loop, physics, sprite rendering,
|
|
156
|
-
and AABB collision. The web variant uses the same `game.ts` logic with a WASM-backed `GoudGame`.
|
|
157
|
-
See the [full source](https://github.com/aram-devdocs/GoudEngine/tree/main/examples/typescript/flappy_bird)
|
|
158
|
-
for the complete implementation including the web entry point.
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
import { GoudGame } from "goudengine";
|
|
162
|
-
|
|
163
|
-
const SCREEN_W = 288, SCREEN_H = 512;
|
|
164
|
-
const GRAVITY = 9.8, JUMP_STRENGTH = -3.5;
|
|
165
|
-
const PIPE_SPEED = 1.0, PIPE_SPAWN_INTERVAL = 1.5, PIPE_GAP = 100;
|
|
166
|
-
const TARGET_FPS = 120;
|
|
167
|
-
|
|
168
|
-
const game = new GoudGame({ width: SCREEN_W, height: SCREEN_H + 112, title: "Flappy Goud" });
|
|
169
|
-
|
|
170
|
-
// Load textures — engine returns numeric handles
|
|
171
|
-
const bgTex = await game.loadTexture("assets/sprites/background-day.png");
|
|
172
|
-
const pipeTex = await game.loadTexture("assets/sprites/pipe-green.png");
|
|
173
|
-
const baseTex = await game.loadTexture("assets/sprites/base.png");
|
|
174
|
-
const birdTex = [
|
|
175
|
-
await game.loadTexture("assets/sprites/bluebird-downflap.png"),
|
|
176
|
-
await game.loadTexture("assets/sprites/bluebird-midflap.png"),
|
|
177
|
-
await game.loadTexture("assets/sprites/bluebird-upflap.png"),
|
|
178
|
-
];
|
|
179
|
-
|
|
180
|
-
// Bird state
|
|
181
|
-
let birdY = SCREEN_H / 2, velocity = 0;
|
|
182
|
-
const birdX = SCREEN_W / 4;
|
|
183
|
-
|
|
184
|
-
// Pipe state
|
|
185
|
-
type Pipe = { x: number; gapY: number };
|
|
186
|
-
let pipes: Pipe[] = [];
|
|
187
|
-
let spawnTimer = 0;
|
|
188
|
-
|
|
189
|
-
function reset() {
|
|
190
|
-
birdY = SCREEN_H / 2; velocity = 0; pipes = []; spawnTimer = 0;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function aabb(x1: number, y1: number, w1: number, h1: number,
|
|
194
|
-
x2: number, y2: number, w2: number, h2: number): boolean {
|
|
195
|
-
return x1 < x2 + w2 && x1 + w1 > x2 && y1 < y2 + h2 && y1 + h1 > y2;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
while (!game.shouldClose()) {
|
|
199
|
-
game.beginFrame(0.4, 0.7, 0.9, 1.0);
|
|
200
|
-
const dt = game.deltaTime;
|
|
201
|
-
|
|
202
|
-
if (game.isKeyPressed(256)) { game.close(); break; } // Escape
|
|
203
|
-
if (game.isKeyPressed(82)) { reset(); } // R
|
|
204
|
-
|
|
205
|
-
// Bird physics
|
|
206
|
-
if (game.isKeyPressed(32) || game.isMouseButtonPressed(0))
|
|
207
|
-
velocity = JUMP_STRENGTH * TARGET_FPS;
|
|
208
|
-
velocity += GRAVITY * dt * TARGET_FPS;
|
|
209
|
-
birdY += velocity * dt;
|
|
210
|
-
|
|
211
|
-
if (birdY + 24 > SCREEN_H || birdY < 0) { reset(); game.endFrame(); continue; }
|
|
212
|
-
|
|
213
|
-
// Pipe movement and collision
|
|
214
|
-
for (const p of pipes) {
|
|
215
|
-
p.x -= PIPE_SPEED * dt * TARGET_FPS;
|
|
216
|
-
const topY = p.gapY - PIPE_GAP - 320;
|
|
217
|
-
if (aabb(birdX, birdY, 34, 24, p.x, topY, 52, 320) ||
|
|
218
|
-
aabb(birdX, birdY, 34, 24, p.x, p.gapY + PIPE_GAP, 52, 320)) {
|
|
219
|
-
reset(); game.endFrame(); continue;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
pipes = pipes.filter(p => p.x + 60 > 0);
|
|
223
|
-
|
|
224
|
-
spawnTimer += dt;
|
|
225
|
-
if (spawnTimer > PIPE_SPAWN_INTERVAL) {
|
|
226
|
-
spawnTimer = 0;
|
|
227
|
-
pipes.push({ x: SCREEN_W, gapY: PIPE_GAP + Math.random() * (SCREEN_H - 2 * PIPE_GAP) });
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// Render — draw order sets depth
|
|
231
|
-
game.drawSprite(bgTex, 144, 256, 288, 512);
|
|
232
|
-
for (const p of pipes) {
|
|
233
|
-
const topY = p.gapY - PIPE_GAP - 320;
|
|
234
|
-
game.drawSprite(pipeTex, p.x + 26, topY + 160, 52, 320, Math.PI);
|
|
235
|
-
game.drawSprite(pipeTex, p.x + 26, p.gapY + PIPE_GAP + 160, 52, 320, 0);
|
|
236
|
-
}
|
|
237
|
-
game.drawSprite(birdTex[Math.floor(game.totalTime / 0.1) % 3], birdX + 17, birdY + 12, 34, 24);
|
|
238
|
-
game.drawSprite(baseTex, 168, SCREEN_H + 56, 336, 112);
|
|
239
|
-
|
|
240
|
-
game.endFrame();
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
game.destroy();
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
**Controls:** `Space` or left-click to flap, `R` to restart, `Escape` to quit.
|
|
247
|
-
The web variant works the same way — import from `goudengine/web` and call `await GoudGame.create(...)`.
|
|
248
|
-
|
|
249
|
-
## Web Platform Notes
|
|
250
|
-
|
|
251
|
-
A few things to keep in mind when targeting the browser:
|
|
252
|
-
|
|
253
|
-
- **Synchronous game loop callback** -- The `game.run()` callback must be
|
|
254
|
-
synchronous. Passing an `async` function triggers a console warning because
|
|
255
|
-
wasm-bindgen's `RefCell` borrow cannot be held across `await` points.
|
|
256
|
-
- **Texture loading uses `fetch()`** -- `loadTexture(path)` calls `fetch()`
|
|
257
|
-
internally, so relative URLs resolve from the page's origin. Make sure your
|
|
258
|
-
asset paths are correct relative to your HTML file or use absolute URLs.
|
|
259
|
-
- **`pause()` / `resume()`** -- You can pause the game loop without detaching
|
|
260
|
-
input handlers by calling `game.pause()`. Call `game.resume()` to restart.
|
|
261
|
-
`game.stop()` fully tears down the loop and input handlers.
|
|
262
|
-
- **Tab visibility** -- `requestAnimationFrame` automatically pauses when the
|
|
263
|
-
browser tab is hidden. No extra handling is needed.
|
|
264
|
-
- **Touch input** -- Touch events are automatically mapped to mouse button 0.
|
|
265
|
-
`touchstart` maps to `press_mouse_button(0)`, `touchend` maps to `release_mouse_button(0)`.
|
|
266
|
-
- **More browser caveats** -- See the Web Platform Gotchas guide for async loop rules,
|
|
267
|
-
asset-loading caveats, and the current networking limitation on `goudengine/web`.
|
|
268
|
-
|
|
269
|
-
## Node vs Web Targets
|
|
270
|
-
|
|
271
|
-
The package uses conditional exports to select the right backend automatically:
|
|
272
|
-
|
|
273
|
-
- **Node.js** -- Uses a native addon built with napi-rs. Calls the Rust engine
|
|
274
|
-
directly through N-API for near-native performance. Requires a `.node` binary
|
|
275
|
-
matching your platform.
|
|
276
|
-
- **Web** -- Uses a WASM module built with wasm-bindgen. Runs in any modern
|
|
277
|
-
browser with WebAssembly support. Smaller binary, slightly lower performance.
|
|
278
|
-
|
|
279
|
-
Both targets expose the same TypeScript API. Game code written against one target
|
|
280
|
-
works on the other without changes.
|
|
281
|
-
|
|
282
|
-
You can also import a specific target explicitly:
|
|
283
|
-
|
|
284
|
-
```typescript
|
|
285
|
-
import { GoudGame } from "goudengine/node"; // Force Node backend
|
|
286
|
-
import { GoudGame } from "goudengine/web"; // Force Web backend
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
## Build from Source
|
|
290
|
-
|
|
291
|
-
### Node.js native addon
|
|
292
|
-
|
|
293
|
-
```bash
|
|
294
|
-
cd sdks/typescript/native && npm run build
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
Or from the SDK root:
|
|
298
|
-
|
|
299
|
-
```bash
|
|
300
|
-
cd sdks/typescript
|
|
301
|
-
npm run build:native # Build napi-rs .node addon
|
|
302
|
-
npm run build:ts # Compile TypeScript sources
|
|
303
|
-
npm run build # Both of the above
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
### WASM module
|
|
307
|
-
|
|
308
|
-
```bash
|
|
309
|
-
cd sdks/typescript
|
|
310
|
-
npm run build:web # Build WASM + compile TS for web target
|
|
311
|
-
npm run build:all # Node + Web
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
### Tests
|
|
46
|
+
## Testing
|
|
315
47
|
|
|
316
48
|
```bash
|
|
317
49
|
cd sdks/typescript
|
|
318
50
|
npm test # node --test test/*.test.mjs
|
|
319
|
-
npx c8 --reporter=text-summary npm test
|
|
320
51
|
npm run typecheck # tsc --noEmit for both targets
|
|
321
52
|
```
|
|
322
53
|
|
|
323
|
-
|
|
324
|
-
|
|
54
|
+
Coverage gate: 80%+ line coverage for both Node and Web targets.
|
|
55
|
+
|
|
56
|
+
## Platform Support
|
|
57
|
+
|
|
58
|
+
| Target | Backend | Status |
|
|
59
|
+
|--------|---------|--------|
|
|
60
|
+
| Node.js | napi-rs native addon | Supported |
|
|
61
|
+
| Web | wasm-bindgen WASM | Supported |
|
|
325
62
|
|
|
326
|
-
##
|
|
63
|
+
## Architecture
|
|
327
64
|
|
|
328
|
-
|
|
329
|
-
by the codegen pipeline. Files with a `.g.rs` or `.g.ts` suffix should not be
|
|
330
|
-
edited by hand. Run `./codegen.sh` from the repository root to regenerate.
|
|
65
|
+
This SDK is a thin wrapper -- all engine logic lives in Rust. Files with `.g.rs` or `.g.ts` suffix are auto-generated by the codegen pipeline. Do not hand-edit generated files. Run `./codegen.sh` to regenerate.
|
|
331
66
|
|
|
332
|
-
##
|
|
67
|
+
## Links
|
|
333
68
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
69
|
+
- [Full documentation](../../docs/src/getting-started/typescript.md)
|
|
70
|
+
- [Examples](https://github.com/aram-devdocs/GoudEngine/tree/main/examples/typescript)
|
|
71
|
+
- [License: MIT](https://github.com/aram-devdocs/GoudEngine/blob/main/LICENSE)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { GoudGame, GoudContext, EngineConfig, UiManager, PhysicsWorld2D, PhysicsWorld3D, Color, Vec2, Vec3, Key, MouseButton, PhysicsBackend2D } from './node/index.g.js';
|
|
1
|
+
export { GoudGame, GoudContext, EngineConfig, UiManager, PhysicsWorld2D, PhysicsWorld3D, Color, Vec2, Vec3, Key, MouseButton, PhysicsBackend2D, RenderBackendKind, WindowBackendKind } from './node/index.g.js';
|
|
2
2
|
export type { IGoudGame, IEngineConfig, IUiManager, IUiStyle, IUiEvent, UiNodeId, IPhysicsWorld2D, IPhysicsWorld3D, IEntity, IColor, IVec2, ITransform2DData, ISpriteData, IRenderStats, IContact, IFpsStats, IDebuggerConfig, IContextConfig, IMemoryCategoryStats, IMemorySummary, IPhysicsRaycastHit2D, IPhysicsCollisionEvent2D, IAnimationEventData, IRenderCapabilities, IPhysicsCapabilities, IAudioCapabilities, IInputCapabilities, INetworkCapabilities, INetworkStats, INetworkSimulationConfig } from './types/engine.g.js';
|
|
3
3
|
export type { IGoudContext, INetworkConnectResult, INetworkPacket } from './node/index.g.js';
|
|
4
4
|
export type { Rect } from './types/math.g.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.g.d.ts","sourceRoot":"","sources":["../../src/generated/index.g.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.g.d.ts","sourceRoot":"","sources":["../../src/generated/index.g.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChN,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,oBAAoB,EAAE,cAAc,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACxgB,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC7F,YAAY,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzM,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file is AUTO-GENERATED by GoudEngine codegen. DO NOT EDIT.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.DiagnosticMode = exports.RecoveryClass = exports.GoudInternalError = exports.GoudProviderError = exports.GoudSystemError = exports.GoudInputError = exports.GoudEntityError = exports.GoudGraphicsError = exports.GoudResourceError = exports.GoudContextError = exports.GoudError = exports.PhysicsBackend2D = exports.MouseButton = exports.Key = exports.Vec3 = exports.Vec2 = exports.Color = exports.PhysicsWorld3D = exports.PhysicsWorld2D = exports.UiManager = exports.EngineConfig = exports.GoudContext = exports.GoudGame = void 0;
|
|
4
|
+
exports.DiagnosticMode = exports.RecoveryClass = exports.GoudInternalError = exports.GoudProviderError = exports.GoudSystemError = exports.GoudInputError = exports.GoudEntityError = exports.GoudGraphicsError = exports.GoudResourceError = exports.GoudContextError = exports.GoudError = exports.WindowBackendKind = exports.RenderBackendKind = exports.PhysicsBackend2D = exports.MouseButton = exports.Key = exports.Vec3 = exports.Vec2 = exports.Color = exports.PhysicsWorld3D = exports.PhysicsWorld2D = exports.UiManager = exports.EngineConfig = exports.GoudContext = exports.GoudGame = void 0;
|
|
5
5
|
var index_g_js_1 = require("./node/index.g.js");
|
|
6
6
|
Object.defineProperty(exports, "GoudGame", { enumerable: true, get: function () { return index_g_js_1.GoudGame; } });
|
|
7
7
|
Object.defineProperty(exports, "GoudContext", { enumerable: true, get: function () { return index_g_js_1.GoudContext; } });
|
|
@@ -15,6 +15,8 @@ Object.defineProperty(exports, "Vec3", { enumerable: true, get: function () { re
|
|
|
15
15
|
Object.defineProperty(exports, "Key", { enumerable: true, get: function () { return index_g_js_1.Key; } });
|
|
16
16
|
Object.defineProperty(exports, "MouseButton", { enumerable: true, get: function () { return index_g_js_1.MouseButton; } });
|
|
17
17
|
Object.defineProperty(exports, "PhysicsBackend2D", { enumerable: true, get: function () { return index_g_js_1.PhysicsBackend2D; } });
|
|
18
|
+
Object.defineProperty(exports, "RenderBackendKind", { enumerable: true, get: function () { return index_g_js_1.RenderBackendKind; } });
|
|
19
|
+
Object.defineProperty(exports, "WindowBackendKind", { enumerable: true, get: function () { return index_g_js_1.WindowBackendKind; } });
|
|
18
20
|
var errors_g_js_1 = require("./errors.g.js");
|
|
19
21
|
Object.defineProperty(exports, "GoudError", { enumerable: true, get: function () { return errors_g_js_1.GoudError; } });
|
|
20
22
|
Object.defineProperty(exports, "GoudContextError", { enumerable: true, get: function () { return errors_g_js_1.GoudContextError; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.g.js","sourceRoot":"","sources":["../../src/generated/index.g.ts"],"names":[],"mappings":";AAAA,kEAAkE;;;AAElE,
|
|
1
|
+
{"version":3,"file":"index.g.js","sourceRoot":"","sources":["../../src/generated/index.g.ts"],"names":[],"mappings":";AAAA,kEAAkE;;;AAElE,gDAAgN;AAAvM,sGAAA,QAAQ,OAAA;AAAE,yGAAA,WAAW,OAAA;AAAE,0GAAA,YAAY,OAAA;AAAE,uGAAA,SAAS,OAAA;AAAE,4GAAA,cAAc,OAAA;AAAE,4GAAA,cAAc,OAAA;AAAE,mGAAA,KAAK,OAAA;AAAE,kGAAA,IAAI,OAAA;AAAE,kGAAA,IAAI,OAAA;AAAE,iGAAA,GAAG,OAAA;AAAE,yGAAA,WAAW,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AAIpL,6CAAyM;AAAhM,wGAAA,SAAS,OAAA;AAAE,+GAAA,gBAAgB,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AAAE,8GAAA,eAAe,OAAA;AAAE,6GAAA,cAAc,OAAA;AAAE,8GAAA,eAAe,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AAAE,4GAAA,aAAa,OAAA;AACjL,qDAAmD;AAA1C,iHAAA,cAAc,OAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { IGoudGame, IUiManager, IUiStyle, IUiEvent, UiNodeId, IEntity, IColor, IVec2, IVec3, ITransform2DData, ISpriteData, IRenderStats, IContact, IFpsStats, IDebuggerConfig, IContextConfig, IMemorySummary, IDebuggerCapture, IDebuggerReplayArtifact, IPhysicsRaycastHit2D, IPhysicsCollisionEvent2D, IAnimationEventData, IPreloadOptions, IRenderCapabilities, IPhysicsCapabilities, IAudioCapabilities, IInputCapabilities, INetworkCapabilities, INetworkStats, INetworkSimulationConfig, IPhysicsWorld2D, IPhysicsWorld3D, PreloadAssetInput } from '../types/engine.g.js';
|
|
2
|
-
import { PhysicsBackend2D } from '../types/input.g.js';
|
|
1
|
+
import type { IGoudGame, IUiManager, IUiStyle, IUiEvent, UiNodeId, IEntity, IColor, IVec2, IVec3, ITransform2DData, ISpriteData, IRenderStats, IContact, IFpsStats, IRenderMetrics, IDebuggerConfig, IContextConfig, IMemorySummary, IDebuggerCapture, IDebuggerReplayArtifact, IPhysicsRaycastHit2D, IPhysicsCollisionEvent2D, IAnimationEventData, IPreloadOptions, IRenderCapabilities, IPhysicsCapabilities, IAudioCapabilities, IInputCapabilities, INetworkCapabilities, INetworkStats, INetworkSimulationConfig, IPhysicsWorld2D, IPhysicsWorld3D, IP2pMeshConfig, IRollbackConfig, PreloadAssetInput, ISpriteCmd, ITextCmd } from '../types/engine.g.js';
|
|
2
|
+
import { PhysicsBackend2D, RenderBackendKind, WindowBackendKind } from '../types/input.g.js';
|
|
3
3
|
export { Color, Vec2, Vec3 } from '../types/math.g.js';
|
|
4
|
-
export { Key, MouseButton, PhysicsBackend2D } from '../types/input.g.js';
|
|
5
|
-
export type { IGoudGame, IUiManager, IUiStyle, IUiEvent, UiNodeId, IEntity, IColor, IVec2, IVec3, ITransform2DData, ISpriteData, IRenderStats, IContact, IFpsStats, IDebuggerConfig, IContextConfig, IMemoryCategoryStats, IMemorySummary, IDebuggerCapture, IDebuggerReplayArtifact, IPhysicsRaycastHit2D, IPhysicsCollisionEvent2D, IAnimationEventData, IRenderCapabilities, IPhysicsCapabilities, IAudioCapabilities, IInputCapabilities, INetworkCapabilities, INetworkStats, INetworkSimulationConfig, IPhysicsWorld2D, IPhysicsWorld3D } from '../types/engine.g.js';
|
|
4
|
+
export { Key, MouseButton, PhysicsBackend2D, RenderBackendKind, WindowBackendKind } from '../types/input.g.js';
|
|
5
|
+
export type { IGoudGame, IUiManager, IUiStyle, IUiEvent, UiNodeId, IEntity, IColor, IVec2, IVec3, ITransform2DData, ISpriteData, IRenderStats, IContact, IFpsStats, IRenderMetrics, IDebuggerConfig, IContextConfig, IMemoryCategoryStats, IMemorySummary, IDebuggerCapture, IDebuggerReplayArtifact, IPhysicsRaycastHit2D, IPhysicsCollisionEvent2D, IAnimationEventData, IRenderCapabilities, IPhysicsCapabilities, IAudioCapabilities, IInputCapabilities, INetworkCapabilities, INetworkStats, INetworkSimulationConfig, IPhysicsWorld2D, IPhysicsWorld3D, IP2pMeshConfig, IRollbackConfig } from '../types/engine.g.js';
|
|
6
6
|
export interface INetworkConnectResult {
|
|
7
7
|
handle: number;
|
|
8
8
|
peerId: number;
|
|
@@ -83,10 +83,14 @@ export declare class GoudGame implements IGoudGame {
|
|
|
83
83
|
get totalTime(): number;
|
|
84
84
|
/** Number of frames processed */
|
|
85
85
|
get frameCount(): number;
|
|
86
|
+
/** Interpolation alpha for render smoothing between fixed timesteps (0.0 to 1.0) */
|
|
87
|
+
get interpolationAlpha(): number;
|
|
86
88
|
/** Returns true if the window close has been requested */
|
|
87
89
|
shouldClose(): boolean;
|
|
88
90
|
/** Signals the window to close */
|
|
89
91
|
close(): void;
|
|
92
|
+
/** Requests a logical resize on the active native window */
|
|
93
|
+
setWindowSize(width: number, height: number): boolean;
|
|
90
94
|
/** Releases all engine resources */
|
|
91
95
|
destroy(): void;
|
|
92
96
|
/** Starts a new render frame with the given clear color */
|
|
@@ -95,6 +99,12 @@ export declare class GoudGame implements IGoudGame {
|
|
|
95
99
|
endFrame(): void;
|
|
96
100
|
/** Runs the game loop. Calls the update callback each frame with delta time. Blocks until the window is closed. */
|
|
97
101
|
run(update: (dt: number) => void): void;
|
|
102
|
+
/** Runs the game loop with a fixed timestep. fixedUpdate runs at the configured fixed rate, update runs once per visual frame. */
|
|
103
|
+
runWithFixedUpdate(fixedUpdate: (dt: number) => void, update: (dt: number) => void): void;
|
|
104
|
+
/** Sets the fixed timestep step size in seconds. Pass 0 to disable. */
|
|
105
|
+
setFixedTimestep(stepSize: number): void;
|
|
106
|
+
/** Sets the maximum fixed steps per frame to prevent spiral of death. */
|
|
107
|
+
setMaxFixedSteps(maxSteps: number): void;
|
|
98
108
|
/** Loads a texture from a file path and returns its handle */
|
|
99
109
|
loadTexture(path: string): Promise<number>;
|
|
100
110
|
/** Destroys a previously loaded texture */
|
|
@@ -105,7 +115,11 @@ export declare class GoudGame implements IGoudGame {
|
|
|
105
115
|
destroyFont(handle: number): boolean;
|
|
106
116
|
/** Draws text using a loaded font */
|
|
107
117
|
drawText(fontHandle: number, text: string, x: number, y: number, fontSize?: number, alignment?: number, maxWidth?: number, lineSpacing?: number, direction?: number, color?: IColor): boolean;
|
|
108
|
-
/**
|
|
118
|
+
/** Set the coordinate origin for subsequent DrawQuad and DrawSprite calls. Center (0) means (x,y) is the center of the shape (default). TopLeft (1) means (x,y) is the top-left corner. */
|
|
119
|
+
setCoordinateOrigin(origin: number): boolean;
|
|
120
|
+
/** Get the current coordinate origin setting. Returns 0 for Center, 1 for TopLeft. */
|
|
121
|
+
getCoordinateOrigin(): number;
|
|
122
|
+
/** Draws a textured sprite. Position (x,y) interpretation depends on the coordinate origin setting (center by default). */
|
|
109
123
|
drawSprite(texture: number, x: number, y: number, width: number, height: number, rotation?: number, color?: IColor): void;
|
|
110
124
|
/** Draws a colored rectangle */
|
|
111
125
|
drawQuad(x: number, y: number, width: number, height: number, color?: IColor): void;
|
|
@@ -219,8 +233,44 @@ export declare class GoudGame implements IGoudGame {
|
|
|
219
233
|
setFogEnabled(enabled: boolean): boolean;
|
|
220
234
|
/** Renders all 3D objects */
|
|
221
235
|
render3D(): boolean;
|
|
236
|
+
/** Creates a 3D material */
|
|
237
|
+
createMaterial(materialType: number, r: number, g: number, b: number, a: number, shininess: number, metallic: number, roughness: number, ao: number): number;
|
|
238
|
+
/** Updates a 3D material */
|
|
239
|
+
updateMaterial(materialId: number, materialType: number, r: number, g: number, b: number, a: number, shininess: number, metallic: number, roughness: number, ao: number): boolean;
|
|
240
|
+
/** Removes a 3D material */
|
|
241
|
+
removeMaterial(materialId: number): boolean;
|
|
242
|
+
/** Binds a material to an object */
|
|
243
|
+
setObjectMaterial(objectId: number, materialId: number): boolean;
|
|
244
|
+
/** Gets the material ID bound to an object */
|
|
245
|
+
getObjectMaterial(objectId: number): number;
|
|
246
|
+
/** Creates a skinned mesh from raw vertex data */
|
|
247
|
+
createSkinnedMesh(verticesPtr: number, vertexCount: number): number;
|
|
248
|
+
/** Removes a skinned mesh */
|
|
249
|
+
removeSkinnedMesh(meshId: number): boolean;
|
|
250
|
+
/** Sets the position of a skinned mesh */
|
|
251
|
+
setSkinnedMeshPosition(meshId: number, x: number, y: number, z: number): boolean;
|
|
252
|
+
/** Sets the rotation of a skinned mesh */
|
|
253
|
+
setSkinnedMeshRotation(meshId: number, x: number, y: number, z: number): boolean;
|
|
254
|
+
/** Sets the scale of a skinned mesh */
|
|
255
|
+
setSkinnedMeshScale(meshId: number, x: number, y: number, z: number): boolean;
|
|
256
|
+
/** Updates bone matrices for a skinned mesh */
|
|
257
|
+
setSkinnedMeshBones(meshId: number, matricesPtr: number, boneCount: number): boolean;
|
|
258
|
+
/** Adds a bloom pass to the post-processing pipeline */
|
|
259
|
+
addBloomPass(threshold: number, intensity: number): number;
|
|
260
|
+
/** Adds a Gaussian blur pass */
|
|
261
|
+
addBlurPass(radius: number): number;
|
|
262
|
+
/** Adds a color grading pass */
|
|
263
|
+
addColorGradePass(exposure: number, contrast: number, saturation: number): number;
|
|
264
|
+
/** Removes a post-processing pass by index */
|
|
265
|
+
removePostprocessPass(index: number): boolean;
|
|
266
|
+
/** Returns the number of post-processing passes */
|
|
267
|
+
postprocessPassCount(): number;
|
|
222
268
|
/** Draws a sprite with source rectangle for sprite sheets */
|
|
223
|
-
drawSpriteRect(texture: number, x: number, y: number, width: number, height: number, rotation: number, srcX: number, srcY: number, srcW: number, srcH: number, color?: IColor): boolean;
|
|
269
|
+
drawSpriteRect(texture: number, x: number, y: number, width: number, height: number, rotation: number, srcX: number, srcY: number, srcW: number, srcH: number, color?: IColor, srcMode?: number): boolean;
|
|
270
|
+
/** Draws a batch of sprites in a single GPU pass for high performance */
|
|
271
|
+
drawSpriteBatch(cmds: ISpriteCmd[]): number;
|
|
272
|
+
/** Draws a batch of text labels in a single pass for high performance */
|
|
273
|
+
drawTextBatch(cmds: ITextCmd[]): number;
|
|
224
274
|
/** Sets the rendering viewport */
|
|
225
275
|
setViewport(x: number, y: number, width: number, height: number): void;
|
|
226
276
|
/** Enables depth testing */
|
|
@@ -235,6 +285,8 @@ export declare class GoudGame implements IGoudGame {
|
|
|
235
285
|
getRenderStats(): IRenderStats;
|
|
236
286
|
/** Returns FPS statistics from the debug overlay rolling window */
|
|
237
287
|
getFpsStats(): IFpsStats;
|
|
288
|
+
/** Returns per-frame render metrics including draw calls, culling stats, batch efficiency, and timing */
|
|
289
|
+
getRenderMetrics(): IRenderMetrics;
|
|
238
290
|
/** Enables or disables the FPS debug overlay */
|
|
239
291
|
setFpsOverlayEnabled(enabled: boolean): void;
|
|
240
292
|
/** Sets how often FPS statistics are recomputed */
|
|
@@ -317,6 +369,12 @@ export declare class GoudGame implements IGoudGame {
|
|
|
317
369
|
physicsCollisionEventsRead(index: number): IPhysicsCollisionEvent2D | null;
|
|
318
370
|
/** Registers or clears a physics collision callback function pointer. C# callers must keep the callback delegate alive for the full registration lifetime. Python and TypeScript wrappers support clear-only (`callbackPtr = 0`, `userData = 0`) for safety. (FFI: goud_physics_set_collision_callback) */
|
|
319
371
|
physicsSetCollisionCallback(callbackPtr: number, userData: number): number;
|
|
372
|
+
/** Returns the number of entities with a specific component type */
|
|
373
|
+
componentCount(typeIdHash: number): number;
|
|
374
|
+
/** Gets entity IDs for all entities with a specific component type */
|
|
375
|
+
componentGetEntities(typeIdHash: number, outEntities: number, maxCount: number): number;
|
|
376
|
+
/** Gets entity IDs and data pointers for all entities with a specific component type */
|
|
377
|
+
componentGetAll(typeIdHash: number, outEntities: number, outDataPtrs: number, maxCount: number): number;
|
|
320
378
|
/** Queries the render provider's capabilities */
|
|
321
379
|
getRenderCapabilities(): IRenderCapabilities;
|
|
322
380
|
/** Queries the physics provider's capabilities */
|
|
@@ -409,6 +467,50 @@ export declare class GoudGame implements IGoudGame {
|
|
|
409
467
|
audioActivate(): number;
|
|
410
468
|
/** Checks if the hot-swap keyboard shortcut (F5) was pressed and cycles the render provider to null. Debug builds only. Returns true if a swap occurred. */
|
|
411
469
|
checkHotSwapShortcut(): boolean;
|
|
470
|
+
/** Creates a P2P mesh host on the given port using the specified transport. */
|
|
471
|
+
p2pCreateMesh(protocol: number, port: number, config: IP2pMeshConfig): number;
|
|
472
|
+
/** Joins an existing P2P mesh at the given address. */
|
|
473
|
+
p2pJoinMesh(protocol: number, address: string, port: number, config: IP2pMeshConfig): number;
|
|
474
|
+
/** Leaves the P2P mesh and destroys the network instance. */
|
|
475
|
+
p2pLeaveMesh(handle: number): number;
|
|
476
|
+
/** Returns the number of connected peers in the mesh. */
|
|
477
|
+
p2pGetPeers(handle: number): number;
|
|
478
|
+
/** Returns the host peer's ID, or 0 on error. */
|
|
479
|
+
p2pGetHost(handle: number): number;
|
|
480
|
+
/** Creates a new rollback netcode session. Returns a positive handle on success. */
|
|
481
|
+
rollbackCreate(config: IRollbackConfig, localPlayer: number, playerIds: Uint8Array, statePtr: number, advanceFn: number, hashFn: number, cloneFn: number, freeFn: number): number;
|
|
482
|
+
/** Destroys a rollback session and frees all associated resources. */
|
|
483
|
+
rollbackDestroy(handle: number): number;
|
|
484
|
+
/** Advances the rollback simulation by one frame with the given local input. */
|
|
485
|
+
rollbackAdvanceFrame(handle: number, input: Uint8Array): number;
|
|
486
|
+
/** Receives a confirmed remote input for a specific player and frame. */
|
|
487
|
+
rollbackReceiveRemoteInput(handle: number, playerId: number, frame: number, input: Uint8Array): number;
|
|
488
|
+
/** Returns 1 if a rollback is pending, 0 otherwise. */
|
|
489
|
+
rollbackShouldRollback(handle: number): number;
|
|
490
|
+
/** Performs rollback and resimulation. Returns the number of frames resimulated. */
|
|
491
|
+
rollbackResimulate(handle: number): number;
|
|
492
|
+
/** Returns the latest confirmed frame. */
|
|
493
|
+
rollbackConfirmedFrame(handle: number): number;
|
|
494
|
+
/** Returns the current simulation frame. */
|
|
495
|
+
rollbackCurrentFrame(handle: number): number;
|
|
496
|
+
/** Checks for desync at the given frame. Returns 0=in sync, 1=desync, 2=frame not available. */
|
|
497
|
+
rollbackCheckDesync(handle: number, remoteHash: number, frame: number): number;
|
|
498
|
+
/** Creates an RPC framework instance. */
|
|
499
|
+
rpcCreate(timeoutMs: number, maxPayload: number): number;
|
|
500
|
+
/** Destroys an RPC framework instance. */
|
|
501
|
+
rpcDestroy(handle: number): number;
|
|
502
|
+
/** Registers an RPC handler with the given direction constraint. */
|
|
503
|
+
rpcRegister(handle: number, rpcId: number, name: string, direction: number): number;
|
|
504
|
+
/** Initiates an RPC call to a peer. Returns the call ID via out parameter. */
|
|
505
|
+
rpcCall(handle: number, peerId: number, rpcId: number, payload: Uint8Array): number;
|
|
506
|
+
/** Advances the RPC framework: checks timeouts and processes pending calls. */
|
|
507
|
+
rpcPoll(handle: number, deltaSecs: number): number;
|
|
508
|
+
/** Feeds raw incoming data to the RPC framework for processing. */
|
|
509
|
+
rpcProcessIncoming(handle: number, peerId: number, data: Uint8Array): number;
|
|
510
|
+
/** Attempts to retrieve the response for a pending RPC call. */
|
|
511
|
+
rpcReceiveResponse(handle: number, callId: number): Uint8Array;
|
|
512
|
+
/** Drains outbound RPC messages and copies the next one into the caller's buffer. */
|
|
513
|
+
rpcDrainOne(handle: number): Uint8Array;
|
|
412
514
|
preload(assets: PreloadAssetInput[], options?: IPreloadOptions): Promise<Record<string, number>>;
|
|
413
515
|
loadScene(name: string, json: string): number;
|
|
414
516
|
unloadScene(name: string): boolean;
|
|
@@ -600,8 +702,8 @@ export declare class EngineConfig implements IEngineConfig {
|
|
|
600
702
|
setSize(width: number, height: number): EngineConfig;
|
|
601
703
|
/** Enables or disables vertical sync */
|
|
602
704
|
setVsync(enabled: boolean): EngineConfig;
|
|
603
|
-
/**
|
|
604
|
-
setFullscreen(
|
|
705
|
+
/** Sets the fullscreen mode (0=Windowed, 1=Borderless, 2=Exclusive) */
|
|
706
|
+
setFullscreen(mode: number): EngineConfig;
|
|
605
707
|
/** Sets the target frames per second */
|
|
606
708
|
setTargetFps(fps: number): EngineConfig;
|
|
607
709
|
/** Enables or disables the FPS debug overlay */
|
|
@@ -610,6 +712,10 @@ export declare class EngineConfig implements IEngineConfig {
|
|
|
610
712
|
setPhysicsDebug(enabled: boolean): EngineConfig;
|
|
611
713
|
/** Selects the 2D physics backend used by the built game */
|
|
612
714
|
setPhysicsBackend2D(backend: PhysicsBackend2D): EngineConfig;
|
|
715
|
+
/** Selects the native render backend used by the built game */
|
|
716
|
+
setRenderBackend(backend: RenderBackendKind): EngineConfig;
|
|
717
|
+
/** Selects the native window backend used by the built game */
|
|
718
|
+
setWindowBackend(backend: WindowBackendKind): EngineConfig;
|
|
613
719
|
/** Configures debugger runtime startup for the created game. */
|
|
614
720
|
setDebugger(debuggerConfig: IDebuggerConfig): EngineConfig;
|
|
615
721
|
/** Consumes the config and creates a windowed GoudGame instance */
|
|
@@ -650,6 +756,10 @@ export declare class UiManager implements IUiManager {
|
|
|
650
756
|
setImageTexturePath(nodeId: UiNodeId, path: string): number;
|
|
651
757
|
/** Sets or creates a slider widget and updates range/value/enabled */
|
|
652
758
|
setSlider(nodeId: UiNodeId, min: number, max: number, value: number, enabled: boolean): number;
|
|
759
|
+
/** Set absolute screen-space position for a UI node. Switches the node to absolute positioning mode. */
|
|
760
|
+
setNodePosition(nodeId: UiNodeId, x: number, y: number): number;
|
|
761
|
+
/** Set visibility for a UI node. Hidden nodes are not rendered. */
|
|
762
|
+
setNodeVisible(nodeId: UiNodeId, visible: boolean): number;
|
|
653
763
|
/** Returns the number of UI events captured in the latest update tick */
|
|
654
764
|
eventCount(): number;
|
|
655
765
|
/** Reads one captured UI event by index */
|