====== input.h ======
===== Functions =====
==== update_inputs ====
This should be called once per frame, ideally right after a v-sync so that the timing is consistent. It updates the controller state variables for both players.
void update_inputs();
==== Input-related Variables ====
extern int player1_buttons, player1_old_buttons, player1_new_buttons;
extern int player2_buttons, player2_old_buttons, player2_new_buttons;
player1_buttons and player2_buttons show the current state of all buttons and directions.
player1_old_buttons and player2_old buttons show the last frame's state of all buttons and directions
player1_new_buttons and player2_new_buttons shows the buttons that have been newly pressed down just now in the current frame
==== Mask Macros ====
These macros are used for checking the state of a particular button in the _buttons variables.
#define INPUT_MASK_UP 2056
#define INPUT_MASK_DOWN 1028
#define INPUT_MASK_LEFT 512
#define INPUT_MASK_RIGHT 256
#define INPUT_MASK_A 16
#define INPUT_MASK_B 4096
#define INPUT_MASK_C 8192
#define INPUT_MASK_START 32
Example of how to check the state of a button
if (player1_new_buttons & INPUT_MASK_A) {
//do something, idk jump
}