crocparty/sys/sys_input.h

34 lines
828 B
C
Raw Normal View History

2024-02-28 05:07:15 +00:00
#ifndef SYS_INPUT_H
#define SYS_INPUT_H
/**
* Update the state of every button. Each button's btnp state depends
* on how long it's been down, and calling this function adds one frame.
*
* Usually this is called by sys_update(), at the start of frame.
*/
void sys_input_update();
/**
* Resets the input state -- all buttons have been held for 0 frames.
*
* If the buttons are held next frame, this will lead to a btnp().
*
* There's rarely any reason for user code to call this.
*/
void sys_input_reset();
/**
* Return whether a button is down.
*/
bool sys_btn(DeviceButton button);
/**
* Return whether a button was just pressed.
*
2024-02-28 05:49:20 +00:00
* If `repeat`, then this repeats after 30 frames, returning true every 8
* frames after that.
2024-02-28 05:07:15 +00:00
*/
2024-02-28 05:49:20 +00:00
bool sys_btnp(DeviceButton button, bool repeat);
2024-02-28 05:07:15 +00:00
#endif // SYS_INPUT_H