supercasiobros/include/keyboard.h

39 lines
728 B
C
Executable File

// v0.3
#ifndef MARIO_KEYBOARD_H
#define MARIO_KEYBOARD_H
#define KONAMI
/* Reduced keyboard
It simulates a nes controller */
typedef enum
{
MK_NONE=-1,
MK_LEFT=0,
MK_RIGHT,
MK_DOWN,
MK_UP,
MK_JUMP, // Shift
MK_RUN // Alpha
} mkb_t;
/* This function has been coded to replace the following array
`extern mkey_t keys[6];`
It returns the specific key state
2=newly pressed
1=currently down
0=up
*/
int mkb_getstate(mkb_t const k);
// Update the keyboard, should be called at each frame
void mkb_update();
// Reset followed keys' states
void mkb_clear();
// Experimental getkey, designed to compensate for a strange bug introduced by original getkey
// /!\ return gint keycodes
int mkb_getkey();
#endif