Skip to content

@vaguevoid/fiasco / ecs/resources / Inputs

Class: Inputs

Defined in: src/ecs/resources.ts:826

The Inputs Resource provides information about current frame inputs, such as mouse and keyboard data.

ts
function system(inputs: Inputs) {
  if (inputs.mouse.left.isPressed) {
    console.log('mouse is clicked!')
  }
}

Extends

Accessors

mouse

Get Signature

get mouse(): object

Defined in: src/ecs/resources.ts:867

Data about the current position of the mouse in the screen. Includes data about which mouse buttons are down/up.

Returns

object

left

left: ButtonState

middle

middle: ButtonState

right: ButtonState

x

x: number

y

y: number


wheel

Get Signature

get wheel(): object

Defined in: src/ecs/resources.ts:883

Data about the mouse scroll wheel positioning.

Returns

object

x

x: number

y

y: number

Methods

deserialize()

deserialize(bytes): boolean

Defined in: src/ecs/resources.ts:70

Parameters

bytes

Uint8Array

Returns

boolean

Inherited from

Resource.deserialize


key()

key(code): ButtonState

Defined in: src/ecs/resources.ts:858

Data about the provided keyboard key state.

Parameters

code

KeyCode

Keyboard key code

Returns

ButtonState

Data about if the key is pressed or not.


serialize()

serialize(): Uint8Array

Defined in: src/ecs/resources.ts:65

Returns

Uint8Array

Inherited from

Resource.serialize