Test sprite from script
This commit is contained in:
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* 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;
|
||||
Reference in New Issue
Block a user