Input
Handling any kind of input action coming from mouse, keyboard or game controllers.
Axis
Use this when querying gamepad analogue buttons.
Axis.LEFTX: int
Axis.LEFTY: int
Axis.RIGHTX: int
Axis.RIGHTY: int
Axis.TRIGGERLEFT: int
Axis.TRIGGERRIGHT: int
Button
Use this when querying gamepad buttons.,
Button.DPAD_UP: int
Button.DPAD_DOWN: int
Button.DPAD_LEFT: int
Button.DPAD_RIGHT: int
Button.A: int
Button.B: int
Button.X: int
Button.Y: int
Button.START: int
Key
Use this when querying the keyboard state.
Key.A: int
Key.B: int
Key.C: int
[...]
Key.UP: int
Key.DOWN: int
Key.LEFT: int
Key.RIGHT: int
Key.ENTER: int
Key.SPACE: int
Key.TAB: int
[...]
getMouseButtonPressed(mouseButton)
Get if a mouse button got pressed at the current frame.
Arguments
mouseButton: int, available values are MOUSE_BUTTON_LEFT, MOUSE_BUTTON_MID, MOUSE_BUTTON_RIGHT,
Return
bool
getMouseButtonDown(mouseButton)
Get if a mouse button is currently being held down.
Arguments
mouseButton: int, available values are MOUSE_BUTTON_LEFT, MOUSE_BUTTON_MID, MOUSE_BUTTON_RIGHT,
Return
bool
getMouseButtonReleased(mouseButton)
Get if a mouse button got released at the current frame.
Arguments
mouseButton: int, available values are MOUSE_BUTTON_LEFT, MOUSE_BUTTON_MID, MOUSE_BUTTON_RIGHT,
Return
bool
getMousePosition()
Get the screen position of the mouse.
Return
vec2
getMouseWheelDelta()
Get the mouse wheel motion.
Return
float
setMouseRelativeMode(state)
Set the mouse to disappear and trap it inside the window. Useful when making a first person game.
Arguments
state: boolean
getMouseRelativeMode()
Get whether the mouse is set to relative mode.
Return
bool
getMouseRelativeMotion()
Get the relative motion of the mouse from the previous frame.
Return
vec2
getKeyPressed(key)
Check if a key got pressed at the current frame.
Arguments
key:
Return
bool
getKeyReleased(key)
Check if a key got released at the current frame.
Arguments
key:
Return
bool
getKeyDown(key)
Check if a key is currently being held down.
Arguments
key:
Return
bool
isAnyKeyPressed()
Check if any keyboard key is has been pressed during the current frame.
Return
bool
getTextInput()
Get text as it's being typed on the keyboard.
Return
string
getKeyboardLayout()
Get the keyboard layout as a string.
Return
string , possible values are "qwerty", "azerty", "qwertz", "colemak", "dvorak"
getGamepadAxis(gamepadIndex, gamepadAxis)
Get the value of an analogue stick axis.
Arguments
gamepadIndex: int
gamepadAxis: Axis
Return
float
getGamepadButtonDown(gamepadIndex, gamepadButton)
Get if a gamepad button is being held down.
Arguments
gamepadIndex: int
gamepadButton: Button
Return
bool
getGamepadButtonPressed(gamepadIndex, gamepadButton)
Get if a gamepad button was pressed at this frame.
Arguments
gamepadIndex: int
gamepadButton: Button
Return
bool
getGamepadButtonReleased(gamepadIndex, gamepadButton)
Get if a gamepad button was released at this frame.
Arguments
gamepadIndex: int
gamepadButton: Button
Return
bool
getGamepadConnected(gamepadIndex)
Get if a gamepad is connected.
Arguments
gamepadIndex: int
Return
bool
getMouseAndKeyboardInputEnabled()
Get if mouse and keyboard input is enabled. When enabled, the player has full control over mouse and keyboard, meanwhile the editor will hide its GUI to prevent unwanted key and button presses while playing.
Return
bool