UNPKG

ridder

Version:

A straightforward game engine for simple data-driven games in JavaScript

40 lines (39 loc) 1.36 kB
import { InputCode } from "./consts.js"; import { Vector } from "./vector.js"; /** * Add the event listeners to listen to key and mouse events. */ export declare function setupInput(): void; /** * Reset a single input's state back to `false`. */ export declare function resetInput(code: InputCode): void; /** * Reset the pressed and released inputs back to `false`. */ export declare function resetInputs(): void; /** * Reset all inputs back to `false`. */ export declare function resetAllInputs(): void; /** * Returns `true` if the input is currently pressed. * * Optionally consumes the input so that sequential calls in the current frame return `false`. */ export declare function isInputPressed(code: InputCode, consume?: boolean): boolean; /** * Returns `true` if the input is currently down. * * Optionally consumes the input so that sequential calls in the current frame return `false`. */ export declare function isInputDown(code: InputCode, consume?: boolean): boolean; /** * Returns `true` if the input is currently released. */ export declare function isInputReleased(code: InputCode, consume?: boolean): boolean; /** * Get the current mouse position on the canvas. * @param inWorld Whether or not to get the mouse position affected by the camera. */ export declare function getMousePosition(inWorld: boolean): Readonly<Vector>;