Skip to main content
Module

x/oid/mod.ts>Input

oidoid 2D game engine.
Go to Latest
class Input
Re-export
import { Input } from "https://deno.land/x/oid@v0.0.5/mod.ts";

Constructors

new
Input(
cam: Readonly<Cam>,
minHeld?,
maxInterval?: number,
)

Properties

readonly
buttons: bigint
readonly
pointerType: PointerType | undefined
readonly
xy: Readonly<I16XY> | undefined

Methods

isAnyOn(...buttons: readonly Button[]): boolean
isCombo(...combo: readonly (readonly Button[])[]): boolean

Combos are interpreted exactly both in buttons pressed per tick (eg, up will not match up + down the way isOn('Up') will) and sequence (order and length).

Combos only test button on state.

isComboHeld(...combo: readonly (readonly Button[])[]): boolean

Like isOnCombo() but test if the last button event is held.

isComboStart(...combo: readonly (readonly Button[])[]): boolean

Like isOnCombo() but test if the last button event is triggered.

isHeld(): boolean

True if held on or off.

isOff(...buttons: readonly Button[]): boolean
isOffHeld(...buttons: readonly Button[]): boolean
isOffStart(...buttons: readonly Button[]): boolean
isOn(...buttons: readonly Button[]): boolean

Test if all buttons are on. True if the buttons are pressed regardless of whether other buttons are pressed. Eg, isOn('Up') will return true when up is pressed, up and down are pressed, and up and any other button is pressed.

isOnHeld(...buttons: readonly Button[]): boolean
isOnStart(...buttons: readonly Button[]): boolean
isStart(...buttons: readonly Button[]): boolean

True if triggered on or off.

postupdate(delta: number): void

Call this function after processing the collected input. This function primes the poller to collect input for the next frame so it should occur towards the end of the game update loop after entity processing.

preupdate(): void
register(op: "add" | "remove"): void
reset(): void
toString(): string