diff options
Diffstat (limited to 'engines/cge/events.h')
-rw-r--r-- | engines/cge/events.h | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/engines/cge/events.h b/engines/cge/events.h index 671878f69a..124597c329 100644 --- a/engines/cge/events.h +++ b/engines/cge/events.h @@ -38,30 +38,33 @@ namespace CGE { /*----------------- KEYBOARD interface -----------------*/ -#define KEYBD_INT 9 -#define LSHIFT 42 -#define RSHIFT 54 -#define CTRL 29 -#define ALT 56 - +#define kKeyCtrl 29 +#define kKeyAlt 56 +#define kEventMax 256 + +enum EventMask { + kMouseRoll = 1 << 0, + kMouseLeftDown = 1 << 1, + kMouseLeftUp = 1 << 2, + kMouseRightDown = 1 << 3, + kMouseRightUp = 1 << 4, + kEventAttn = 1 << 5, + kEventKeyb = 1 << 7 +}; class Keyboard { private: - bool getKey(uint16 keycode, int &cgeCode); + bool getKey(Common::Event &event, int &cgeCode); + uint16 _current; public: static const uint16 _code[0x60]; static const uint16 _scummVmCodes[0x60]; - uint16 _current; Sprite *_client; bool _key[0x60]; void newKeyboard(Common::Event &event); - uint16 last() { - uint16 cur = _current; - _current = 0; - return cur; - } + uint16 lastKey(); Sprite *setClient(Sprite *spr); Keyboard(); @@ -70,23 +73,13 @@ public: /*----------------- MOUSE interface -----------------*/ -#define EVT_MAX 256 -#define ROLL 0x01 -#define L_DN 0x02 -#define L_UP 0x04 -#define R_DN 0x08 -#define R_UP 0x10 -#define ATTN 0x20 // 0x40 -#define KEYB 0x80 - - extern Talk *_talk; struct CGEEvent { - uint16 _msk; + uint16 _mask; uint16 _x; uint16 _y; - Sprite *_ptr; + Sprite *_spritePtr; }; @@ -114,13 +107,19 @@ private: class EventManager { private: Common::Event _event; + CGEEvent _eventQueue[kEventMax]; + uint16 _eventQueueHead; + uint16 _eventQueueTail; + void handleEvents(); public: bool _quitFlag; EventManager(); void poll(); - static void clrEvt(Sprite *spr = NULL); + void clearEvent(Sprite *spr); + + CGEEvent &getNextEvent(); }; } // End of namespace CGE |