supercasiobros/include/keyboard.h

40 lines
727 B
C
Raw Normal View History

2020-01-29 14:34:47 +01:00
// v0.3
#ifndef MARIO_KEYBOARD_H
#define MARIO_KEYBOARD_H
2019-11-21 19:30:54 +01:00
2020-01-29 14:34:47 +01:00
#define KONAMI
/* Reduced keyboard
2020-01-29 14:34:47 +01:00
It simulates a nes controller */
2019-11-21 19:30:54 +01:00
typedef enum
{
MK_NONE=-1,
2020-01-29 14:34:47 +01:00
MK_LEFT=0,
2019-11-21 19:30:54 +01:00
MK_RIGHT,
2020-01-29 14:34:47 +01:00
MK_DOWN,
MK_UP,
2020-01-29 14:34:47 +01:00
MK_JUMP, // Shift
MK_RUN // Alpha
} MKB_t;
2020-01-29 14:34:47 +01:00
/* 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_getKeyState(MKB_t const k);
2019-11-21 19:30:54 +01:00
2020-01-29 14:34:47 +01:00
// Update the keyboard, should be called at each frame
void MKB_update();
2019-11-21 19:30:54 +01:00
2020-01-29 14:34:47 +01:00
// Reset followed keys' states
void MKB_clear();
2020-01-06 20:56:10 +01:00
2020-01-29 14:34:47 +01:00
// Experimental getkey, designed to compensate for a strange bug introduced by original getkey
// /!\ return gint keycodes
int MKB_getkey();
#endif