Module tetra::input

source ·
Expand description

Functions and types relating to handling user input (e.g. keyboards, mice, gamepads).

Gamepads

When accessing gamepad state, you specify which gamepad you’re interested in via a ‘gamepad index’. The first gamepad connected to the system has index 0, the second has index 1, and so on.

If a controller is disconnected, the next controller to be connected will take its index - otherwise, a new one will be allocated. This behaviour might be made smarter in future versions.

Enums

Functions

Returns the current position of the specified gamepad axis.
Returns an iterator of the buttons that are currently down on the specified gamepad.
Returns an iterator of the buttons that were pressed this tick on the specified gamepad.
Returns an iterator of the buttons that were released this tick on the specified gamepad.
Returns the name of the specified gamepad, or None if it is not connected.
Returns the current position of the specified gamepad control stick.
Returns an iterator of the keys that are currently down.
Returns an iterator of the keys that were pressed this tick.
Returns an iterator of the keys that were released this tick.
Get the position of the mouse.
Get the X co-ordinate of the mouse.
Get the Y co-ordinate of the mouse.
Returns the text that the user entered this tick. This will match the user’s keyboard and OS settings.
Returns true if the specified gamepad button is currently down.
Returns true if the specified gamepad button was pressed this tick.
Returns true if the specified gamepad button was released this tick.
Returns true if the specified gamepad button is currently up.
Returns true if the specified gamepad is currently connected.
Returns true if the specified key is currently down.
Returns true if the specified key was pressed this tick.
Returns true if the specified key was released this tick.
Returns true if the specified key is currently up.
Returns true if the specified mouse button is currently down.
Returns true if the specified mouse button was pressed this tick.
Returns true if the specified mouse button was released this tick.
Returns true if the specified mouse button is currently up.