Module: input

Mapping and functions for live user input

Found in Chapter 4, page 125 of the textbook

Examples: 4.2 Keyboard Support, 7.5 Mouse Input
Source:

Members

(inner, constant) eMouseButton

Mouse button enums
Source:

(inner, constant) keys

Keyboard enums
Source:

Methods

(inner) getMousePosX() → {float}

Returns mouse X position
Source:
Returns:
X position of mouse
Type
float

(inner) getMousePosY() → {float}

Returns mouse Y position
Source:
Returns:
Y position of mouse
Type
float

(inner) init(canvasID)

Initialize the input manager and instantiate input listeners
Parameters:
Name Type Description
canvasID string the case sensitive html canvas id
Source:

(inner) isButtonClicked(button) → {boolean}

Returns if a specific mouse button is clicked. For a button to be clicked it must have been pressed then released
Parameters:
Name Type Description
button eMouseButton button to check for ckicked state
Source:
Returns:
true if the button is clicked
Type
boolean

(inner) isButtonPressed(button) → {boolean}

Returns if a specific mouse button is pressed
Parameters:
Name Type Description
button eMouseButton button to check for pressed state
Source:
Returns:
true if the button is pressed
Type
boolean

(inner) isKeyClicked(keyCode) → {boolean}

Returns if a specific key is clicked. For a key to be clicked it must have been pressed then released
Parameters:
Name Type Description
keyCode keys key to check for clicked state
Source:
Returns:
true if the key is clicked
Type
boolean

(inner) isKeyPressed(keyCode) → {boolean}

Returns if a specific key is pressed
Parameters:
Name Type Description
keyCode keys key to check for pressed state
Source:
Returns:
true if the key is pressed
Type
boolean

(inner) update()

Update function called from GameLoop
Source: