Removed old scripted types
This commit is contained in:
Vendored
-61
@@ -1,61 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** A single keyframe descriptor passed to the Animation constructor. */
|
|
||||||
interface AnimationKeyframe {
|
|
||||||
/** Time offset in seconds. */
|
|
||||||
time: number;
|
|
||||||
/** Value at this keyframe. */
|
|
||||||
value: number;
|
|
||||||
/** Easing type (EASING_* constant). Defaults to EASING_LINEAR. */
|
|
||||||
easing?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Keyframe-based float animation. */
|
|
||||||
interface AnimationInstance {
|
|
||||||
/**
|
|
||||||
* Interpolates the animation at the given time.
|
|
||||||
* @param time Time in seconds.
|
|
||||||
* @returns Interpolated value.
|
|
||||||
*/
|
|
||||||
getValue(time: number): number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Constructs a new Animation from an array of keyframe descriptors. */
|
|
||||||
declare var Animation: {
|
|
||||||
new (keyframes: AnimationKeyframe[]): AnimationInstance;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Easing function utilities. */
|
|
||||||
interface EasingNamespace {
|
|
||||||
/**
|
|
||||||
* Applies the given easing function to normalized time t.
|
|
||||||
* @param type An EASING_* constant.
|
|
||||||
* @param t Normalized time in [0, 1].
|
|
||||||
* @returns Eased value in [0, 1].
|
|
||||||
*/
|
|
||||||
apply(type: number, t: number): number;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Easing: EasingNamespace;
|
|
||||||
|
|
||||||
declare var EASING_LINEAR: number;
|
|
||||||
declare var EASING_IN_SINE: number;
|
|
||||||
declare var EASING_OUT_SINE: number;
|
|
||||||
declare var EASING_IN_OUT_SINE: number;
|
|
||||||
declare var EASING_IN_QUAD: number;
|
|
||||||
declare var EASING_OUT_QUAD: number;
|
|
||||||
declare var EASING_IN_OUT_QUAD: number;
|
|
||||||
declare var EASING_IN_CUBIC: number;
|
|
||||||
declare var EASING_OUT_CUBIC: number;
|
|
||||||
declare var EASING_IN_OUT_CUBIC: number;
|
|
||||||
declare var EASING_IN_QUART: number;
|
|
||||||
declare var EASING_OUT_QUART: number;
|
|
||||||
declare var EASING_IN_OUT_QUART: number;
|
|
||||||
declare var EASING_IN_BACK: number;
|
|
||||||
declare var EASING_OUT_BACK: number;
|
|
||||||
declare var EASING_IN_OUT_BACK: number;
|
|
||||||
Vendored
-72
@@ -1,72 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Asset archive queries and cache management. */
|
|
||||||
interface AssetNamespace {
|
|
||||||
// Loader type constants
|
|
||||||
readonly TYPE_MESH: number;
|
|
||||||
readonly TYPE_TEXTURE: number;
|
|
||||||
readonly TYPE_TILESET: number;
|
|
||||||
readonly TYPE_LOCALE: number;
|
|
||||||
readonly TYPE_JSON: number;
|
|
||||||
readonly TYPE_SCRIPT: number;
|
|
||||||
|
|
||||||
// Mesh axis input constants (pass as `input` to lock with TYPE_MESH)
|
|
||||||
readonly MESH_AXIS_Y_UP: number;
|
|
||||||
readonly MESH_AXIS_Z_UP: number;
|
|
||||||
readonly MESH_AXIS_X_UP: number;
|
|
||||||
readonly MESH_AXIS_Y_DOWN: number;
|
|
||||||
readonly MESH_AXIS_Z_DOWN: number;
|
|
||||||
readonly MESH_AXIS_X_DOWN: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns `true` if the given path exists in the asset archive (`dusk.dsk`).
|
|
||||||
*
|
|
||||||
* @param path - Archive-relative path, e.g. `"init.js"` or `"ui/hud.png"`.
|
|
||||||
*/
|
|
||||||
exists(path: string): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Locks an entry in the asset cache and returns an `AssetEntry`.
|
|
||||||
* The entry begins loading in the background. Call `entry.requireLoaded()`
|
|
||||||
* to block until it is ready.
|
|
||||||
*
|
|
||||||
* The lock is released when the `AssetEntry` is GC'd or `entry.unlock()`
|
|
||||||
* is called explicitly.
|
|
||||||
*
|
|
||||||
* @param path - Archive-relative path.
|
|
||||||
* @param type - Loader type constant (`Asset.TYPE_*`).
|
|
||||||
* @param input - Optional loader-specific input constant.
|
|
||||||
* `TYPE_TEXTURE` → `Texture.FORMAT_*`
|
|
||||||
* `TYPE_MESH` → `Asset.MESH_AXIS_*`
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const entry = Asset.lock('data/map.json');
|
|
||||||
* entry.requireLoaded();
|
|
||||||
*/
|
|
||||||
lock(path: string, type: number, input?: number): AssetEntry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Blocks until the given entry is fully loaded.
|
|
||||||
* Returns the entry for chaining.
|
|
||||||
* @throws If the load fails.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const entry = Asset.requireLoaded(Asset.lock('map.json', Asset.TYPE_JSON));
|
|
||||||
*/
|
|
||||||
requireLoaded(entry: AssetEntry): AssetEntry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Releases the lock on an asset by path.
|
|
||||||
* Prefer calling `entry.unlock()` on the `AssetEntry` object directly.
|
|
||||||
*
|
|
||||||
* @param path - The path originally passed to `lock`.
|
|
||||||
*/
|
|
||||||
unlock(path: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Asset: AssetNamespace;
|
|
||||||
Vendored
-97
@@ -1,97 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Descriptor for one entry in an `AssetBatch`.
|
|
||||||
*
|
|
||||||
* `format` - texture format constant (`Texture.FORMAT_*`). Alias for `input`
|
|
||||||
* when the type is `Asset.TYPE_TEXTURE`.
|
|
||||||
* `axis` - mesh axis constant (`Asset.MESH_AXIS_*`). Alias for `input`
|
|
||||||
* when the type is `Asset.TYPE_MESH`.
|
|
||||||
* `input` - generic numeric input for all other loader types.
|
|
||||||
*/
|
|
||||||
interface AssetBatchDescriptor {
|
|
||||||
path: string;
|
|
||||||
type: number;
|
|
||||||
format?: number;
|
|
||||||
axis?: number;
|
|
||||||
input?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A group of asset entries locked and queued for loading together. */
|
|
||||||
interface AssetBatch {
|
|
||||||
/** Number of entries in the batch. */
|
|
||||||
readonly count: number;
|
|
||||||
/** `true` when every entry has reached `LOADED`. */
|
|
||||||
readonly isLoaded: boolean;
|
|
||||||
/** `true` if any entry is in an `ERROR` state. */
|
|
||||||
readonly hasError: boolean;
|
|
||||||
/**
|
|
||||||
* Returns a Promise that resolves when all entries have loaded, or rejects
|
|
||||||
* if any entry errors. Use with `await`.
|
|
||||||
*/
|
|
||||||
loaded(): Promise<void>;
|
|
||||||
/**
|
|
||||||
* Blocks (spin-waits) until every entry is loaded.
|
|
||||||
* Returns `this` for chaining.
|
|
||||||
* @throws If any entry fails to load.
|
|
||||||
*/
|
|
||||||
requireLoaded(): this;
|
|
||||||
/**
|
|
||||||
* Acquires one additional lock on every entry.
|
|
||||||
* Returns `this` for chaining.
|
|
||||||
*/
|
|
||||||
lock(): this;
|
|
||||||
/**
|
|
||||||
* Releases all locks and clears the batch.
|
|
||||||
* After this call the object is invalid - do not use it again.
|
|
||||||
*/
|
|
||||||
unlock(): void;
|
|
||||||
/**
|
|
||||||
* Returns the `AssetEntry` at `index`, adding an independent lock.
|
|
||||||
* The returned entry must be unlocked separately when no longer needed.
|
|
||||||
* Returns `undefined` if `index` is out of range or the batch is disposed.
|
|
||||||
*/
|
|
||||||
entry(index: number): AssetEntry | undefined;
|
|
||||||
/**
|
|
||||||
* Returns the first `AssetEntry` whose path matches, adding an
|
|
||||||
* independent lock. Returns `undefined` if no entry matches.
|
|
||||||
* The returned entry must be unlocked separately when no longer needed.
|
|
||||||
*/
|
|
||||||
getAssetByPath(path: string): AssetEntry | undefined;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fires once when every entry has loaded successfully.
|
|
||||||
* Subscribe with `onLoaded[0] = () => { ... }`.
|
|
||||||
*/
|
|
||||||
readonly onLoaded: AssetEventProxy;
|
|
||||||
/**
|
|
||||||
* Fires each time a single entry finishes loading.
|
|
||||||
* Subscribe with `onEntryLoaded[0] = () => { ... }`.
|
|
||||||
*/
|
|
||||||
readonly onEntryLoaded: AssetEventProxy;
|
|
||||||
/**
|
|
||||||
* Fires once when all entries have finished but at least one errored.
|
|
||||||
* Subscribe with `onError[0] = () => { ... }`.
|
|
||||||
*/
|
|
||||||
readonly onError: AssetEventProxy;
|
|
||||||
/**
|
|
||||||
* Fires each time a single entry transitions to an error state.
|
|
||||||
* Subscribe with `onEntryError[0] = () => { ... }`.
|
|
||||||
*/
|
|
||||||
readonly onEntryError: AssetEventProxy;
|
|
||||||
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AssetBatchConstructor {
|
|
||||||
/** Creates a batch from an array of descriptors. Works with or without `new`. */
|
|
||||||
(descriptors: AssetBatchDescriptor[]): AssetBatch;
|
|
||||||
new(descriptors: AssetBatchDescriptor[]): AssetBatch;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var AssetBatch: AssetBatchConstructor;
|
|
||||||
Vendored
-65
@@ -1,65 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A live reference to an entry in the asset cache.
|
|
||||||
* Holds a lock that keeps the entry alive; the lock is released automatically
|
|
||||||
* when the object is garbage collected, or immediately via `unlock()`.
|
|
||||||
*/
|
|
||||||
interface AssetEntry {
|
|
||||||
/** Archive-relative path used as the cache key. */
|
|
||||||
readonly name: string;
|
|
||||||
/** Current loading state - compare against `AssetEntry.*` state constants. */
|
|
||||||
readonly state: number;
|
|
||||||
/** Loader type - one of the `AssetEntry.TYPE_*` constants. */
|
|
||||||
readonly type: number;
|
|
||||||
/** `true` when the entry has fully loaded (`state === AssetEntry.LOADED`). */
|
|
||||||
readonly isLoaded: boolean;
|
|
||||||
/**
|
|
||||||
* Returns a `Texture` for this entry when it is a loaded texture asset.
|
|
||||||
* The `Texture` holds its own asset lock - independent of this `AssetEntry`.
|
|
||||||
* Returns `undefined` if the entry is not of type `Asset.TYPE_TEXTURE` or
|
|
||||||
* is not yet loaded.
|
|
||||||
*/
|
|
||||||
readonly texture: Texture | undefined;
|
|
||||||
/** Event proxy - subscribe up to 4 callbacks for when loading completes. */
|
|
||||||
readonly onLoaded: AssetEventProxy;
|
|
||||||
/** Event proxy - subscribe up to 4 callbacks for when the entry is disposed. */
|
|
||||||
readonly onUnloaded: AssetEventProxy;
|
|
||||||
/** Event proxy - subscribe up to 4 callbacks for when loading fails. */
|
|
||||||
readonly onError: AssetEventProxy;
|
|
||||||
/**
|
|
||||||
* Returns a Promise that resolves when the entry is loaded, or rejects on
|
|
||||||
* error. Use with `await`.
|
|
||||||
*/
|
|
||||||
loaded(): Promise<void>;
|
|
||||||
/**
|
|
||||||
* Blocks (spin-waits) until the entry reaches `LOADED` (or `ERROR`).
|
|
||||||
* Returns `this` for chaining.
|
|
||||||
* @throws If the load fails.
|
|
||||||
*/
|
|
||||||
requireLoaded(): this;
|
|
||||||
/**
|
|
||||||
* Releases the lock immediately.
|
|
||||||
* After this call the object is invalid - do not use it again.
|
|
||||||
*/
|
|
||||||
unlock(): void;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AssetEntryConstructor {
|
|
||||||
// Loading state constants
|
|
||||||
readonly NOT_STARTED: number;
|
|
||||||
readonly PENDING: number;
|
|
||||||
readonly LOADING: number;
|
|
||||||
readonly LOADED: number;
|
|
||||||
readonly ERROR: number;
|
|
||||||
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var AssetEntry: AssetEntryConstructor;
|
|
||||||
Vendored
-23
@@ -1,23 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An event proxy with up to 4 subscribable callback slots (indices 0–3).
|
|
||||||
* Assign a function to subscribe; assign `null` to unsubscribe.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* assets.onLoaded[0] = () => { Console.print('all loaded'); };
|
|
||||||
* assets.onLoaded[0] = null; // unsubscribe
|
|
||||||
*/
|
|
||||||
interface AssetEventProxy {
|
|
||||||
0: (() => void) | null;
|
|
||||||
1: (() => void) | null;
|
|
||||||
2: (() => void) | null;
|
|
||||||
3: (() => void) | null;
|
|
||||||
/** Number of available slots (always 4). */
|
|
||||||
readonly length: number;
|
|
||||||
}
|
|
||||||
Vendored
-27
@@ -1,27 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Interface for the in-game developer console. */
|
|
||||||
interface ConsoleNamespace {
|
|
||||||
/**
|
|
||||||
* Prints one or more values to the in-game console, separated by tabs.
|
|
||||||
* Each argument is coerced to a string before printing.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* Console.print("x =", player.x, "y =", player.y);
|
|
||||||
*/
|
|
||||||
print(...args: unknown[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the in-game console overlay is currently visible.
|
|
||||||
* Set to `true` to show the console, `false` to hide it.
|
|
||||||
*/
|
|
||||||
visible: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** In-game developer console. */
|
|
||||||
declare var Console: ConsoleNamespace;
|
|
||||||
Vendored
-41
@@ -1,41 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** An RGBA color with channels in the range 0–255. */
|
|
||||||
declare class Color {
|
|
||||||
/** @param r Red 0–255 (default 0) */
|
|
||||||
/** @param g Green 0–255 (default 0) */
|
|
||||||
/** @param b Blue 0–255 (default 0) */
|
|
||||||
/** @param a Alpha 0–255 (default 255) */
|
|
||||||
constructor(r?: number, g?: number, b?: number, a?: number);
|
|
||||||
|
|
||||||
r: number;
|
|
||||||
g: number;
|
|
||||||
b: number;
|
|
||||||
a: number;
|
|
||||||
|
|
||||||
toString(): string;
|
|
||||||
|
|
||||||
// Named color constants
|
|
||||||
static readonly WHITE: Color;
|
|
||||||
static readonly BLACK: Color;
|
|
||||||
static readonly RED: Color;
|
|
||||||
static readonly GREEN: Color;
|
|
||||||
static readonly BLUE: Color;
|
|
||||||
static readonly YELLOW: Color;
|
|
||||||
static readonly CYAN: Color;
|
|
||||||
static readonly MAGENTA: Color;
|
|
||||||
static readonly TRANSPARENT: Color;
|
|
||||||
static readonly GRAY: Color;
|
|
||||||
static readonly LIGHT_GRAY: Color;
|
|
||||||
static readonly DARK_GRAY: Color;
|
|
||||||
static readonly ORANGE: Color;
|
|
||||||
static readonly PURPLE: Color;
|
|
||||||
static readonly PINK: Color;
|
|
||||||
static readonly TEAL: Color;
|
|
||||||
static readonly CORNFLOWER_BLUE: Color;
|
|
||||||
}
|
|
||||||
Vendored
-19
@@ -1,19 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Read-only information about the current display surface. */
|
|
||||||
interface ScreenNamespace {
|
|
||||||
/** Current render-target width in pixels. */
|
|
||||||
readonly width: number;
|
|
||||||
/** Current render-target height in pixels. */
|
|
||||||
readonly height: number;
|
|
||||||
/** Aspect ratio: `width / height`. */
|
|
||||||
readonly aspect: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Current display / render-target dimensions. */
|
|
||||||
declare var Screen: ScreenNamespace;
|
|
||||||
Vendored
-28
@@ -1,28 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A loaded texture asset. Holds a lock on the underlying asset entry -
|
|
||||||
* the lock is released automatically when the object is garbage collected.
|
|
||||||
*/
|
|
||||||
interface Texture {
|
|
||||||
/** Pixel width of the texture. */
|
|
||||||
readonly width: number;
|
|
||||||
/** Pixel height of the texture. */
|
|
||||||
readonly height: number;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface TextureConstructor {
|
|
||||||
/** RGBA 32-bit format (4 channels × 8 bits). */
|
|
||||||
readonly FORMAT_RGBA: number;
|
|
||||||
/** Paletted format. */
|
|
||||||
readonly FORMAT_PALETTE: number;
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Texture: TextureConstructor;
|
|
||||||
Vendored
-24
@@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Controls over the engine main loop. */
|
|
||||||
interface EngineNamespace {
|
|
||||||
/**
|
|
||||||
* Whether the engine main loop is still running.
|
|
||||||
* Becomes `false` after `Engine.exit()` is called.
|
|
||||||
*/
|
|
||||||
readonly running: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Requests an orderly shutdown. Sets `running` to `false`; the main loop
|
|
||||||
* exits at the end of the current tick.
|
|
||||||
*/
|
|
||||||
exit(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Engine lifecycle controls. */
|
|
||||||
declare var Engine: EngineNamespace;
|
|
||||||
Vendored
-24
@@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a Promise that resolves on the next engine frame.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* await frame();
|
|
||||||
* Console.print('one frame later');
|
|
||||||
*/
|
|
||||||
declare function frame(): Promise<void>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a Promise that resolves after `ms` milliseconds of engine time.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* await timeout(500);
|
|
||||||
* Console.print('half a second later');
|
|
||||||
*/
|
|
||||||
declare function timeout(ms: number): Promise<void>;
|
|
||||||
Vendored
-31
@@ -1,31 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base type for all components. `entity.add()` returns a subtype when the
|
|
||||||
* component type has a dedicated module; cast with `as Position` etc. when
|
|
||||||
* you need the specific API.
|
|
||||||
*/
|
|
||||||
interface Component {
|
|
||||||
/** Entity ID this component belongs to. */
|
|
||||||
readonly entity: number;
|
|
||||||
/** Component slot index. */
|
|
||||||
readonly id: number;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ComponentConstructor {
|
|
||||||
readonly POSITION: number;
|
|
||||||
readonly CAMERA: number;
|
|
||||||
readonly RENDERABLE: number;
|
|
||||||
readonly PHYSICS: number;
|
|
||||||
readonly TRIGGER: number;
|
|
||||||
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Component: ComponentConstructor;
|
|
||||||
Vendored
-28
@@ -1,28 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Camera projection component. Only one camera is active at a time. */
|
|
||||||
interface Camera extends Component {
|
|
||||||
/** Field of view in radians (perspective only). */
|
|
||||||
fov: number;
|
|
||||||
/** Near clip plane distance. */
|
|
||||||
nearClip: number;
|
|
||||||
/** Far clip plane distance. */
|
|
||||||
farClip: number;
|
|
||||||
/** One of `Camera.PERSPECTIVE`, `Camera.PERSPECTIVE_FLIPPED`, or `Camera.ORTHOGRAPHIC`. */
|
|
||||||
projType: number;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface CameraConstructor {
|
|
||||||
readonly PERSPECTIVE: number;
|
|
||||||
readonly PERSPECTIVE_FLIPPED: number;
|
|
||||||
readonly ORTHOGRAPHIC: number;
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Camera: CameraConstructor;
|
|
||||||
-26
@@ -1,26 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interactable component. Fires a callback when the player activates it.
|
|
||||||
*
|
|
||||||
* Assign a JS function to `onInteract` to handle the event from script.
|
|
||||||
* Call `trigger()` to fire the callback imperatively from C or JS.
|
|
||||||
*/
|
|
||||||
interface Interactable extends Component {
|
|
||||||
/** Called when the player interacts with this entity. Set to null to clear. */
|
|
||||||
onInteract: (() => void) | null;
|
|
||||||
/** Fires the registered callback immediately (no-op if none is set). */
|
|
||||||
trigger(): void;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface InteractableConstructor {
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Interactable: InteractableConstructor;
|
|
||||||
-41
@@ -1,41 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Overworld character component (player or NPC). */
|
|
||||||
interface Overworld extends Component {
|
|
||||||
/**
|
|
||||||
* Entity type - `Overworld.PLAYER` or `Overworld.NPC`.
|
|
||||||
*/
|
|
||||||
type: number;
|
|
||||||
/**
|
|
||||||
* Facing direction - one of the `Overworld.FACING_*` constants.
|
|
||||||
*/
|
|
||||||
facing: number;
|
|
||||||
/** Component ID of the linked Renderable, or INVALID if none. */
|
|
||||||
readonly renderComponentId: number;
|
|
||||||
/** Component ID of the linked Physics body, or INVALID if none. */
|
|
||||||
readonly physicsComponentId: number;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface OverworldConstructor {
|
|
||||||
readonly PLAYER: number;
|
|
||||||
readonly NPC: number;
|
|
||||||
|
|
||||||
readonly FACING_DOWN: number;
|
|
||||||
readonly FACING_UP: number;
|
|
||||||
readonly FACING_LEFT: number;
|
|
||||||
readonly FACING_RIGHT: number;
|
|
||||||
readonly FACING_SOUTH: number;
|
|
||||||
readonly FACING_NORTH: number;
|
|
||||||
readonly FACING_WEST: number;
|
|
||||||
readonly FACING_EAST: number;
|
|
||||||
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Overworld: OverworldConstructor;
|
|
||||||
-35
@@ -1,35 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overworld follow-camera component.
|
|
||||||
* Smoothly tracks a target entity's Position each frame.
|
|
||||||
*/
|
|
||||||
interface OverworldCamera extends Component {
|
|
||||||
/** Entity ID to follow. */
|
|
||||||
targetEntity: number;
|
|
||||||
/** Position component ID on the target entity. */
|
|
||||||
targetPositionComponent: number;
|
|
||||||
/** World-space offset added to the target's position before placing the camera. */
|
|
||||||
targetOffset: Vec3;
|
|
||||||
/** Eye-space offset applied on top of targetOffset. */
|
|
||||||
eyeOffset: Vec3;
|
|
||||||
/** Orthographic scale factor (larger = wider view). */
|
|
||||||
scale: number;
|
|
||||||
/**
|
|
||||||
* Convenience setter - equivalent to assigning `targetEntity` and
|
|
||||||
* `targetPositionComponent` individually.
|
|
||||||
*/
|
|
||||||
setTarget(targetEntityId: number, targetPositionComponentId: number): void;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface OverworldCameraConstructor {
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var OverworldCamera: OverworldCameraConstructor;
|
|
||||||
-38
@@ -1,38 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overworld AABB trigger. Fires callbacks as the player enters, stays inside,
|
|
||||||
* exits, or remains outside the defined bounding box each frame.
|
|
||||||
*/
|
|
||||||
interface OverworldTrigger extends Component {
|
|
||||||
/** Minimum corner of the trigger AABB. */
|
|
||||||
min: Vec3;
|
|
||||||
/** Maximum corner of the trigger AABB. */
|
|
||||||
max: Vec3;
|
|
||||||
/** `true` while the player is inside the trigger bounds. */
|
|
||||||
readonly playerInside: boolean;
|
|
||||||
|
|
||||||
/** Fired once when the player first enters the bounds. */
|
|
||||||
onEnter: (() => void) | null;
|
|
||||||
/** Fired once when the player leaves the bounds. */
|
|
||||||
onExit: (() => void) | null;
|
|
||||||
/** Fired every frame while the player remains inside the bounds. */
|
|
||||||
onStay: (() => void) | null;
|
|
||||||
/** Fired every frame while the player remains outside the bounds. */
|
|
||||||
onOutside: (() => void) | null;
|
|
||||||
|
|
||||||
/** Convenience setter for both corners at once. */
|
|
||||||
setBounds(min: Vec3, max: Vec3): void;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface OverworldTriggerConstructor {
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var OverworldTrigger: OverworldTriggerConstructor;
|
|
||||||
Vendored
-39
@@ -1,39 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Physics body component. */
|
|
||||||
interface Physics extends Component {
|
|
||||||
/** Body simulation type - `Physics.STATIC`, `DYNAMIC`, or `KINEMATIC`. */
|
|
||||||
bodyType: number;
|
|
||||||
/**
|
|
||||||
* Collision shape type - one of the `Physics.SHAPE_*` constants.
|
|
||||||
* Changing the type preserves existing velocity and ground state.
|
|
||||||
*/
|
|
||||||
shape: number;
|
|
||||||
/** Current linear velocity (Vec3). */
|
|
||||||
velocity: Vec3;
|
|
||||||
/** Gravity multiplier. 0 = no gravity, 1 = full, negative = inverted. */
|
|
||||||
gravityScale: number;
|
|
||||||
/** `true` if the body rested on a surface during the last simulation step. */
|
|
||||||
readonly onGround: boolean;
|
|
||||||
/** Applies an instantaneous velocity change. No-op on STATIC bodies. */
|
|
||||||
applyImpulse(impulse: Vec3): void;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PhysicsConstructor {
|
|
||||||
readonly STATIC: number;
|
|
||||||
readonly DYNAMIC: number;
|
|
||||||
readonly KINEMATIC: number;
|
|
||||||
readonly SHAPE_CUBE: number;
|
|
||||||
readonly SHAPE_SPHERE: number;
|
|
||||||
readonly SHAPE_CAPSULE: number;
|
|
||||||
readonly SHAPE_PLANE: number;
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Physics: PhysicsConstructor;
|
|
||||||
Vendored
-21
@@ -1,21 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Player movement component. Controls walk and run speeds. */
|
|
||||||
interface Player extends Component {
|
|
||||||
/** Walk speed in world units per second. */
|
|
||||||
speed: number;
|
|
||||||
/** Run speed in world units per second. */
|
|
||||||
runSpeed: number;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PlayerConstructor {
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Player: PlayerConstructor;
|
|
||||||
Vendored
-41
@@ -1,41 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Transform component - local/world PRS with an optional parent hierarchy. */
|
|
||||||
interface Position extends Component {
|
|
||||||
/**
|
|
||||||
* Local-space position. Reading returns a Vec3 copy; assigning a Vec3
|
|
||||||
* writes through to the C transform and marks descendants dirty.
|
|
||||||
*/
|
|
||||||
localPosition: Vec3;
|
|
||||||
/** World-space position (full parent-chain applied). */
|
|
||||||
worldPosition: Vec3;
|
|
||||||
/** Local euler rotation in radians (XYZ order). */
|
|
||||||
localRotation: Vec3;
|
|
||||||
/** World euler rotation in radians. */
|
|
||||||
worldRotation: Vec3;
|
|
||||||
/** Local scale. */
|
|
||||||
localScale: Vec3;
|
|
||||||
/** World scale (extracted from parent-chain matrix). */
|
|
||||||
worldScale: Vec3;
|
|
||||||
/**
|
|
||||||
* Orients the transform so it faces `target`. Uses the current local
|
|
||||||
* position as the eye. `up` defaults to world Y-up.
|
|
||||||
*/
|
|
||||||
lookAt(target: Vec3, up?: Vec3): void;
|
|
||||||
/**
|
|
||||||
* Attaches this transform to a parent. Pass `null` / `undefined` to detach.
|
|
||||||
*/
|
|
||||||
setParent(parent: Position | null | undefined): void;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PositionConstructor {
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Position: PositionConstructor;
|
|
||||||
-52
@@ -1,52 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** A Renderable component. Returned by `entity.add(Component.RENDERABLE)`. */
|
|
||||||
interface Renderable extends Component {
|
|
||||||
/** Current render type - one of the `Renderable.*` type constants. */
|
|
||||||
type: number;
|
|
||||||
/** Render priority. 0 = auto. Higher = drawn later. */
|
|
||||||
priority: number;
|
|
||||||
/**
|
|
||||||
* Unlit material color. Reading returns a fresh `Color` copy; assigning
|
|
||||||
* a `Color` instance writes through to the C material.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* r.color = Color.RED;
|
|
||||||
* r.color = new Color(255, 128, 0);
|
|
||||||
*/
|
|
||||||
color: Color;
|
|
||||||
/**
|
|
||||||
* The bound texture. Assigning a `Texture` switches the renderable to
|
|
||||||
* `SPRITEBATCH` mode and pins the object against GC. Reading returns the
|
|
||||||
* same `Texture` instance that was assigned, or `undefined` if none.
|
|
||||||
*/
|
|
||||||
texture: Texture | undefined;
|
|
||||||
/**
|
|
||||||
* Sprite list. Reading returns a JS array of 10-element sub-arrays
|
|
||||||
* `[x1,y1,z1, x2,y2,z2, u1,v1, u2,v2]` - one per sprite.
|
|
||||||
*
|
|
||||||
* Assigning an array replaces all sprites. Each element may be:
|
|
||||||
* - 10 numbers (3D): `[x1,y1,z1, x2,y2,z2, u1,v1, u2,v2]`
|
|
||||||
* - 8 numbers (2D, z defaults to 0): `[x1,y1, x2,y2, u1,v1, u2,v2]`
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* r.sprites = [[-0.5, 0, 0.5, 1, 0, 0, 1, 1]];
|
|
||||||
* r.sprites = []; // clear
|
|
||||||
*/
|
|
||||||
sprites: number[][];
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RenderableConstructor {
|
|
||||||
readonly SHADER_MATERIAL: number;
|
|
||||||
readonly SPRITEBATCH: number;
|
|
||||||
readonly CUSTOM: number;
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Renderable: RenderableConstructor;
|
|
||||||
Vendored
-25
@@ -1,25 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** AABB trigger volume. `contains` tests whether a world point is inside. */
|
|
||||||
interface Trigger extends Component {
|
|
||||||
/** Minimum corner of the AABB (Vec3). */
|
|
||||||
min: Vec3;
|
|
||||||
/** Maximum corner of the AABB (Vec3). */
|
|
||||||
max: Vec3;
|
|
||||||
/** Sets both corners at once. */
|
|
||||||
setBounds(min: Vec3, max: Vec3): void;
|
|
||||||
/** Returns `true` if `point` is inside `[min, max]`. */
|
|
||||||
contains(point: Vec3): boolean;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface TriggerConstructor {
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Trigger: TriggerConstructor;
|
|
||||||
Vendored
-29
@@ -1,29 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
interface Entity {
|
|
||||||
/**
|
|
||||||
* Adds a component of the given type and returns it.
|
|
||||||
* Returns a typed subclass when the component has a dedicated module
|
|
||||||
* (`Position`, `Camera`, `Renderable`, `Trigger`, `Physics`); otherwise
|
|
||||||
* returns the base `Component`. Cast with `as Position` etc. when needed.
|
|
||||||
*/
|
|
||||||
add(type: number): Component;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface EntityConstructor {
|
|
||||||
/** Sentinel for an invalid entity ID. */
|
|
||||||
readonly INVALID: number;
|
|
||||||
/** Allocates a new entity from the fixed pool (max 64). */
|
|
||||||
create(): Entity;
|
|
||||||
/** Disposes the entity and all of its components. */
|
|
||||||
dispose(entity: Entity): void;
|
|
||||||
new(): never;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Entity: EntityConstructor;
|
|
||||||
Vendored
-72
@@ -1,72 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*
|
|
||||||
* Root type declarations for the Dusk engine built-in JavaScript modules.
|
|
||||||
* These globals are injected by the native JerryScript runtime - they are not
|
|
||||||
* ES modules and cannot be imported.
|
|
||||||
*
|
|
||||||
* Reference this file from a jsconfig.json or tsconfig.json to get
|
|
||||||
* IntelliSense across all game scripts:
|
|
||||||
*
|
|
||||||
* { "compilerOptions": { "typeRoots": ["./types"] } }
|
|
||||||
*/
|
|
||||||
|
|
||||||
// module system
|
|
||||||
/// <reference path="./require.d.ts" />
|
|
||||||
|
|
||||||
// math
|
|
||||||
/// <reference path="./math/vec3.d.ts" />
|
|
||||||
|
|
||||||
// display
|
|
||||||
/// <reference path="./display/color.d.ts" />
|
|
||||||
/// <reference path="./display/screen.d.ts" />
|
|
||||||
/// <reference path="./display/texture.d.ts" />
|
|
||||||
|
|
||||||
// asset
|
|
||||||
/// <reference path="./asset/asseteventproxy.d.ts" />
|
|
||||||
/// <reference path="./asset/assetentry.d.ts" />
|
|
||||||
/// <reference path="./asset/assetbatch.d.ts" />
|
|
||||||
/// <reference path="./asset/asset.d.ts" />
|
|
||||||
|
|
||||||
// animation
|
|
||||||
/// <reference path="./animation/animation.d.ts" />
|
|
||||||
|
|
||||||
// overworld
|
|
||||||
/// <reference path="./overworld/overworld.d.ts" />
|
|
||||||
|
|
||||||
// item system
|
|
||||||
/// <reference path="./item/item.d.ts" />
|
|
||||||
/// <reference path="./item/backpack.d.ts" />
|
|
||||||
|
|
||||||
// story system
|
|
||||||
/// <reference path="./story/story.d.ts" />
|
|
||||||
|
|
||||||
// locale
|
|
||||||
/// <reference path="./locale/locale.d.ts" />
|
|
||||||
|
|
||||||
// save
|
|
||||||
/// <reference path="./save/save.d.ts" />
|
|
||||||
|
|
||||||
// ui
|
|
||||||
/// <reference path="./ui/fullbox.d.ts" />
|
|
||||||
/// <reference path="./ui/textbox.d.ts" />
|
|
||||||
|
|
||||||
// engine systems
|
|
||||||
/// <reference path="./console/console.d.ts" />
|
|
||||||
/// <reference path="./engine/engine.d.ts" />
|
|
||||||
/// <reference path="./engine/globals.d.ts" />
|
|
||||||
/// <reference path="./input/input.d.ts" />
|
|
||||||
/// <reference path="./scene/scene.d.ts" />
|
|
||||||
/// <reference path="./system/system.d.ts" />
|
|
||||||
|
|
||||||
// entity / components
|
|
||||||
/// <reference path="./entity/component.d.ts" />
|
|
||||||
/// <reference path="./entity/component/camera.d.ts" />
|
|
||||||
/// <reference path="./entity/component/physics.d.ts" />
|
|
||||||
/// <reference path="./entity/component/position.d.ts" />
|
|
||||||
/// <reference path="./entity/component/renderable.d.ts" />
|
|
||||||
/// <reference path="./entity/component/trigger.d.ts" />
|
|
||||||
/// <reference path="./entity/entity.d.ts" />
|
|
||||||
Vendored
-50
@@ -1,50 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Opaque type alias for input action identifiers. */
|
|
||||||
type InputAction = number;
|
|
||||||
|
|
||||||
/** Polling-based input queries and button rebinding. */
|
|
||||||
interface InputNamespace {
|
|
||||||
/** Returns `true` while the given action is held down this frame. */
|
|
||||||
isDown(action: InputAction): boolean;
|
|
||||||
/** Returns `true` if the given action was held down last frame. */
|
|
||||||
wasDown(action: InputAction): boolean;
|
|
||||||
/** Returns `true` on the first frame the action transitions up → down. */
|
|
||||||
pressed(action: InputAction): boolean;
|
|
||||||
/** Returns `true` on the first frame the action transitions down → up. */
|
|
||||||
released(action: InputAction): boolean;
|
|
||||||
/** Continuous (analog) value in `0.0–1.0`. Digital buttons return 0 or 1. */
|
|
||||||
getValue(action: InputAction): number;
|
|
||||||
/**
|
|
||||||
* Signed axis value `-1.0–1.0`: `getValue(pos) - getValue(neg)`.
|
|
||||||
* @param neg - Action mapped to the negative direction.
|
|
||||||
* @param pos - Action mapped to the positive direction.
|
|
||||||
*/
|
|
||||||
axis(neg: InputAction, pos: InputAction): number;
|
|
||||||
/**
|
|
||||||
* Rebinds a physical button to a logical action at runtime.
|
|
||||||
* @param buttonName - Platform-specific button name, e.g. `"A"`, `"START"`.
|
|
||||||
* @param action - Target `INPUT_ACTION_*` constant.
|
|
||||||
*/
|
|
||||||
bind(buttonName: string, action: InputAction): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Polling-based input system. */
|
|
||||||
declare var Input: InputNamespace;
|
|
||||||
|
|
||||||
// Input action constants - injected as globals by the engine at startup.
|
|
||||||
declare var INPUT_ACTION_UP: InputAction;
|
|
||||||
declare var INPUT_ACTION_DOWN: InputAction;
|
|
||||||
declare var INPUT_ACTION_LEFT: InputAction;
|
|
||||||
declare var INPUT_ACTION_RIGHT: InputAction;
|
|
||||||
declare var INPUT_ACTION_ACCEPT: InputAction;
|
|
||||||
declare var INPUT_ACTION_CANCEL: InputAction;
|
|
||||||
declare var INPUT_ACTION_RAGEQUIT: InputAction;
|
|
||||||
declare var INPUT_ACTION_CONSOLE: InputAction;
|
|
||||||
declare var INPUT_ACTION_POINTERX: InputAction;
|
|
||||||
declare var INPUT_ACTION_POINTERY: InputAction;
|
|
||||||
Vendored
-63
@@ -1,63 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** The player's item backpack (a fixed 20-slot inventory). */
|
|
||||||
interface BackpackNamespace {
|
|
||||||
/** `true` when all 20 storage slots are occupied by distinct items. */
|
|
||||||
readonly isFull: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the quantity of `itemId` in the backpack (0 if absent).
|
|
||||||
* @param itemId - An `ITEM_ID_*` constant.
|
|
||||||
*/
|
|
||||||
getCount(itemId: ItemId): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns `true` if `itemId` is present with quantity greater than 0.
|
|
||||||
* @param itemId - An `ITEM_ID_*` constant.
|
|
||||||
*/
|
|
||||||
has(itemId: ItemId): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns `true` if the stack for `itemId` is at maximum quantity (255).
|
|
||||||
* @param itemId - An `ITEM_ID_*` constant.
|
|
||||||
*/
|
|
||||||
isItemFull(itemId: ItemId): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the quantity of `itemId`; passing 0 removes the stack entirely.
|
|
||||||
* @param itemId - An `ITEM_ID_*` constant.
|
|
||||||
* @param quantity - New quantity, 0–255.
|
|
||||||
*/
|
|
||||||
set(itemId: ItemId, quantity: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds `quantity` units of `itemId` to the backpack.
|
|
||||||
* @param itemId - An `ITEM_ID_*` constant.
|
|
||||||
* @param quantity - Amount to add, 1–255.
|
|
||||||
*/
|
|
||||||
add(itemId: ItemId, quantity: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes `itemId` entirely from the backpack.
|
|
||||||
* @param itemId - An `ITEM_ID_*` constant.
|
|
||||||
*/
|
|
||||||
remove(itemId: ItemId): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sorts the backpack contents.
|
|
||||||
* @param sortBy - `INVENTORY_SORT_BY_ID` or `INVENTORY_SORT_BY_TYPE`.
|
|
||||||
* @param reverse - Optional; pass `true` to reverse the sort order.
|
|
||||||
*/
|
|
||||||
sort(sortBy: number, reverse?: boolean): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Backpack: BackpackNamespace;
|
|
||||||
|
|
||||||
// Inventory sort constants - injected as globals by the engine at startup.
|
|
||||||
declare var INVENTORY_SORT_BY_ID: number;
|
|
||||||
declare var INVENTORY_SORT_BY_TYPE: number;
|
|
||||||
Vendored
-39
@@ -1,39 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Opaque type alias for item identifier constants. */
|
|
||||||
type ItemId = number;
|
|
||||||
|
|
||||||
/** Opaque type alias for item type constants. */
|
|
||||||
type ItemType = number;
|
|
||||||
|
|
||||||
/** Item data lookup. */
|
|
||||||
interface ItemNamespace {
|
|
||||||
/**
|
|
||||||
* Returns the string name for the given item ID.
|
|
||||||
* @param itemId - An `ITEM_ID_*` constant.
|
|
||||||
*/
|
|
||||||
getName(itemId: ItemId): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the type constant for the given item ID.
|
|
||||||
* @param itemId - An `ITEM_ID_*` constant.
|
|
||||||
* @returns An `ITEM_TYPE_*` constant.
|
|
||||||
*/
|
|
||||||
getType(itemId: ItemId): ItemType;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Item: ItemNamespace;
|
|
||||||
|
|
||||||
// Item ID constants - injected as globals by the engine at startup.
|
|
||||||
declare var ITEM_ID_POTION: ItemId;
|
|
||||||
declare var ITEM_ID_POTATO: ItemId;
|
|
||||||
declare var ITEM_ID_APPLE: ItemId;
|
|
||||||
|
|
||||||
// Item type constants - injected as globals by the engine at startup.
|
|
||||||
declare var ITEM_TYPE_MEDICINE: ItemType;
|
|
||||||
declare var ITEM_TYPE_FOOD: ItemType;
|
|
||||||
Vendored
-31
@@ -1,31 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Locale string lookup and language switching. */
|
|
||||||
interface LocaleNamespace {
|
|
||||||
/**
|
|
||||||
* Returns the translated string for the given message ID.
|
|
||||||
*
|
|
||||||
* @param id - PO message ID, e.g. `"ITEM_POTION_NAME"`.
|
|
||||||
* @param pluralCount - Optional count used to select the plural form.
|
|
||||||
* Defaults to 1 (singular).
|
|
||||||
* @param args - Optional substitution values (`%s`, `%d`, `%f`).
|
|
||||||
*/
|
|
||||||
getText(
|
|
||||||
id: string,
|
|
||||||
pluralCount?: number,
|
|
||||||
...args: Array<string | number>
|
|
||||||
): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Switches the active locale.
|
|
||||||
* @param name - Locale name string, e.g. `"en-US"`.
|
|
||||||
*/
|
|
||||||
setLocale(name: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Locale: LocaleNamespace;
|
|
||||||
Vendored
-15
@@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** A three-component float vector (x, y, z). */
|
|
||||||
declare class Vec3 {
|
|
||||||
constructor(x?: number, y?: number, z?: number);
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
z: number;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
Vendored
-40
@@ -1,40 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Map loading and world-position management. */
|
|
||||||
interface OverworldNamespace {
|
|
||||||
/**
|
|
||||||
* Loads the map with the given handle, disposing any currently loaded map.
|
|
||||||
* @param handle Map handle string (max 31 chars).
|
|
||||||
*/
|
|
||||||
loadMap(handle: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns `true` when a map is currently loaded.
|
|
||||||
*/
|
|
||||||
isLoaded(): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Slides the loaded chunk window to the given tile-space position.
|
|
||||||
* @param x Tile X.
|
|
||||||
* @param y Tile Y.
|
|
||||||
* @param z Tile Z.
|
|
||||||
*/
|
|
||||||
setPosition(x: number, y: number, z: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Advances the map one tick. Call once per frame.
|
|
||||||
*/
|
|
||||||
update(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unloads the current map.
|
|
||||||
*/
|
|
||||||
dispose(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Overworld: OverworldNamespace;
|
|
||||||
Vendored
-46
@@ -1,46 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CommonJS-style module loader.
|
|
||||||
*
|
|
||||||
* Modules are cached after their first load. Subsequent calls with the same
|
|
||||||
* resolved path return the cached exports without re-executing the file.
|
|
||||||
*
|
|
||||||
* Path rules: the string is passed verbatim to the asset loader and resolved
|
|
||||||
* from the archive root. The `.js` extension must be included explicitly.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const NPC = require('./entities/NPC');
|
|
||||||
*/
|
|
||||||
declare function require(path: string): any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Asynchronous module loader. Loads the module at `path` in the background
|
|
||||||
* and returns a Promise that resolves to the module's `exports`.
|
|
||||||
*
|
|
||||||
* If the module is already cached it resolves immediately. On load failure
|
|
||||||
* the Promise is rejected.
|
|
||||||
*
|
|
||||||
* Path rules are identical to `require`.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const NPC = await requireAsync('./entities/NPC');
|
|
||||||
*/
|
|
||||||
declare function requireAsync(path: string): Promise<any>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The module object for the currently executing script.
|
|
||||||
* Assign `module.exports` to control what `require()` returns to callers.
|
|
||||||
*/
|
|
||||||
declare var module: { exports: any };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shorthand for `module.exports`. Direct assignment (`exports = ...`) does
|
|
||||||
* NOT update `module.exports`; use `module.exports = ...` for that.
|
|
||||||
*/
|
|
||||||
declare var exports: any;
|
|
||||||
Vendored
-38
@@ -1,38 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Slot-based save file management. */
|
|
||||||
interface SaveNamespace {
|
|
||||||
/**
|
|
||||||
* Returns `true` if a save file is present for the given slot.
|
|
||||||
* @param slot - Save slot index (0–2).
|
|
||||||
*/
|
|
||||||
exists(slot: number): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the save file for the given slot from persistent storage.
|
|
||||||
* Throws if the load fails.
|
|
||||||
* @param slot - Save slot index (0–2).
|
|
||||||
*/
|
|
||||||
load(slot: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes the save file for the given slot to persistent storage.
|
|
||||||
* Throws if the write fails.
|
|
||||||
* @param slot - Save slot index (0–2).
|
|
||||||
*/
|
|
||||||
write(slot: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes the save file for the given slot from persistent storage.
|
|
||||||
* Throws if the delete fails.
|
|
||||||
* @param slot - Save slot index (0–2).
|
|
||||||
*/
|
|
||||||
delete(slot: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Save: SaveNamespace;
|
|
||||||
Vendored
-56
@@ -1,56 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The object a JS scene module must export.
|
|
||||||
* All methods are optional.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* // assets/scenes/game.js
|
|
||||||
* var scene = {};
|
|
||||||
*
|
|
||||||
* scene.init = function() { Console.print('scene started'); };
|
|
||||||
* scene.update = function() { /* per-frame logic *\/ };
|
|
||||||
* scene.dispose = function() { };
|
|
||||||
*
|
|
||||||
* module.exports = scene;
|
|
||||||
*/
|
|
||||||
interface SceneObject {
|
|
||||||
/** Called when this scene becomes active. Optional. */
|
|
||||||
init?(): void;
|
|
||||||
/** Called every frame while this scene is active. Optional. */
|
|
||||||
update?(): void;
|
|
||||||
/** Called when the scene is replaced or the engine shuts down. Optional. */
|
|
||||||
dispose?(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Scene management. */
|
|
||||||
interface SceneNamespace {
|
|
||||||
/** The currently active scene object, or `null` if none. */
|
|
||||||
current: SceneObject | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replaces the active scene. Calls `dispose()` on the previous scene (if
|
|
||||||
* any), then calls `init()` on the new one. Pass `null` to clear.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const myScene = require('./scenes/game');
|
|
||||||
* Scene.set(myScene);
|
|
||||||
*/
|
|
||||||
set(newScene: SceneObject | null): void;
|
|
||||||
|
|
||||||
/** Called each frame by the engine - drives `current.update()`. */
|
|
||||||
update(): void;
|
|
||||||
|
|
||||||
/** Called each frame by the engine for dynamic/physics updates. */
|
|
||||||
dynamicUpdate(): void;
|
|
||||||
|
|
||||||
/** Disposes the current scene and sets `current` to `null`. */
|
|
||||||
dispose(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Scene: SceneNamespace;
|
|
||||||
Vendored
-30
@@ -1,30 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Opaque type alias for story flag identifier constants. */
|
|
||||||
type StoryFlag = number;
|
|
||||||
|
|
||||||
/** Story flag read/write access. */
|
|
||||||
interface StoryNamespace {
|
|
||||||
/**
|
|
||||||
* Returns the current value of a story flag (0–255).
|
|
||||||
* @param flagId - A `STORY_FLAG_*` constant.
|
|
||||||
*/
|
|
||||||
get(flagId: StoryFlag): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a story flag to a new value.
|
|
||||||
* @param flagId - A `STORY_FLAG_*` constant.
|
|
||||||
* @param value - New value, 0–255.
|
|
||||||
*/
|
|
||||||
set(flagId: StoryFlag, value: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var Story: StoryNamespace;
|
|
||||||
|
|
||||||
// Story flag constants - injected as globals by the engine at startup.
|
|
||||||
declare var STORY_FLAG_TEST: StoryFlag;
|
|
||||||
Vendored
-27
@@ -1,27 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Runtime platform detection. */
|
|
||||||
interface SystemNamespace {
|
|
||||||
/**
|
|
||||||
* Numeric identifier for the current platform.
|
|
||||||
* Compare against the `System.PLATFORM_*` constants.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* if(System.platform === System.PLATFORM_PSP) { useLowResAssets(); }
|
|
||||||
*/
|
|
||||||
readonly platform: number;
|
|
||||||
|
|
||||||
readonly PLATFORM_LINUX: number;
|
|
||||||
readonly PLATFORM_KNULLI: number;
|
|
||||||
readonly PLATFORM_PSP: number;
|
|
||||||
readonly PLATFORM_GAMECUBE: number;
|
|
||||||
readonly PLATFORM_WII: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Platform detection and system-level information. */
|
|
||||||
declare var System: SystemNamespace;
|
|
||||||
Vendored
-39
@@ -1,39 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** A full-screen color overlay. */
|
|
||||||
interface UIFullboxInstance {
|
|
||||||
/**
|
|
||||||
* Sets the overlay to a solid color with no animation.
|
|
||||||
* Returns a Promise that resolves immediately.
|
|
||||||
* @param color - The color to apply.
|
|
||||||
*/
|
|
||||||
setColor(color: Color): Promise<void>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Animates the overlay from one color to another.
|
|
||||||
* Returns a Promise that resolves when the transition completes.
|
|
||||||
* Starting a new transition while one is in progress resolves the
|
|
||||||
* old Promise immediately before beginning the new one.
|
|
||||||
* @param from - Starting color.
|
|
||||||
* @param to - Ending color.
|
|
||||||
* @param duration - Duration in seconds.
|
|
||||||
* @param easing - Optional EASING_* constant (default: EASING_LINEAR).
|
|
||||||
*/
|
|
||||||
transition(
|
|
||||||
from: Color,
|
|
||||||
to: Color,
|
|
||||||
duration: number,
|
|
||||||
easing?: number
|
|
||||||
): Promise<void>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Full-screen overlay drawn on top of all UI elements. */
|
|
||||||
declare var UIFullboxOver: UIFullboxInstance;
|
|
||||||
|
|
||||||
/** Full-screen overlay drawn below all UI elements. */
|
|
||||||
declare var UIFullboxUnder: UIFullboxInstance;
|
|
||||||
Vendored
-50
@@ -1,50 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** VN-style typewriter textbox singleton. */
|
|
||||||
interface UITextboxNamespace {
|
|
||||||
/** `true` when the typewriter has fully revealed the current page. */
|
|
||||||
readonly isPageComplete: boolean;
|
|
||||||
/** `true` when at least one more page follows the current one. */
|
|
||||||
readonly hasNextPage: boolean;
|
|
||||||
/** Zero-based index of the current page. */
|
|
||||||
readonly currentPage: number;
|
|
||||||
/** Total number of pages for the current text. */
|
|
||||||
readonly pageCount: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the textbox content and rebuilds the word-wrap layout.
|
|
||||||
* Resets to page 0 and scroll 0.
|
|
||||||
* @param text - Text to display (max 1024 chars).
|
|
||||||
*/
|
|
||||||
setText(text: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Advances to the next page; no-op on the last page.
|
|
||||||
*/
|
|
||||||
nextPage(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Advances the typewriter scroll by one tick.
|
|
||||||
* Call once per frame before `draw()`.
|
|
||||||
*/
|
|
||||||
update(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws the frame and currently visible text.
|
|
||||||
* Call once per frame after `update()`.
|
|
||||||
*/
|
|
||||||
draw(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the input action that auto-advances the textbox when held.
|
|
||||||
* @param action - An `INPUT_ACTION_*` constant.
|
|
||||||
*/
|
|
||||||
setAdvanceAction(action: InputAction): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var UITextbox: UITextboxNamespace;
|
|
||||||
Reference in New Issue
Block a user