#include "libepc.h" #include "tetris.h" #define DOWN(key) key #define UP(key) ((key) | 0x80) #define LEFT 0x4B #define RIGHT 0x4D #define SPACE 0x39 KEYS *GetKeys(void) { static KEYS keys = {FALSE, FALSE, FALSE} ; if (ScanCodeRdy()) switch (GetScanCode()) { case DOWN(LEFT): keys.left_down = TRUE ; break ; case UP(LEFT): keys.left_down = FALSE ; break ; case DOWN(RIGHT): keys.right_down = TRUE ; break ; case UP(RIGHT): keys.right_down = FALSE ; break ; case DOWN(SPACE): keys.space_down = TRUE ; break ; case UP(SPACE): keys.space_down = FALSE ; break ; } return &keys ; }