From ed54ea9155961d8ca5d5fb3c7777fc57a29f2751 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 17 Mar 2007 19:02:05 +0000 Subject: Moved Event/EventType/keyboard enum from common/system.h (part of class OSystem) to common/events.h (part of namespace Common). Porters may have to make minor changes to their backends to get them to compile again svn-id: r26180 --- backends/platform/PalmOS/Src/base_event.cpp | 45 +++++------ backends/platform/PalmOS/Src/base_mouse.cpp | 2 +- backends/platform/PalmOS/Src/be_base.h | 6 +- backends/platform/PalmOS/Src/be_os5.h | 2 +- backends/platform/PalmOS/Src/be_zodiac.h | 2 +- backends/platform/PalmOS/Src/os5_event.cpp | 8 +- backends/platform/PalmOS/Src/zodiac_event.cpp | 14 ++-- backends/platform/dc/dc.h | 2 +- backends/platform/dc/input.cpp | 27 +++---- backends/platform/dc/selector.cpp | 2 +- backends/platform/dc/softkbd.cpp | 7 +- backends/platform/ds/arm9/source/dsmain.cpp | 54 ++++++------- backends/platform/ds/arm9/source/dsoptions.cpp | 12 +-- backends/platform/ds/arm9/source/osystem_ds.cpp | 12 +-- backends/platform/ds/arm9/source/osystem_ds.h | 6 +- backends/platform/ds/arm9/source/touchkeyboard.cpp | 6 +- backends/platform/gp2x/events.cpp | 89 ++++++++++----------- backends/platform/gp2x/gp2x-common.h | 6 +- backends/platform/gp2x/graphics.cpp | 8 +- backends/platform/gp32/gp32_osys.cpp | 40 +++++----- backends/platform/gp32/gp32_osys.h | 4 +- backends/platform/morphos/morphos.cpp | 33 ++++---- backends/platform/morphos/morphos.h | 2 +- backends/platform/null/null.cpp | 4 +- backends/platform/ps2/ps2input.cpp | 37 ++++----- backends/platform/ps2/ps2input.h | 4 +- backends/platform/ps2/systemps2.cpp | 4 +- backends/platform/ps2/systemps2.h | 2 +- backends/platform/psp/osys_psp.cpp | 10 +-- backends/platform/psp/osys_psp.h | 2 +- backends/platform/psp/osys_psp_gu.cpp | 7 +- backends/platform/psp/osys_psp_gu.h | 2 +- backends/platform/sdl/events.cpp | 91 +++++++++++----------- backends/platform/sdl/graphics.cpp | 8 +- backends/platform/sdl/sdl-common.h | 6 +- backends/platform/symbian/src/SymbianOS.cpp | 27 +++---- backends/platform/symbian/src/SymbianOS.h | 4 +- backends/platform/wince/wince-sdl.cpp | 40 +++++----- backends/platform/wince/wince-sdl.h | 4 +- backends/platform/x11/x11.cpp | 33 ++++---- backends/platform/x11/x11.h | 2 +- 41 files changed, 343 insertions(+), 333 deletions(-) (limited to 'backends/platform') diff --git a/backends/platform/PalmOS/Src/base_event.cpp b/backends/platform/PalmOS/Src/base_event.cpp index b46a3c83ec..7da7cd5861 100644 --- a/backends/platform/PalmOS/Src/base_event.cpp +++ b/backends/platform/PalmOS/Src/base_event.cpp @@ -23,6 +23,7 @@ */ #include "be_base.h" +#include "common/events.h" #ifdef STDLIB_TRACE_MEMORY # include @@ -119,7 +120,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) { event.kbd.keycode = 275; if (event.kbd.keycode) { - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.ascii = event.kbd.keycode; event.kbd.flags = 0; return true; @@ -141,7 +142,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) { if (sx || sy) { simulate_mouse(event, sx, sy, &x, &y); - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; event.mouse.x = x; event.mouse.y = y; warpMouse(x, y); @@ -156,7 +157,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) { switch (ev.data.keyDown.chr) { // ESC key case vchrLaunch: - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = 27; event.kbd.ascii = 27; event.kbd.flags = 0; @@ -164,7 +165,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) { // F5 = menu case vchrMenu: - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = 319; event.kbd.ascii = 319; event.kbd.flags = 0; @@ -206,7 +207,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) { if (abs(y - event.mouse.y) <= 2 || abs(x - event.mouse.x) <= 2) return false; - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; event.mouse.x = x; event.mouse.y = y; warpMouse(x, y); @@ -222,7 +223,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) { (3 - (3 * x / _screenWidth )) - (3 * (3 * y / _screenHeight)); - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = num; event.kbd.ascii = num; event.kbd.flags = 0; @@ -234,7 +235,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) { if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0) return false; - event.type = ((gVars->stylusClick || _overlayVisible) ? EVENT_LBUTTONDOWN : EVENT_MOUSEMOVE); + event.type = ((gVars->stylusClick || _overlayVisible) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_MOUSEMOVE); event.mouse.x = x; event.mouse.y = y; warpMouse(x, y); @@ -243,7 +244,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) { case penUpEvent: get_coordinates(&ev, x, y); - event.type = ((gVars->stylusClick || _overlayVisible) ? EVENT_LBUTTONUP : EVENT_MOUSEMOVE); + event.type = ((gVars->stylusClick || _overlayVisible) ? Common::EVENT_LBUTTONUP : Common::EVENT_MOUSEMOVE); if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0) return false; @@ -272,15 +273,15 @@ bool OSystem_PalmBase::pollEvent(Event &event) { if (_lastKeyModifier == kModifierNone) { // for keyboard mode - if (ev.data.keyDown.modifiers & shiftKeyMask) mask |= KBD_SHIFT; - if (ev.data.keyDown.modifiers & controlKeyMask) mask |= KBD_CTRL; - if (ev.data.keyDown.modifiers & optionKeyMask) mask |= KBD_ALT; - if (ev.data.keyDown.modifiers & commandKeyMask) mask |= KBD_CTRL|KBD_ALT; + if (ev.data.keyDown.modifiers & shiftKeyMask) mask |= Common::KBD_SHIFT; + if (ev.data.keyDown.modifiers & controlKeyMask) mask |= Common::KBD_CTRL; + if (ev.data.keyDown.modifiers & optionKeyMask) mask |= Common::KBD_ALT; + if (ev.data.keyDown.modifiers & commandKeyMask) mask |= Common::KBD_CTRL|Common::KBD_ALT; } else { // for grafiti mode - if (_lastKeyModifier == kModifierCommand) mask = KBD_CTRL|KBD_ALT; - if (_lastKeyModifier == kModifierAlt) mask = KBD_ALT; - if (_lastKeyModifier == kModifierCtrl) mask = KBD_CTRL; + if (_lastKeyModifier == kModifierCommand) mask = Common::KBD_CTRL|Common::KBD_ALT; + if (_lastKeyModifier == kModifierAlt) mask = Common::KBD_ALT; + if (_lastKeyModifier == kModifierCtrl) mask = Common::KBD_CTRL; } if (_lastKeyModifier) @@ -288,22 +289,22 @@ bool OSystem_PalmBase::pollEvent(Event &event) { _lastKeyModifier = kModifierNone; // F1 -> F10 key - if (key >= '0' && key <= '9' && mask == (KBD_CTRL|KBD_ALT)) { + if (key >= '0' && key <= '9' && mask == (Common::KBD_CTRL|Common::KBD_ALT)) { key = (key == '0') ? 324 : (315 + key - '1'); mask = 0; #ifdef STDLIB_TRACE_MEMORY // print memory - } else if (key == 'm' && mask == (KBD_CTRL|KBD_ALT)) { + } else if (key == 'm' && mask == (Common::KBD_CTRL|Common::KBD_ALT)) { printf("Used memory: %d\n", __stdlib_trace_memory); #endif // exit - } else if ((key == 'z' && mask == KBD_CTRL) || (mask == KBD_ALT && key == 'x')) { - event.type = EVENT_QUIT; + } else if ((key == 'z' && mask == Common::KBD_CTRL) || (mask == Common::KBD_ALT && key == 'x')) { + event.type = Common::EVENT_QUIT; return true; // num pad (indy fight mode) - } else if (key == 'n' && mask == (KBD_CTRL|KBD_ALT) && !_overlayVisible) { + } else if (key == 'n' && mask == (Common::KBD_CTRL|Common::KBD_ALT) && !_overlayVisible) { _useNumPad = !_useNumPad; draw_osd(kDrawFight, _screenDest.w - 34, _screenDest.h + 2, _useNumPad, 1); displayMessageOnOSD(_useNumPad ? "Fight mode on." : "Fight mode off."); @@ -312,7 +313,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) { // other keys _wasKey = true; - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = key; event.kbd.ascii = key; event.kbd.flags = mask; @@ -320,7 +321,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) { default: if (_wasKey) { - event.type = EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; _wasKey = false; return true; } diff --git a/backends/platform/PalmOS/Src/base_mouse.cpp b/backends/platform/PalmOS/Src/base_mouse.cpp index 8e6d2724cb..2f3d3f5476 100644 --- a/backends/platform/PalmOS/Src/base_mouse.cpp +++ b/backends/platform/PalmOS/Src/base_mouse.cpp @@ -42,7 +42,7 @@ bool OSystem_PalmBase::showMouse(bool visible) { return last; } -void OSystem_PalmBase::simulate_mouse(Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr) { +void OSystem_PalmBase::simulate_mouse(Common::Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr) { Int16 x = _mouseCurState.x; Int16 y = _mouseCurState.y; Int16 slow, fact; diff --git a/backends/platform/PalmOS/Src/be_base.h b/backends/platform/PalmOS/Src/be_base.h index 1418d69b6c..cd4c38980e 100644 --- a/backends/platform/PalmOS/Src/be_base.h +++ b/backends/platform/PalmOS/Src/be_base.h @@ -95,12 +95,12 @@ private: virtual void undraw_mouse() = 0; // virtual bool check_hard_keys() = 0; - virtual bool check_event(Event &event, EventPtr ev) = 0; + virtual bool check_event(Common::Event &event, EventPtr ev) = 0; virtual void timer_handler(); void battery_handler(); virtual void get_coordinates(EventPtr ev, Coord &x, Coord &y) = 0; - void simulate_mouse(Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr); + void simulate_mouse(Common::Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr); virtual void sound_handler() = 0; virtual bool setSoundCallback(SoundProc proc, void *param) = 0; @@ -229,7 +229,7 @@ public: virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b) = 0; virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) = 0; - bool pollEvent(Event &event); + bool pollEvent(Common::Event &event); virtual uint32 getMillis(); virtual void delayMillis(uint msecs); diff --git a/backends/platform/PalmOS/Src/be_os5.h b/backends/platform/PalmOS/Src/be_os5.h index fdcd70f254..e6c4227e71 100644 --- a/backends/platform/PalmOS/Src/be_os5.h +++ b/backends/platform/PalmOS/Src/be_os5.h @@ -123,7 +123,7 @@ private: void draw_mouse(); void undraw_mouse(); - virtual bool check_event(Event &event, EventPtr ev); + virtual bool check_event(Common::Event &event, EventPtr ev); virtual void extras_palette(uint8 index, uint8 r, uint8 g, uint8 b); void calc_scale(); diff --git a/backends/platform/PalmOS/Src/be_zodiac.h b/backends/platform/PalmOS/Src/be_zodiac.h index d641a51ef1..1d28afa493 100644 --- a/backends/platform/PalmOS/Src/be_zodiac.h +++ b/backends/platform/PalmOS/Src/be_zodiac.h @@ -55,7 +55,7 @@ private: void extras_palette(uint8 index, uint8 r, uint8 g, uint8 b); void calc_rect(Boolean fullscreen); - bool check_event(Event &event, EventPtr ev); + bool check_event(Common::Event &event, EventPtr ev); void draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color = 0); public: diff --git a/backends/platform/PalmOS/Src/os5_event.cpp b/backends/platform/PalmOS/Src/os5_event.cpp index 1e1c8c393e..8af2a717a7 100644 --- a/backends/platform/PalmOS/Src/os5_event.cpp +++ b/backends/platform/PalmOS/Src/os5_event.cpp @@ -41,13 +41,13 @@ bool OSystem_PalmOS5::check_event(Event &event, EventPtr ev) { if (ev->eType == keyUpEvent) { switch (ev->data.keyDown.chr) { case vchrHard3: - event.type = EVENT_LBUTTONUP; + event.type = Common::EVENT_LBUTTONUP; event.mouse.x = _mouseCurState.x; event.mouse.y = _mouseCurState.y; return true; case vchrHard4: - event.type = EVENT_RBUTTONUP; + event.type = Common::EVENT_RBUTTONUP; event.mouse.x = _mouseCurState.x; event.mouse.y = _mouseCurState.y; return true; @@ -70,13 +70,13 @@ bool OSystem_PalmOS5::check_event(Event &event, EventPtr ev) { return false; // not a key case vchrHard3: - event.type = EVENT_RBUTTONDOWN; + event.type = Common::EVENT_RBUTTONDOWN; event.mouse.x = _mouseCurState.x; event.mouse.y = _mouseCurState.y; return true; case vchrHard4: - event.type = EVENT_RBUTTONDOWN; + event.type = Common::EVENT_RBUTTONDOWN; event.mouse.x = _mouseCurState.x; event.mouse.y = _mouseCurState.y; return true; diff --git a/backends/platform/PalmOS/Src/zodiac_event.cpp b/backends/platform/PalmOS/Src/zodiac_event.cpp index fd664ae940..a0e62bda43 100644 --- a/backends/platform/PalmOS/Src/zodiac_event.cpp +++ b/backends/platform/PalmOS/Src/zodiac_event.cpp @@ -24,17 +24,17 @@ #include "be_zodiac.h" -bool OSystem_PalmZodiac::check_event(Event &event, EventPtr ev) { +bool OSystem_PalmZodiac::check_event(Common::Event &event, EventPtr ev) { if (ev->eType == keyUpEvent) { switch (ev->data.keyDown.chr) { case vchrActionLeft: - event.type = EVENT_LBUTTONUP; + event.type = Common::EVENT_LBUTTONUP; event.mouse.x = _mouseCurState.x; event.mouse.y = _mouseCurState.y; return true; case vchrActionRight: - event.type = EVENT_RBUTTONUP; + event.type = Common::EVENT_RBUTTONUP; event.mouse.x = _mouseCurState.x; event.mouse.y = _mouseCurState.y; return true; @@ -44,7 +44,7 @@ bool OSystem_PalmZodiac::check_event(Event &event, EventPtr ev) { switch (ev->data.keyDown.chr) { // F5 = menu case vchrThumbWheelBack: - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = 319; event.kbd.ascii = 319; event.kbd.flags = 0; @@ -59,20 +59,20 @@ bool OSystem_PalmZodiac::check_event(Event &event, EventPtr ev) { return false; // not a key case vchrActionLeft: - event.type = EVENT_LBUTTONDOWN; + event.type = Common::EVENT_LBUTTONDOWN; event.mouse.x = _mouseCurState.x; event.mouse.y = _mouseCurState.y; return true; case vchrActionRight: - event.type = EVENT_RBUTTONDOWN; + event.type = Common::EVENT_RBUTTONDOWN; event.mouse.x = _mouseCurState.x; event.mouse.y = _mouseCurState.y; return true; // skip text case vchrActionDown: - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = '.'; event.kbd.ascii = '.'; event.kbd.flags = 0; diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index bda9d36def..0b723992f3 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -114,7 +114,7 @@ class OSystem_Dreamcast : public OSystem { // Get the next event. // Returns true if an event was retrieved. - bool pollEvent(Event &event); + bool pollEvent(Common::Event &event); // Determine the output sample rate. Audio data provided by the sound // callback will be played using this rate. diff --git a/backends/platform/dc/input.cpp b/backends/platform/dc/input.cpp index 49b6a56e6f..08d3c95e9f 100644 --- a/backends/platform/dc/input.cpp +++ b/backends/platform/dc/input.cpp @@ -25,6 +25,7 @@ #include #include +#include "common/events.h" #include "dc.h" int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, @@ -84,9 +85,9 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, int key = pad->cond.kbd.key[p]; if(shift & 0x08) lmb++; if(shift & 0x80) rmb++; - if(shift & 0x11) shiftFlags |= OSystem::KBD_CTRL; - if(shift & 0x44) shiftFlags |= OSystem::KBD_ALT; - if(shift & 0x22) shiftFlags |= OSystem::KBD_SHIFT; + if(shift & 0x11) shiftFlags |= Common::KBD_CTRL; + if(shift & 0x44) shiftFlags |= Common::KBD_ALT; + if(shift & 0x22) shiftFlags |= Common::KBD_SHIFT; if(key >= 4 && key <= 0x1d) newkey = key+('a'-4); else if(key >= 0x1e && key <= 0x26) @@ -143,26 +144,26 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, if(lmb && !lastlmb) { lastlmb = 1; - return -OSystem::EVENT_LBUTTONDOWN; + return -Common::EVENT_LBUTTONDOWN; } else if(lastlmb && !lmb) { lastlmb = 0; - return -OSystem::EVENT_LBUTTONUP; + return -Common::EVENT_LBUTTONUP; } if(rmb && !lastrmb) { lastrmb = 1; - return -OSystem::EVENT_RBUTTONDOWN; + return -Common::EVENT_RBUTTONDOWN; } else if(lastrmb && !rmb) { lastrmb = 0; - return -OSystem::EVENT_RBUTTONUP; + return -Common::EVENT_RBUTTONUP; } if(mouse_wheel != lastwheel) if(((int8)(mouse_wheel - lastwheel)) > 0) { lastwheel++; - return -OSystem::EVENT_WHEELDOWN; + return -Common::EVENT_WHEELDOWN; } else { --lastwheel; - return -OSystem::EVENT_WHEELUP; + return -Common::EVENT_WHEELUP; } if(newkey && inter && newkey != lastkey) { @@ -187,7 +188,7 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, return 0; } -bool OSystem_Dreamcast::pollEvent(Event &event) +bool OSystem_Dreamcast::pollEvent(Common::Event &event) { unsigned int t = Timer(); @@ -224,9 +225,9 @@ bool OSystem_Dreamcast::pollEvent(Event &event) bool processed = false, down = !(e&(1<<30)); e &= ~(1<<30); if(e < 1000) { - event.type = (down? EVENT_KEYDOWN : EVENT_KEYUP); + event.type = (down? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP); event.kbd.keycode = e; - event.kbd.ascii = (e>='a' && e<='z' && (event.kbd.flags & KBD_SHIFT)? + event.kbd.ascii = (e>='a' && e<='z' && (event.kbd.flags & Common::KBD_SHIFT)? e &~ 0x20 : e); processed = true; } else if(down) { @@ -236,7 +237,7 @@ bool OSystem_Dreamcast::pollEvent(Event &event) } return processed; } else if(_ms_cur_x != _ms_old_x || _ms_cur_y != _ms_old_y) { - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; _ms_old_x = _ms_cur_x; _ms_old_y = _ms_cur_y; return true; diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp index ac6b828105..7abcd2704c 100644 --- a/backends/platform/dc/selector.cpp +++ b/backends/platform/dc/selector.cpp @@ -361,7 +361,7 @@ int gameMenu(Game *games, int num_games) event = handleInput(locked_get_pads(), mousex, mousey, shiftFlags); setimask(mask); - if(event==-OSystem::EVENT_LBUTTONDOWN || event==13 || event==319) { + if(event==-Common::EVENT_LBUTTONDOWN || event==13 || event==319) { int selected_game = top_game + selector_pos; for(int fade=0; fade<=256; fade+=4) { diff --git a/backends/platform/dc/softkbd.cpp b/backends/platform/dc/softkbd.cpp index f0bf4a777c..3a842e8b1b 100644 --- a/backends/platform/dc/softkbd.cpp +++ b/backends/platform/dc/softkbd.cpp @@ -23,6 +23,7 @@ #include #include +#include "common/events.h" #include "engines/engine.h" #include @@ -58,7 +59,7 @@ static const short key_codes[] = K('h','H'), K('j','J'), K('k','K'), K('l','L'), K(';','+'), K(':','*'), K('z','Z'), K('x','X'), K('c','C'), K('v','V'), K('b','B'), K('n','N'), K('m','M'), K(',','<'), K('.','>'), K('/','?'), K('\\','_'), - ~OSystem::KBD_SHIFT, ~OSystem::KBD_CTRL, ~OSystem::KBD_ALT, ' ', 8, 13 + ~Common::KBD_SHIFT, ~Common::KBD_CTRL, ~Common::KBD_ALT, ' ', 8, 13 }; SoftKeyboard::SoftKeyboard(const OSystem_Dreamcast *_os) @@ -96,7 +97,7 @@ void SoftKeyboard::draw(float x, float y, int transp) draw_trans_quad(x, y, x+w, y+24.0, bg, bg, bg, bg); if(key_codes[i]<0 && (shiftState & ~key_codes[i])) labels[0][i].draw(x+2, y+5, txt_alpha_mask|0xffffff, 0.5); - else if(key_codes[i]>8192 && (shiftState & OSystem::KBD_SHIFT)) + else if(key_codes[i]>8192 && (shiftState & Common::KBD_SHIFT)) labels[1][i].draw(x+2, y+5, txt_alpha_mask|0x000000, 0.5); else labels[0][i].draw(x+2, y+5, txt_alpha_mask|0x000000, 0.5); @@ -148,7 +149,7 @@ int SoftKeyboard::key(int k, byte &shiftFlags) else { shiftFlags = shiftState; if(key_codes[keySel] > 8192) - return ((shiftState & OSystem::KBD_SHIFT)? (key_codes[keySel]>>8): + return ((shiftState & Common::KBD_SHIFT)? (key_codes[keySel]>>8): key_codes[keySel]) & 0xff; else return key_codes[keySel]; diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index e73c18badf..24063d81ce 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -851,9 +851,9 @@ void memoryReport() { void addIndyFightingKeys() { OSystem_DS* system = OSystem_DS::instance(); - OSystem::Event event; + Common::Event event; - event.type = OSystem::EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.flags = 0; if ((getKeysDown() & KEY_L)) { @@ -995,7 +995,7 @@ void addEventsToQueue() { consolePrintf("addEventsToQueue\n"); #endif OSystem_DS* system = OSystem_DS::instance(); - OSystem::Event event; + Common::Event event; @@ -1028,7 +1028,7 @@ void addEventsToQueue() { if ((getKeysDown() & KEY_B) && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) { // consolePrintf("Pressing Esc"); - event.type = OSystem::EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = 27; event.kbd.ascii = 27; event.kbd.flags = 0; @@ -1065,13 +1065,13 @@ void addEventsToQueue() { } else { // If we're playing sam and max, click and release the right mouse // button to change verb - OSystem::Event event; + Common::Event event; - event.type = OSystem::EVENT_RBUTTONDOWN; + event.type = Common::EVENT_RBUTTONDOWN; event.mouse = Common::Point(getPenX(), getPenY()); system->addEvent(event); - event.type = OSystem::EVENT_RBUTTONUP; + event.type = Common::EVENT_RBUTTONUP; system->addEvent(event); } } @@ -1099,10 +1099,10 @@ void addEventsToQueue() { updateStatus(); - OSystem::Event event; + Common::Event event; if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) { - event.type = OSystem::EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; event.mouse = Common::Point(getPenX(), getPenY()); system->addEvent(event); //consolePrintf("x=%d y=%d \n", getPenX(), getPenY()); @@ -1111,13 +1111,13 @@ void addEventsToQueue() { if (!keyboardEnable) { if ((mouseMode != MOUSE_HOVER) || (!displayModeIs8Bit)) { if (getPenDown() && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) { - event.type = ((mouseMode == MOUSE_LEFT) || (!displayModeIs8Bit))? OSystem::EVENT_LBUTTONDOWN: OSystem::EVENT_RBUTTONDOWN; + event.type = ((mouseMode == MOUSE_LEFT) || (!displayModeIs8Bit))? Common::EVENT_LBUTTONDOWN: OSystem::EVENT_RBUTTONDOWN; event.mouse = Common::Point(getPenX(), getPenY()); system->addEvent(event); } if (getPenReleased()) { - event.type = mouseMode == MOUSE_LEFT? OSystem::EVENT_LBUTTONUP: OSystem::EVENT_RBUTTONUP; + event.type = mouseMode == MOUSE_LEFT? Common::EVENT_LBUTTONUP: OSystem::EVENT_RBUTTONUP; event.mouse = Common::Point(getPenX(), getPenY()); system->addEvent(event); } @@ -1126,23 +1126,23 @@ void addEventsToQueue() { if (getPenHeld()) { if (getKeysDown() & KEY_LEFT) { - event.type = OSystem::EVENT_LBUTTONDOWN; + event.type = Common::EVENT_LBUTTONDOWN; event.mouse = Common::Point(getPenX(), getPenY()); system->addEvent(event); } /* if (getKeysReleased() & KEY_LEFT) { - event.type = OSystem::EVENT_LBUTTONUP; + event.type = Common::EVENT_LBUTTONUP; event.mouse = Common::Point(getPenX(), getPenY()); system->addEvent(event); }*/ if (getKeysDown() & KEY_RIGHT) { - event.type = OSystem::EVENT_RBUTTONDOWN; + event.type = Common::EVENT_RBUTTONDOWN; event.mouse = Common::Point(getPenX(), getPenY()); system->addEvent(event); } /*if (getKeysReleased() & KEY_RIGHT) { - event.type = OSystem::EVENT_RBUTTONUP; + event.type = Common::EVENT_RBUTTONUP; event.mouse = Common::Point(getPenX(), getPenY()); system->addEvent(event); }*/ @@ -1164,9 +1164,9 @@ void addEventsToQueue() { if (currentGame->control == CONT_SIMON) { // Extra controls for Simon the Sorcerer if ((getKeysDown() & KEY_DOWN)) { - OSystem::Event event; + Common::Event event; - event.type = OSystem::EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = '#'; // F10 or # - show hotspots event.kbd.ascii = '#'; event.kbd.flags = 0; @@ -1178,9 +1178,9 @@ void addEventsToQueue() { if (currentGame->control == CONT_SCUMM_ORIGINAL) { // Extra controls for Scumm v1-5 games if ((getKeysDown() & KEY_DOWN)) { - OSystem::Event event; + Common::Event event; - event.type = OSystem::EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = '.'; // Full stop - skips current dialogue line event.kbd.ascii = '.'; event.kbd.flags = 0; @@ -1200,35 +1200,35 @@ void addEventsToQueue() { // Front end controls if (leftHandedSwap(getKeysDown()) & KEY_UP) { - event.type = OSystem::EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = SDLK_UP; event.kbd.ascii = 0; event.kbd.flags = 0; system->addEvent(event); - event.type = OSystem::EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; system->addEvent(event); } if (leftHandedSwap(getKeysDown()) & KEY_DOWN) { - event.type = OSystem::EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = SDLK_DOWN; event.kbd.ascii = 0; event.kbd.flags = 0; system->addEvent(event); - event.type = OSystem::EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; system->addEvent(event); } if (leftHandedSwap(getKeysDown()) & KEY_A) { - event.type = OSystem::EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = SDLK_RETURN; event.kbd.ascii = 0; event.kbd.flags = 0; system->addEvent(event); - event.type = OSystem::EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; system->addEvent(event); } @@ -1236,13 +1236,13 @@ void addEventsToQueue() { if ((getKeysDown() & KEY_START)) { - event.type = OSystem::EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = 319; // F5 event.kbd.ascii = 319; event.kbd.flags = 0; system->addEvent(event); /* - event.type = OSystem::EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; event.kbd.keycode = 319; // F5 event.kbd.ascii = 319; system->addEvent(event);*/ diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp index 272685a462..b05f50783e 100644 --- a/backends/platform/ds/arm9/source/dsoptions.cpp +++ b/backends/platform/ds/arm9/source/dsoptions.cpp @@ -154,13 +154,13 @@ void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint _delDialog->setList(Scumm::generateSavegameList(Scumm::g_scumm, false)); _delDialog->handleCommand(NULL, GUI::kListSelectionChangedCmd, 0); - OSystem::Event event; - event.type = OSystem::EVENT_KEYDOWN; + Common::Event event; + event.type = Common::EVENT_KEYDOWN; event.kbd.ascii = SDLK_DOWN; event.kbd.keycode = SDLK_DOWN; OSystem_DS::instance()->addEvent(event); - event.type = OSystem::EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; OSystem_DS::instance()->addEvent(event); int idx = _delDialog->runModal(); @@ -182,8 +182,8 @@ void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint void showOptionsDialog() { OSystem_DS* system = OSystem_DS::instance(); - OSystem::Event event; - event.type = OSystem::EVENT_KEYDOWN; + Common::Event event; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = 'P'; // F5 event.kbd.ascii = 'P'; event.kbd.flags = 0; @@ -199,7 +199,7 @@ void showOptionsDialog() { DS::displayMode8Bit(); - event.type = OSystem::EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = 'P'; // F5 event.kbd.ascii = 'P'; event.kbd.flags = 0; diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 70299ae5b2..dff6acad96 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -302,11 +302,11 @@ void OSystem_DS::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, i DS::setCursorIcon(buf, w, h, keycolor); } -void OSystem_DS::addEvent(Event& e) { +void OSystem_DS::addEvent(Common::Event& e) { eventQueue[queuePos++] = e; } -bool OSystem_DS::pollEvent(Event &event) +bool OSystem_DS::pollEvent(Common::Event &event) { if (lastPenFrame != DS::getMillis()) { @@ -316,7 +316,7 @@ bool OSystem_DS::pollEvent(Event &event) queuePos = 0; // Bodge - this last event seems to be processed sometimes and not others. // So we make it something harmless which won't cause any adverse effects. - event.type = EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; event.kbd.ascii = 0; event.kbd.keycode = 0; event.kbd.flags = 0; @@ -331,7 +331,7 @@ bool OSystem_DS::pollEvent(Event &event) /* if (lastPenFrame != DS::getMillis()) { if ((eventNum == 0)) { - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; event.mouse = Common::Point(DS::getPenX(), DS::getPenY()); eventNum = 1; return true; @@ -340,12 +340,12 @@ bool OSystem_DS::pollEvent(Event &event) eventNum = 0; lastPenFrame = DS::getMillis(); if (DS::getPenDown()) { - event.type = EVENT_LBUTTONDOWN; + event.type = Common::EVENT_LBUTTONDOWN; event.mouse = Common::Point(DS::getPenX(), DS::getPenY()); consolePrintf("Down %d, %d ", event.mouse.x, event.mouse.y); return true; } else if (DS::getPenReleased()) { - event.type = EVENT_LBUTTONUP; + event.type = Common::EVENT_LBUTTONUP; event.mouse = Common::Point(DS::getPenX(), DS::getPenY()); consolePrintf("Up %d, %d ", event.mouse.x, event.mouse.y); return true; diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index dfff30bf4a..3f4e56e000 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -42,7 +42,7 @@ public: int eventNum; int lastPenFrame; - Event eventQueue[64]; + Common::Event eventQueue[64]; int queuePos; DSSaveFileManager saveManager; @@ -94,7 +94,7 @@ public: virtual void warpMouse(int x, int y); virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int targetCursorScale = 1); - virtual bool pollEvent(Event &event); + virtual bool pollEvent(Common::Event &event); virtual uint32 getMillis(); virtual void delayMillis(uint msecs); @@ -121,7 +121,7 @@ public: virtual Common::SaveFileManager *getSavefileManager(); - void addEvent(Event& e); + void addEvent(Common::Event& e); bool isEventQueueEmpty() { return queuePos == 0; } virtual bool grabRawScreen(Graphics::Surface* surf); diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp index 3e33786e3e..82271b0d82 100644 --- a/backends/platform/ds/arm9/source/touchkeyboard.cpp +++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp @@ -232,7 +232,7 @@ void addKeyboardEvents() { if (( (tx >= keys[r].x) && (tx <= keys[r].x + 1)) && (ty >= keys[r].y) && (ty <= keys[r].y + 1)) { OSystem_DS* system = OSystem_DS::instance(); - OSystem::Event event; + Common::Event event; // consolePrintf("Key: %d\n", r); if ((keys[r].character == SDLK_UNKNOWN)) { @@ -260,11 +260,11 @@ void addKeyboardEvents() { //event.kbd.keycode = keys[r].character; //event.kbd.ascii = keys[r].character; - event.type = OSystem::EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.flags = 0; system->addEvent(event); - event.type = OSystem::EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; system->addEvent(event); switch (keys[r].character) { diff --git a/backends/platform/gp2x/events.cpp b/backends/platform/gp2x/events.cpp index f3d5ef0d58..7ef18fca01 100644 --- a/backends/platform/gp2x/events.cpp +++ b/backends/platform/gp2x/events.cpp @@ -23,13 +23,14 @@ */ /* - * GP2X: Event Handling. + * GP2X: Common::Event Handling. * */ #include "backends/platform/gp2x/gp2x-common.h" #include "backends/platform/gp2x/gp2x-hw.h" #include "common/util.h" +#include "common/events.h" // FIXME move joystick defines out and replace with confile file options // we should really allow users to map any key to a joystick button @@ -78,7 +79,7 @@ static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) return key; } -void OSystem_GP2X::fillMouseEvent(Event &event, int x, int y) { +void OSystem_GP2X::fillMouseEvent(Common::Event &event, int x, int y) { event.mouse.x = x; event.mouse.y = y; @@ -170,15 +171,15 @@ static byte SDLModToOSystemKeyFlags(SDLMod mod) { // Yopy has no ALT key, steal the SHIFT key // (which isn't used much anyway) if (mod & KMOD_SHIFT) - b |= OSystem::KBD_ALT; + b |= Common::KBD_ALT; #else if (mod & KMOD_SHIFT) - b |= OSystem::KBD_SHIFT; + b |= Common::KBD_SHIFT; if (mod & KMOD_ALT) - b |= OSystem::KBD_ALT; + b |= Common::KBD_ALT; #endif if (mod & KMOD_CTRL) - b |= OSystem::KBD_CTRL; + b |= Common::KBD_CTRL; return b; } @@ -251,17 +252,17 @@ void OSystem_GP2X::moveStick() { //int GP2X_BUTTON_STATE_VOLUP = FALSE; //int GP2X_BUTTON_STATE_VOLDOWN = FALSE; -bool OSystem_GP2X::pollEvent(Event &event) { +bool OSystem_GP2X::pollEvent(Common::Event &event) { SDL_Event ev; int axis; byte b = 0; handleKbdMouse(); - // If the screen mode changed, send an EVENT_SCREEN_CHANGED + // If the screen mode changed, send an Common::EVENT_SCREEN_CHANGED if (_modeChanged) { _modeChanged = false; - event.type = EVENT_SCREEN_CHANGED; + event.type = Common::EVENT_SCREEN_CHANGED; _screenChangeCount++; return true; } @@ -302,7 +303,7 @@ bool OSystem_GP2X::pollEvent(Event &event) { Combos: GP2X_BUTTON_VOLUP & GP2X_BUTTON_VOLDOWN 0 (For Monkey 2 CP) - GP2X_BUTTON_L & GP2X_BUTTON_SELECT EVENT_QUIT (Calls Sync() to make sure SD is flushed) + GP2X_BUTTON_L & GP2X_BUTTON_SELECT Common::EVENT_QUIT (Calls Sync() to make sure SD is flushed) GP2X_BUTTON_L & GP2X_BUTTON_Y Toggles setZoomOnMouse() for larger then 320*240 games to scale to the point + raduis. */ @@ -313,14 +314,14 @@ bool OSystem_GP2X::pollEvent(Event &event) { b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState()); // Alt-Return and Alt-Enter toggle full screen mode - if (b == KBD_ALT && (ev.key.keysym.sym == SDLK_RETURN + if (b == Common::KBD_ALT && (ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_KP_ENTER)) { setFullscreenMode(!_fullscreen); break; } // Alt-S: Create a screenshot - if (b == KBD_ALT && ev.key.keysym.sym == 's') { + if (b == Common::KBD_ALT && ev.key.keysym.sym == 's') { char filename[20]; for (int n = 0;; n++) { @@ -340,7 +341,7 @@ bool OSystem_GP2X::pollEvent(Event &event) { } // Ctrl-m toggles mouse capture - //if (b == KBD_CTRL && ev.key.keysym.sym == 'm') { + //if (b == Common::KBD_CTRL && ev.key.keysym.sym == 'm') { // toggleMouseGrab(); // break; //} @@ -348,25 +349,25 @@ bool OSystem_GP2X::pollEvent(Event &event) { //#ifdef MACOSX // // On Macintosh', Cmd-Q quits // if ((ev.key.keysym.mod & KMOD_META) && ev.key.keysym.sym == 'q') { -// event.type = EVENT_QUIT; +// event.type = Common::EVENT_QUIT; // return true; // } //#elif defined(UNIX) // // On other unices, Control-Q quits // if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'q') { -// event.type = EVENT_QUIT; +// event.type = Common::EVENT_QUIT; // return true; // } //#else // // Ctrl-z and Alt-X quit -// if ((b == KBD_CTRL && ev.key.keysym.sym == 'z') || (b == KBD_ALT && ev.key.keysym.sym == 'x')) { -// event.type = EVENT_QUIT; +// if ((b == Common::KBD_CTRL && ev.key.keysym.sym == 'z') || (b == Common::KBD_ALT && ev.key.keysym.sym == 'x')) { +// event.type = Common::EVENT_QUIT; // return true; // } //#endif // // // Ctrl-Alt- will change the GFX mode -// if ((b & (KBD_CTRL|KBD_ALT)) == (KBD_CTRL|KBD_ALT)) { +// if ((b & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) { // // handleScalerHotkeys(ev.key); // break; @@ -376,7 +377,7 @@ bool OSystem_GP2X::pollEvent(Event &event) { if (event_complete) return true; - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = ev.key.keysym.sym; event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); @@ -389,13 +390,13 @@ bool OSystem_GP2X::pollEvent(Event &event) { if (event_complete) return true; - event.type = EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; event.kbd.keycode = ev.key.keysym.sym; event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState()); // Ctrl-Alt- will change the GFX mode - if ((b & (KBD_CTRL|KBD_ALT)) == (KBD_CTRL|KBD_ALT)) { + if ((b & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) { // Swallow these key up events break; } @@ -403,7 +404,7 @@ bool OSystem_GP2X::pollEvent(Event &event) { return true; } case SDL_MOUSEMOTION: - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, ev.motion.x, ev.motion.y); setMousePos(event.mouse.x, event.mouse.y); @@ -411,14 +412,14 @@ bool OSystem_GP2X::pollEvent(Event &event) { case SDL_MOUSEBUTTONDOWN: if (ev.button.button == SDL_BUTTON_LEFT) - event.type = EVENT_LBUTTONDOWN; + event.type = Common::EVENT_LBUTTONDOWN; else if (ev.button.button == SDL_BUTTON_RIGHT) - event.type = EVENT_RBUTTONDOWN; + event.type = Common::EVENT_RBUTTONDOWN; #if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN) else if (ev.button.button == SDL_BUTTON_WHEELUP) - event.type = EVENT_WHEELUP; + event.type = Common::EVENT_WHEELUP; else if (ev.button.button == SDL_BUTTON_WHEELDOWN) - event.type = EVENT_WHEELDOWN; + event.type = Common::EVENT_WHEELDOWN; #endif else break; @@ -429,9 +430,9 @@ bool OSystem_GP2X::pollEvent(Event &event) { case SDL_MOUSEBUTTONUP: if (ev.button.button == SDL_BUTTON_LEFT) - event.type = EVENT_LBUTTONUP; + event.type = Common::EVENT_LBUTTONUP; else if (ev.button.button == SDL_BUTTON_RIGHT) - event.type = EVENT_RBUTTONUP; + event.type = Common::EVENT_RBUTTONUP; else break; fillMouseEvent(event, ev.button.x, ev.button.y); @@ -443,22 +444,22 @@ bool OSystem_GP2X::pollEvent(Event &event) { case SDL_JOYBUTTONDOWN: _stickBtn[ev.jbutton.button] = 1; if (ev.jbutton.button == JOY_BUT_LMOUSE) { - event.type = EVENT_LBUTTONDOWN; + event.type = Common::EVENT_LBUTTONDOWN; fillMouseEvent(event, _km.x, _km.y); } else if (ev.jbutton.button == GP2X_BUTTON_CLICK) { - event.type = EVENT_LBUTTONDOWN; + event.type = Common::EVENT_LBUTTONDOWN; fillMouseEvent(event, _km.x, _km.y); } else if (ev.jbutton.button == JOY_BUT_RMOUSE) { - event.type = EVENT_RBUTTONDOWN; + event.type = Common::EVENT_RBUTTONDOWN; fillMouseEvent(event, _km.x, _km.y); } else if (_stickBtn[JOY_BUT_COMB] && (ev.jbutton.button == JOY_BUT_EXIT)) { - event.type = EVENT_QUIT; + event.type = Common::EVENT_QUIT; } else if (ev.jbutton.button < 8) { moveStick(); - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, _km.x, _km.y); } else { - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.flags = 0; switch (ev.jbutton.button) { case GP2X_BUTTON_L: @@ -475,7 +476,7 @@ bool OSystem_GP2X::pollEvent(Event &event) { break; case GP2X_BUTTON_SELECT: if (GP2X_BUTTON_STATE_L == TRUE) { - event.type = EVENT_QUIT; + event.type = Common::EVENT_QUIT; } else { event.kbd.keycode = SDLK_ESCAPE; event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0); @@ -506,7 +507,7 @@ bool OSystem_GP2X::pollEvent(Event &event) { // if ((ev.jbutton.button == GP2X_BUTTON_L) && (ev.jbutton.button == GP2X_BUTTON_R)) { // displayMessageOnOSD("Exiting ScummVM"); // //Sync(); - // event.type = EVENT_QUIT; + // event.type = Common::EVENT_QUIT; // break; // } else if ((ev.jbutton.button == GP2X_BUTTON_L) && (ev.jbutton.button != GP2X_BUTTON_R)) { // displayMessageOnOSD("Left Trigger Pressed"); @@ -548,17 +549,17 @@ bool OSystem_GP2X::pollEvent(Event &event) { case SDL_JOYBUTTONUP: _stickBtn[ev.jbutton.button] = 0; if (ev.jbutton.button == JOY_BUT_LMOUSE) { - event.type = EVENT_LBUTTONUP; + event.type = Common::EVENT_LBUTTONUP; fillMouseEvent(event, _km.x, _km.y); } else if (ev.jbutton.button == JOY_BUT_RMOUSE) { - event.type = EVENT_RBUTTONUP; + event.type = Common::EVENT_RBUTTONUP; fillMouseEvent(event, _km.x, _km.y); } else if (ev.jbutton.button < 8) { moveStick(); - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, _km.x, _km.y); } else { - event.type = EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; event.kbd.flags = 0; switch (ev.jbutton.button) { case GP2X_BUTTON_SELECT: @@ -596,10 +597,10 @@ bool OSystem_GP2X::pollEvent(Event &event) { axis = ev.jaxis.value; if ( axis > JOY_DEADZONE) { axis -= JOY_DEADZONE; - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; } else if ( axis < -JOY_DEADZONE ) { axis += JOY_DEADZONE; - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; } else axis = 0; @@ -644,14 +645,14 @@ bool OSystem_GP2X::pollEvent(Event &event) { break; case SDL_QUIT: - event.type = EVENT_QUIT; + event.type = Common::EVENT_QUIT; return true; } } return false; } -bool OSystem_GP2X::remapKey(SDL_Event &ev,Event &event) { +bool OSystem_GP2X::remapKey(SDL_Event &ev,Common::Event &event) { return false; } diff --git a/backends/platform/gp2x/gp2x-common.h b/backends/platform/gp2x/gp2x-common.h index 24c2dba44f..a2c891ef27 100644 --- a/backends/platform/gp2x/gp2x-common.h +++ b/backends/platform/gp2x/gp2x-common.h @@ -129,7 +129,7 @@ public: // Get the next event. // Returns true if an event was retrieved. - virtual bool pollEvent(Event &event); // overloaded by CE backend + virtual bool pollEvent(Common::Event &event); // overloaded by CE backend // Set function that generates samples typedef void (*SoundProc)(void *param, byte *buf, int len); @@ -384,7 +384,7 @@ protected: /** Set the position of the virtual mouse cursor. */ void setMousePos(int x, int y); - virtual void fillMouseEvent(Event &event, int x, int y); + virtual void fillMouseEvent(Common::Event &event, int x, int y); //void toggleMouseGrab(); virtual void internUpdateScreen(); @@ -405,7 +405,7 @@ protected: void setupIcon(); void handleKbdMouse(); - virtual bool remapKey(SDL_Event &ev, Event &event); + virtual bool remapKey(SDL_Event &ev, Common::Event &event); void handleScalerHotkeys(const SDL_KeyboardEvent &key); diff --git a/backends/platform/gp2x/graphics.cpp b/backends/platform/gp2x/graphics.cpp index 01a79e154c..e327ac85e0 100644 --- a/backends/platform/gp2x/graphics.cpp +++ b/backends/platform/gp2x/graphics.cpp @@ -190,7 +190,7 @@ bool OSystem_GP2X::setGraphicsMode(int mode) { if (_transactionMode != kTransactionCommit) internUpdateScreen(); - // Make sure that an EVENT_SCREEN_CHANGED gets sent later + // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later _modeChanged = true; return true; @@ -421,7 +421,7 @@ void OSystem_GP2X::hotswapGFXMode() { // Blit everything to the screen internUpdateScreen(); - // Make sure that an EVENT_SCREEN_CHANGED gets sent later + // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later _modeChanged = true; } @@ -644,7 +644,7 @@ void OSystem_GP2X::setFullscreenMode(bool enable) { // Blit everything to the screen internUpdateScreen(); - // Make sure that an EVENT_SCREEN_CHANGED gets sent later + // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later _modeChanged = true; } #endif @@ -671,7 +671,7 @@ void OSystem_GP2X::setAspectRatioCorrection(bool enable) { hotswapGFXMode(); } - // Make sure that an EVENT_SCREEN_CHANGED gets sent later + // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later _modeChanged = true; } } diff --git a/backends/platform/gp32/gp32_osys.cpp b/backends/platform/gp32/gp32_osys.cpp index 9f3350d752..d1e1e5de70 100644 --- a/backends/platform/gp32/gp32_osys.cpp +++ b/backends/platform/gp32/gp32_osys.cpp @@ -480,7 +480,7 @@ void OSystem_GP32::handleKbdMouse() { } } -void OSystem_GP32::fillMouseEvent(Event &event, int x, int y) { +void OSystem_GP32::fillMouseEvent(Common::Event &event, int x, int y) { event.mouse.x = x; event.mouse.y = y; @@ -493,7 +493,7 @@ void OSystem_GP32::fillMouseEvent(Event &event, int x, int y) { // event.mouse.y = aspect2Real(event.mouse.y); } -bool OSystem_GP32::pollEvent(Event &event) { +bool OSystem_GP32::pollEvent(Common::Event &event) { //NP("OSys::pollEvent()"); GP32BtnEvent ev; @@ -521,7 +521,7 @@ bool OSystem_GP32::pollEvent(Event &event) { _km.y_down_count = 1; } if (ev.button == GPC_VK_START) { // START = menu/enter - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; if (_overlayVisible) event.kbd.keycode = event.kbd.ascii = 13; else @@ -529,27 +529,27 @@ bool OSystem_GP32::pollEvent(Event &event) { return true; } if (ev.button == GPC_VK_SELECT) { // SELECT = pause - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = event.kbd.ascii = 32; return true; } if (ev.button == GPC_VK_FL) { - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = event.kbd.ascii = '0'; return true; } if (ev.button == GPC_VK_FR) { // R = ESC - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = event.kbd.ascii = 27; return true; } if (ev.button == GPC_VK_FA) { - event.type = EVENT_LBUTTONDOWN; + event.type = Common::EVENT_LBUTTONDOWN; fillMouseEvent(event, _km.x, _km.y); return true; } if (ev.button == GPC_VK_FB) { - event.type = EVENT_RBUTTONDOWN; + event.type = Common::EVENT_RBUTTONDOWN; fillMouseEvent(event, _km.x, _km.y); return true; } @@ -560,7 +560,7 @@ bool OSystem_GP32::pollEvent(Event &event) { _km.x_vel = 0; _km.x_down_count = 0; } - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, _km.x, _km.y); return true; } @@ -569,7 +569,7 @@ bool OSystem_GP32::pollEvent(Event &event) { _km.x_vel = 0; _km.x_down_count = 0; } - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, _km.x, _km.y); return true; } @@ -578,7 +578,7 @@ bool OSystem_GP32::pollEvent(Event &event) { _km.y_vel = 0; _km.y_down_count = 0; } - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, _km.x, _km.y); return true; } @@ -587,13 +587,13 @@ bool OSystem_GP32::pollEvent(Event &event) { _km.y_vel = 0; _km.y_down_count = 0; } - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, _km.x, _km.y); return true; } if (ev.button == GPC_VK_START) { - event.type = EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; if (_overlayVisible) event.kbd.keycode = event.kbd.ascii = 13; else @@ -601,40 +601,40 @@ bool OSystem_GP32::pollEvent(Event &event) { return true; } if (ev.button == GPC_VK_SELECT) { - event.type = EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; event.kbd.keycode = event.kbd.ascii = 32; return true; } if (ev.button == GPC_VK_FL) { - event.type = EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; event.kbd.keycode = event.kbd.ascii = '0'; return true; } if (ev.button == GPC_VK_FR) { - event.type = EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; event.kbd.keycode = event.kbd.ascii = 27; return true; } if (ev.button == GPC_VK_FA) { - event.type = EVENT_LBUTTONUP; + event.type = Common::EVENT_LBUTTONUP; fillMouseEvent(event, _km.x, _km.y); return true; } if (ev.button == GPC_VK_FB) { - event.type = EVENT_RBUTTONUP; + event.type = Common::EVENT_RBUTTONUP; fillMouseEvent(event, _km.x, _km.y); return true; } break; default: - error("Unknown Event!"); + error("Unknown Common::Event!"); } if (gp_getButtonPressed(GPC_VK_LEFT) || gp_getButtonPressed(GPC_VK_RIGHT) || gp_getButtonPressed(GPC_VK_UP) || gp_getButtonPressed(GPC_VK_DOWN)) { - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, _km.x, _km.y); return true; } diff --git a/backends/platform/gp32/gp32_osys.h b/backends/platform/gp32/gp32_osys.h index 474c56754d..96d2b0d592 100644 --- a/backends/platform/gp32/gp32_osys.h +++ b/backends/platform/gp32/gp32_osys.h @@ -124,7 +124,7 @@ public: void warpMouse(int x, int y); void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int cursorTargetScale = 1); - bool pollEvent(Event &event); + bool pollEvent(Common::Event &event); uint32 getMillis(); void delayMillis(uint msecs); @@ -145,7 +145,7 @@ public: void displayMessageOnOSD(const char *msg); - void fillMouseEvent(Event &event, int x, int y); + void fillMouseEvent(Common::Event &event, int x, int y); void handleKbdMouse(); }; diff --git a/backends/platform/morphos/morphos.cpp b/backends/platform/morphos/morphos.cpp index 9fe082995c..2b92809691 100644 --- a/backends/platform/morphos/morphos.cpp +++ b/backends/platform/morphos/morphos.cpp @@ -24,6 +24,7 @@ #include "common/stdafx.h" #include "engines/engine.h" +#include "common/events.h" #include "common/util.h" #include "scumm/scumm.h" @@ -799,7 +800,7 @@ void OSystem_MorphOS::SwitchScalerTo(SCALERTYPE newScaler) } } -bool OSystem_MorphOS::pollEvent(Event &event) +bool OSystem_MorphOS::pollEvent(Common::Event &event) { IntuiMessage *ScummMsg; @@ -819,14 +820,14 @@ bool OSystem_MorphOS::pollEvent(Event &event) FakedIEvent.ie_Code = ScummMsg->Code; if (ScummMsg->Qualifier & (IEQUALIFIER_LALT | IEQUALIFIER_RALT)) - qual |= KBD_ALT; + qual |= Common::KBD_ALT; if (ScummMsg->Qualifier & (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)) - qual |= KBD_SHIFT; + qual |= Common::KBD_SHIFT; if (ScummMsg->Qualifier & IEQUALIFIER_CONTROL) - qual |= KBD_CTRL; + qual |= Common::KBD_CTRL; event.kbd.flags = qual; - event.type = (ScummMsg->Code & IECODE_UP_PREFIX) ? EVENT_KEYUP : EVENT_KEYDOWN; + event.type = (ScummMsg->Code & IECODE_UP_PREFIX) ? Common::EVENT_KEYUP : Common::EVENT_KEYDOWN; ScummMsg->Code &= ~IECODE_UP_PREFIX; if (ScummMsg->Code >= RAWKEY_F1 && ScummMsg->Code <= RAWKEY_F10) @@ -850,16 +851,16 @@ bool OSystem_MorphOS::pollEvent(Event &event) /* * Wheelmouse event */ - event.type = (ScummMsg->Code == NM_WHEEL_UP) ? EVENT_WHEELUP : EVENT_WHEELDOWN; + event.type = (ScummMsg->Code == NM_WHEEL_UP) ? Common::EVENT_WHEELUP : Common::EVENT_WHEELDOWN; } else if (MapRawKey(&FakedIEvent, &charbuf, 1, NULL) == 1) { - if (qual == KBD_CTRL && charbuf == 'z') + if (qual == Common::KBD_CTRL && charbuf == 'z') { - event.type = EVENT_QUIT; + event.type = Common::EVENT_QUIT; break; } - else if (qual == KBD_ALT) + else if (qual == Common::KBD_ALT) { if (charbuf >= '0' && charbuf <= '9') { @@ -871,7 +872,7 @@ bool OSystem_MorphOS::pollEvent(Event &event) } else if (charbuf == 'x') { - event.type = EVENT_QUIT; + event.type = Common::EVENT_QUIT; break; } else if (charbuf == 0x0d) @@ -916,7 +917,7 @@ bool OSystem_MorphOS::pollEvent(Event &event) else if (FullScreenMode) newy = newy > ScummScale)-2; - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; event.mouse.x = newx; event.mouse.y = newy; set_mouse_pos(event.mouse.x, event.mouse.y); @@ -933,19 +934,19 @@ bool OSystem_MorphOS::pollEvent(Event &event) switch (ScummMsg->Code) { case SELECTDOWN: - event.type = EVENT_LBUTTONDOWN; + event.type = Common::EVENT_LBUTTONDOWN; break; case SELECTUP: - event.type = EVENT_LBUTTONUP; + event.type = Common::EVENT_LBUTTONUP; break; case MENUDOWN: - event.type = EVENT_RBUTTONDOWN; + event.type = Common::EVENT_RBUTTONDOWN; break; case MENUUP: - event.type = EVENT_RBUTTONUP; + event.type = Common::EVENT_RBUTTONUP; break; default: @@ -958,7 +959,7 @@ bool OSystem_MorphOS::pollEvent(Event &event) } case IDCMP_CLOSEWINDOW: - event.type = EVENT_QUIT; + event.type = Common::EVENT_QUIT; break; } diff --git a/backends/platform/morphos/morphos.h b/backends/platform/morphos/morphos.h index 67ed8a481e..46ed2fdcc0 100644 --- a/backends/platform/morphos/morphos.h +++ b/backends/platform/morphos/morphos.h @@ -95,7 +95,7 @@ class OSystem_MorphOS : public OSystem // Get the next event. // Returns true if an event was retrieved. - virtual bool pollEvent(Event &event); + virtual bool pollEvent(Common::Event &event); // Moves mouse pointer to specified position virtual void warpMouse(int x, int y); diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp index 0aa6a5d978..c13e8e56ff 100644 --- a/backends/platform/null/null.cpp +++ b/backends/platform/null/null.cpp @@ -76,7 +76,7 @@ public: virtual void warpMouse(int x, int y); virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255); - virtual bool pollEvent(Event &event); + virtual bool pollEvent(Common::Event &event); virtual uint32 getMillis(); virtual void delayMillis(uint msecs); @@ -232,7 +232,7 @@ void OSystem_NULL::warpMouse(int x, int y) { void OSystem_NULL::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor) { } -bool OSystem_NULL::pollEvent(Event &event) { +bool OSystem_NULL::pollEvent(Common::Event &event) { return false; } diff --git a/backends/platform/ps2/ps2input.cpp b/backends/platform/ps2/ps2input.cpp index bfca9f83be..5297b38747 100644 --- a/backends/platform/ps2/ps2input.cpp +++ b/backends/platform/ps2/ps2input.cpp @@ -29,6 +29,7 @@ #include "backends/platform/ps2/ps2pad.h" #include "backends/platform/ps2/systemps2.h" #include "backends/platform/ps2/sdlkeys.h" +#include "common/events.h" #include "common/system.h" Ps2Input::Ps2Input(OSystem_PS2 *system, bool mouseLoaded, bool kbdLoaded) { @@ -98,7 +99,7 @@ int Ps2Input::mapKey(int key, int mod) { // copied from sdl backend return key - SDLK_KP0 + '0'; } else if (key >= SDLK_UP && key <= SDLK_PAGEDOWN) { return key; - } else if (key >= 'a' && key <= 'z' && mod & OSystem::KBD_SHIFT) { + } else if (key >= 'a' && key <= 'z' && mod & Common::KBD_SHIFT) { return key & ~0x20; } else if (key >= SDLK_NUMLOCK && key <= SDLK_EURO) { return 0; @@ -106,7 +107,7 @@ int Ps2Input::mapKey(int key, int mod) { // copied from sdl backend return key; } -bool Ps2Input::pollEvent(OSystem::Event *event) { +bool Ps2Input::pollEvent(Common::Event *event) { bool checkPadMouse, checkPadKbd; checkPadMouse = checkPadKbd = _pad->padAlive(); @@ -116,7 +117,7 @@ bool Ps2Input::pollEvent(OSystem::Event *event) { if ((_posX != mData.x) || (_posY != mData.y)) { event->mouse.x = _posX = mData.x; event->mouse.y = _posY = mData.y; - event->type = OSystem::EVENT_MOUSEMOVE; + event->type = Common::EVENT_MOUSEMOVE; return true; } if (mData.buttons != _mButtons) { @@ -124,9 +125,9 @@ bool Ps2Input::pollEvent(OSystem::Event *event) { _mButtons = mData.buttons; if (change & (PS2MOUSE_BTN1 | PS2MOUSE_BTN2)) { if (change & PS2MOUSE_BTN1) - event->type = (_mButtons & PS2MOUSE_BTN1) ? OSystem::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP; + event->type = (_mButtons & PS2MOUSE_BTN1) ? Common::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP; else - event->type = (_mButtons & PS2MOUSE_BTN2) ? OSystem::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP; + event->type = (_mButtons & PS2MOUSE_BTN2) ? Common::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP; event->mouse.x = _posX; event->mouse.y = _posY; return true; @@ -140,24 +141,24 @@ bool Ps2Input::pollEvent(OSystem::Event *event) { if (_usbToSdlk[key.key]) { if ((_usbToSdlk[key.key] == SDLK_LSHIFT) || (_usbToSdlk[key.key] == SDLK_RSHIFT)) { if (key.state & 1) - _keyFlags |= OSystem::KBD_SHIFT; + _keyFlags |= Common::KBD_SHIFT; else - _keyFlags &= ~OSystem::KBD_SHIFT; + _keyFlags &= ~Common::KBD_SHIFT; } else if ((_usbToSdlk[key.key] == SDLK_LCTRL) || (_usbToSdlk[key.key] == SDLK_RCTRL)) { if (key.state & 1) - _keyFlags |= OSystem::KBD_CTRL; + _keyFlags |= Common::KBD_CTRL; else - _keyFlags &= ~OSystem::KBD_CTRL; + _keyFlags &= ~Common::KBD_CTRL; } else if ((_usbToSdlk[key.key] == SDLK_LALT) || (_usbToSdlk[key.key] == SDLK_RALT)) { if (key.state & 1) - _keyFlags |= OSystem::KBD_ALT; + _keyFlags |= Common::KBD_ALT; else - _keyFlags &= ~OSystem::KBD_ALT; + _keyFlags &= ~Common::KBD_ALT; } if (key.state & 1) // down - event->type = OSystem::EVENT_KEYDOWN; + event->type = Common::EVENT_KEYDOWN; else - event->type = OSystem::EVENT_KEYUP; + event->type = Common::EVENT_KEYUP; event->kbd.flags = 0; event->kbd.keycode = _usbToSdlk[key.key]; event->kbd.ascii = mapKey(_usbToSdlk[key.key], _keyFlags); @@ -176,9 +177,9 @@ bool Ps2Input::pollEvent(OSystem::Event *event) { if (checkPadMouse) { if (btnChange & (PAD_CROSS | PAD_CIRCLE)) { if (btnChange & PAD_CROSS) - event->type = (buttons & PAD_CROSS) ? OSystem::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP; + event->type = (buttons & PAD_CROSS) ? Common::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP; else - event->type = (buttons & PAD_CIRCLE) ? OSystem::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP; + event->type = (buttons & PAD_CIRCLE) ? Common::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP; event->mouse.x = _posX; event->mouse.y = _posY; _padLastButtons = buttons; @@ -211,7 +212,7 @@ bool Ps2Input::pollEvent(OSystem::Event *event) { newX = ((newX < (int16)_minx) ? (_minx) : ((newX > (int16)_maxx) ? (_maxx) : ((int16)newX))); newY = ((newY < (int16)_miny) ? (_miny) : ((newY > (int16)_maxy) ? (_maxy) : ((int16)newY))); if ((_posX != newX) || (_posY != newY)) { - event->type = OSystem::EVENT_MOUSEMOVE; + event->type = Common::EVENT_MOUSEMOVE; event->mouse.x = _posX = newX; event->mouse.y = _posY = newY; return true; @@ -228,7 +229,7 @@ bool Ps2Input::pollEvent(OSystem::Event *event) { return false; } -bool Ps2Input::getKeyEvent(OSystem::Event *event, uint16 buttonCode, bool down) { +bool Ps2Input::getKeyEvent(Common::Event *event, uint16 buttonCode, bool down) { // for simulating key presses with the pad if (buttonCode) { uint8 entry = 0; @@ -237,7 +238,7 @@ bool Ps2Input::getKeyEvent(OSystem::Event *event, uint16 buttonCode, bool down) buttonCode >>= 1; } if (_padCodes[entry]) { - event->type = (down) ? OSystem::EVENT_KEYDOWN : OSystem::EVENT_KEYUP; + event->type = (down) ? Common::EVENT_KEYDOWN : OSystem::EVENT_KEYUP; event->kbd.keycode = _padCodes[entry]; event->kbd.flags = _padFlags[entry]; event->kbd.ascii = mapKey(_padCodes[entry], _padFlags[entry]); diff --git a/backends/platform/ps2/ps2input.h b/backends/platform/ps2/ps2input.h index c7a29c7bfd..6a6bdfe2e9 100644 --- a/backends/platform/ps2/ps2input.h +++ b/backends/platform/ps2/ps2input.h @@ -33,11 +33,11 @@ public: Ps2Input(OSystem_PS2 *system, bool mouseLoaded, bool kbdLoaded); ~Ps2Input(void); void newRange(uint16 minx, uint16 miny, uint16 maxx, uint16 maxy); - bool pollEvent(OSystem::Event *event); + bool pollEvent(Common::Event *event); void warpTo(uint16 x, uint16 y); private: int mapKey(int key, int mod); - bool getKeyEvent(OSystem::Event *event, uint16 buttonCode, bool down); + bool getKeyEvent(Common::Event *event, uint16 buttonCode, bool down); OSystem_PS2 *_system; Ps2Pad *_pad; diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index 6c479f30d7..4ba426590c 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -649,9 +649,9 @@ int OSystem_PS2::getDefaultGraphicsMode(void) const { return 0; } -bool OSystem_PS2::pollEvent(Event &event) { +bool OSystem_PS2::pollEvent(Common::Event &event) { bool res = _input->pollEvent(&event); - if (res && (event.type == EVENT_MOUSEMOVE)) + if (res && (event.type == Common::EVENT_MOUSEMOVE)) _screen->setMouseXy(event.mouse.x, event.mouse.y); return res; } diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index 4c51e78c66..f3821cee66 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -70,7 +70,7 @@ public: virtual uint32 getMillis(); virtual void delayMillis(uint msecs); virtual void setTimerCallback(TimerProc callback, int interval); - virtual bool pollEvent(Event &event); + virtual bool pollEvent(Common::Event &event); virtual bool setSoundCallback(SoundProc proc, void *param); virtual void clearSoundCallback(); diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 42e066b543..27cfa0fefb 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -417,7 +417,7 @@ void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, #define PAD_CHECK_TIME 40 #define PAD_DIR_MASK (PSP_CTRL_UP | PSP_CTRL_DOWN | PSP_CTRL_LEFT | PSP_CTRL_RIGHT) -bool OSystem_PSP::pollEvent(Event &event) { +bool OSystem_PSP::pollEvent(Common::Event &event) { s8 analogStepAmountX = 0; s8 analogStepAmountY = 0; /* @@ -431,14 +431,14 @@ bool OSystem_PSP::pollEvent(Event &event) { if (buttonsChanged & (PSP_CTRL_CROSS | PSP_CTRL_CIRCLE | PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER | PSP_CTRL_START | PSP_CTRL_SELECT | PSP_CTRL_SQUARE)) { if (buttonsChanged & PSP_CTRL_CROSS) { - event.type = (pad.Buttons & PSP_CTRL_CROSS) ? OSystem::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP; + event.type = (pad.Buttons & PSP_CTRL_CROSS) ? Common::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP; } else if (buttonsChanged & PSP_CTRL_CIRCLE) { - event.type = (pad.Buttons & PSP_CTRL_CIRCLE) ? OSystem::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP; + event.type = (pad.Buttons & PSP_CTRL_CIRCLE) ? Common::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP; } else { //any of the other buttons. - event.type = buttonsChanged & pad.Buttons ? OSystem::EVENT_KEYDOWN : OSystem::EVENT_KEYUP; + event.type = buttonsChanged & pad.Buttons ? Common::EVENT_KEYDOWN : OSystem::EVENT_KEYUP; event.kbd.flags = 0; if (buttonsChanged & PSP_CTRL_LTRIGGER) { @@ -537,7 +537,7 @@ bool OSystem_PSP::pollEvent(Event &event) { } if ((_mouseX != newX) || (_mouseY != newY)) { - event.type = OSystem::EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; event.mouse.x = _mouseX = newX; event.mouse.y = _mouseY = newY; return true; diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index d8c92da431..fe5d5f3195 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -123,7 +123,7 @@ public: virtual void warpMouse(int x, int y); virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int cursorTargetScale = 1); - virtual bool pollEvent(Event &event); + virtual bool pollEvent(Common::Event &event); virtual uint32 getMillis(); virtual void delayMillis(uint msecs); diff --git a/backends/platform/psp/osys_psp_gu.cpp b/backends/platform/psp/osys_psp_gu.cpp index 7553140118..871d93acba 100644 --- a/backends/platform/psp/osys_psp_gu.cpp +++ b/backends/platform/psp/osys_psp_gu.cpp @@ -25,6 +25,7 @@ #include #include "osys_psp_gu.h" #include "./trace.h" +#include "common/events.h" #define PIXEL_SIZE (4) #define BUF_WIDTH (512) @@ -451,7 +452,7 @@ void OSystem_PSP_GU::updateScreen() { //sceKernelDcacheWritebackAll(); } -bool OSystem_PSP_GU::pollEvent(Event &event) { +bool OSystem_PSP_GU::pollEvent(Common::Event &event) { float nub_angle = -1; int x, y; @@ -522,7 +523,7 @@ bool OSystem_PSP_GU::pollEvent(Event &event) { _kbdClut[_keySelected] = 0xffff; if (buttonsChanged & PSP_CTRL_CROSS) { - event.type = (pad.Buttons & PSP_CTRL_CROSS) ? OSystem::EVENT_KEYDOWN : OSystem::EVENT_KEYUP; + event.type = (pad.Buttons & PSP_CTRL_CROSS) ? Common::EVENT_KEYDOWN : OSystem::EVENT_KEYUP; if(_keySelected > 26) { event.kbd.flags = 0; switch(_keySelected) { @@ -553,7 +554,7 @@ bool OSystem_PSP_GU::pollEvent(Event &event) { case CAPS_LOCK: event.kbd.ascii = 'A'+_keySelected-1; event.kbd.keycode = SDLK_a + _keySelected-1; - event.kbd.flags = KBD_SHIFT; + event.kbd.flags = Common::KBD_SHIFT; break; case SYMBOLS: if (_keySelected < 21) { diff --git a/backends/platform/psp/osys_psp_gu.h b/backends/platform/psp/osys_psp_gu.h index b1445a520e..1a9a6d9ee1 100644 --- a/backends/platform/psp/osys_psp_gu.h +++ b/backends/platform/psp/osys_psp_gu.h @@ -48,7 +48,7 @@ public: void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale); void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) ; void setPalette(const byte *colors, uint start, uint num); - bool pollEvent(Event &event); + bool pollEvent(Common::Event &event); int _graphicMode; struct Vertex *_vertices; unsigned short* _clut; diff --git a/backends/platform/sdl/events.cpp b/backends/platform/sdl/events.cpp index 325222f8be..09c49405d8 100644 --- a/backends/platform/sdl/events.cpp +++ b/backends/platform/sdl/events.cpp @@ -23,6 +23,7 @@ #include "backends/platform/sdl/sdl-common.h" #include "common/util.h" +#include "common/events.h" // FIXME move joystick defines out and replace with confile file options // we should really allow users to map any key to a joystick button @@ -64,7 +65,7 @@ static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) return key; } -void OSystem_SDL::fillMouseEvent(Event &event, int x, int y) { +void OSystem_SDL::fillMouseEvent(Common::Event &event, int x, int y) { event.mouse.x = x; event.mouse.y = y; @@ -156,30 +157,30 @@ static byte SDLModToOSystemKeyFlags(SDLMod mod) { // Yopy has no ALT key, steal the SHIFT key // (which isn't used much anyway) if (mod & KMOD_SHIFT) - b |= OSystem::KBD_ALT; + b |= Common::KBD_ALT; #else if (mod & KMOD_SHIFT) - b |= OSystem::KBD_SHIFT; + b |= Common::KBD_SHIFT; if (mod & KMOD_ALT) - b |= OSystem::KBD_ALT; + b |= Common::KBD_ALT; #endif if (mod & KMOD_CTRL) - b |= OSystem::KBD_CTRL; + b |= Common::KBD_CTRL; return b; } -bool OSystem_SDL::pollEvent(Event &event) { +bool OSystem_SDL::pollEvent(Common::Event &event) { SDL_Event ev; int axis; byte b = 0; handleKbdMouse(); - // If the screen mode changed, send an EVENT_SCREEN_CHANGED + // If the screen mode changed, send an Common::EVENT_SCREEN_CHANGED if (_modeChanged) { _modeChanged = false; - event.type = EVENT_SCREEN_CHANGED; + event.type = Common::EVENT_SCREEN_CHANGED; _screenChangeCount++; return true; } @@ -190,7 +191,7 @@ bool OSystem_SDL::pollEvent(Event &event) { b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState()); // Alt-Return and Alt-Enter toggle full screen mode - if (b == KBD_ALT && (ev.key.keysym.sym == SDLK_RETURN + if (b == Common::KBD_ALT && (ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_KP_ENTER)) { setFullscreenMode(!_fullscreen); #ifdef USE_OSD @@ -204,7 +205,7 @@ bool OSystem_SDL::pollEvent(Event &event) { } // Alt-S: Create a screenshot - if (b == KBD_ALT && ev.key.keysym.sym == 's') { + if (b == Common::KBD_ALT && ev.key.keysym.sym == 's') { char filename[20]; for (int n = 0;; n++) { @@ -224,7 +225,7 @@ bool OSystem_SDL::pollEvent(Event &event) { } // Ctrl-m toggles mouse capture - if (b == KBD_CTRL && ev.key.keysym.sym == 'm') { + if (b == Common::KBD_CTRL && ev.key.keysym.sym == 'm') { toggleMouseGrab(); break; } @@ -233,25 +234,25 @@ bool OSystem_SDL::pollEvent(Event &event) { // On Macintosh', Cmd-Q quits // On Amigas, Amiga-Q quits if ((ev.key.keysym.mod & KMOD_META) && ev.key.keysym.sym == 'q') { - event.type = EVENT_QUIT; + event.type = Common::EVENT_QUIT; return true; } #elif defined(UNIX) // On other unices, Control-Q quits if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'q') { - event.type = EVENT_QUIT; + event.type = Common::EVENT_QUIT; return true; } #else // Ctrl-z and Alt-X quit - if ((b == KBD_CTRL && ev.key.keysym.sym == 'z') || (b == KBD_ALT && ev.key.keysym.sym == 'x')) { - event.type = EVENT_QUIT; + if ((b == Common::KBD_CTRL && ev.key.keysym.sym == 'z') || (b == Common::KBD_ALT && ev.key.keysym.sym == 'x')) { + event.type = Common::EVENT_QUIT; return true; } #endif // Ctrl-Alt- will change the GFX mode - if ((b & (KBD_CTRL|KBD_ALT)) == (KBD_CTRL|KBD_ALT)) { + if ((b & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) { handleScalerHotkeys(ev.key); break; @@ -261,7 +262,7 @@ bool OSystem_SDL::pollEvent(Event &event) { if (event_complete) return true; - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = ev.key.keysym.sym; event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); @@ -274,13 +275,13 @@ bool OSystem_SDL::pollEvent(Event &event) { if (event_complete) return true; - event.type = EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; event.kbd.keycode = ev.key.keysym.sym; event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState()); // Ctrl-Alt- will change the GFX mode - if ((b & (KBD_CTRL|KBD_ALT)) == (KBD_CTRL|KBD_ALT)) { + if ((b & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) { // Swallow these key up events break; } @@ -288,7 +289,7 @@ bool OSystem_SDL::pollEvent(Event &event) { return true; } case SDL_MOUSEMOTION: - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, ev.motion.x, ev.motion.y); setMousePos(event.mouse.x, event.mouse.y); @@ -296,14 +297,14 @@ bool OSystem_SDL::pollEvent(Event &event) { case SDL_MOUSEBUTTONDOWN: if (ev.button.button == SDL_BUTTON_LEFT) - event.type = EVENT_LBUTTONDOWN; + event.type = Common::EVENT_LBUTTONDOWN; else if (ev.button.button == SDL_BUTTON_RIGHT) - event.type = EVENT_RBUTTONDOWN; + event.type = Common::EVENT_RBUTTONDOWN; #if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN) else if (ev.button.button == SDL_BUTTON_WHEELUP) - event.type = EVENT_WHEELUP; + event.type = Common::EVENT_WHEELUP; else if (ev.button.button == SDL_BUTTON_WHEELDOWN) - event.type = EVENT_WHEELDOWN; + event.type = Common::EVENT_WHEELDOWN; #endif else break; @@ -314,9 +315,9 @@ bool OSystem_SDL::pollEvent(Event &event) { case SDL_MOUSEBUTTONUP: if (ev.button.button == SDL_BUTTON_LEFT) - event.type = EVENT_LBUTTONUP; + event.type = Common::EVENT_LBUTTONUP; else if (ev.button.button == SDL_BUTTON_RIGHT) - event.type = EVENT_RBUTTONUP; + event.type = Common::EVENT_RBUTTONUP; else break; fillMouseEvent(event, ev.button.x, ev.button.y); @@ -325,13 +326,13 @@ bool OSystem_SDL::pollEvent(Event &event) { case SDL_JOYBUTTONDOWN: if (ev.jbutton.button == JOY_BUT_LMOUSE) { - event.type = EVENT_LBUTTONDOWN; + event.type = Common::EVENT_LBUTTONDOWN; fillMouseEvent(event, _km.x, _km.y); } else if (ev.jbutton.button == JOY_BUT_RMOUSE) { - event.type = EVENT_RBUTTONDOWN; + event.type = Common::EVENT_RBUTTONDOWN; fillMouseEvent(event, _km.x, _km.y); } else { - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; switch (ev.jbutton.button) { case JOY_BUT_ESCAPE: event.kbd.keycode = SDLK_ESCAPE; @@ -355,13 +356,13 @@ bool OSystem_SDL::pollEvent(Event &event) { case SDL_JOYBUTTONUP: if (ev.jbutton.button == JOY_BUT_LMOUSE) { - event.type = EVENT_LBUTTONUP; + event.type = Common::EVENT_LBUTTONUP; fillMouseEvent(event, _km.x, _km.y); } else if (ev.jbutton.button == JOY_BUT_RMOUSE) { - event.type = EVENT_RBUTTONUP; + event.type = Common::EVENT_RBUTTONUP; fillMouseEvent(event, _km.x, _km.y); } else { - event.type = EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; switch (ev.jbutton.button) { case JOY_BUT_ESCAPE: event.kbd.keycode = SDLK_ESCAPE; @@ -387,10 +388,10 @@ bool OSystem_SDL::pollEvent(Event &event) { axis = ev.jaxis.value; if ( axis > JOY_DEADZONE) { axis -= JOY_DEADZONE; - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; } else if ( axis < -JOY_DEADZONE ) { axis += JOY_DEADZONE; - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; } else axis = 0; @@ -435,37 +436,37 @@ bool OSystem_SDL::pollEvent(Event &event) { break; case SDL_QUIT: - event.type = EVENT_QUIT; + event.type = Common::EVENT_QUIT; return true; } } return false; } -bool OSystem_SDL::remapKey(SDL_Event &ev,Event &event) { +bool OSystem_SDL::remapKey(SDL_Event &ev,Common::Event &event) { #ifdef LINUPY // On Yopy map the End button to quit if ((ev.key.keysym.sym == 293)) { - event.type = EVENT_QUIT; + event.type = Common::EVENT_QUIT; return true; } // Map menu key to f5 (scumm menu) if (ev.key.keysym.sym == 306) { - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = SDLK_F5; event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); return true; } // Map action key to action if (ev.key.keysym.sym == 291) { - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = SDLK_TAB; event.kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0); return true; } // Map OK key to skip cinematic if (ev.key.keysym.sym == 292) { - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = SDLK_ESCAPE; event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0); return true; @@ -475,13 +476,13 @@ bool OSystem_SDL::remapKey(SDL_Event &ev,Event &event) { #ifdef QTOPIA // Quit on fn+backspace on zaurus if (ev.key.keysym.sym == 127) { - event.type = EVENT_QUIT; + event.type = Common::EVENT_QUIT; return true; } // Map menu key (f11) to f5 (scumm menu) if (ev.key.keysym.sym == SDLK_F11) { - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = SDLK_F5; event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); } @@ -489,20 +490,20 @@ bool OSystem_SDL::remapKey(SDL_Event &ev,Event &event) { // I wanted to map the calendar button but the calendar comes up // else if (ev.key.keysym.sym == SDLK_SPACE) { - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = SDLK_TAB; event.kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0); } // Since we stole space (pause) above we'll rebind it to the tab key on the keyboard else if (ev.key.keysym.sym == SDLK_TAB) { - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = SDLK_SPACE; event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); } else { // Let the events fall through if we didn't change them, this may not be the best way to // set it up, but i'm not sure how sdl would like it if we let if fall through then redid it though. // and yes i have an huge terminal size so i dont wrap soon enough. - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = ev.key.keysym.sym; event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); } diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index cb8457fbdb..2ffabd9aba 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -261,7 +261,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) { if (_transactionMode != kTransactionCommit) internUpdateScreen(); - // Make sure that an EVENT_SCREEN_CHANGED gets sent later + // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later _modeChanged = true; return true; @@ -500,7 +500,7 @@ void OSystem_SDL::hotswapGFXMode() { // Blit everything to the screen internUpdateScreen(); - // Make sure that an EVENT_SCREEN_CHANGED gets sent later + // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later _modeChanged = true; } @@ -727,7 +727,7 @@ void OSystem_SDL::setFullscreenMode(bool enable) { // Blit everything to the screen internUpdateScreen(); - // Make sure that an EVENT_SCREEN_CHANGED gets sent later + // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later _modeChanged = true; } #endif @@ -754,7 +754,7 @@ void OSystem_SDL::setAspectRatioCorrection(bool enable) { hotswapGFXMode(); } - // Make sure that an EVENT_SCREEN_CHANGED gets sent later + // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later _modeChanged = true; } } diff --git a/backends/platform/sdl/sdl-common.h b/backends/platform/sdl/sdl-common.h index 2a5b88cef2..58ebb72bd1 100644 --- a/backends/platform/sdl/sdl-common.h +++ b/backends/platform/sdl/sdl-common.h @@ -130,7 +130,7 @@ public: // Get the next event. // Returns true if an event was retrieved. - virtual bool pollEvent(Event &event); // overloaded by CE backend + virtual bool pollEvent(Common::Event &event); // overloaded by CE backend // Set function that generates samples typedef void (*SoundProc)(void *param, byte *buf, int len); @@ -382,7 +382,7 @@ protected: /** Set the position of the virtual mouse cursor. */ void setMousePos(int x, int y); - virtual void fillMouseEvent(Event &event, int x, int y); // overloaded by CE backend + virtual void fillMouseEvent(Common::Event &event, int x, int y); // overloaded by CE backend void toggleMouseGrab(); virtual void internUpdateScreen(); // overloaded by CE backend @@ -404,7 +404,7 @@ protected: void setupIcon(); void handleKbdMouse(); - virtual bool remapKey(SDL_Event &ev, Event &event); + virtual bool remapKey(SDL_Event &ev, Common::Event &event); void handleScalerHotkeys(const SDL_KeyboardEvent &key); }; diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index 71303ff3ce..846f1cce06 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -25,6 +25,7 @@ #include "backends/platform/symbian/src/SymbianOS.h" #include "backends/platform/symbian/src/SymbianActions.h" #include "common/config-manager.h" +#include "common/events.h" #include "gui/Actions.h" #include "gui/Key.h" #include "gui/message.h" @@ -248,9 +249,9 @@ void OSystem_SDL_Symbian::symbianMix(byte *samples, int len) { * This is an implementation by the remapKey function * @param SDL_Event to remap * @param ScumVM event to modify if special result is requested - * @return true if Event has a valid return status + * @return true if Common::Event has a valid return status */ -bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) { +bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Common::Event &event) { if (GUI::Actions::Instance()->mappingActive() || ev.key.keysym.sym <= SDLK_UNKNOWN) return false; @@ -267,7 +268,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) { _km.y_vel = 0; _km.y_down_count = 0; } - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, _km.x, _km.y); return true; @@ -280,7 +281,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) { _km.y_vel = 0; _km.y_down_count = 0; } - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, _km.x, _km.y); return true; @@ -293,7 +294,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) { _km.x_vel = 0; _km.x_down_count = 0; } - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, _km.x, _km.y); return true; @@ -306,19 +307,19 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) { _km.x_vel = 0; _km.x_down_count = 0; } - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, _km.x, _km.y); return true; case GUI::ACTION_LEFTCLICK: - event.type = (ev.type == SDL_KEYDOWN ? EVENT_LBUTTONDOWN : EVENT_LBUTTONUP); + event.type = (ev.type == SDL_KEYDOWN ? Common::EVENT_LBUTTONDOWN : Common::EVENT_LBUTTONUP); fillMouseEvent(event, _km.x, _km.y); return true; case GUI::ACTION_RIGHTCLICK: - event.type = (ev.type == SDL_KEYDOWN ? EVENT_RBUTTONDOWN : EVENT_RBUTTONUP); + event.type = (ev.type == SDL_KEYDOWN ? Common::EVENT_RBUTTONDOWN : Common::EVENT_RBUTTONUP); fillMouseEvent(event, _km.x, _km.y); return true; @@ -338,7 +339,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) { _currentZone++; if (_currentZone >= TOTAL_ZONES) _currentZone = 0; - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, _mouseXZone[_currentZone], _mouseYZone[_currentZone]); SDL_WarpMouse(event.mouse.x, event.mouse.y); } @@ -359,20 +360,20 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) { ev.key.keysym.scancode= key.keycode(); ev.key.keysym.mod = (SDLMod) key.flags(); - // Translate from SDL keymod event to Scummvm Key Mod Event. + // Translate from SDL keymod event to Scummvm Key Mod Common::Event. // This codes is also present in GP32 backend and in SDL backend as a static function // Perhaps it should be shared. if(key.flags() != 0) { event.kbd.flags = 0; if (ev.key.keysym.mod & KMOD_SHIFT) - event.kbd.flags |= OSystem::KBD_SHIFT; + event.kbd.flags |= Common::KBD_SHIFT; if (ev.key.keysym.mod & KMOD_ALT) - event.kbd.flags |= OSystem::KBD_ALT; + event.kbd.flags |= Common::KBD_ALT; if (ev.key.keysym.mod & KMOD_CTRL) - event.kbd.flags |= OSystem::KBD_CTRL; + event.kbd.flags |= Common::KBD_CTRL; } return false; diff --git a/backends/platform/symbian/src/SymbianOS.h b/backends/platform/symbian/src/SymbianOS.h index bb3a992891..80278af58c 100644 --- a/backends/platform/symbian/src/SymbianOS.h +++ b/backends/platform/symbian/src/SymbianOS.h @@ -104,9 +104,9 @@ protected: // This is an implementation by the remapKey function // @param SDL_Event to remap // @param ScumVM event to modify if special result is requested - // @return true if Event has a valid return status + // @return true if Common::Event has a valid return status // - bool remapKey(SDL_Event &ev, Event &event); + bool remapKey(SDL_Event &ev, Common::Event &event); void setWindowCaption(const char *caption); diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index e77f7fa0fb..13c59c37a1 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -1325,7 +1325,7 @@ void OSystem_WINCE3::hotswapGFXMode() { // Blit everything to the screen internUpdateScreen(); - // Make sure that an EVENT_SCREEN_CHANGED gets sent later + // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later _modeChanged = true; } @@ -1970,7 +1970,7 @@ void OSystem_WINCE3::drawMouse() { internDrawMouse(); } -void OSystem_WINCE3::fillMouseEvent(Event &event, int x, int y) { +void OSystem_WINCE3::fillMouseEvent(Common::Event &event, int x, int y) { event.mouse.x = x; event.mouse.y = y; @@ -2060,22 +2060,22 @@ void OSystem_WINCE3::addDirtyRect(int x, int y, int w, int h, bool mouseRect) { // FIXME // See if some SDL mapping can be useful for HPCs -bool OSystem_WINCE3::pollEvent(Event &event) { +bool OSystem_WINCE3::pollEvent(Common::Event &event) { SDL_Event ev; byte b = 0; - Event temp_event; + Common::Event temp_event; DWORD currentTime; bool keyEvent = false; - memset(&temp_event, 0, sizeof(Event)); - memset(&event, 0, sizeof(Event)); + memset(&temp_event, 0, sizeof(Common::Event)); + memset(&event, 0, sizeof(Common::Event)); handleKbdMouse(); - // If the screen mode changed, send an EVENT_SCREEN_CHANGED + // If the screen mode changed, send an Common::EVENT_SCREEN_CHANGED if (_modeChanged) { _modeChanged = false; - event.type = EVENT_SCREEN_CHANGED; + event.type = Common::EVENT_SCREEN_CHANGED; _screenChangeCount++; return true; } @@ -2098,7 +2098,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) { return true; } - event.type = EVENT_KEYDOWN; + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = ev.key.keysym.sym; event.kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); @@ -2117,7 +2117,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) { return true; } - event.type = EVENT_KEYUP; + event.type = Common::EVENT_KEYUP; event.kbd.keycode = ev.key.keysym.sym; event.kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); @@ -2127,16 +2127,16 @@ bool OSystem_WINCE3::pollEvent(Event &event) { return true; case SDL_MOUSEMOTION: - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; fillMouseEvent(event, ev.motion.x, ev.motion.y); setMousePos(event.mouse.x, event.mouse.y); return true; case SDL_MOUSEBUTTONDOWN: if (ev.button.button == SDL_BUTTON_LEFT) - temp_event.type = EVENT_LBUTTONDOWN; + temp_event.type = Common::EVENT_LBUTTONDOWN; else if (ev.button.button == SDL_BUTTON_RIGHT) - temp_event.type = EVENT_RBUTTONDOWN; + temp_event.type = Common::EVENT_RBUTTONDOWN; else break; @@ -2159,7 +2159,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) { if (temp_event.mouse.y <= 20 && _panelInitialized) { // panel double tap? swap_panel_visibility(); } else { // simulate right click - temp_event.type = EVENT_RBUTTONDOWN; + temp_event.type = Common::EVENT_RBUTTONDOWN; _rbutton = true; } } @@ -2183,21 +2183,21 @@ bool OSystem_WINCE3::pollEvent(Event &event) { } } else { if (!_freeLook) - memcpy(&event, &temp_event, sizeof(Event)); + memcpy(&event, &temp_event, sizeof(Common::Event)); } return true; case SDL_MOUSEBUTTONUP: if (ev.button.button == SDL_BUTTON_LEFT) - temp_event.type = EVENT_LBUTTONUP; + temp_event.type = Common::EVENT_LBUTTONUP; else if (ev.button.button == SDL_BUTTON_RIGHT) - temp_event.type = EVENT_RBUTTONUP; + temp_event.type = Common::EVENT_RBUTTONUP; else break; if (_rbutton) { - temp_event.type = EVENT_RBUTTONUP; + temp_event.type = Common::EVENT_RBUTTONUP; _rbutton = false; } @@ -2208,7 +2208,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) { internUpdateScreen(); } else { if (!_freeLook) - memcpy(&event, &temp_event, sizeof(Event)); + memcpy(&event, &temp_event, sizeof(Common::Event)); } return true; @@ -2218,7 +2218,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) { break; case SDL_QUIT: - event.type = EVENT_QUIT; + event.type = Common::EVENT_QUIT; return true; } } diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h index 193970c6e7..7d797e5959 100644 --- a/backends/platform/wince/wince-sdl.h +++ b/backends/platform/wince/wince-sdl.h @@ -69,11 +69,11 @@ public: void initBackend(); // Overloaded from SDL_Common (toolbar handling) - bool pollEvent(Event &event); + bool pollEvent(Common::Event &event); // Overloaded from SDL_Common (toolbar handling) void drawMouse(); // Overloaded from SDL_Common (mouse and new scaler handling) - void fillMouseEvent(Event &event, int x, int y); + void fillMouseEvent(Common::Event &event, int x, int y); // Overloaded from SDL_Common (new scaler handling) void addDirtyRect(int x, int y, int w, int h, bool mouseRect = false); // Overloaded from SDL_Common (new scaler handling) diff --git a/backends/platform/x11/x11.cpp b/backends/platform/x11/x11.cpp index 7be5a976a9..60c6939b2d 100644 --- a/backends/platform/x11/x11.cpp +++ b/backends/platform/x11/x11.cpp @@ -25,6 +25,7 @@ #include "common/stdafx.h" #include "common/scummsys.h" +#include "common/events.h" #include "common/system.h" #include "common/util.h" #include "base/main.h" @@ -753,7 +754,7 @@ void OSystem_X11::delayMillis(uint msecs) { usleep(msecs * 1000); } -bool OSystem_X11::pollEvent(Event &scumm_event) { +bool OSystem_X11::pollEvent(Common::Event &scumm_event) { /* First, handle timers */ uint32 current_msecs = getMillis(); @@ -812,11 +813,11 @@ bool OSystem_X11::pollEvent(Event &scumm_event) { byte mode = 0; if (event.xkey.state & 0x01) - mode |= KBD_SHIFT; + mode |= Common::KBD_SHIFT; if (event.xkey.state & 0x04) - mode |= KBD_CTRL; + mode |= Common::KBD_CTRL; if (event.xkey.state & 0x08) - mode |= KBD_ALT; + mode |= Common::KBD_ALT; switch (event.xkey.keycode) { case 9: /* Escape on my PC */ @@ -852,7 +853,7 @@ bool OSystem_X11::pollEvent(Event &scumm_event) { } } if (keycode != -1) { - scumm_event.type = EVENT_KEYDOWN; + scumm_event.type = Common::EVENT_KEYDOWN; scumm_event.kbd.keycode = keycode; scumm_event.kbd.ascii = (ascii != -1 ? ascii : keycode); scumm_event.kbd.flags = mode; @@ -870,11 +871,11 @@ bool OSystem_X11::pollEvent(Event &scumm_event) { byte mode = 0; if (event.xkey.state & 0x01) - mode |= KBD_SHIFT; + mode |= Common::KBD_SHIFT; if (event.xkey.state & 0x04) - mode |= KBD_CTRL; + mode |= Common::KBD_CTRL; if (event.xkey.state & 0x08) - mode |= KBD_ALT; + mode |= Common::KBD_ALT; switch (event.xkey.keycode) { case 132: /* 'Q' on the iPAQ */ _report_presses = 1; @@ -894,7 +895,7 @@ bool OSystem_X11::pollEvent(Event &scumm_event) { } } if (keycode != -1) { - scumm_event.type = EVENT_KEYUP; + scumm_event.type = Common::EVENT_KEYUP; scumm_event.kbd.keycode = keycode; scumm_event.kbd.ascii = (ascii != -1 ? ascii : keycode); scumm_event.kbd.flags = mode; @@ -907,12 +908,12 @@ bool OSystem_X11::pollEvent(Event &scumm_event) { if (_report_presses != 0) { if (event.xbutton.button == 1) { if (_fake_right_mouse == 0) { - scumm_event.type = EVENT_LBUTTONDOWN; + scumm_event.type = Common::EVENT_LBUTTONDOWN; } else { - scumm_event.type = EVENT_RBUTTONDOWN; + scumm_event.type = Common::EVENT_RBUTTONDOWN; } } else if (event.xbutton.button == 3) - scumm_event.type = EVENT_RBUTTONDOWN; + scumm_event.type = Common::EVENT_RBUTTONDOWN; scumm_event.mouse.x = event.xbutton.x - _scumm_x; scumm_event.mouse.y = event.xbutton.y - _scumm_y; return true; @@ -923,12 +924,12 @@ bool OSystem_X11::pollEvent(Event &scumm_event) { if (_report_presses != 0) { if (event.xbutton.button == 1) { if (_fake_right_mouse == 0) { - scumm_event.type = EVENT_LBUTTONUP; + scumm_event.type = Common::EVENT_LBUTTONUP; } else { - scumm_event.type = EVENT_RBUTTONUP; + scumm_event.type = Common::EVENT_RBUTTONUP; } } else if (event.xbutton.button == 3) - scumm_event.type = EVENT_RBUTTONUP; + scumm_event.type = Common::EVENT_RBUTTONUP; scumm_event.mouse.x = event.xbutton.x - _scumm_x; scumm_event.mouse.y = event.xbutton.y - _scumm_y; return true; @@ -936,7 +937,7 @@ bool OSystem_X11::pollEvent(Event &scumm_event) { break; case MotionNotify: - scumm_event.type = EVENT_MOUSEMOVE; + scumm_event.type = Common::EVENT_MOUSEMOVE; scumm_event.mouse.x = event.xmotion.x - _scumm_x; scumm_event.mouse.y = event.xmotion.y - _scumm_y; set_mouse_pos(scumm_event.mouse.x, scumm_event.mouse.y); diff --git a/backends/platform/x11/x11.h b/backends/platform/x11/x11.h index ba29bc7eab..3a46a3f793 100644 --- a/backends/platform/x11/x11.h +++ b/backends/platform/x11/x11.h @@ -88,7 +88,7 @@ public: // Get the next event. // Returns true if an event was retrieved. - bool pollEvent(Event &event); + bool pollEvent(Common::Event &event); // Set function that generates samples bool setSoundCallback(SoundProc proc, void *param); -- cgit v1.2.3