1.03 - Inputs

You can get information about the low-level keyboard and joypad inputs through sol.input.

But remember that when a low-level keyboard or joypad input event occurs, all useful objects (sol.main, the game, map and menus) are already notified. For example, when the user presses a keyboard key, the engine automatically calls sol.main:on_key_pressed().

Also note that during the game, there exists the higher-level notion of game commands to ease your life.

Functions of sol.input

sol.input.is_joypad_enabled()

Returns whether joypad support is enabled.

This may be true even without any joypad plugged.

sol.input.set_joypad_enabled([joypad_enabled])

Enables or disables joypad support.

Joypad support may be enabled even without any joypad plugged.

sol.input.is_key_pressed(key)

Returns whether a keyboard key is currently down.

sol.input.get_modifiers()

Returns the keyboard key modifiers currently active.

sol.input.is_joypad_button_pressed(button)

Returns whether a joypad button is currently down.

sol.input.get_joypad_axis_state(axis)

Returns the current state of an axis of the joypad.

sol.input.get_joypad_hat_direction(hat)

Returns the current direction of a hat of the joypad.

sol.input.get_mouse_position()

Returns the current position of the mouse cursor.

sol.input.is_moutton_button_pressed(button)

Returns whether a mouse button is currently down.

sol.input.get_finger_position(finger)

Returns the current position of a finger if it exists.

sol.input.get_finger_pressure(finger)

Returns the current pressure of a finger if it exists.

sol.input.is_finger_pressed(finger)

Returns whether a finger is currently pressed.

sol.input.simulate_key_pressed(key)

Simulate pressing a keyboard key. Note that every call to this function should have an associated call to sol.input.simulate_key_released(key) for internal reasons, unless repeating keys is allowed.

sol.input.simulate_key_released(key)

Simulate releasing a keyboard key. Note that every call to this function should have an associated call to sol.input.simulate_key_pressed(key) for internal reasons, unless repeating keys is allowed.