[][src]Module tetra::input

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

GamepadAxis
GamepadButton
GamepadStick
Key
MouseButton

Functions

get_gamepad_axis_position

Returns the current position of the specified gamepad axis.

get_gamepad_buttons_down

Returns an iterator of the buttons that are currently down on the specified gamepad.

get_gamepad_buttons_pressed

Returns an iterator of the buttons that were pressed this tick on the specified gamepad.

get_gamepad_buttons_released

Returns an iterator of the buttons that were released this tick on the specified gamepad.

get_gamepad_name

Returns the name of the specified gamepad, or None if it is not connected.

get_gamepad_stick_position

Returns the current position of the specified gamepad control stick.

get_keys_down

Returns an iterator of the keys that are currently down.

get_keys_pressed

Returns an iterator of the keys that were pressed this tick.

get_keys_released

Returns an iterator of the keys that were released this tick.

get_mouse_position

Get the position of the mouse.

get_mouse_x

Get the X co-ordinate of the mouse.

get_mouse_y

Get the Y co-ordinate of the mouse.

get_text_input

Returns the text that the user entered this tick. This will match the user's keyboard and OS settings.

is_gamepad_button_down

Returns true if the specified gamepad button is currently down.

is_gamepad_button_pressed

Returns true if the specified gamepad button was pressed this tick.

is_gamepad_button_released

Returns true if the specified gamepad button was released this tick.

is_gamepad_button_up

Returns true if the specified gamepad button is currently up.

is_gamepad_connected

Returns true if the specified gamepad is currently connected.

is_key_down

Returns true if the specified key is currently down.

is_key_pressed

Returns true if the specified key was pressed this tick.

is_key_released

Returns true if the specified key was released this tick.

is_key_up

Returns true if the specified key is currently up.

is_mouse_button_down

Returns true if the specified mouse button is currently down.

is_mouse_button_pressed

Returns true if the specified mouse button was pressed this tick.

is_mouse_button_released

Returns true if the specified mouse button was released this tick.

is_mouse_button_up

Returns true if the specified mouse button is currently up.