Clean up OSystem::Event

svn-id: r15990
This commit is contained in:
Max Horn 2004-12-05 17:42:20 +00:00
parent 8d4fcb1689
commit f09293b22c
26 changed files with 146 additions and 111 deletions

View file

@ -56,7 +56,7 @@ void OSystem_PALMOS::SimulateArrowKeys(Event &event, Int8 iHoriz, Int8 iVert) {
y = (y < 0 ) ? 0 : y; y = (y < 0 ) ? 0 : y;
y = (y >= _screenHeight ) ? _screenHeight - 1 : y; y = (y >= _screenHeight ) ? _screenHeight - 1 : y;
event.event_code = EVENT_MOUSEMOVE; event.type = EVENT_MOUSEMOVE;
event.mouse.x = x; event.mouse.x = x;
event.mouse.y = y; event.mouse.y = y;
set_mouse_pos(x, y); set_mouse_pos(x, y);
@ -126,7 +126,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
Int8 sy = 0; Int8 sy = 0;
if (keyCurrentState & _keyMouse.bitButLeft) { if (keyCurrentState & _keyMouse.bitButLeft) {
event.event_code = EVENT_LBUTTONDOWN; event.type = EVENT_LBUTTONDOWN;
event.mouse.x = _mouseCurState.x; event.mouse.x = _mouseCurState.x;
event.mouse.y = _mouseCurState.y; event.mouse.y = _mouseCurState.y;
_lastKeyPressed = kLastKeyNone; _lastKeyPressed = kLastKeyNone;
@ -165,7 +165,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
// ESC key // ESC key
case vchrLaunch: case vchrLaunch:
_lastKeyPressed = kLastKeyNone; _lastKeyPressed = kLastKeyNone;
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = 27; event.kbd.keycode = 27;
event.kbd.ascii = 27; event.kbd.ascii = 27;
event.kbd.flags = 0; event.kbd.flags = 0;
@ -176,7 +176,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
case vchrMenu: case vchrMenu:
case vchrThumbWheelBack: // Tapwave back button case vchrThumbWheelBack: // Tapwave back button
_lastKeyPressed = kLastKeyNone; _lastKeyPressed = kLastKeyNone;
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = 319; event.kbd.keycode = 319;
event.kbd.ascii = 319; event.kbd.ascii = 319;
event.kbd.flags = 0; event.kbd.flags = 0;
@ -185,7 +185,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
case vchrCalc: case vchrCalc:
if (_lastKeyPressed & kLastKeyCalc) if (_lastKeyPressed & kLastKeyCalc)
if ((getMillis() - _exit_delay) <= (EXITDELAY)) if ((getMillis() - _exit_delay) <= (EXITDELAY))
event.event_code = EVENT_QUIT; event.type = EVENT_QUIT;
_exit_delay = getMillis(); _exit_delay = getMillis();
_lastKeyPressed = kLastKeyCalc; _lastKeyPressed = kLastKeyCalc;
@ -197,7 +197,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
#ifndef DISABLE_TAPWAVE #ifndef DISABLE_TAPWAVE
case vchrActionRight: case vchrActionRight:
#endif #endif
event.event_code = EVENT_RBUTTONDOWN; event.type = EVENT_RBUTTONDOWN;
event.mouse.x = _mouseCurState.x; event.mouse.x = _mouseCurState.x;
event.mouse.y = _mouseCurState.y; event.mouse.y = _mouseCurState.y;
_lastKeyPressed = kLastKeyNone; _lastKeyPressed = kLastKeyNone;
@ -213,11 +213,11 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
// wheel // wheel
case vchrJogUp: case vchrJogUp:
event.event_code = EVENT_WHEELUP; event.type = EVENT_WHEELUP;
return true; return true;
case vchrJogDown: case vchrJogDown:
event.event_code = EVENT_WHEELDOWN; event.type = EVENT_WHEELDOWN;
return true; return true;
@ -260,7 +260,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
// ESC key // ESC key
case vchrHard2: case vchrHard2:
_lastKeyPressed = kLastKeyNone; _lastKeyPressed = kLastKeyNone;
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = 27; event.kbd.keycode = 27;
event.kbd.ascii = 27; event.kbd.ascii = 27;
event.kbd.flags = 0; event.kbd.flags = 0;
@ -269,7 +269,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
// F5 = menu // F5 = menu
case vchrHard3: case vchrHard3:
_lastKeyPressed = kLastKeyNone; _lastKeyPressed = kLastKeyNone;
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = 319; event.kbd.keycode = 319;
event.kbd.ascii = 319; event.kbd.ascii = 319;
event.kbd.flags = 0; event.kbd.flags = 0;
@ -321,7 +321,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
b = 0; b = 0;
} else if ((keycode == 'z' && b == KBD_CTRL) || (b == KBD_ALT && keycode == 'x')) { } else if ((keycode == 'z' && b == KBD_CTRL) || (b == KBD_ALT && keycode == 'x')) {
event.event_code = EVENT_QUIT; event.type = EVENT_QUIT;
return true; return true;
} else if (keycode == 'n' && b == KBD_CTRL) { } else if (keycode == 'n' && b == KBD_CTRL) {
@ -344,7 +344,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
#endif #endif
} }
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = keycode; event.kbd.keycode = keycode;
event.kbd.ascii = keycode; //(keycode>='a' && keycode<='z' && (event.kbd.flags & KBD_SHIFT) ? keycode &~ 0x20 : keycode); event.kbd.ascii = keycode; //(keycode>='a' && keycode<='z' && (event.kbd.flags & KBD_SHIFT) ? keycode &~ 0x20 : keycode);
event.kbd.flags = b; event.kbd.flags = b;
@ -367,7 +367,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
return true; return true;
_lastEvent = penMoveEvent; _lastEvent = penMoveEvent;
event.event_code = EVENT_MOUSEMOVE; event.type = EVENT_MOUSEMOVE;
event.mouse.x = x; event.mouse.x = x;
event.mouse.y = y; event.mouse.y = y;
set_mouse_pos(event.mouse.x, event.mouse.y); set_mouse_pos(event.mouse.x, event.mouse.y);
@ -387,7 +387,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
_lastEvent = keyDownEvent; _lastEvent = keyDownEvent;
_lastKeyPressed = kLastKeyNone; _lastKeyPressed = kLastKeyNone;
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = key; event.kbd.keycode = key;
event.kbd.ascii = key; event.kbd.ascii = key;
event.kbd.flags = 0; event.kbd.flags = 0;
@ -399,7 +399,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0) if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0)
return true; return true;
event.event_code = EVENT_LBUTTONDOWN; event.type = EVENT_LBUTTONDOWN;
event.mouse.x = x; event.mouse.x = x;
event.mouse.y = y; event.mouse.y = y;
set_mouse_pos(event.mouse.x, event.mouse.y); set_mouse_pos(event.mouse.x, event.mouse.y);
@ -407,7 +407,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
case penUpEvent: case penUpEvent:
getCoordinates(&ev, &x, &y); getCoordinates(&ev, &x, &y);
event.event_code = EVENT_LBUTTONUP; event.type = EVENT_LBUTTONUP;
if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0) if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0)
return true; return true;

View file

@ -203,13 +203,13 @@ bool OSystem_Dreamcast::pollEvent(Event &event)
} }
event.kbd.ascii = event.kbd.keycode = 0; event.kbd.ascii = event.kbd.keycode = 0;
if(e<0) { if(e<0) {
event.event_code = (EventCode)-e; event.type = (EventType)-e;
return true; return true;
} else if(e>0) { } else if(e>0) {
bool processed = false, down = !(e&(1<<30)); bool processed = false, down = !(e&(1<<30));
e &= ~(1<<30); e &= ~(1<<30);
if(e < 1000) { if(e < 1000) {
event.event_code = (down? EVENT_KEYDOWN : EVENT_KEYUP); event.type = (down? EVENT_KEYDOWN : EVENT_KEYUP);
event.kbd.keycode = e; 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 & KBD_SHIFT)?
e &~ 0x20 : e); e &~ 0x20 : e);
@ -221,12 +221,12 @@ bool OSystem_Dreamcast::pollEvent(Event &event)
} }
return processed; return processed;
} else if(_ms_cur_x != _ms_old_x || _ms_cur_y != _ms_old_y) { } else if(_ms_cur_x != _ms_old_x || _ms_cur_y != _ms_old_y) {
event.event_code = EVENT_MOUSEMOVE; event.type = EVENT_MOUSEMOVE;
_ms_old_x = _ms_cur_x; _ms_old_x = _ms_cur_x;
_ms_old_y = _ms_cur_y; _ms_old_y = _ms_cur_y;
return true; return true;
} else { } else {
event.event_code = (EventCode)0; event.type = (EventType)0;
return false; return false;
} }
} }

View file

@ -842,7 +842,7 @@ bool OSystem_GP32::pollEvent(Event &event) { // fixme: make more user-friendly
if (key == GPC_VK_NONE) { if (key == GPC_VK_NONE) {
if (lastevent==EVENT_LBUTTONDOWN) { if (lastevent==EVENT_LBUTTONDOWN) {
lastevent=0; lastevent=0;
event.event_code = EVENT_LBUTTONUP; event.type = EVENT_LBUTTONUP;
return true; return true;
} }
return false; return false;
@ -855,7 +855,7 @@ bool OSystem_GP32::pollEvent(Event &event) { // fixme: make more user-friendly
oldkey=key; oldkey=key;
eventcount=EVENT_COUNT; eventcount=EVENT_COUNT;
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
if (key & GPC_VK_FL && key & GPC_VK_FR) { // L+R = save state if (key & GPC_VK_FL && key & GPC_VK_FR) { // L+R = save state
printf("Saving game, please wait..."); printf("Saving game, please wait...");
@ -903,12 +903,12 @@ bool OSystem_GP32::pollEvent(Event &event) { // fixme: make more user-friendly
if (key & GPC_VK_FA) { if (key & GPC_VK_FA) {
lastevent=EVENT_LBUTTONDOWN; lastevent=EVENT_LBUTTONDOWN;
event.event_code = EVENT_LBUTTONDOWN; event.type = EVENT_LBUTTONDOWN;
return true; return true;
} }
if (key & GPC_VK_FB) { if (key & GPC_VK_FB) {
lastevent=EVENT_RBUTTONDOWN; lastevent=EVENT_RBUTTONDOWN;
event.event_code = EVENT_RBUTTONDOWN; event.type = EVENT_RBUTTONDOWN;
return true; return true;
} }
@ -932,7 +932,7 @@ bool OSystem_GP32::pollEvent(Event &event) { // fixme: make more user-friendly
if (my>199) my=199; if (my>199) my=199;
} }
event.event_code = EVENT_MOUSEMOVE; event.type = EVENT_MOUSEMOVE;
km.x = event.mouse.x = mx; km.x = event.mouse.x = mx;
km.y = event.mouse.y = my; km.y = event.mouse.y = my;

View file

@ -113,7 +113,7 @@ public:
static int eatSystemEvents() { static int eatSystemEvents() {
OSystem::Event event; OSystem::Event event;
while (g_system->pollEvent(event)) { while (g_system->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_QUIT: case OSystem::EVENT_QUIT:
return 1; return 1;
default: default:

View file

@ -825,7 +825,7 @@ bool OSystem_MorphOS::pollEvent(Event &event)
qual |= KBD_CTRL; qual |= KBD_CTRL;
event.kbd.flags = qual; event.kbd.flags = qual;
event.event_code = (ScummMsg->Code & IECODE_UP_PREFIX) ? EVENT_KEYUP : EVENT_KEYDOWN; event.type = (ScummMsg->Code & IECODE_UP_PREFIX) ? EVENT_KEYUP : EVENT_KEYDOWN;
ScummMsg->Code &= ~IECODE_UP_PREFIX; ScummMsg->Code &= ~IECODE_UP_PREFIX;
if (ScummMsg->Code >= RAWKEY_F1 && ScummMsg->Code <= RAWKEY_F10) if (ScummMsg->Code >= RAWKEY_F1 && ScummMsg->Code <= RAWKEY_F10)
@ -849,13 +849,13 @@ bool OSystem_MorphOS::pollEvent(Event &event)
/* /*
* Wheelmouse event * Wheelmouse event
*/ */
event.event_code = (ScummMsg->Code == NM_WHEEL_UP) ? EVENT_WHEELUP : EVENT_WHEELDOWN; event.type = (ScummMsg->Code == NM_WHEEL_UP) ? EVENT_WHEELUP : EVENT_WHEELDOWN;
} }
else if (MapRawKey(&FakedIEvent, &charbuf, 1, NULL) == 1) else if (MapRawKey(&FakedIEvent, &charbuf, 1, NULL) == 1)
{ {
if (qual == KBD_CTRL && charbuf == 'z') if (qual == KBD_CTRL && charbuf == 'z')
{ {
event.event_code = EVENT_QUIT; event.type = EVENT_QUIT;
break; break;
} }
else if (qual == KBD_ALT) else if (qual == KBD_ALT)
@ -870,7 +870,7 @@ bool OSystem_MorphOS::pollEvent(Event &event)
} }
else if (charbuf == 'x') else if (charbuf == 'x')
{ {
event.event_code = EVENT_QUIT; event.type = EVENT_QUIT;
break; break;
} }
else if (charbuf == 0x0d) else if (charbuf == 0x0d)
@ -915,7 +915,7 @@ bool OSystem_MorphOS::pollEvent(Event &event)
else if (FullScreenMode) else if (FullScreenMode)
newy = newy <? (ScummScrHeight >> ScummScale)-2; newy = newy <? (ScummScrHeight >> ScummScale)-2;
event.event_code = EVENT_MOUSEMOVE; event.type = EVENT_MOUSEMOVE;
event.mouse.x = newx; event.mouse.x = newx;
event.mouse.y = newy; event.mouse.y = newy;
set_mouse_pos(event.mouse.x, event.mouse.y); set_mouse_pos(event.mouse.x, event.mouse.y);
@ -932,19 +932,19 @@ bool OSystem_MorphOS::pollEvent(Event &event)
switch (ScummMsg->Code) switch (ScummMsg->Code)
{ {
case SELECTDOWN: case SELECTDOWN:
event.event_code = EVENT_LBUTTONDOWN; event.type = EVENT_LBUTTONDOWN;
break; break;
case SELECTUP: case SELECTUP:
event.event_code = EVENT_LBUTTONUP; event.type = EVENT_LBUTTONUP;
break; break;
case MENUDOWN: case MENUDOWN:
event.event_code = EVENT_RBUTTONDOWN; event.type = EVENT_RBUTTONDOWN;
break; break;
case MENUUP: case MENUUP:
event.event_code = EVENT_RBUTTONUP; event.type = EVENT_RBUTTONUP;
break; break;
default: default:
@ -957,7 +957,7 @@ bool OSystem_MorphOS::pollEvent(Event &event)
} }
case IDCMP_CLOSEWINDOW: case IDCMP_CLOSEWINDOW:
event.event_code = EVENT_QUIT; event.type = EVENT_QUIT;
break; break;
} }

View file

@ -155,7 +155,7 @@ bool OSystem_SDL::pollEvent(Event &event) {
// If the screen mode changed, send an EVENT_SCREEN_CHANGED // If the screen mode changed, send an EVENT_SCREEN_CHANGED
if (_modeChanged) { if (_modeChanged) {
_modeChanged = false; _modeChanged = false;
event.event_code = EVENT_SCREEN_CHANGED; event.type = EVENT_SCREEN_CHANGED;
return true; return true;
} }
@ -222,19 +222,19 @@ bool OSystem_SDL::pollEvent(Event &event) {
#ifdef MACOSX #ifdef MACOSX
// On Macintosh', Cmd-Q quits // On Macintosh', Cmd-Q quits
if ((ev.key.keysym.mod & KMOD_META) && ev.key.keysym.sym == 'q') { if ((ev.key.keysym.mod & KMOD_META) && ev.key.keysym.sym == 'q') {
event.event_code = EVENT_QUIT; event.type = EVENT_QUIT;
return true; return true;
} }
#elif defined(UNIX) #elif defined(UNIX)
// On other unices, Control-Q quits // On other unices, Control-Q quits
if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'q') { if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'q') {
event.event_code = EVENT_QUIT; event.type = EVENT_QUIT;
return true; return true;
} }
#else #else
// Ctrl-z and Alt-X quit // Ctrl-z and Alt-X quit
if ((b == KBD_CTRL && ev.key.keysym.sym == 'z') || (b == KBD_ALT && ev.key.keysym.sym == 'x')) { if ((b == KBD_CTRL && ev.key.keysym.sym == 'z') || (b == KBD_ALT && ev.key.keysym.sym == 'x')) {
event.event_code = EVENT_QUIT; event.type = EVENT_QUIT;
return true; return true;
} }
#endif #endif
@ -322,26 +322,26 @@ bool OSystem_SDL::pollEvent(Event &event) {
#ifdef LINUPY #ifdef LINUPY
// On Yopy map the End button to quit // On Yopy map the End button to quit
if ((ev.key.keysym.sym == 293)) { if ((ev.key.keysym.sym == 293)) {
event.event_code = EVENT_QUIT; event.type = EVENT_QUIT;
return true; return true;
} }
// Map menu key to f5 (scumm menu) // Map menu key to f5 (scumm menu)
if (ev.key.keysym.sym == 306) { if (ev.key.keysym.sym == 306) {
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = SDLK_F5; event.kbd.keycode = SDLK_F5;
event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
return true; return true;
} }
// Map action key to action // Map action key to action
if (ev.key.keysym.sym == 291) { if (ev.key.keysym.sym == 291) {
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = SDLK_TAB; event.kbd.keycode = SDLK_TAB;
event.kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0); event.kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0);
return true; return true;
} }
// Map OK key to skip cinematic // Map OK key to skip cinematic
if (ev.key.keysym.sym == 292) { if (ev.key.keysym.sym == 292) {
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = SDLK_ESCAPE; event.kbd.keycode = SDLK_ESCAPE;
event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0); event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
return true; return true;
@ -351,13 +351,13 @@ bool OSystem_SDL::pollEvent(Event &event) {
#ifdef QTOPIA #ifdef QTOPIA
// quit on fn+backspace on zaurus // quit on fn+backspace on zaurus
if (ev.key.keysym.sym == 127) { if (ev.key.keysym.sym == 127) {
event.event_code = EVENT_QUIT; event.type = EVENT_QUIT;
return true; return true;
} }
// map menu key (f11) to f5 (scumm menu) // map menu key (f11) to f5 (scumm menu)
if (ev.key.keysym.sym == SDLK_F11) { if (ev.key.keysym.sym == SDLK_F11) {
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = SDLK_F5; event.kbd.keycode = SDLK_F5;
event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
} }
@ -365,25 +365,25 @@ bool OSystem_SDL::pollEvent(Event &event) {
// I wanted to map the calendar button but the calendar comes up // I wanted to map the calendar button but the calendar comes up
// //
else if (ev.key.keysym.sym == SDLK_SPACE) { else if (ev.key.keysym.sym == SDLK_SPACE) {
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = SDLK_TAB; event.kbd.keycode = SDLK_TAB;
event.kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0); 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 // 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) { else if (ev.key.keysym.sym == SDLK_TAB) {
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = SDLK_SPACE; event.kbd.keycode = SDLK_SPACE;
event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
} else { } else {
// let the events fall through if we didn't change them, this may not be the best way to // 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. // 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. // and yes i have an huge terminal size so i dont wrap soon enough.
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = ev.key.keysym.sym; event.kbd.keycode = ev.key.keysym.sym;
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
} }
#else #else
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = ev.key.keysym.sym; event.kbd.keycode = ev.key.keysym.sym;
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
#endif #endif
@ -412,7 +412,7 @@ bool OSystem_SDL::pollEvent(Event &event) {
return true; return true;
case SDL_KEYUP: case SDL_KEYUP:
event.event_code = EVENT_KEYUP; event.type = EVENT_KEYUP;
event.kbd.keycode = ev.key.keysym.sym; event.kbd.keycode = ev.key.keysym.sym;
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
@ -447,7 +447,7 @@ bool OSystem_SDL::pollEvent(Event &event) {
return true; return true;
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
event.event_code = EVENT_MOUSEMOVE; event.type = EVENT_MOUSEMOVE;
fillMouseEvent(event, ev.motion.x, ev.motion.y); fillMouseEvent(event, ev.motion.x, ev.motion.y);
setMousePos(event.mouse.x, event.mouse.y); setMousePos(event.mouse.x, event.mouse.y);
@ -455,14 +455,14 @@ bool OSystem_SDL::pollEvent(Event &event) {
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
if (ev.button.button == SDL_BUTTON_LEFT) if (ev.button.button == SDL_BUTTON_LEFT)
event.event_code = EVENT_LBUTTONDOWN; event.type = EVENT_LBUTTONDOWN;
else if (ev.button.button == SDL_BUTTON_RIGHT) else if (ev.button.button == SDL_BUTTON_RIGHT)
event.event_code = EVENT_RBUTTONDOWN; event.type = EVENT_RBUTTONDOWN;
#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN) #if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
else if (ev.button.button == SDL_BUTTON_WHEELUP) else if (ev.button.button == SDL_BUTTON_WHEELUP)
event.event_code = EVENT_WHEELUP; event.type = EVENT_WHEELUP;
else if (ev.button.button == SDL_BUTTON_WHEELDOWN) else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
event.event_code = EVENT_WHEELDOWN; event.type = EVENT_WHEELDOWN;
#endif #endif
else else
break; break;
@ -473,9 +473,9 @@ bool OSystem_SDL::pollEvent(Event &event) {
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
if (ev.button.button == SDL_BUTTON_LEFT) if (ev.button.button == SDL_BUTTON_LEFT)
event.event_code = EVENT_LBUTTONUP; event.type = EVENT_LBUTTONUP;
else if (ev.button.button == SDL_BUTTON_RIGHT) else if (ev.button.button == SDL_BUTTON_RIGHT)
event.event_code = EVENT_RBUTTONUP; event.type = EVENT_RBUTTONUP;
else else
break; break;
fillMouseEvent(event, ev.button.x, ev.button.y); fillMouseEvent(event, ev.button.x, ev.button.y);
@ -484,11 +484,11 @@ bool OSystem_SDL::pollEvent(Event &event) {
case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONDOWN:
if (ev.jbutton.button == JOY_BUT_LMOUSE) { if (ev.jbutton.button == JOY_BUT_LMOUSE) {
event.event_code = EVENT_LBUTTONDOWN; event.type = EVENT_LBUTTONDOWN;
} else if (ev.jbutton.button == JOY_BUT_RMOUSE) { } else if (ev.jbutton.button == JOY_BUT_RMOUSE) {
event.event_code = EVENT_RBUTTONDOWN; event.type = EVENT_RBUTTONDOWN;
} else { } else {
event.event_code = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
switch (ev.jbutton.button) { switch (ev.jbutton.button) {
case JOY_BUT_ESCAPE: case JOY_BUT_ESCAPE:
event.kbd.keycode = SDLK_ESCAPE; event.kbd.keycode = SDLK_ESCAPE;
@ -512,11 +512,11 @@ bool OSystem_SDL::pollEvent(Event &event) {
case SDL_JOYBUTTONUP: case SDL_JOYBUTTONUP:
if (ev.jbutton.button == JOY_BUT_LMOUSE) { if (ev.jbutton.button == JOY_BUT_LMOUSE) {
event.event_code = EVENT_LBUTTONUP; event.type = EVENT_LBUTTONUP;
} else if (ev.jbutton.button == JOY_BUT_RMOUSE) { } else if (ev.jbutton.button == JOY_BUT_RMOUSE) {
event.event_code = EVENT_RBUTTONUP; event.type = EVENT_RBUTTONUP;
} else { } else {
event.event_code = EVENT_KEYUP; event.type = EVENT_KEYUP;
switch (ev.jbutton.button) { switch (ev.jbutton.button) {
case JOY_BUT_ESCAPE: case JOY_BUT_ESCAPE:
event.kbd.keycode = SDLK_ESCAPE; event.kbd.keycode = SDLK_ESCAPE;
@ -542,10 +542,10 @@ bool OSystem_SDL::pollEvent(Event &event) {
axis = ev.jaxis.value; axis = ev.jaxis.value;
if ( axis > JOY_DEADZONE) { if ( axis > JOY_DEADZONE) {
axis -= JOY_DEADZONE; axis -= JOY_DEADZONE;
event.event_code = EVENT_MOUSEMOVE; event.type = EVENT_MOUSEMOVE;
} else if ( axis < -JOY_DEADZONE ) { } else if ( axis < -JOY_DEADZONE ) {
axis += JOY_DEADZONE; axis += JOY_DEADZONE;
event.event_code = EVENT_MOUSEMOVE; event.type = EVENT_MOUSEMOVE;
} else } else
axis = 0; axis = 0;
@ -590,7 +590,7 @@ bool OSystem_SDL::pollEvent(Event &event) {
break; break;
case SDL_QUIT: case SDL_QUIT:
event.event_code = EVENT_QUIT; event.type = EVENT_QUIT;
return true; return true;
} }
} }

View file

@ -1303,7 +1303,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
// If the screen mode changed, send an EVENT_SCREEN_CHANGED // If the screen mode changed, send an EVENT_SCREEN_CHANGED
if (_modeChanged) { if (_modeChanged) {
_modeChanged = false; _modeChanged = false;
event->event_code = EVENT_SCREEN_CHANGED; event->type = EVENT_SCREEN_CHANGED;
return true; return true;
} }
@ -1313,7 +1313,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
if (CEActions::Instance()->performMapped(ev.key.keysym.sym, true)) if (CEActions::Instance()->performMapped(ev.key.keysym.sym, true))
return true; return true;
event->event_code = EVENT_KEYDOWN; event->type = EVENT_KEYDOWN;
event->kbd.keycode = ev.key.keysym.sym; event->kbd.keycode = ev.key.keysym.sym;
event->kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); event->kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
@ -1326,7 +1326,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
if (CEActions::Instance()->performMapped(ev.key.keysym.sym, false)) if (CEActions::Instance()->performMapped(ev.key.keysym.sym, false))
return true; return true;
event->event_code = EVENT_KEYUP; event->type = EVENT_KEYUP;
event->kbd.keycode = ev.key.keysym.sym; event->kbd.keycode = ev.key.keysym.sym;
event->kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); event->kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
@ -1336,16 +1336,16 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
return true; return true;
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
event->event_code = EVENT_MOUSEMOVE; event->type = EVENT_MOUSEMOVE;
fillMouseEvent(*event, ev.motion.x, ev.motion.y); fillMouseEvent(*event, ev.motion.x, ev.motion.y);
set_mouse_pos(event->mouse.x, event->mouse.y); set_mouse_pos(event->mouse.x, event->mouse.y);
return true; return true;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
if (ev.button.button == SDL_BUTTON_LEFT) if (ev.button.button == SDL_BUTTON_LEFT)
temp_event.event_code = EVENT_LBUTTONDOWN; temp_event.type = EVENT_LBUTTONDOWN;
else if (ev.button.button == SDL_BUTTON_RIGHT) else if (ev.button.button == SDL_BUTTON_RIGHT)
temp_event.event_code = EVENT_RBUTTONDOWN; temp_event.type = EVENT_RBUTTONDOWN;
else else
break; break;
@ -1371,9 +1371,9 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
if (ev.button.button == SDL_BUTTON_LEFT) if (ev.button.button == SDL_BUTTON_LEFT)
temp_event.event_code = EVENT_LBUTTONUP; temp_event.type = EVENT_LBUTTONUP;
else if (ev.button.button == SDL_BUTTON_RIGHT) else if (ev.button.button == SDL_BUTTON_RIGHT)
temp_event.event_code = EVENT_RBUTTONUP; temp_event.type = EVENT_RBUTTONUP;
else else
break; break;
@ -1395,7 +1395,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
break; break;
case SDL_QUIT: case SDL_QUIT:
event->event_code = EVENT_QUIT; event->type = EVENT_QUIT;
return true; return true;
} }
} }

View file

@ -923,7 +923,7 @@ bool OSystem_X11::pollEvent(Event &scumm_event) {
} }
} }
if (keycode != -1) { if (keycode != -1) {
scumm_event.event_code = EVENT_KEYDOWN; scumm_event.type = EVENT_KEYDOWN;
scumm_event.kbd.keycode = keycode; scumm_event.kbd.keycode = keycode;
scumm_event.kbd.ascii = (ascii != -1 ? ascii : keycode); scumm_event.kbd.ascii = (ascii != -1 ? ascii : keycode);
scumm_event.kbd.flags = mode; scumm_event.kbd.flags = mode;
@ -965,7 +965,7 @@ bool OSystem_X11::pollEvent(Event &scumm_event) {
} }
} }
if (keycode != -1) { if (keycode != -1) {
scumm_event.event_code = EVENT_KEYUP; scumm_event.type = EVENT_KEYUP;
scumm_event.kbd.keycode = keycode; scumm_event.kbd.keycode = keycode;
scumm_event.kbd.ascii = (ascii != -1 ? ascii : keycode); scumm_event.kbd.ascii = (ascii != -1 ? ascii : keycode);
scumm_event.kbd.flags = mode; scumm_event.kbd.flags = mode;
@ -978,12 +978,12 @@ bool OSystem_X11::pollEvent(Event &scumm_event) {
if (report_presses != 0) { if (report_presses != 0) {
if (event.xbutton.button == 1) { if (event.xbutton.button == 1) {
if (fake_right_mouse == 0) { if (fake_right_mouse == 0) {
scumm_event.event_code = EVENT_LBUTTONDOWN; scumm_event.type = EVENT_LBUTTONDOWN;
} else { } else {
scumm_event.event_code = EVENT_RBUTTONDOWN; scumm_event.type = EVENT_RBUTTONDOWN;
} }
} else if (event.xbutton.button == 3) } else if (event.xbutton.button == 3)
scumm_event.event_code = EVENT_RBUTTONDOWN; scumm_event.type = EVENT_RBUTTONDOWN;
scumm_event.mouse.x = event.xbutton.x - scumm_x; scumm_event.mouse.x = event.xbutton.x - scumm_x;
scumm_event.mouse.y = event.xbutton.y - scumm_y; scumm_event.mouse.y = event.xbutton.y - scumm_y;
return true; return true;
@ -994,12 +994,12 @@ bool OSystem_X11::pollEvent(Event &scumm_event) {
if (report_presses != 0) { if (report_presses != 0) {
if (event.xbutton.button == 1) { if (event.xbutton.button == 1) {
if (fake_right_mouse == 0) { if (fake_right_mouse == 0) {
scumm_event.event_code = EVENT_LBUTTONUP; scumm_event.type = EVENT_LBUTTONUP;
} else { } else {
scumm_event.event_code = EVENT_RBUTTONUP; scumm_event.type = EVENT_RBUTTONUP;
} }
} else if (event.xbutton.button == 3) } else if (event.xbutton.button == 3)
scumm_event.event_code = EVENT_RBUTTONUP; scumm_event.type = EVENT_RBUTTONUP;
scumm_event.mouse.x = event.xbutton.x - scumm_x; scumm_event.mouse.x = event.xbutton.x - scumm_x;
scumm_event.mouse.y = event.xbutton.y - scumm_y; scumm_event.mouse.y = event.xbutton.y - scumm_y;
return true; return true;
@ -1007,7 +1007,7 @@ bool OSystem_X11::pollEvent(Event &scumm_event) {
break; break;
case MotionNotify: case MotionNotify:
scumm_event.event_code = EVENT_MOUSEMOVE; scumm_event.type = EVENT_MOUSEMOVE;
scumm_event.mouse.x = event.xmotion.x - scumm_x; scumm_event.mouse.x = event.xmotion.x - scumm_x;
scumm_event.mouse.y = event.xmotion.y - scumm_y; scumm_event.mouse.y = event.xmotion.y - scumm_y;
set_mouse_pos(scumm_event.mouse.x, scumm_event.mouse.y); set_mouse_pos(scumm_event.mouse.x, scumm_event.mouse.y);

View file

@ -394,10 +394,18 @@ public:
/** /**
* The types of events backends may generate. * The types of events backends may generate.
* @see Event * @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 EventCode { enum EventType {
/** A key was pressed, details in Event::kbd. */
EVENT_KEYDOWN = 1, EVENT_KEYDOWN = 1,
/** A key was released, details in Event::kbd. */
EVENT_KEYUP = 2, EVENT_KEYUP = 2,
/** The mouse moved, details in Event::mouse. */
EVENT_MOUSEMOVE = 3, EVENT_MOUSEMOVE = 3,
EVENT_LBUTTONDOWN = 4, EVENT_LBUTTONDOWN = 4,
EVENT_LBUTTONUP = 5, EVENT_LBUTTONUP = 5,
@ -410,19 +418,46 @@ public:
EVENT_SCREEN_CHANGED = 11 EVENT_SCREEN_CHANGED = 11
}; };
/**
* Keyboard modifier flags, used for Event::kbd::flags.
*/
enum { enum {
KBD_CTRL = 1, KBD_CTRL = 1 << 0,
KBD_ALT = 2, KBD_ALT = 1 << 1,
KBD_SHIFT = 4 KBD_SHIFT = 1 << 2
}; };
/** /**
* Data structure for an event. A pointer to an instance of Event * Data structure for an event. A pointer to an instance of Event
* can be passed to pollEvent. * 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 { struct Event {
/** The type of the event. */ /** The type of the event. */
EventCode event_code; EventType type;
/** /**
* Keyboard data; only valid for keyboard events (EVENT_KEYDOWN and * Keyboard data; only valid for keyboard events (EVENT_KEYDOWN and
* EVENT_KEYUP). For all other event types, content is undefined. * EVENT_KEYUP). For all other event types, content is undefined.
@ -521,7 +556,7 @@ public:
* Create a new mutex. * Create a new mutex.
* @return the newly created mutex, or 0 if an error occured. * @return the newly created mutex, or 0 if an error occured.
*/ */
virtual MutexRef createMutex(void) = 0; virtual MutexRef createMutex() = 0;
/** /**
* Lock the given mutex. * Lock the given mutex.

View file

@ -110,7 +110,7 @@ void NewGui::runLoop() {
uint32 time = _system->getMillis(); uint32 time = _system->getMillis();
while (_system->pollEvent(event)) { while (_system->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_KEYDOWN: case OSystem::EVENT_KEYDOWN:
#if !defined(__PALM_OS__) #if !defined(__PALM_OS__)
// init continuous event stream // init continuous event stream

View file

@ -252,7 +252,7 @@ int KyraEngine::go() {
_font->drawStringToPlane("Nothing scripted!", _screen, 320, 200, 85, 189, 136); _font->drawStringToPlane("Nothing scripted!", _screen, 320, 200, 85, 189, 136);
updateScreen(); updateScreen();
while (g_system->pollEvent(event)) { while (g_system->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_QUIT: case OSystem::EVENT_QUIT:
g_system->quit(); g_system->quit();
break; break;

View file

@ -97,7 +97,7 @@ void Input::delay(uint amount) {
do { do {
while (_system->pollEvent(event)) { while (_system->pollEvent(event)) {
_idleTime = 0; _idleTime = 0;
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_KEYDOWN: case OSystem::EVENT_KEYDOWN:
if (event.kbd.flags == OSystem::KBD_CTRL) { if (event.kbd.flags == OSystem::KBD_CTRL) {
if (event.kbd.keycode == 'd') { if (event.kbd.keycode == 'd') {

View file

@ -63,7 +63,7 @@ void Journal::use() {
while (!_quit) { while (!_quit) {
OSystem::Event event; OSystem::Event event;
while (system->pollEvent(event)) { while (system->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_KEYDOWN: case OSystem::EVENT_KEYDOWN:
handleKeyDown(event.kbd.ascii, event.kbd.keycode); handleKeyDown(event.kbd.ascii, event.kbd.keycode);
break; break;

View file

@ -38,7 +38,7 @@ int SagaEngine::processInput() {
Point imousePt; Point imousePt;
while (g_system->pollEvent(event)) { while (g_system->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_KEYDOWN: case OSystem::EVENT_KEYDOWN:
if (event.kbd.flags == OSystem::KBD_CTRL) { if (event.kbd.flags == OSystem::KBD_CTRL) {
if (event.kbd.keycode == 'd') if (event.kbd.keycode == 'd')

View file

@ -42,7 +42,7 @@ void ScummEngine::parseEvents() {
while (_system->pollEvent(event)) { while (_system->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_KEYDOWN: case OSystem::EVENT_KEYDOWN:
if (event.kbd.keycode >= '0' && event.kbd.keycode <= '9' if (event.kbd.keycode >= '0' && event.kbd.keycode <= '9'
&& (event.kbd.flags == OSystem::KBD_ALT || && (event.kbd.flags == OSystem::KBD_ALT ||

View file

@ -4830,7 +4830,7 @@ void SimonEngine::delay(uint amount) {
} }
while (_system->pollEvent(event)) { while (_system->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_KEYDOWN: case OSystem::EVENT_KEYDOWN:
if (event.kbd.keycode >= '0' && event.kbd.keycode <='9' if (event.kbd.keycode >= '0' && event.kbd.keycode <='9'
&& (event.kbd.flags == OSystem::KBD_ALT || && (event.kbd.flags == OSystem::KBD_ALT ||

View file

@ -1686,7 +1686,7 @@ void Control::delay(unsigned int amount) {
do { do {
while (_system->pollEvent(event)) { while (_system->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_KEYDOWN: case OSystem::EVENT_KEYDOWN:
// Make sure backspace works right (this fixes a small issue on OS X) // Make sure backspace works right (this fixes a small issue on OS X)
if (event.kbd.keycode == 8) if (event.kbd.keycode == 8)

View file

@ -898,10 +898,10 @@ bool Intro::escDelay(uint32 msecs) {
int32 nDelay = 0; int32 nDelay = 0;
do { do {
while (_system->pollEvent(event)) { while (_system->pollEvent(event)) {
if (event.event_code == OSystem::EVENT_KEYDOWN) { if (event.type == OSystem::EVENT_KEYDOWN) {
if (event.kbd.keycode == 27) if (event.kbd.keycode == 27)
return false; return false;
} else if (event.event_code == OSystem::EVENT_QUIT) { } else if (event.type == OSystem::EVENT_QUIT) {
_quitProg = true; _quitProg = true;
return false; return false;
} }

View file

@ -170,8 +170,8 @@ void Mouse::waitMouseNotPressed(void) {
while (mousePressed) { while (mousePressed) {
_system->delayMillis(20); _system->delayMillis(20);
while (_system->pollEvent(event)) { while (_system->pollEvent(event)) {
if ((event.event_code == OSystem::EVENT_LBUTTONUP) || if ((event.type == OSystem::EVENT_LBUTTONUP) ||
(event.event_code == OSystem::EVENT_QUIT)) (event.type == OSystem::EVENT_QUIT))
mousePressed = false; mousePressed = false;
} }
} }

View file

@ -453,7 +453,7 @@ void SkyEngine::delay(uint amount) {
do { do {
while (_system->pollEvent(event)) { while (_system->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_KEYDOWN: case OSystem::EVENT_KEYDOWN:
if (event.kbd.flags == OSystem::KBD_CTRL) { if (event.kbd.flags == OSystem::KBD_CTRL) {
if (event.kbd.keycode == 'f') { if (event.kbd.keycode == 'f') {

View file

@ -141,7 +141,7 @@ void MoviePlayer::play(uint32 id) {
frameCount++; frameCount++;
OSystem::Event event; OSystem::Event event;
while (_sys->pollEvent(event)) { while (_sys->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
#ifndef BACKEND_8BIT #ifndef BACKEND_8BIT
case OSystem::EVENT_SCREEN_CHANGED: case OSystem::EVENT_SCREEN_CHANGED:
anim->invalidateLookup(true); anim->invalidateLookup(true);

View file

@ -993,7 +993,7 @@ void Control::delay(uint32 msecs) {
do { do {
while (_system->pollEvent(event)) { while (_system->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_KEYDOWN: case OSystem::EVENT_KEYDOWN:
// Make sure backspace works right (this fixes a small issue on OS X) // Make sure backspace works right (this fixes a small issue on OS X)

View file

@ -273,7 +273,7 @@ void CreditsPlayer::delay(int msecs) {
uint32 start = _system->getMillis(); uint32 start = _system->getMillis();
do { do {
while (_system->pollEvent(event)) { while (_system->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_QUIT: case OSystem::EVENT_QUIT:
SwordEngine::_systemVars.engineQuit = true; SwordEngine::_systemVars.engineQuit = true;
break; break;

View file

@ -1292,7 +1292,7 @@ void SwordEngine::delay(uint amount) { //copied and mutilated from sky.cpp
do { do {
while (_system->pollEvent(event)) { while (_system->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_KEYDOWN: case OSystem::EVENT_KEYDOWN:
// Make sure backspace works right (this fixes a small issue on OS X) // Make sure backspace works right (this fixes a small issue on OS X)

View file

@ -255,7 +255,7 @@ int32 MoviePlayer::play(const char *filename, MovieTextObject *text[], byte *mus
OSystem::Event event; OSystem::Event event;
while (_sys->pollEvent(event)) { while (_sys->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
#ifndef BACKEND_8BIT #ifndef BACKEND_8BIT
case OSystem::EVENT_SCREEN_CHANGED: case OSystem::EVENT_SCREEN_CHANGED:
anim->invalidateLookup(true); anim->invalidateLookup(true);

View file

@ -419,7 +419,7 @@ void Sword2Engine::parseEvents() {
OSystem::Event event; OSystem::Event event;
while (_system->pollEvent(event)) { while (_system->pollEvent(event)) {
switch (event.event_code) { switch (event.type) {
case OSystem::EVENT_KEYDOWN: case OSystem::EVENT_KEYDOWN:
if (!(_eventFilter & RD_KEYDOWN)) { if (!(_eventFilter & RD_KEYDOWN)) {
_keyboardEvent.pending = true; _keyboardEvent.pending = true;