Module tetra::input[][src]

Expand description

Functions and types relating to handling the player’s input.

Gamepads

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

If a controller is disconnected, the next controller to be connected will take its ID - otherwise, a new one will be allocated. This means that if you unplug a controller and then plug it back in, it should retain its existing ID. This behaviour might be made smarter in future versions.

Examples

The keyboard example demonstrates how to handle keyboard input.

The mouse example demonstrates how to handle mouse input.

The gamepad example demonstrates how to handle gamepad input.

The text_input example demonstrates how to handle text entry.

Enums

An axis of movement on a gamepad.

A button on a gamepad.

A control stick on a gamepad.

A physical key on a keyboard.

A key, as represented by the current system keyboard layout.

A key modifier on the keyboard.

A button on a mouse.

Functions

Gets the text currently stored in the system’s clipboard.

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 on the specified gamepad since the last update.

Returns an iterator of the buttons that were released on the specified gamepad since the last update .

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 the label for the specified key in the current keyboard layout.

Returns the key that has the specified label in the current keyboard layout.

Returns an iterator of the keys that are currently down.

Returns an iterator of the keys that were pressed since the last update.

Returns an iterator of the keys that were released since the last update.

Get the position of the mouse.

Get the amount that the mouse wheel moved since the last update.

Get the X co-ordinate of the mouse.

Get the Y co-ordinate of the mouse.

Returns the text that the user entered since the last update. 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 since the last update.

Returns true if the specified gamepad button was released since the last update.

Returns true if the specified gamepad button is currently up.

Returns true if the specified gamepad is currently connected.

Returns true if the specified gamepad supports vibration.

Returns true if the specified key is currently down.

Returns true if the specified key modifier is currently down.

Returns true if the specified key modifier is currently up.

Returns true if the specified key was pressed since the last update.

Returns true if the specified key was released since the last update.

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 since the last update.

Returns true if the specified mouse button was released since the last update.

Returns true if the specified mouse button is currently up.

Returns true if the user scrolled down since the last update.

Returns true if the user scrolled up since the last update.

Sets the contents of the system’s clipboard.

Sets the specified gamepad’s motors to vibrate indefinitely.

Sets the specified gamepad’s motors to vibrate for a set duration, specified in milliseconds. After this time has passed, the vibration will automatically stop.

Stops the specified gamepad’s motors from vibrating.