diff options
Diffstat (limited to 'include/common.h')
-rw-r--r-- | include/common.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/include/common.h b/include/common.h index 36a2d21..3922a9f 100644 --- a/include/common.h +++ b/include/common.h @@ -9,6 +9,24 @@ enum game_state { GS_PAUSED }; +// Bits in bitmap of keys +#define RIGHT (1 << 0) +#define UP (1 << 1) +#define DOWN (1 << 2) +#define LEFT (1 << 3) +#define RIGHTHOLD (1 << 4) +#define HARDDROP (1 << 5) +#define PAUSE (1 << 6) +#define LEFTHOLD (1 << 7) +#define GAMEOVER (1 << 8) + +struct controls { + uint32_t keys; // bitmap of keys pressed + sfClock *repPushDown; // repeat latency when hold Down arrow + sfClock *repKeyLeft; // repeat latency when hold Left arrow + sfClock *repKeyRight; // repeat latency when hold Right arrow +}; + struct game { enum game_state state; size_t level; @@ -19,9 +37,7 @@ struct game { sfClock *over_wait_tick; sfClock *putTick; sfClock *mTick; - sfClock *repPushDown; // repeat latency when hold Down arrow - sfClock *repKeyLeft; // repeat latency when hold Left arrow - sfClock *repKeyRight; // repeat latency when hold Right arrow + struct controls controls; struct field *fld; struct field *nxt; |