topdownengine.controls Reference¶
KeyboardInputManager
¶
Acts as a keyboard and mouse input reciever.
Attributes:
| Name | Type | Description |
|---|---|---|
keybinds |
dict[str, int | str]
|
Stores all keybind data. |
non_hold_inputs |
list[str]
|
List of which inputs can't be held. |
keys |
ScancodeWrapper
|
Keys currently pressed. |
just_pressed_keys |
ScancodeWrapper
|
Keys pressed in the current frame. |
Source code in topdownengine\controls.py
__init__()
¶
Initialize KeyboardInputManager.
deserialize(data)
¶
Deserialize the keybinds into this object.
get_input()
¶
Returns all inputs to execute logic for. MUST be called after pg.event.get().
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: The inputs to execute logic for. |
Source code in topdownengine\controls.py
MoreKeysPressed
¶
Emulates a pygame ScancodeWrapper where given keys are always pressed.
Attributes:
| Name | Type | Description |
|---|---|---|
wrapper |
The base wrapper that keys were added to. |
|
pressed_keys |
The keys added to the wrapper. |