Skip to main content

Class: InputsComponent

Defined in: input/components/inputs-component.ts:9

The InputsComponent tracks various input states such as key presses, mouse button presses, and mouse coordinates.

Implements

Constructors

Constructor

new InputsComponent(): InputsComponent

Defined in: input/components/inputs-component.ts:59

Returns

InputsComponent

Properties

keyDowns

keyDowns: Set<string>

Defined in: input/components/inputs-component.ts:25

A set of keys that are currently down.


keyPresses

keyPresses: Set<string>

Defined in: input/components/inputs-component.ts:20

A set of currently pressed keys.


keyUps

keyUps: Set<string>

Defined in: input/components/inputs-component.ts:30

A set of keys that have been released.


localMouseCoordinates

localMouseCoordinates: Vector2

Defined in: input/components/inputs-component.ts:50

The current coordinates of the mouse cursor in screen space, where [x: 0, y: 0] is the top-left of the screen.


mouseButtonDowns

mouseButtonDowns: Set<number>

Defined in: input/components/inputs-component.ts:40

A set of mouse buttons that are currently down.


mouseButtonPresses

mouseButtonPresses: Set<number>

Defined in: input/components/inputs-component.ts:35

A set of currently pressed mouse buttons.


mouseButtonUps

mouseButtonUps: Set<number>

Defined in: input/components/inputs-component.ts:45

A set of mouse buttons that have been released.


name

name: symbol

Defined in: input/components/inputs-component.ts:10

The unique name of the component.

Implementation of

Component.name


scrollDelta

scrollDelta: number = 0

Defined in: input/components/inputs-component.ts:15

The scroll delta value for the mouse wheel.


worldMouseCoordinates

worldMouseCoordinates: Vector2

Defined in: input/components/inputs-component.ts:55

The current coordinates of the mouse cursor in world space, where [x: 0, y: 0] is the center of the world.


symbol

readonly static symbol: typeof symbol

Defined in: input/components/inputs-component.ts:57

Methods

isMouseButtonDown()

isMouseButtonDown(button): boolean

Defined in: input/components/inputs-component.ts:95

Checks if a mouse button is currently down.

Parameters

button

number

The mouse button to check.

Returns

boolean

True if the mouse button is down, false otherwise.


isMouseButtonPressed()

isMouseButtonPressed(button): boolean

Defined in: input/components/inputs-component.ts:113

Checks if a mouse button is currently pressed.

Parameters

button

number

The mouse button to check.

Returns

boolean

True if the mouse button is pressed, false otherwise.


isMouseButtonUp()

isMouseButtonUp(button): boolean

Defined in: input/components/inputs-component.ts:104

Checks if a mouse button has been released.

Parameters

button

number

The mouse button to check.

Returns

boolean

True if the mouse button is released, false otherwise.


keyPressed()

keyPressed(code): boolean

Defined in: input/components/inputs-component.ts:68

Checks if a key is currently pressed.

Parameters

code

string

The key code to check.

Returns

boolean

True if the key is pressed, false otherwise.


keyPressedDown()

keyPressedDown(code): boolean

Defined in: input/components/inputs-component.ts:77

Checks if a key is currently down.

Parameters

code

string

The key code to check.

Returns

boolean

True if the key is down, false otherwise.


keyPressedUp()

keyPressedUp(code): boolean

Defined in: input/components/inputs-component.ts:86

Checks if a key has been released.

Parameters

code

string

The key code to check.

Returns

boolean

True if the key is released, false otherwise.