[Scummvm-cvs-logs] SF.net SVN: scummvm: [26180] scummvm/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sat Mar 17 20:02:07 CET 2007
Revision: 26180
http://scummvm.svn.sourceforge.net/scummvm/?rev=26180&view=rev
Author: fingolfin
Date: 2007-03-17 12:02:05 -0700 (Sat, 17 Mar 2007)
Log Message:
-----------
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
Modified Paths:
--------------
scummvm/trunk/backends/events/default/default-events.cpp
scummvm/trunk/backends/events/default/default-events.h
scummvm/trunk/backends/platform/PalmOS/Src/base_event.cpp
scummvm/trunk/backends/platform/PalmOS/Src/base_mouse.cpp
scummvm/trunk/backends/platform/PalmOS/Src/be_base.h
scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h
scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.h
scummvm/trunk/backends/platform/PalmOS/Src/os5_event.cpp
scummvm/trunk/backends/platform/PalmOS/Src/zodiac_event.cpp
scummvm/trunk/backends/platform/dc/dc.h
scummvm/trunk/backends/platform/dc/input.cpp
scummvm/trunk/backends/platform/dc/selector.cpp
scummvm/trunk/backends/platform/dc/softkbd.cpp
scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp
scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp
scummvm/trunk/backends/platform/gp2x/events.cpp
scummvm/trunk/backends/platform/gp2x/gp2x-common.h
scummvm/trunk/backends/platform/gp2x/graphics.cpp
scummvm/trunk/backends/platform/gp32/gp32_osys.cpp
scummvm/trunk/backends/platform/gp32/gp32_osys.h
scummvm/trunk/backends/platform/morphos/morphos.cpp
scummvm/trunk/backends/platform/morphos/morphos.h
scummvm/trunk/backends/platform/null/null.cpp
scummvm/trunk/backends/platform/ps2/ps2input.cpp
scummvm/trunk/backends/platform/ps2/ps2input.h
scummvm/trunk/backends/platform/ps2/systemps2.cpp
scummvm/trunk/backends/platform/ps2/systemps2.h
scummvm/trunk/backends/platform/psp/osys_psp.cpp
scummvm/trunk/backends/platform/psp/osys_psp.h
scummvm/trunk/backends/platform/psp/osys_psp_gu.cpp
scummvm/trunk/backends/platform/psp/osys_psp_gu.h
scummvm/trunk/backends/platform/sdl/events.cpp
scummvm/trunk/backends/platform/sdl/graphics.cpp
scummvm/trunk/backends/platform/sdl/sdl-common.h
scummvm/trunk/backends/platform/symbian/src/SymbianOS.cpp
scummvm/trunk/backends/platform/symbian/src/SymbianOS.h
scummvm/trunk/backends/platform/wince/wince-sdl.cpp
scummvm/trunk/backends/platform/wince/wince-sdl.h
scummvm/trunk/backends/platform/x11/x11.cpp
scummvm/trunk/backends/platform/x11/x11.h
scummvm/trunk/common/events.h
scummvm/trunk/common/system.h
scummvm/trunk/engines/agi/agi.cpp
scummvm/trunk/engines/agos/animation.cpp
scummvm/trunk/engines/agos/event.cpp
scummvm/trunk/engines/cine/main_loop.cpp
scummvm/trunk/engines/gob/util.cpp
scummvm/trunk/engines/kyra/gui.cpp
scummvm/trunk/engines/kyra/kyra.cpp
scummvm/trunk/engines/kyra/sequences_v1.cpp
scummvm/trunk/engines/kyra/text.cpp
scummvm/trunk/engines/kyra/vqa.cpp
scummvm/trunk/engines/lure/animseq.cpp
scummvm/trunk/engines/lure/debug-input.cpp
scummvm/trunk/engines/lure/events.cpp
scummvm/trunk/engines/lure/events.h
scummvm/trunk/engines/lure/game.cpp
scummvm/trunk/engines/lure/intro.cpp
scummvm/trunk/engines/lure/menu.cpp
scummvm/trunk/engines/lure/surface.cpp
scummvm/trunk/engines/parallaction/dialogue.cpp
scummvm/trunk/engines/parallaction/parallaction.cpp
scummvm/trunk/engines/queen/input.cpp
scummvm/trunk/engines/queen/journal.cpp
scummvm/trunk/engines/saga/input.cpp
scummvm/trunk/engines/scumm/input.cpp
scummvm/trunk/engines/scumm/scumm.cpp
scummvm/trunk/engines/sky/control.cpp
scummvm/trunk/engines/sky/intro.cpp
scummvm/trunk/engines/sky/mouse.cpp
scummvm/trunk/engines/sky/screen.cpp
scummvm/trunk/engines/sky/sky.cpp
scummvm/trunk/engines/sword1/animation.cpp
scummvm/trunk/engines/sword1/control.cpp
scummvm/trunk/engines/sword1/credits.cpp
scummvm/trunk/engines/sword1/sword1.cpp
scummvm/trunk/engines/sword2/animation.cpp
scummvm/trunk/engines/sword2/sword2.cpp
scummvm/trunk/engines/touche/touche.cpp
scummvm/trunk/engines/touche/ui.cpp
scummvm/trunk/gui/about.cpp
scummvm/trunk/gui/console.cpp
scummvm/trunk/gui/launcher.cpp
scummvm/trunk/gui/newgui.cpp
scummvm/trunk/sound/softsynth/mt32.cpp
Modified: scummvm/trunk/backends/events/default/default-events.cpp
===================================================================
--- scummvm/trunk/backends/events/default/default-events.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/events/default/default-events.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -38,7 +38,7 @@
_currentKeyDown.keycode = 0;
}
-bool DefaultEventManager::pollEvent(OSystem::Event &event) {
+bool DefaultEventManager::pollEvent(Common::Event &event) {
uint32 time = _boss->getMillis();
bool result;
@@ -47,7 +47,7 @@
if (result) {
event.synthetic = false;
switch (event.type) {
- case OSystem::EVENT_KEYDOWN:
+ case Common::EVENT_KEYDOWN:
_modifierState = event.kbd.flags;
// init continuous event stream
@@ -59,7 +59,7 @@
_keyRepeatTime = time + kKeyRepeatInitialDelay;
#endif
break;
- case OSystem::EVENT_KEYUP:
+ case Common::EVENT_KEYUP:
_modifierState = event.kbd.flags;
if (event.kbd.keycode == _currentKeyDown.keycode) {
// Only stop firing events if it's the current key
@@ -67,29 +67,29 @@
}
break;
- case OSystem::EVENT_MOUSEMOVE:
+ case Common::EVENT_MOUSEMOVE:
_mousePos = event.mouse;
break;
- case OSystem::EVENT_LBUTTONDOWN:
+ case Common::EVENT_LBUTTONDOWN:
_mousePos = event.mouse;
_buttonState |= LBUTTON;
break;
- case OSystem::EVENT_LBUTTONUP:
+ case Common::EVENT_LBUTTONUP:
_mousePos = event.mouse;
_buttonState &= ~LBUTTON;
break;
- case OSystem::EVENT_RBUTTONDOWN:
+ case Common::EVENT_RBUTTONDOWN:
_mousePos = event.mouse;
_buttonState |= RBUTTON;
break;
- case OSystem::EVENT_RBUTTONUP:
+ case Common::EVENT_RBUTTONUP:
_mousePos = event.mouse;
_buttonState &= ~RBUTTON;
break;
- case OSystem::EVENT_QUIT:
+ case Common::EVENT_QUIT:
_shouldQuit = true;
break;
@@ -100,7 +100,7 @@
// Check if event should be sent again (keydown)
if (_currentKeyDown.keycode != 0 && _keyRepeatTime < time) {
// fire event
- event.type = OSystem::EVENT_KEYDOWN;
+ event.type = Common::EVENT_KEYDOWN;
event.synthetic = true;
event.kbd.ascii = _currentKeyDown.ascii;
event.kbd.keycode = _currentKeyDown.keycode;
Modified: scummvm/trunk/backends/events/default/default-events.h
===================================================================
--- scummvm/trunk/backends/events/default/default-events.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/events/default/default-events.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -62,7 +62,7 @@
public:
DefaultEventManager(OSystem *boss);
- virtual bool pollEvent(OSystem::Event &event);
+ virtual bool pollEvent(Common::Event &event);
virtual Common::Point getMousePos() const { return _mousePos; }
virtual int getButtonState() const { return _buttonState; }
Modified: scummvm/trunk/backends/platform/PalmOS/Src/base_event.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/base_event.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/PalmOS/Src/base_event.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -23,6 +23,7 @@
*/
#include "be_base.h"
+#include "common/events.h"
#ifdef STDLIB_TRACE_MEMORY
# include <stdlib.h>
@@ -119,7 +120,7 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
(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 @@
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 @@
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 @@
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 @@
_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 @@
// 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 @@
default:
if (_wasKey) {
- event.type = EVENT_KEYUP;
+ event.type = Common::EVENT_KEYUP;
_wasKey = false;
return true;
}
Modified: scummvm/trunk/backends/platform/PalmOS/Src/base_mouse.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/base_mouse.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/PalmOS/Src/base_mouse.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -42,7 +42,7 @@
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;
Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_base.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_base.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_base.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -95,12 +95,12 @@
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 @@
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);
Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -123,7 +123,7 @@
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();
Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -55,7 +55,7 @@
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:
Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5_event.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5_event.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5_event.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -41,13 +41,13 @@
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 @@
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;
Modified: scummvm/trunk/backends/platform/PalmOS/Src/zodiac_event.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/zodiac_event.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/PalmOS/Src/zodiac_event.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -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 @@
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 @@
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;
Modified: scummvm/trunk/backends/platform/dc/dc.h
===================================================================
--- scummvm/trunk/backends/platform/dc/dc.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/dc/dc.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -114,7 +114,7 @@
// 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.
Modified: scummvm/trunk/backends/platform/dc/input.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/input.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/dc/input.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -25,6 +25,7 @@
#include <common/stdafx.h>
#include <common/scummsys.h>
+#include "common/events.h"
#include "dc.h"
int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
@@ -84,9 +85,9 @@
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 @@
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 @@
return 0;
}
-bool OSystem_Dreamcast::pollEvent(Event &event)
+bool OSystem_Dreamcast::pollEvent(Common::Event &event)
{
unsigned int t = Timer();
@@ -224,9 +225,9 @@
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 @@
}
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;
Modified: scummvm/trunk/backends/platform/dc/selector.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/selector.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/dc/selector.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -361,7 +361,7 @@
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) {
Modified: scummvm/trunk/backends/platform/dc/softkbd.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/softkbd.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/dc/softkbd.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -23,6 +23,7 @@
#include <common/stdafx.h>
#include <common/scummsys.h>
+#include "common/events.h"
#include "engines/engine.h"
#include <ronin/ronin.h>
@@ -58,7 +59,7 @@
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 @@
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 @@
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];
Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -851,9 +851,9 @@
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 @@
consolePrintf("addEventsToQueue\n");
#endif
OSystem_DS* system = OSystem_DS::instance();
- OSystem::Event event;
+ Common::Event event;
@@ -1028,7 +1028,7 @@
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 @@
} 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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);*/
Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -154,13 +154,13 @@
_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 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 @@
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;
Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -302,11 +302,11 @@
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 @@
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 @@
/* 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 @@
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;
Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -42,7 +42,7 @@
int eventNum;
int lastPenFrame;
- Event eventQueue[64];
+ Common::Event eventQueue[64];
int queuePos;
DSSaveFileManager saveManager;
@@ -94,7 +94,7 @@
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 @@
virtual Common::SaveFileManager *getSavefileManager();
- void addEvent(Event& e);
+ void addEvent(Common::Event& e);
bool isEventQueueEmpty() { return queuePos == 0; }
virtual bool grabRawScreen(Graphics::Surface* surf);
Modified: scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -232,7 +232,7 @@
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 @@
//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) {
Modified: scummvm/trunk/backends/platform/gp2x/events.cpp
===================================================================
--- scummvm/trunk/backends/platform/gp2x/events.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/gp2x/events.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -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 @@
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 @@
// 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 @@
//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 @@
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 @@
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 @@
}
// 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 @@
//#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-<key> 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 @@
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 @@
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-<key> 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
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;
}
Modified: scummvm/trunk/backends/platform/gp2x/gp2x-common.h
===================================================================
--- scummvm/trunk/backends/platform/gp2x/gp2x-common.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/gp2x/gp2x-common.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -129,7 +129,7 @@
// 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 @@
/** 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 @@
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);
Modified: scummvm/trunk/backends/platform/gp2x/graphics.cpp
===================================================================
--- scummvm/trunk/backends/platform/gp2x/graphics.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/gp2x/graphics.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -190,7 +190,7 @@
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 @@
// 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 @@
// 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 @@
hotswapGFXMode();
}
- // Make sure that an EVENT_SCREEN_CHANGED gets sent later
+ // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
_modeChanged = true;
}
}
Modified: scummvm/trunk/backends/platform/gp32/gp32_osys.cpp
===================================================================
--- scummvm/trunk/backends/platform/gp32/gp32_osys.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/gp32/gp32_osys.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -480,7 +480,7 @@
}
}
-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 @@
// 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 @@
_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 @@
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 @@
_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 @@
_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 @@
_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 @@
_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 @@
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;
}
Modified: scummvm/trunk/backends/platform/gp32/gp32_osys.h
===================================================================
--- scummvm/trunk/backends/platform/gp32/gp32_osys.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/gp32/gp32_osys.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -124,7 +124,7 @@
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 @@
void displayMessageOnOSD(const char *msg);
- void fillMouseEvent(Event &event, int x, int y);
+ void fillMouseEvent(Common::Event &event, int x, int y);
void handleKbdMouse();
};
Modified: scummvm/trunk/backends/platform/morphos/morphos.cpp
===================================================================
--- scummvm/trunk/backends/platform/morphos/morphos.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/morphos/morphos.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -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 @@
}
}
-bool OSystem_MorphOS::pollEvent(Event &event)
+bool OSystem_MorphOS::pollEvent(Common::Event &event)
{
IntuiMessage *ScummMsg;
@@ -819,14 +820,14 @@
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 @@
/*
* 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 @@
}
else if (charbuf == 'x')
{
- event.type = EVENT_QUIT;
+ event.type = Common::EVENT_QUIT;
break;
}
else if (charbuf == 0x0d)
@@ -916,7 +917,7 @@
else if (FullScreenMode)
newy = newy <? (ScummScrHeight >> 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 @@
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 @@
}
case IDCMP_CLOSEWINDOW:
- event.type = EVENT_QUIT;
+ event.type = Common::EVENT_QUIT;
break;
}
Modified: scummvm/trunk/backends/platform/morphos/morphos.h
===================================================================
--- scummvm/trunk/backends/platform/morphos/morphos.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/morphos/morphos.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -95,7 +95,7 @@
// 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);
Modified: scummvm/trunk/backends/platform/null/null.cpp
===================================================================
--- scummvm/trunk/backends/platform/null/null.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/null/null.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -76,7 +76,7 @@
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::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;
}
Modified: scummvm/trunk/backends/platform/ps2/ps2input.cpp
===================================================================
--- scummvm/trunk/backends/platform/ps2/ps2input.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/ps2/ps2input.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -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 @@
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 @@
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 @@
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 @@
_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 @@
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 @@
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 @@
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 @@
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 @@
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]);
Modified: scummvm/trunk/backends/platform/ps2/ps2input.h
===================================================================
--- scummvm/trunk/backends/platform/ps2/ps2input.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/ps2/ps2input.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -33,11 +33,11 @@
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;
Modified: scummvm/trunk/backends/platform/ps2/systemps2.cpp
===================================================================
--- scummvm/trunk/backends/platform/ps2/systemps2.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/ps2/systemps2.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -649,9 +649,9 @@
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;
}
Modified: scummvm/trunk/backends/platform/ps2/systemps2.h
===================================================================
--- scummvm/trunk/backends/platform/ps2/systemps2.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/ps2/systemps2.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -70,7 +70,7 @@
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();
Modified: scummvm/trunk/backends/platform/psp/osys_psp.cpp
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/psp/osys_psp.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -417,7 +417,7 @@
#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 @@
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 @@
}
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;
Modified: scummvm/trunk/backends/platform/psp/osys_psp.h
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/psp/osys_psp.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -123,7 +123,7 @@
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);
Modified: scummvm/trunk/backends/platform/psp/osys_psp_gu.cpp
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp_gu.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/psp/osys_psp_gu.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -25,6 +25,7 @@
#include <zlib.h>
#include "osys_psp_gu.h"
#include "./trace.h"
+#include "common/events.h"
#define PIXEL_SIZE (4)
#define BUF_WIDTH (512)
@@ -451,7 +452,7 @@
//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 @@
_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 @@
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) {
Modified: scummvm/trunk/backends/platform/psp/osys_psp_gu.h
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp_gu.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/psp/osys_psp_gu.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -48,7 +48,7 @@
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;
Modified: scummvm/trunk/backends/platform/sdl/events.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/events.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/sdl/events.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -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 @@
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 @@
// 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 @@
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 @@
}
// 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 @@
}
// 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 @@
// 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-<key> 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 @@
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 @@
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-<key> 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
#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 @@
// 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);
}
Modified: scummvm/trunk/backends/platform/sdl/graphics.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/graphics.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/sdl/graphics.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -261,7 +261,7 @@
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 @@
// 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 @@
// 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 @@
hotswapGFXMode();
}
- // Make sure that an EVENT_SCREEN_CHANGED gets sent later
+ // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
_modeChanged = true;
}
}
Modified: scummvm/trunk/backends/platform/sdl/sdl-common.h
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl-common.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/sdl/sdl-common.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -130,7 +130,7 @@
// 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 @@
/** 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 @@
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);
};
Modified: scummvm/trunk/backends/platform/symbian/src/SymbianOS.cpp
===================================================================
--- scummvm/trunk/backends/platform/symbian/src/SymbianOS.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/symbian/src/SymbianOS.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -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 @@
* 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 @@
_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 @@
_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 @@
_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 @@
_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 @@
_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 @@
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;
Modified: scummvm/trunk/backends/platform/symbian/src/SymbianOS.h
===================================================================
--- scummvm/trunk/backends/platform/symbian/src/SymbianOS.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/symbian/src/SymbianOS.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -104,9 +104,9 @@
// 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);
Modified: scummvm/trunk/backends/platform/wince/wince-sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/wince/wince-sdl.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/wince/wince-sdl.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -1325,7 +1325,7 @@
// 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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
}
} 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 @@
internUpdateScreen();
} else {
if (!_freeLook)
- memcpy(&event, &temp_event, sizeof(Event));
+ memcpy(&event, &temp_event, sizeof(Common::Event));
}
return true;
@@ -2218,7 +2218,7 @@
break;
case SDL_QUIT:
- event.type = EVENT_QUIT;
+ event.type = Common::EVENT_QUIT;
return true;
}
}
Modified: scummvm/trunk/backends/platform/wince/wince-sdl.h
===================================================================
--- scummvm/trunk/backends/platform/wince/wince-sdl.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/wince/wince-sdl.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -69,11 +69,11 @@
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)
Modified: scummvm/trunk/backends/platform/x11/x11.cpp
===================================================================
--- scummvm/trunk/backends/platform/x11/x11.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/x11/x11.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -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 @@
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 @@
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 @@
}
}
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 @@
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 @@
}
}
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 @@
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 @@
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 @@
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);
Modified: scummvm/trunk/backends/platform/x11/x11.h
===================================================================
--- scummvm/trunk/backends/platform/x11/x11.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/backends/platform/x11/x11.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -88,7 +88,7 @@
// 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);
Modified: scummvm/trunk/common/events.h
===================================================================
--- scummvm/trunk/common/events.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/common/events.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -30,6 +30,118 @@
namespace Common {
/**
+ * The types of events backends may generate.
+ * @see Event
+ *
+ * @todo Merge EVENT_LBUTTONDOWN, EVENT_RBUTTONDOWN and EVENT_WHEELDOWN;
+ * likewiese EVENT_LBUTTONUP, EVENT_RBUTTONUP, EVENT_WHEELUP.
+ * To do that, we just have to add a field to the Event which
+ * indicates which button was pressed.
+ */
+enum EventType {
+ /** A key was pressed, details in Event::kbd. */
+ EVENT_KEYDOWN = 1,
+ /** A key was released, details in Event::kbd. */
+ EVENT_KEYUP = 2,
+ /** The mouse moved, details in Event::mouse. */
+ EVENT_MOUSEMOVE = 3,
+ EVENT_LBUTTONDOWN = 4,
+ EVENT_LBUTTONUP = 5,
+ EVENT_RBUTTONDOWN = 6,
+ EVENT_RBUTTONUP = 7,
+ EVENT_WHEELUP = 8,
+ EVENT_WHEELDOWN = 9,
+
+ EVENT_QUIT = 10,
+ EVENT_SCREEN_CHANGED = 11
+};
+
+/**
+ * Keyboard modifier flags, used for Event::kbd::flags.
+ */
+enum {
+ KBD_CTRL = 1 << 0,
+ KBD_ALT = 1 << 1,
+ KBD_SHIFT = 1 << 2
+};
+
+/**
+ * Data structure for an event. A pointer to an instance of Event
+ * can be passed to pollEvent.
+ * @todo Rework/document this structure. It should be made 100% clear which
+ * field is valid for which event type.
+ * Implementation wise, we might want to use the classic
+ * union-of-structs trick. It goes roughly like this:
+ * struct BasicEvent {
+ * EventType type;
+ * };
+ * struct MouseMovedEvent : BasicEvent {
+ * Common::Point pos;
+ * };
+ * struct MouseButtonEvent : MouseMovedEvent {
+ * int button;
+ * };
+ * struct KeyEvent : BasicEvent {
+ * ...
+ * };
+ * ...
+ * union Event {
+ * EventType type;
+ * MouseMovedEvent mouse;
+ * MouseButtonEvent button;
+ * KeyEvent key;
+ * ...
+ * };
+ */
+struct Event {
+ /** The type of the event. */
+ EventType type;
+ /** Flag to indicate if the event is real or synthetic. E.g. keyboard
+ * repeat events are synthetic.
+ */
+ bool synthetic;
+ /**
+ * Keyboard data; only valid for keyboard events (EVENT_KEYDOWN and
+ * EVENT_KEYUP). For all other event types, content is undefined.
+ */
+ struct {
+ /**
+ * Abstract key code (will be the same for any given key regardless
+ * of modifiers being held at the same time.
+ * For example, this is the same for both 'A' and Shift-'A'.
+ * @todo Document which values are to be used for non-ASCII keys
+ * like F1-F10. For now, let's just say that our primary backend
+ * is the SDL one, and it uses the values SDL uses... so until
+ * we fix this, your best bet is to get a copy of SDL_keysym.h
+ * and look at that, if you want to find out a key code.
+ */
+ int keycode;
+ /**
+ * ASCII-value of the pressed key (if any).
+ * This depends on modifiers, i.e. pressing the 'A' key results in
+ * different values here depending on the status of shift, alt and
+ * caps lock.
+ * For the function keys F1-F9, values of 315-323 are used.
+ */
+ uint16 ascii;
+ /**
+ * Status of the modifier keys. Bits are set in this for each
+ * pressed modifier
+ * @see KBD_CTRL, KBD_ALT, KBD_SHIFT
+ */
+ byte flags;
+ } kbd;
+ /**
+ * The mouse coordinates, in virtual screen coordinates. Only valid
+ * for mouse events.
+ * Virtual screen coordinates means: the coordinate system of the
+ * screen area as defined by the most recent call to initSize().
+ */
+ Common::Point mouse;
+};
+
+
+/**
* The EventManager provides user input events to the client code.
* In addition, it keeps track of the state of various input devices,
* like keys, mouse position and buttons.
@@ -49,7 +161,7 @@
* @param event point to an Event struct, which will be filled with the event data.
* @return true if an event was retrieved.
*/
- virtual bool pollEvent(OSystem::Event &event) = 0;
+ virtual bool pollEvent(Common::Event &event) = 0;
/** Return the current key state */
Modified: scummvm/trunk/common/system.h
===================================================================
--- scummvm/trunk/common/system.h 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/common/system.h 2007-03-17 19:02:05 UTC (rev 26180)
@@ -38,6 +38,7 @@
}
namespace Common {
+ struct Event;
class EventManager;
class SaveFileManager;
class TimerManager;
@@ -676,126 +677,15 @@
/** @name Events and Time */
//@{
- /**
- * The types of events backends may generate.
- * @see Event
- *
- * @todo Merge EVENT_LBUTTONDOWN, EVENT_RBUTTONDOWN and EVENT_WHEELDOWN;
- * likewiese EVENT_LBUTTONUP, EVENT_RBUTTONUP, EVENT_WHEELUP.
- * To do that, we just have to add a field to the Event which
- * indicates which button was pressed.
- */
- enum EventType {
- /** A key was pressed, details in Event::kbd. */
- EVENT_KEYDOWN = 1,
- /** A key was released, details in Event::kbd. */
- EVENT_KEYUP = 2,
- /** The mouse moved, details in Event::mouse. */
- EVENT_MOUSEMOVE = 3,
- EVENT_LBUTTONDOWN = 4,
- EVENT_LBUTTONUP = 5,
- EVENT_RBUTTONDOWN = 6,
- EVENT_RBUTTONUP = 7,
- EVENT_WHEELUP = 8,
- EVENT_WHEELDOWN = 9,
-
- EVENT_QUIT = 10,
- EVENT_SCREEN_CHANGED = 11
- };
-
- /**
- * Keyboard modifier flags, used for Event::kbd::flags.
- */
- enum {
- KBD_CTRL = 1 << 0,
- KBD_ALT = 1 << 1,
- KBD_SHIFT = 1 << 2
- };
-
- /**
- * Data structure for an event. A pointer to an instance of Event
- * can be passed to pollEvent.
- * @todo Rework/document this structure. It should be made 100% clear which
- * field is valid for which event type.
- * Implementation wise, we might want to use the classic
- * union-of-structs trick. It goes roughly like this:
- * struct BasicEvent {
- * EventType type;
- * };
- * struct MouseMovedEvent : BasicEvent {
- * Common::Point pos;
- * };
- * struct MouseButtonEvent : MouseMovedEvent {
- * int button;
- * };
- * struct KeyEvent : BasicEvent {
- * ...
- * };
- * ...
- * union Event {
- * EventType type;
- * MouseMovedEvent mouse;
- * MouseButtonEvent button;
- * KeyEvent key;
- * ...
- * };
- */
- struct Event {
- /** The type of the event. */
- EventType type;
- /** Flag to indicate if the event is real or synthetic. E.g. keyboard
- * repeat events are synthetic.
- */
- bool synthetic;
- /**
- * Keyboard data; only valid for keyboard events (EVENT_KEYDOWN and
- * EVENT_KEYUP). For all other event types, content is undefined.
- */
- struct {
- /**
- * Abstract key code (will be the same for any given key regardless
- * of modifiers being held at the same time.
- * For example, this is the same for both 'A' and Shift-'A'.
- * @todo Document which values are to be used for non-ASCII keys
- * like F1-F10. For now, let's just say that our primary backend
- * is the SDL one, and it uses the values SDL uses... so until
- * we fix this, your best bet is to get a copy of SDL_keysym.h
- * and look at that, if you want to find out a key code.
- */
- int keycode;
- /**
- * ASCII-value of the pressed key (if any).
- * This depends on modifiers, i.e. pressing the 'A' key results in
- * different values here depending on the status of shift, alt and
- * caps lock.
- * For the function keys F1-F9, values of 315-323 are used.
- */
- uint16 ascii;
- /**
- * Status of the modifier keys. Bits are set in this for each
- * pressed modifier
- * @see KBD_CTRL, KBD_ALT, KBD_SHIFT
- */
- byte flags;
- } kbd;
- /**
- * The mouse coordinates, in virtual screen coordinates. Only valid
- * for mouse events.
- * Virtual screen coordinates means: the coordinate system of the
- * screen area as defined by the most recent call to initSize().
- */
- Common::Point mouse;
- };
-
protected:
friend class DefaultEventManager;
/**
* Get the next event in the event queue.
- * @param event point to an Event struct, which will be filled with the event data.
+ * @param event point to an Common::Event struct, which will be filled with the event data.
* @return true if an event was retrieved.
*/
- virtual bool pollEvent(Event &event) = 0;
+ virtual bool pollEvent(Common::Event &event) = 0;
public:
/** Get the number of milliseconds since the program was started. */
Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp 2007-03-17 17:52:30 UTC (rev 26179)
+++ scummvm/trunk/engines/agi/agi.cpp 2007-03-17 19:02:05 UTC (rev 26180)
@@ -58,60 +58,60 @@
}
void AgiEngine::processEvents() {
- OSystem::Event event;
+ Common::Event event;
int key = 0;
Common::EventManager *eventMan = _system->getEventManager();
while (eventMan->pollEvent(event)) {
switch (event.type) {
- case OSystem::EVENT_QUIT:
+ case Common::EVENT_QUIT:
_gfx->deinitVideo();
_gfx->deinitMachine();
_system->quit();
break;
- case OSystem::EVENT_LBUTTONDOWN:
+ case Common::EVENT_LBUTTONDOWN:
key = BUTTON_LEFT;
g_mouse.button = 1;
keyEnqueue(key);
g_mouse.x = event.mouse.x;
g_mouse.y = event.mouse.y;
break;
- case OSystem::EVENT_RBUTTONDOWN:
+ case Common::EVENT_RBUTTONDOWN:
key = BUTTON_RIGHT;
g_mouse.button = 2;
keyEnqueue(key);
g_mouse.x = event.mouse.x;
g_mouse.y = event.mouse.y;
break;
- case OSystem::EVENT_WHEELUP:
+ case Common::EVENT_WHEELUP:
key = WHEEL_UP;
keyEnqueue(key);
break;
- case OSystem::EVENT_WHEELDOWN:
+ case Common::EVENT_WHEELDOWN:
key = WHEEL_DOWN;
keyEnqueue(key);
break;
- case OSystem::EVENT_MOUSEMOVE:
+ case Common::EVENT_MOUSEMOVE:
g_mouse.x = event.mouse.x;
g_mouse.y = event.mouse.y;
break;
- case OSystem::EVENT_LBUTTONUP:
- case OSystem::EVENT_RBUTTONUP:
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONUP:
g_mouse.button = 0;
break;
- case OSystem::EVENT_KEYDOWN:
+ case Common::EVENT_KEYDOWN:
_keyControl = 0;
_keyAlt = 0;
- if (event.kbd.flags == OSystem::KBD_CTRL && event.kbd.keycode == 'd') {
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list