1 #ifndef INCLUDED_BADGE2013_BADGE_UI_EVENT_H
2 #define INCLUDED_BADGE2013_BADGE_UI_EVENT_H
11 BADGE_EVENT_USER_INPUT
,
12 BADGE_EVENT_GAME_TICK
,
16 BADGE_EVENT_KEY_UP
= 1,
17 BADGE_EVENT_KEY_LEFT
= 2,
18 BADGE_EVENT_KEY_DOWN
= 4,
19 BADGE_EVENT_KEY_RIGHT
= 8,
20 BADGE_EVENT_KEY_CENTER
= 16,
21 BADGE_EVENT_KEY_BTN_A
= 32,
22 BADGE_EVENT_KEY_BTN_B
= 64
25 typedef uint16_t badge_event_t
;
27 static inline uint8_t badge_event_type (badge_event_t event
) { return (uint8_t) (event
& 0x03); }
28 static inline uint8_t badge_event_old_input_state(badge_event_t event
) { return (uint8_t) (event
>> 2 & 0x7f); }
29 static inline uint8_t badge_event_new_input_state(badge_event_t event
) { return (uint8_t) (event
>> 9 ); }
31 uint8_t badge_input_raw(void);
32 uint8_t badge_event_current_input_state(void);
34 static inline badge_event_t
badge_event_new(uint8_t type
, uint8_t old_input_state
, uint8_t new_input_state
) {
35 return (badge_event_t
) ((type
& 0x3) | ((badge_event_t
) (old_input_state
& 0x7f) << 2) | ((badge_event_t
) (new_input_state
& 0x7f) << 9));
38 badge_event_t
badge_event_wait(void);
39 void badge_event_start(void);
This page took 0.0424 seconds and 5 git commands to generate.