@whatever-engine/api 0.2.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.
- package/README.md +4 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,10 +25,14 @@ No install step needed — Bun resolves the package automatically for any script
|
|
|
25
25
|
- `Engine.on(event, handler)` — subscribe to an engine event (`init`, `exit`, `tick`, `mod_message`)
|
|
26
26
|
- `Engine.log(level, message)` — log through the engine logger (`"info"`, `"warn"`, `"error"`)
|
|
27
27
|
- `Engine.setTickRate(ticks_per_second)` — override the game tick rate at runtime
|
|
28
|
+
- `Engine.setFpsCap(fps | null)` — set FPS cap; `null` = uncapped
|
|
29
|
+
- `Engine.setVsync(enabled)` — enable or disable vertical sync
|
|
28
30
|
|
|
29
31
|
### `Window`
|
|
30
32
|
|
|
31
33
|
- `Window.setTitle(title)` — change the window title
|
|
34
|
+
- `Window.setSize(width, height)` — request a new inner size in physical pixels (no-op in fullscreen modes)
|
|
35
|
+
- `Window.setMode(mode)` — set display mode: `"windowed"`, `"borderless"`, or `"fullscreen"`
|
|
32
36
|
|
|
33
37
|
### `File`
|
|
34
38
|
|
package/dist/index.d.ts
CHANGED
|
@@ -80,11 +80,26 @@ export declare const Engine: {
|
|
|
80
80
|
log(level: "info" | "warn" | "error", message: string): void;
|
|
81
81
|
/** Override the game tick rate. Takes effect immediately. */
|
|
82
82
|
setTickRate(ticks_per_second: number): void;
|
|
83
|
+
/** Set the FPS cap. Pass `null` to remove the cap (uncapped). */
|
|
84
|
+
setFpsCap(fps: number | null): void;
|
|
85
|
+
/** Enable or disable vertical sync. Takes effect immediately. */
|
|
86
|
+
setVsync(enabled: boolean): void;
|
|
83
87
|
};
|
|
88
|
+
export type WindowMode = "windowed" | "borderless" | "fullscreen";
|
|
84
89
|
/** Window management. */
|
|
85
90
|
export declare const Window: {
|
|
86
91
|
/** Set the title of the active window. */
|
|
87
92
|
setTitle(title: string): void;
|
|
93
|
+
/** Request a new inner window size in physical pixels. Has no effect in fullscreen modes. */
|
|
94
|
+
setSize(width: number, height: number): void;
|
|
95
|
+
/**
|
|
96
|
+
* Set the window display mode.
|
|
97
|
+
* - `"windowed"` — normal window
|
|
98
|
+
* - `"borderless"` — borderless fullscreen (windowed fullscreen)
|
|
99
|
+
* - `"fullscreen"` — exclusive fullscreen using the monitor's preferred video mode;
|
|
100
|
+
* falls back to borderless if no exclusive mode is available
|
|
101
|
+
*/
|
|
102
|
+
setMode(mode: WindowMode): void;
|
|
88
103
|
};
|
|
89
104
|
/** Sandboxed per-mod file I/O. Paths must not contain `..`. */
|
|
90
105
|
declare const File$1: {
|
package/dist/index.js
CHANGED
|
@@ -221,12 +221,24 @@ var Engine = {
|
|
|
221
221
|
},
|
|
222
222
|
setTickRate(ticks_per_second) {
|
|
223
223
|
_send({ type: "SetTickRate", ticks_per_second });
|
|
224
|
+
},
|
|
225
|
+
setFpsCap(fps) {
|
|
226
|
+
_send({ type: "SetFpsCap", fps });
|
|
227
|
+
},
|
|
228
|
+
setVsync(enabled) {
|
|
229
|
+
_send({ type: "SetVsync", enabled });
|
|
224
230
|
}
|
|
225
231
|
};
|
|
226
232
|
// src/components/window.ts
|
|
227
233
|
var Window = {
|
|
228
234
|
setTitle(title) {
|
|
229
235
|
_send({ type: "SetWindowTitle", title });
|
|
236
|
+
},
|
|
237
|
+
setSize(width, height) {
|
|
238
|
+
_send({ type: "SetWindowSize", width, height });
|
|
239
|
+
},
|
|
240
|
+
setMode(mode) {
|
|
241
|
+
_send({ type: "SetWindowMode", mode });
|
|
230
242
|
}
|
|
231
243
|
};
|
|
232
244
|
// src/components/file.ts
|
package/package.json
CHANGED