natiny_input_get_key_pressed
bool natiny_input_get_key_pressed(uint32_t key);
Returns true only on the frame when the specified key was first pressed down.
Parameters
| Name | Type | Description |
|---|---|---|
key |
uint32_t |
Key code - a NATINY_INPUT_KEY_* constant |
Returns
| Type | Description |
|---|---|
bool |
true on the frame the key was pressed, false otherwise |
Example
if (natiny_input_get_key_pressed(NATINY_INPUT_KEY_SPACE))
jump();
Notes
- Returns
truefor the frame that consumes a released-to-pressed transition. - Key constants are listed in Key codes.