A unified game input system supporting keyboard, gamepad, and touchscreen. More...
| Import Statement: | import Clayground.GameController |
GameController provides a simple NES-style controller abstraction with directional axis controls and two action buttons. It supports multiple input sources that can be switched at runtime.
Horizontal directional axis value in range [-1, 1]. Negative values indicate left, positive values indicate right.
Vertical directional axis value in range [-1, 1]. Negative values indicate down, positive values indicate up.
True when the primary action button (A) is pressed.
True when the secondary action button (B) is pressed.
Shows a visual debug overlay displaying current controller state. Useful during development to verify input is working correctly.
True if a physical gamepad is the active input source.
True if the touchscreen virtual gamepad is the active input source.
True if keyboard is the active input source.
Reference to the connected physical gamepad object, or null if none.
Device ID of the connected gamepad, or -1 if no gamepad is connected.
Number of currently connected physical gamepads.
Selects a physical gamepad as the input source. gamePadIdx is the index of the gamepad to select (0-based). useAnalogAxis if true uses analog sticks for axis, otherwise uses D-pad.
Configures keyboard as the input source with specified key mappings. All parameters are Qt.Key values for the respective directions and buttons.
Enables the touchscreen virtual gamepad overlay for touch input.