natiny_input_get_key_pressed

C
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

C
if (natiny_input_get_key_pressed(NATINY_INPUT_KEY_SPACE))
    jump();

Notes

  • Returns true for the frame that consumes a released-to-pressed transition.
  • Key constants are listed in Key codes.