crocparty/sys/sys_input.h
2024-02-27 21:49:20 -08:00

34 lines
828 B
C

#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.
*
* If `repeat`, then this repeats after 30 frames, returning true every 8
* frames after that.
*/
bool sys_btnp(DeviceButton button, bool repeat);
#endif // SYS_INPUT_H