Moved Event/EventType/keyboard enum from common/system.h (part of class OSystem) to common/events.h (part of namespace Common). Porters may have to make minor changes to their backends to get them to compile again
svn-id: r26180
This commit is contained in:
parent
f272d19570
commit
ed54ea9155
88 changed files with 762 additions and 748 deletions
|
@ -38,7 +38,7 @@ DefaultEventManager::DefaultEventManager(OSystem *boss) :
|
|||
_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 @@ bool DefaultEventManager::pollEvent(OSystem::Event &event) {
|
|||
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 @@ bool DefaultEventManager::pollEvent(OSystem::Event &event) {
|
|||
_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 @@ bool DefaultEventManager::pollEvent(OSystem::Event &event) {
|
|||
}
|
||||
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 @@ bool DefaultEventManager::pollEvent(OSystem::Event &event) {
|
|||
// 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;
|
||||
|
|
|
@ -62,7 +62,7 @@ class DefaultEventManager : public Common::EventManager {
|
|||
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; }
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
#include "be_base.h"
|
||||
#include "common/events.h"
|
||||
|
||||
#ifdef STDLIB_TRACE_MEMORY
|
||||
# include <stdlib.h>
|
||||
|
@ -119,7 +120,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) {
|
|||
event.kbd.keycode = 275;
|
||||
|
||||
if (event.kbd.keycode) {
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.ascii = event.kbd.keycode;
|
||||
event.kbd.flags = 0;
|
||||
return true;
|
||||
|
@ -141,7 +142,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) {
|
|||
|
||||
if (sx || sy) {
|
||||
simulate_mouse(event, sx, sy, &x, &y);
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
event.mouse.x = x;
|
||||
event.mouse.y = y;
|
||||
warpMouse(x, y);
|
||||
|
@ -156,7 +157,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) {
|
|||
switch (ev.data.keyDown.chr) {
|
||||
// ESC key
|
||||
case vchrLaunch:
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = 27;
|
||||
event.kbd.ascii = 27;
|
||||
event.kbd.flags = 0;
|
||||
|
@ -164,7 +165,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) {
|
|||
|
||||
// F5 = menu
|
||||
case vchrMenu:
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = 319;
|
||||
event.kbd.ascii = 319;
|
||||
event.kbd.flags = 0;
|
||||
|
@ -206,7 +207,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) {
|
|||
if (abs(y - event.mouse.y) <= 2 || abs(x - event.mouse.x) <= 2)
|
||||
return false;
|
||||
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
event.mouse.x = x;
|
||||
event.mouse.y = y;
|
||||
warpMouse(x, y);
|
||||
|
@ -222,7 +223,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) {
|
|||
(3 - (3 * x / _screenWidth )) -
|
||||
(3 * (3 * y / _screenHeight));
|
||||
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = num;
|
||||
event.kbd.ascii = num;
|
||||
event.kbd.flags = 0;
|
||||
|
@ -234,7 +235,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) {
|
|||
if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0)
|
||||
return false;
|
||||
|
||||
event.type = ((gVars->stylusClick || _overlayVisible) ? EVENT_LBUTTONDOWN : EVENT_MOUSEMOVE);
|
||||
event.type = ((gVars->stylusClick || _overlayVisible) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_MOUSEMOVE);
|
||||
event.mouse.x = x;
|
||||
event.mouse.y = y;
|
||||
warpMouse(x, y);
|
||||
|
@ -243,7 +244,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) {
|
|||
case penUpEvent:
|
||||
get_coordinates(&ev, x, y);
|
||||
|
||||
event.type = ((gVars->stylusClick || _overlayVisible) ? EVENT_LBUTTONUP : EVENT_MOUSEMOVE);
|
||||
event.type = ((gVars->stylusClick || _overlayVisible) ? Common::EVENT_LBUTTONUP : Common::EVENT_MOUSEMOVE);
|
||||
if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0)
|
||||
return false;
|
||||
|
||||
|
@ -272,15 +273,15 @@ bool OSystem_PalmBase::pollEvent(Event &event) {
|
|||
|
||||
if (_lastKeyModifier == kModifierNone) {
|
||||
// for keyboard mode
|
||||
if (ev.data.keyDown.modifiers & shiftKeyMask) mask |= KBD_SHIFT;
|
||||
if (ev.data.keyDown.modifiers & controlKeyMask) mask |= KBD_CTRL;
|
||||
if (ev.data.keyDown.modifiers & optionKeyMask) mask |= KBD_ALT;
|
||||
if (ev.data.keyDown.modifiers & commandKeyMask) mask |= KBD_CTRL|KBD_ALT;
|
||||
if (ev.data.keyDown.modifiers & shiftKeyMask) mask |= Common::KBD_SHIFT;
|
||||
if (ev.data.keyDown.modifiers & controlKeyMask) mask |= Common::KBD_CTRL;
|
||||
if (ev.data.keyDown.modifiers & optionKeyMask) mask |= Common::KBD_ALT;
|
||||
if (ev.data.keyDown.modifiers & commandKeyMask) mask |= Common::KBD_CTRL|Common::KBD_ALT;
|
||||
} else {
|
||||
// for grafiti mode
|
||||
if (_lastKeyModifier == kModifierCommand) mask = KBD_CTRL|KBD_ALT;
|
||||
if (_lastKeyModifier == kModifierAlt) mask = KBD_ALT;
|
||||
if (_lastKeyModifier == kModifierCtrl) mask = KBD_CTRL;
|
||||
if (_lastKeyModifier == kModifierCommand) mask = Common::KBD_CTRL|Common::KBD_ALT;
|
||||
if (_lastKeyModifier == kModifierAlt) mask = Common::KBD_ALT;
|
||||
if (_lastKeyModifier == kModifierCtrl) mask = Common::KBD_CTRL;
|
||||
}
|
||||
|
||||
if (_lastKeyModifier)
|
||||
|
@ -288,22 +289,22 @@ bool OSystem_PalmBase::pollEvent(Event &event) {
|
|||
_lastKeyModifier = kModifierNone;
|
||||
|
||||
// F1 -> F10 key
|
||||
if (key >= '0' && key <= '9' && mask == (KBD_CTRL|KBD_ALT)) {
|
||||
if (key >= '0' && key <= '9' && mask == (Common::KBD_CTRL|Common::KBD_ALT)) {
|
||||
key = (key == '0') ? 324 : (315 + key - '1');
|
||||
mask = 0;
|
||||
|
||||
#ifdef STDLIB_TRACE_MEMORY
|
||||
// print memory
|
||||
} else if (key == 'm' && mask == (KBD_CTRL|KBD_ALT)) {
|
||||
} else if (key == 'm' && mask == (Common::KBD_CTRL|Common::KBD_ALT)) {
|
||||
printf("Used memory: %d\n", __stdlib_trace_memory);
|
||||
#endif
|
||||
// exit
|
||||
} else if ((key == 'z' && mask == KBD_CTRL) || (mask == KBD_ALT && key == 'x')) {
|
||||
event.type = EVENT_QUIT;
|
||||
} else if ((key == 'z' && mask == Common::KBD_CTRL) || (mask == Common::KBD_ALT && key == 'x')) {
|
||||
event.type = Common::EVENT_QUIT;
|
||||
return true;
|
||||
|
||||
// num pad (indy fight mode)
|
||||
} else if (key == 'n' && mask == (KBD_CTRL|KBD_ALT) && !_overlayVisible) {
|
||||
} else if (key == 'n' && mask == (Common::KBD_CTRL|Common::KBD_ALT) && !_overlayVisible) {
|
||||
_useNumPad = !_useNumPad;
|
||||
draw_osd(kDrawFight, _screenDest.w - 34, _screenDest.h + 2, _useNumPad, 1);
|
||||
displayMessageOnOSD(_useNumPad ? "Fight mode on." : "Fight mode off.");
|
||||
|
@ -312,7 +313,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) {
|
|||
|
||||
// other keys
|
||||
_wasKey = true;
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = key;
|
||||
event.kbd.ascii = key;
|
||||
event.kbd.flags = mask;
|
||||
|
@ -320,7 +321,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) {
|
|||
|
||||
default:
|
||||
if (_wasKey) {
|
||||
event.type = EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
_wasKey = false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ bool OSystem_PalmBase::showMouse(bool visible) {
|
|||
return last;
|
||||
}
|
||||
|
||||
void OSystem_PalmBase::simulate_mouse(Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr) {
|
||||
void OSystem_PalmBase::simulate_mouse(Common::Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr) {
|
||||
Int16 x = _mouseCurState.x;
|
||||
Int16 y = _mouseCurState.y;
|
||||
Int16 slow, fact;
|
||||
|
|
|
@ -95,12 +95,12 @@ private:
|
|||
virtual void undraw_mouse() = 0;
|
||||
|
||||
// virtual bool check_hard_keys() = 0;
|
||||
virtual bool check_event(Event &event, EventPtr ev) = 0;
|
||||
virtual bool check_event(Common::Event &event, EventPtr ev) = 0;
|
||||
|
||||
virtual void timer_handler();
|
||||
void battery_handler();
|
||||
virtual void get_coordinates(EventPtr ev, Coord &x, Coord &y) = 0;
|
||||
void simulate_mouse(Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr);
|
||||
void simulate_mouse(Common::Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr);
|
||||
|
||||
virtual void sound_handler() = 0;
|
||||
virtual bool setSoundCallback(SoundProc proc, void *param) = 0;
|
||||
|
@ -229,7 +229,7 @@ public:
|
|||
virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b) = 0;
|
||||
virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) = 0;
|
||||
|
||||
bool pollEvent(Event &event);
|
||||
bool pollEvent(Common::Event &event);
|
||||
|
||||
virtual uint32 getMillis();
|
||||
virtual void delayMillis(uint msecs);
|
||||
|
|
|
@ -123,7 +123,7 @@ private:
|
|||
|
||||
void draw_mouse();
|
||||
void undraw_mouse();
|
||||
virtual bool check_event(Event &event, EventPtr ev);
|
||||
virtual bool check_event(Common::Event &event, EventPtr ev);
|
||||
virtual void extras_palette(uint8 index, uint8 r, uint8 g, uint8 b);
|
||||
void calc_scale();
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ private:
|
|||
|
||||
void extras_palette(uint8 index, uint8 r, uint8 g, uint8 b);
|
||||
void calc_rect(Boolean fullscreen);
|
||||
bool check_event(Event &event, EventPtr ev);
|
||||
bool check_event(Common::Event &event, EventPtr ev);
|
||||
void draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color = 0);
|
||||
|
||||
public:
|
||||
|
|
|
@ -41,13 +41,13 @@ bool OSystem_PalmOS5::check_event(Event &event, EventPtr ev) {
|
|||
if (ev->eType == keyUpEvent) {
|
||||
switch (ev->data.keyDown.chr) {
|
||||
case vchrHard3:
|
||||
event.type = EVENT_LBUTTONUP;
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
event.mouse.x = _mouseCurState.x;
|
||||
event.mouse.y = _mouseCurState.y;
|
||||
return true;
|
||||
|
||||
case vchrHard4:
|
||||
event.type = EVENT_RBUTTONUP;
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
event.mouse.x = _mouseCurState.x;
|
||||
event.mouse.y = _mouseCurState.y;
|
||||
return true;
|
||||
|
@ -70,13 +70,13 @@ bool OSystem_PalmOS5::check_event(Event &event, EventPtr ev) {
|
|||
return false; // not a key
|
||||
|
||||
case vchrHard3:
|
||||
event.type = EVENT_RBUTTONDOWN;
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
event.mouse.x = _mouseCurState.x;
|
||||
event.mouse.y = _mouseCurState.y;
|
||||
return true;
|
||||
|
||||
case vchrHard4:
|
||||
event.type = EVENT_RBUTTONDOWN;
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
event.mouse.x = _mouseCurState.x;
|
||||
event.mouse.y = _mouseCurState.y;
|
||||
return true;
|
||||
|
|
|
@ -24,17 +24,17 @@
|
|||
|
||||
#include "be_zodiac.h"
|
||||
|
||||
bool OSystem_PalmZodiac::check_event(Event &event, EventPtr ev) {
|
||||
bool OSystem_PalmZodiac::check_event(Common::Event &event, EventPtr ev) {
|
||||
if (ev->eType == keyUpEvent) {
|
||||
switch (ev->data.keyDown.chr) {
|
||||
case vchrActionLeft:
|
||||
event.type = EVENT_LBUTTONUP;
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
event.mouse.x = _mouseCurState.x;
|
||||
event.mouse.y = _mouseCurState.y;
|
||||
return true;
|
||||
|
||||
case vchrActionRight:
|
||||
event.type = EVENT_RBUTTONUP;
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
event.mouse.x = _mouseCurState.x;
|
||||
event.mouse.y = _mouseCurState.y;
|
||||
return true;
|
||||
|
@ -44,7 +44,7 @@ bool OSystem_PalmZodiac::check_event(Event &event, EventPtr ev) {
|
|||
switch (ev->data.keyDown.chr) {
|
||||
// F5 = menu
|
||||
case vchrThumbWheelBack:
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = 319;
|
||||
event.kbd.ascii = 319;
|
||||
event.kbd.flags = 0;
|
||||
|
@ -59,20 +59,20 @@ bool OSystem_PalmZodiac::check_event(Event &event, EventPtr ev) {
|
|||
return false; // not a key
|
||||
|
||||
case vchrActionLeft:
|
||||
event.type = EVENT_LBUTTONDOWN;
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
event.mouse.x = _mouseCurState.x;
|
||||
event.mouse.y = _mouseCurState.y;
|
||||
return true;
|
||||
|
||||
case vchrActionRight:
|
||||
event.type = EVENT_RBUTTONDOWN;
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
event.mouse.x = _mouseCurState.x;
|
||||
event.mouse.y = _mouseCurState.y;
|
||||
return true;
|
||||
|
||||
// skip text
|
||||
case vchrActionDown:
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = '.';
|
||||
event.kbd.ascii = '.';
|
||||
event.kbd.flags = 0;
|
||||
|
|
|
@ -114,7 +114,7 @@ class OSystem_Dreamcast : public OSystem {
|
|||
|
||||
// Get the next event.
|
||||
// Returns true if an event was retrieved.
|
||||
bool pollEvent(Event &event);
|
||||
bool pollEvent(Common::Event &event);
|
||||
|
||||
// Determine the output sample rate. Audio data provided by the sound
|
||||
// callback will be played using this rate.
|
||||
|
|
|
@ -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 handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
|
|||
int key = pad->cond.kbd.key[p];
|
||||
if(shift & 0x08) lmb++;
|
||||
if(shift & 0x80) rmb++;
|
||||
if(shift & 0x11) shiftFlags |= OSystem::KBD_CTRL;
|
||||
if(shift & 0x44) shiftFlags |= OSystem::KBD_ALT;
|
||||
if(shift & 0x22) shiftFlags |= OSystem::KBD_SHIFT;
|
||||
if(shift & 0x11) shiftFlags |= Common::KBD_CTRL;
|
||||
if(shift & 0x44) shiftFlags |= Common::KBD_ALT;
|
||||
if(shift & 0x22) shiftFlags |= Common::KBD_SHIFT;
|
||||
if(key >= 4 && key <= 0x1d)
|
||||
newkey = key+('a'-4);
|
||||
else if(key >= 0x1e && key <= 0x26)
|
||||
|
@ -143,26 +144,26 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
|
|||
|
||||
if(lmb && !lastlmb) {
|
||||
lastlmb = 1;
|
||||
return -OSystem::EVENT_LBUTTONDOWN;
|
||||
return -Common::EVENT_LBUTTONDOWN;
|
||||
} else if(lastlmb && !lmb) {
|
||||
lastlmb = 0;
|
||||
return -OSystem::EVENT_LBUTTONUP;
|
||||
return -Common::EVENT_LBUTTONUP;
|
||||
}
|
||||
if(rmb && !lastrmb) {
|
||||
lastrmb = 1;
|
||||
return -OSystem::EVENT_RBUTTONDOWN;
|
||||
return -Common::EVENT_RBUTTONDOWN;
|
||||
} else if(lastrmb && !rmb) {
|
||||
lastrmb = 0;
|
||||
return -OSystem::EVENT_RBUTTONUP;
|
||||
return -Common::EVENT_RBUTTONUP;
|
||||
}
|
||||
|
||||
if(mouse_wheel != lastwheel)
|
||||
if(((int8)(mouse_wheel - lastwheel)) > 0) {
|
||||
lastwheel++;
|
||||
return -OSystem::EVENT_WHEELDOWN;
|
||||
return -Common::EVENT_WHEELDOWN;
|
||||
} else {
|
||||
--lastwheel;
|
||||
return -OSystem::EVENT_WHEELUP;
|
||||
return -Common::EVENT_WHEELUP;
|
||||
}
|
||||
|
||||
if(newkey && inter && newkey != lastkey) {
|
||||
|
@ -187,7 +188,7 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool OSystem_Dreamcast::pollEvent(Event &event)
|
||||
bool OSystem_Dreamcast::pollEvent(Common::Event &event)
|
||||
{
|
||||
unsigned int t = Timer();
|
||||
|
||||
|
@ -224,9 +225,9 @@ bool OSystem_Dreamcast::pollEvent(Event &event)
|
|||
bool processed = false, down = !(e&(1<<30));
|
||||
e &= ~(1<<30);
|
||||
if(e < 1000) {
|
||||
event.type = (down? EVENT_KEYDOWN : EVENT_KEYUP);
|
||||
event.type = (down? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP);
|
||||
event.kbd.keycode = e;
|
||||
event.kbd.ascii = (e>='a' && e<='z' && (event.kbd.flags & KBD_SHIFT)?
|
||||
event.kbd.ascii = (e>='a' && e<='z' && (event.kbd.flags & Common::KBD_SHIFT)?
|
||||
e &~ 0x20 : e);
|
||||
processed = true;
|
||||
} else if(down) {
|
||||
|
@ -236,7 +237,7 @@ bool OSystem_Dreamcast::pollEvent(Event &event)
|
|||
}
|
||||
return processed;
|
||||
} else if(_ms_cur_x != _ms_old_x || _ms_cur_y != _ms_old_y) {
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
_ms_old_x = _ms_cur_x;
|
||||
_ms_old_y = _ms_cur_y;
|
||||
return true;
|
||||
|
|
|
@ -361,7 +361,7 @@ int gameMenu(Game *games, int num_games)
|
|||
event = handleInput(locked_get_pads(), mousex, mousey, shiftFlags);
|
||||
setimask(mask);
|
||||
|
||||
if(event==-OSystem::EVENT_LBUTTONDOWN || event==13 || event==319) {
|
||||
if(event==-Common::EVENT_LBUTTONDOWN || event==13 || event==319) {
|
||||
int selected_game = top_game + selector_pos;
|
||||
|
||||
for(int fade=0; fade<=256; fade+=4) {
|
||||
|
|
|
@ -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 @@ static const short key_codes[] =
|
|||
K('h','H'), K('j','J'), K('k','K'), K('l','L'), K(';','+'), K(':','*'),
|
||||
K('z','Z'), K('x','X'), K('c','C'), K('v','V'), K('b','B'),
|
||||
K('n','N'), K('m','M'), K(',','<'), K('.','>'), K('/','?'), K('\\','_'),
|
||||
~OSystem::KBD_SHIFT, ~OSystem::KBD_CTRL, ~OSystem::KBD_ALT, ' ', 8, 13
|
||||
~Common::KBD_SHIFT, ~Common::KBD_CTRL, ~Common::KBD_ALT, ' ', 8, 13
|
||||
};
|
||||
|
||||
SoftKeyboard::SoftKeyboard(const OSystem_Dreamcast *_os)
|
||||
|
@ -96,7 +97,7 @@ void SoftKeyboard::draw(float x, float y, int transp)
|
|||
draw_trans_quad(x, y, x+w, y+24.0, bg, bg, bg, bg);
|
||||
if(key_codes[i]<0 && (shiftState & ~key_codes[i]))
|
||||
labels[0][i].draw(x+2, y+5, txt_alpha_mask|0xffffff, 0.5);
|
||||
else if(key_codes[i]>8192 && (shiftState & OSystem::KBD_SHIFT))
|
||||
else if(key_codes[i]>8192 && (shiftState & Common::KBD_SHIFT))
|
||||
labels[1][i].draw(x+2, y+5, txt_alpha_mask|0x000000, 0.5);
|
||||
else
|
||||
labels[0][i].draw(x+2, y+5, txt_alpha_mask|0x000000, 0.5);
|
||||
|
@ -148,7 +149,7 @@ int SoftKeyboard::key(int k, byte &shiftFlags)
|
|||
else {
|
||||
shiftFlags = shiftState;
|
||||
if(key_codes[keySel] > 8192)
|
||||
return ((shiftState & OSystem::KBD_SHIFT)? (key_codes[keySel]>>8):
|
||||
return ((shiftState & Common::KBD_SHIFT)? (key_codes[keySel]>>8):
|
||||
key_codes[keySel]) & 0xff;
|
||||
else
|
||||
return key_codes[keySel];
|
||||
|
|
|
@ -851,9 +851,9 @@ void memoryReport() {
|
|||
|
||||
void addIndyFightingKeys() {
|
||||
OSystem_DS* system = OSystem_DS::instance();
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
event.type = OSystem::EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.flags = 0;
|
||||
|
||||
if ((getKeysDown() & KEY_L)) {
|
||||
|
@ -995,7 +995,7 @@ void addEventsToQueue() {
|
|||
consolePrintf("addEventsToQueue\n");
|
||||
#endif
|
||||
OSystem_DS* system = OSystem_DS::instance();
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
|
||||
|
||||
|
@ -1028,7 +1028,7 @@ void addEventsToQueue() {
|
|||
if ((getKeysDown() & KEY_B) && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) {
|
||||
// consolePrintf("Pressing Esc");
|
||||
|
||||
event.type = OSystem::EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = 27;
|
||||
event.kbd.ascii = 27;
|
||||
event.kbd.flags = 0;
|
||||
|
@ -1065,13 +1065,13 @@ void addEventsToQueue() {
|
|||
} else {
|
||||
// If we're playing sam and max, click and release the right mouse
|
||||
// button to change verb
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
event.type = OSystem::EVENT_RBUTTONDOWN;
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
event.mouse = Common::Point(getPenX(), getPenY());
|
||||
system->addEvent(event);
|
||||
|
||||
event.type = OSystem::EVENT_RBUTTONUP;
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
system->addEvent(event);
|
||||
}
|
||||
}
|
||||
|
@ -1099,10 +1099,10 @@ void addEventsToQueue() {
|
|||
|
||||
updateStatus();
|
||||
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) {
|
||||
event.type = OSystem::EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
event.mouse = Common::Point(getPenX(), getPenY());
|
||||
system->addEvent(event);
|
||||
//consolePrintf("x=%d y=%d \n", getPenX(), getPenY());
|
||||
|
@ -1111,13 +1111,13 @@ void addEventsToQueue() {
|
|||
if (!keyboardEnable) {
|
||||
if ((mouseMode != MOUSE_HOVER) || (!displayModeIs8Bit)) {
|
||||
if (getPenDown() && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) {
|
||||
event.type = ((mouseMode == MOUSE_LEFT) || (!displayModeIs8Bit))? OSystem::EVENT_LBUTTONDOWN: OSystem::EVENT_RBUTTONDOWN;
|
||||
event.type = ((mouseMode == MOUSE_LEFT) || (!displayModeIs8Bit))? Common::EVENT_LBUTTONDOWN: OSystem::EVENT_RBUTTONDOWN;
|
||||
event.mouse = Common::Point(getPenX(), getPenY());
|
||||
system->addEvent(event);
|
||||
}
|
||||
|
||||
if (getPenReleased()) {
|
||||
event.type = mouseMode == MOUSE_LEFT? OSystem::EVENT_LBUTTONUP: OSystem::EVENT_RBUTTONUP;
|
||||
event.type = mouseMode == MOUSE_LEFT? Common::EVENT_LBUTTONUP: OSystem::EVENT_RBUTTONUP;
|
||||
event.mouse = Common::Point(getPenX(), getPenY());
|
||||
system->addEvent(event);
|
||||
}
|
||||
|
@ -1126,23 +1126,23 @@ void addEventsToQueue() {
|
|||
|
||||
if (getPenHeld()) {
|
||||
if (getKeysDown() & KEY_LEFT) {
|
||||
event.type = OSystem::EVENT_LBUTTONDOWN;
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
event.mouse = Common::Point(getPenX(), getPenY());
|
||||
system->addEvent(event);
|
||||
}
|
||||
/* if (getKeysReleased() & KEY_LEFT) {
|
||||
event.type = OSystem::EVENT_LBUTTONUP;
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
event.mouse = Common::Point(getPenX(), getPenY());
|
||||
system->addEvent(event);
|
||||
}*/
|
||||
|
||||
if (getKeysDown() & KEY_RIGHT) {
|
||||
event.type = OSystem::EVENT_RBUTTONDOWN;
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
event.mouse = Common::Point(getPenX(), getPenY());
|
||||
system->addEvent(event);
|
||||
}
|
||||
/*if (getKeysReleased() & KEY_RIGHT) {
|
||||
event.type = OSystem::EVENT_RBUTTONUP;
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
event.mouse = Common::Point(getPenX(), getPenY());
|
||||
system->addEvent(event);
|
||||
}*/
|
||||
|
@ -1164,9 +1164,9 @@ void addEventsToQueue() {
|
|||
if (currentGame->control == CONT_SIMON) {
|
||||
// Extra controls for Simon the Sorcerer
|
||||
if ((getKeysDown() & KEY_DOWN)) {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
event.type = OSystem::EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = '#'; // F10 or # - show hotspots
|
||||
event.kbd.ascii = '#';
|
||||
event.kbd.flags = 0;
|
||||
|
@ -1178,9 +1178,9 @@ void addEventsToQueue() {
|
|||
if (currentGame->control == CONT_SCUMM_ORIGINAL) {
|
||||
// Extra controls for Scumm v1-5 games
|
||||
if ((getKeysDown() & KEY_DOWN)) {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
event.type = OSystem::EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = '.'; // Full stop - skips current dialogue line
|
||||
event.kbd.ascii = '.';
|
||||
event.kbd.flags = 0;
|
||||
|
@ -1200,35 +1200,35 @@ void addEventsToQueue() {
|
|||
// Front end controls
|
||||
|
||||
if (leftHandedSwap(getKeysDown()) & KEY_UP) {
|
||||
event.type = OSystem::EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = SDLK_UP;
|
||||
event.kbd.ascii = 0;
|
||||
event.kbd.flags = 0;
|
||||
system->addEvent(event);
|
||||
|
||||
event.type = OSystem::EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
system->addEvent(event);
|
||||
}
|
||||
|
||||
if (leftHandedSwap(getKeysDown()) & KEY_DOWN) {
|
||||
event.type = OSystem::EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = SDLK_DOWN;
|
||||
event.kbd.ascii = 0;
|
||||
event.kbd.flags = 0;
|
||||
system->addEvent(event);
|
||||
|
||||
event.type = OSystem::EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
system->addEvent(event);
|
||||
}
|
||||
|
||||
if (leftHandedSwap(getKeysDown()) & KEY_A) {
|
||||
event.type = OSystem::EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = SDLK_RETURN;
|
||||
event.kbd.ascii = 0;
|
||||
event.kbd.flags = 0;
|
||||
system->addEvent(event);
|
||||
|
||||
event.type = OSystem::EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
system->addEvent(event);
|
||||
}
|
||||
|
||||
|
@ -1236,13 +1236,13 @@ void addEventsToQueue() {
|
|||
|
||||
|
||||
if ((getKeysDown() & KEY_START)) {
|
||||
event.type = OSystem::EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = 319; // F5
|
||||
event.kbd.ascii = 319;
|
||||
event.kbd.flags = 0;
|
||||
system->addEvent(event);
|
||||
/*
|
||||
event.type = OSystem::EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
event.kbd.keycode = 319; // F5
|
||||
event.kbd.ascii = 319;
|
||||
system->addEvent(event);*/
|
||||
|
|
|
@ -154,13 +154,13 @@ void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint
|
|||
_delDialog->setList(Scumm::generateSavegameList(Scumm::g_scumm, false));
|
||||
_delDialog->handleCommand(NULL, GUI::kListSelectionChangedCmd, 0);
|
||||
|
||||
OSystem::Event event;
|
||||
event.type = OSystem::EVENT_KEYDOWN;
|
||||
Common::Event event;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.ascii = SDLK_DOWN;
|
||||
event.kbd.keycode = SDLK_DOWN;
|
||||
OSystem_DS::instance()->addEvent(event);
|
||||
|
||||
event.type = OSystem::EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
OSystem_DS::instance()->addEvent(event);
|
||||
|
||||
int idx = _delDialog->runModal();
|
||||
|
@ -182,8 +182,8 @@ void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint
|
|||
void showOptionsDialog() {
|
||||
OSystem_DS* system = OSystem_DS::instance();
|
||||
|
||||
OSystem::Event event;
|
||||
event.type = OSystem::EVENT_KEYDOWN;
|
||||
Common::Event event;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = 'P'; // F5
|
||||
event.kbd.ascii = 'P';
|
||||
event.kbd.flags = 0;
|
||||
|
@ -199,7 +199,7 @@ void showOptionsDialog() {
|
|||
|
||||
DS::displayMode8Bit();
|
||||
|
||||
event.type = OSystem::EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = 'P'; // F5
|
||||
event.kbd.ascii = 'P';
|
||||
event.kbd.flags = 0;
|
||||
|
|
|
@ -302,11 +302,11 @@ void OSystem_DS::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, i
|
|||
DS::setCursorIcon(buf, w, h, keycolor);
|
||||
}
|
||||
|
||||
void OSystem_DS::addEvent(Event& e) {
|
||||
void OSystem_DS::addEvent(Common::Event& e) {
|
||||
eventQueue[queuePos++] = e;
|
||||
}
|
||||
|
||||
bool OSystem_DS::pollEvent(Event &event)
|
||||
bool OSystem_DS::pollEvent(Common::Event &event)
|
||||
{
|
||||
|
||||
if (lastPenFrame != DS::getMillis()) {
|
||||
|
@ -316,7 +316,7 @@ bool OSystem_DS::pollEvent(Event &event)
|
|||
queuePos = 0;
|
||||
// Bodge - this last event seems to be processed sometimes and not others.
|
||||
// So we make it something harmless which won't cause any adverse effects.
|
||||
event.type = EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
event.kbd.ascii = 0;
|
||||
event.kbd.keycode = 0;
|
||||
event.kbd.flags = 0;
|
||||
|
@ -331,7 +331,7 @@ bool OSystem_DS::pollEvent(Event &event)
|
|||
|
||||
/* if (lastPenFrame != DS::getMillis()) {
|
||||
if ((eventNum == 0)) {
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
event.mouse = Common::Point(DS::getPenX(), DS::getPenY());
|
||||
eventNum = 1;
|
||||
return true;
|
||||
|
@ -340,12 +340,12 @@ bool OSystem_DS::pollEvent(Event &event)
|
|||
eventNum = 0;
|
||||
lastPenFrame = DS::getMillis();
|
||||
if (DS::getPenDown()) {
|
||||
event.type = EVENT_LBUTTONDOWN;
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
event.mouse = Common::Point(DS::getPenX(), DS::getPenY());
|
||||
consolePrintf("Down %d, %d ", event.mouse.x, event.mouse.y);
|
||||
return true;
|
||||
} else if (DS::getPenReleased()) {
|
||||
event.type = EVENT_LBUTTONUP;
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
event.mouse = Common::Point(DS::getPenX(), DS::getPenY());
|
||||
consolePrintf("Up %d, %d ", event.mouse.x, event.mouse.y);
|
||||
return true;
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
int eventNum;
|
||||
int lastPenFrame;
|
||||
|
||||
Event eventQueue[64];
|
||||
Common::Event eventQueue[64];
|
||||
int queuePos;
|
||||
|
||||
DSSaveFileManager saveManager;
|
||||
|
@ -94,7 +94,7 @@ public:
|
|||
virtual void warpMouse(int x, int y);
|
||||
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int targetCursorScale = 1);
|
||||
|
||||
virtual bool pollEvent(Event &event);
|
||||
virtual bool pollEvent(Common::Event &event);
|
||||
virtual uint32 getMillis();
|
||||
virtual void delayMillis(uint msecs);
|
||||
|
||||
|
@ -121,7 +121,7 @@ public:
|
|||
|
||||
virtual Common::SaveFileManager *getSavefileManager();
|
||||
|
||||
void addEvent(Event& e);
|
||||
void addEvent(Common::Event& e);
|
||||
bool isEventQueueEmpty() { return queuePos == 0; }
|
||||
|
||||
virtual bool grabRawScreen(Graphics::Surface* surf);
|
||||
|
|
|
@ -232,7 +232,7 @@ void addKeyboardEvents() {
|
|||
if (( (tx >= keys[r].x) && (tx <= keys[r].x + 1)) &&
|
||||
(ty >= keys[r].y) && (ty <= keys[r].y + 1)) {
|
||||
OSystem_DS* system = OSystem_DS::instance();
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
// consolePrintf("Key: %d\n", r);
|
||||
if ((keys[r].character == SDLK_UNKNOWN)) {
|
||||
|
@ -260,11 +260,11 @@ void addKeyboardEvents() {
|
|||
|
||||
//event.kbd.keycode = keys[r].character;
|
||||
//event.kbd.ascii = keys[r].character;
|
||||
event.type = OSystem::EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.flags = 0;
|
||||
system->addEvent(event);
|
||||
|
||||
event.type = OSystem::EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
system->addEvent(event);
|
||||
|
||||
switch (keys[r].character) {
|
||||
|
|
|
@ -23,13 +23,14 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* GP2X: Event Handling.
|
||||
* GP2X: Common::Event Handling.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "backends/platform/gp2x/gp2x-common.h"
|
||||
#include "backends/platform/gp2x/gp2x-hw.h"
|
||||
#include "common/util.h"
|
||||
#include "common/events.h"
|
||||
|
||||
// FIXME move joystick defines out and replace with confile file options
|
||||
// we should really allow users to map any key to a joystick button
|
||||
|
@ -78,7 +79,7 @@ static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode)
|
|||
return key;
|
||||
}
|
||||
|
||||
void OSystem_GP2X::fillMouseEvent(Event &event, int x, int y) {
|
||||
void OSystem_GP2X::fillMouseEvent(Common::Event &event, int x, int y) {
|
||||
event.mouse.x = x;
|
||||
event.mouse.y = y;
|
||||
|
||||
|
@ -170,15 +171,15 @@ static byte SDLModToOSystemKeyFlags(SDLMod mod) {
|
|||
// Yopy has no ALT key, steal the SHIFT key
|
||||
// (which isn't used much anyway)
|
||||
if (mod & KMOD_SHIFT)
|
||||
b |= OSystem::KBD_ALT;
|
||||
b |= Common::KBD_ALT;
|
||||
#else
|
||||
if (mod & KMOD_SHIFT)
|
||||
b |= OSystem::KBD_SHIFT;
|
||||
b |= Common::KBD_SHIFT;
|
||||
if (mod & KMOD_ALT)
|
||||
b |= OSystem::KBD_ALT;
|
||||
b |= Common::KBD_ALT;
|
||||
#endif
|
||||
if (mod & KMOD_CTRL)
|
||||
b |= OSystem::KBD_CTRL;
|
||||
b |= Common::KBD_CTRL;
|
||||
|
||||
return b;
|
||||
}
|
||||
|
@ -251,17 +252,17 @@ void OSystem_GP2X::moveStick() {
|
|||
//int GP2X_BUTTON_STATE_VOLUP = FALSE;
|
||||
//int GP2X_BUTTON_STATE_VOLDOWN = FALSE;
|
||||
|
||||
bool OSystem_GP2X::pollEvent(Event &event) {
|
||||
bool OSystem_GP2X::pollEvent(Common::Event &event) {
|
||||
SDL_Event ev;
|
||||
int axis;
|
||||
byte b = 0;
|
||||
|
||||
handleKbdMouse();
|
||||
|
||||
// If the screen mode changed, send an EVENT_SCREEN_CHANGED
|
||||
// If the screen mode changed, send an Common::EVENT_SCREEN_CHANGED
|
||||
if (_modeChanged) {
|
||||
_modeChanged = false;
|
||||
event.type = EVENT_SCREEN_CHANGED;
|
||||
event.type = Common::EVENT_SCREEN_CHANGED;
|
||||
_screenChangeCount++;
|
||||
return true;
|
||||
}
|
||||
|
@ -302,7 +303,7 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
Combos:
|
||||
|
||||
GP2X_BUTTON_VOLUP & GP2X_BUTTON_VOLDOWN 0 (For Monkey 2 CP)
|
||||
GP2X_BUTTON_L & GP2X_BUTTON_SELECT EVENT_QUIT (Calls Sync() to make sure SD is flushed)
|
||||
GP2X_BUTTON_L & GP2X_BUTTON_SELECT Common::EVENT_QUIT (Calls Sync() to make sure SD is flushed)
|
||||
GP2X_BUTTON_L & GP2X_BUTTON_Y Toggles setZoomOnMouse() for larger then 320*240 games to scale to the point + raduis.
|
||||
*/
|
||||
|
||||
|
@ -313,14 +314,14 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());
|
||||
|
||||
// Alt-Return and Alt-Enter toggle full screen mode
|
||||
if (b == KBD_ALT && (ev.key.keysym.sym == SDLK_RETURN
|
||||
if (b == Common::KBD_ALT && (ev.key.keysym.sym == SDLK_RETURN
|
||||
|| ev.key.keysym.sym == SDLK_KP_ENTER)) {
|
||||
setFullscreenMode(!_fullscreen);
|
||||
break;
|
||||
}
|
||||
|
||||
// Alt-S: Create a screenshot
|
||||
if (b == KBD_ALT && ev.key.keysym.sym == 's') {
|
||||
if (b == Common::KBD_ALT && ev.key.keysym.sym == 's') {
|
||||
char filename[20];
|
||||
|
||||
for (int n = 0;; n++) {
|
||||
|
@ -340,7 +341,7 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
}
|
||||
|
||||
// Ctrl-m toggles mouse capture
|
||||
//if (b == KBD_CTRL && ev.key.keysym.sym == 'm') {
|
||||
//if (b == Common::KBD_CTRL && ev.key.keysym.sym == 'm') {
|
||||
// toggleMouseGrab();
|
||||
// break;
|
||||
//}
|
||||
|
@ -348,25 +349,25 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
//#ifdef MACOSX
|
||||
// // On Macintosh', Cmd-Q quits
|
||||
// if ((ev.key.keysym.mod & KMOD_META) && ev.key.keysym.sym == 'q') {
|
||||
// event.type = EVENT_QUIT;
|
||||
// event.type = Common::EVENT_QUIT;
|
||||
// return true;
|
||||
// }
|
||||
//#elif defined(UNIX)
|
||||
// // On other unices, Control-Q quits
|
||||
// if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'q') {
|
||||
// event.type = EVENT_QUIT;
|
||||
// event.type = Common::EVENT_QUIT;
|
||||
// return true;
|
||||
// }
|
||||
//#else
|
||||
// // Ctrl-z and Alt-X quit
|
||||
// if ((b == KBD_CTRL && ev.key.keysym.sym == 'z') || (b == KBD_ALT && ev.key.keysym.sym == 'x')) {
|
||||
// event.type = EVENT_QUIT;
|
||||
// if ((b == Common::KBD_CTRL && ev.key.keysym.sym == 'z') || (b == Common::KBD_ALT && ev.key.keysym.sym == 'x')) {
|
||||
// event.type = Common::EVENT_QUIT;
|
||||
// return true;
|
||||
// }
|
||||
//#endif
|
||||
//
|
||||
// // Ctrl-Alt-<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 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
if (event_complete)
|
||||
return true;
|
||||
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = ev.key.keysym.sym;
|
||||
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
|
||||
|
||||
|
@ -389,13 +390,13 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
if (event_complete)
|
||||
return true;
|
||||
|
||||
event.type = EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
event.kbd.keycode = ev.key.keysym.sym;
|
||||
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
|
||||
b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());
|
||||
|
||||
// Ctrl-Alt-<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 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
return true;
|
||||
}
|
||||
case SDL_MOUSEMOTION:
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, ev.motion.x, ev.motion.y);
|
||||
|
||||
setMousePos(event.mouse.x, event.mouse.y);
|
||||
|
@ -411,14 +412,14 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
if (ev.button.button == SDL_BUTTON_LEFT)
|
||||
event.type = EVENT_LBUTTONDOWN;
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
else if (ev.button.button == SDL_BUTTON_RIGHT)
|
||||
event.type = EVENT_RBUTTONDOWN;
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
|
||||
else if (ev.button.button == SDL_BUTTON_WHEELUP)
|
||||
event.type = EVENT_WHEELUP;
|
||||
event.type = Common::EVENT_WHEELUP;
|
||||
else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
|
||||
event.type = EVENT_WHEELDOWN;
|
||||
event.type = Common::EVENT_WHEELDOWN;
|
||||
#endif
|
||||
else
|
||||
break;
|
||||
|
@ -429,9 +430,9 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if (ev.button.button == SDL_BUTTON_LEFT)
|
||||
event.type = EVENT_LBUTTONUP;
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
else if (ev.button.button == SDL_BUTTON_RIGHT)
|
||||
event.type = EVENT_RBUTTONUP;
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
else
|
||||
break;
|
||||
fillMouseEvent(event, ev.button.x, ev.button.y);
|
||||
|
@ -443,22 +444,22 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
case SDL_JOYBUTTONDOWN:
|
||||
_stickBtn[ev.jbutton.button] = 1;
|
||||
if (ev.jbutton.button == JOY_BUT_LMOUSE) {
|
||||
event.type = EVENT_LBUTTONDOWN;
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
} else if (ev.jbutton.button == GP2X_BUTTON_CLICK) {
|
||||
event.type = EVENT_LBUTTONDOWN;
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
} else if (ev.jbutton.button == JOY_BUT_RMOUSE) {
|
||||
event.type = EVENT_RBUTTONDOWN;
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
} else if (_stickBtn[JOY_BUT_COMB] && (ev.jbutton.button == JOY_BUT_EXIT)) {
|
||||
event.type = EVENT_QUIT;
|
||||
event.type = Common::EVENT_QUIT;
|
||||
} else if (ev.jbutton.button < 8) {
|
||||
moveStick();
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
} else {
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.flags = 0;
|
||||
switch (ev.jbutton.button) {
|
||||
case GP2X_BUTTON_L:
|
||||
|
@ -475,7 +476,7 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
break;
|
||||
case GP2X_BUTTON_SELECT:
|
||||
if (GP2X_BUTTON_STATE_L == TRUE) {
|
||||
event.type = EVENT_QUIT;
|
||||
event.type = Common::EVENT_QUIT;
|
||||
} else {
|
||||
event.kbd.keycode = SDLK_ESCAPE;
|
||||
event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
|
||||
|
@ -506,7 +507,7 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
// if ((ev.jbutton.button == GP2X_BUTTON_L) && (ev.jbutton.button == GP2X_BUTTON_R)) {
|
||||
// displayMessageOnOSD("Exiting ScummVM");
|
||||
// //Sync();
|
||||
// event.type = EVENT_QUIT;
|
||||
// event.type = Common::EVENT_QUIT;
|
||||
// break;
|
||||
// } else if ((ev.jbutton.button == GP2X_BUTTON_L) && (ev.jbutton.button != GP2X_BUTTON_R)) {
|
||||
// displayMessageOnOSD("Left Trigger Pressed");
|
||||
|
@ -548,17 +549,17 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
case SDL_JOYBUTTONUP:
|
||||
_stickBtn[ev.jbutton.button] = 0;
|
||||
if (ev.jbutton.button == JOY_BUT_LMOUSE) {
|
||||
event.type = EVENT_LBUTTONUP;
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
} else if (ev.jbutton.button == JOY_BUT_RMOUSE) {
|
||||
event.type = EVENT_RBUTTONUP;
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
} else if (ev.jbutton.button < 8) {
|
||||
moveStick();
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
} else {
|
||||
event.type = EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
event.kbd.flags = 0;
|
||||
switch (ev.jbutton.button) {
|
||||
case GP2X_BUTTON_SELECT:
|
||||
|
@ -596,10 +597,10 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
axis = ev.jaxis.value;
|
||||
if ( axis > JOY_DEADZONE) {
|
||||
axis -= JOY_DEADZONE;
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
} else if ( axis < -JOY_DEADZONE ) {
|
||||
axis += JOY_DEADZONE;
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
} else
|
||||
axis = 0;
|
||||
|
||||
|
@ -644,14 +645,14 @@ bool OSystem_GP2X::pollEvent(Event &event) {
|
|||
break;
|
||||
|
||||
case SDL_QUIT:
|
||||
event.type = EVENT_QUIT;
|
||||
event.type = Common::EVENT_QUIT;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSystem_GP2X::remapKey(SDL_Event &ev,Event &event) {
|
||||
bool OSystem_GP2X::remapKey(SDL_Event &ev,Common::Event &event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ public:
|
|||
|
||||
// Get the next event.
|
||||
// Returns true if an event was retrieved.
|
||||
virtual bool pollEvent(Event &event); // overloaded by CE backend
|
||||
virtual bool pollEvent(Common::Event &event); // overloaded by CE backend
|
||||
|
||||
// Set function that generates samples
|
||||
typedef void (*SoundProc)(void *param, byte *buf, int len);
|
||||
|
@ -384,7 +384,7 @@ protected:
|
|||
|
||||
/** Set the position of the virtual mouse cursor. */
|
||||
void setMousePos(int x, int y);
|
||||
virtual void fillMouseEvent(Event &event, int x, int y);
|
||||
virtual void fillMouseEvent(Common::Event &event, int x, int y);
|
||||
//void toggleMouseGrab();
|
||||
|
||||
virtual void internUpdateScreen();
|
||||
|
@ -405,7 +405,7 @@ protected:
|
|||
void setupIcon();
|
||||
void handleKbdMouse();
|
||||
|
||||
virtual bool remapKey(SDL_Event &ev, Event &event);
|
||||
virtual bool remapKey(SDL_Event &ev, Common::Event &event);
|
||||
|
||||
void handleScalerHotkeys(const SDL_KeyboardEvent &key);
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ bool OSystem_GP2X::setGraphicsMode(int mode) {
|
|||
if (_transactionMode != kTransactionCommit)
|
||||
internUpdateScreen();
|
||||
|
||||
// Make sure that an EVENT_SCREEN_CHANGED gets sent later
|
||||
// Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
|
||||
_modeChanged = true;
|
||||
|
||||
return true;
|
||||
|
@ -421,7 +421,7 @@ void OSystem_GP2X::hotswapGFXMode() {
|
|||
// Blit everything to the screen
|
||||
internUpdateScreen();
|
||||
|
||||
// Make sure that an EVENT_SCREEN_CHANGED gets sent later
|
||||
// Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
|
||||
_modeChanged = true;
|
||||
}
|
||||
|
||||
|
@ -644,7 +644,7 @@ void OSystem_GP2X::setFullscreenMode(bool enable) {
|
|||
// Blit everything to the screen
|
||||
internUpdateScreen();
|
||||
|
||||
// Make sure that an EVENT_SCREEN_CHANGED gets sent later
|
||||
// Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
|
||||
_modeChanged = true;
|
||||
}
|
||||
#endif
|
||||
|
@ -671,7 +671,7 @@ void OSystem_GP2X::setAspectRatioCorrection(bool enable) {
|
|||
hotswapGFXMode();
|
||||
}
|
||||
|
||||
// Make sure that an EVENT_SCREEN_CHANGED gets sent later
|
||||
// Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
|
||||
_modeChanged = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -480,7 +480,7 @@ void OSystem_GP32::handleKbdMouse() {
|
|||
}
|
||||
}
|
||||
|
||||
void OSystem_GP32::fillMouseEvent(Event &event, int x, int y) {
|
||||
void OSystem_GP32::fillMouseEvent(Common::Event &event, int x, int y) {
|
||||
event.mouse.x = x;
|
||||
event.mouse.y = y;
|
||||
|
||||
|
@ -493,7 +493,7 @@ void OSystem_GP32::fillMouseEvent(Event &event, int x, int y) {
|
|||
// event.mouse.y = aspect2Real(event.mouse.y);
|
||||
}
|
||||
|
||||
bool OSystem_GP32::pollEvent(Event &event) {
|
||||
bool OSystem_GP32::pollEvent(Common::Event &event) {
|
||||
//NP("OSys::pollEvent()");
|
||||
GP32BtnEvent ev;
|
||||
|
||||
|
@ -521,7 +521,7 @@ bool OSystem_GP32::pollEvent(Event &event) {
|
|||
_km.y_down_count = 1;
|
||||
}
|
||||
if (ev.button == GPC_VK_START) { // START = menu/enter
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
if (_overlayVisible)
|
||||
event.kbd.keycode = event.kbd.ascii = 13;
|
||||
else
|
||||
|
@ -529,27 +529,27 @@ bool OSystem_GP32::pollEvent(Event &event) {
|
|||
return true;
|
||||
}
|
||||
if (ev.button == GPC_VK_SELECT) { // SELECT = pause
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = event.kbd.ascii = 32;
|
||||
return true;
|
||||
}
|
||||
if (ev.button == GPC_VK_FL) {
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = event.kbd.ascii = '0';
|
||||
return true;
|
||||
}
|
||||
if (ev.button == GPC_VK_FR) { // R = ESC
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = event.kbd.ascii = 27;
|
||||
return true;
|
||||
}
|
||||
if (ev.button == GPC_VK_FA) {
|
||||
event.type = EVENT_LBUTTONDOWN;
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
}
|
||||
if (ev.button == GPC_VK_FB) {
|
||||
event.type = EVENT_RBUTTONDOWN;
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ bool OSystem_GP32::pollEvent(Event &event) {
|
|||
_km.x_vel = 0;
|
||||
_km.x_down_count = 0;
|
||||
}
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ bool OSystem_GP32::pollEvent(Event &event) {
|
|||
_km.x_vel = 0;
|
||||
_km.x_down_count = 0;
|
||||
}
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ bool OSystem_GP32::pollEvent(Event &event) {
|
|||
_km.y_vel = 0;
|
||||
_km.y_down_count = 0;
|
||||
}
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
}
|
||||
|
@ -587,13 +587,13 @@ bool OSystem_GP32::pollEvent(Event &event) {
|
|||
_km.y_vel = 0;
|
||||
_km.y_down_count = 0;
|
||||
}
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ev.button == GPC_VK_START) {
|
||||
event.type = EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
if (_overlayVisible)
|
||||
event.kbd.keycode = event.kbd.ascii = 13;
|
||||
else
|
||||
|
@ -601,40 +601,40 @@ bool OSystem_GP32::pollEvent(Event &event) {
|
|||
return true;
|
||||
}
|
||||
if (ev.button == GPC_VK_SELECT) {
|
||||
event.type = EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
event.kbd.keycode = event.kbd.ascii = 32;
|
||||
return true;
|
||||
}
|
||||
if (ev.button == GPC_VK_FL) {
|
||||
event.type = EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
event.kbd.keycode = event.kbd.ascii = '0';
|
||||
return true;
|
||||
}
|
||||
if (ev.button == GPC_VK_FR) {
|
||||
event.type = EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
event.kbd.keycode = event.kbd.ascii = 27;
|
||||
return true;
|
||||
}
|
||||
if (ev.button == GPC_VK_FA) {
|
||||
event.type = EVENT_LBUTTONUP;
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
}
|
||||
if (ev.button == GPC_VK_FB) {
|
||||
event.type = EVENT_RBUTTONUP;
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
error("Unknown Event!");
|
||||
error("Unknown Common::Event!");
|
||||
}
|
||||
|
||||
if (gp_getButtonPressed(GPC_VK_LEFT) ||
|
||||
gp_getButtonPressed(GPC_VK_RIGHT) ||
|
||||
gp_getButtonPressed(GPC_VK_UP) ||
|
||||
gp_getButtonPressed(GPC_VK_DOWN)) {
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
void warpMouse(int x, int y);
|
||||
void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int cursorTargetScale = 1);
|
||||
|
||||
bool pollEvent(Event &event);
|
||||
bool pollEvent(Common::Event &event);
|
||||
uint32 getMillis();
|
||||
void delayMillis(uint msecs);
|
||||
|
||||
|
@ -145,7 +145,7 @@ public:
|
|||
|
||||
void displayMessageOnOSD(const char *msg);
|
||||
|
||||
void fillMouseEvent(Event &event, int x, int y);
|
||||
void fillMouseEvent(Common::Event &event, int x, int y);
|
||||
void handleKbdMouse();
|
||||
};
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "common/stdafx.h"
|
||||
#include "engines/engine.h"
|
||||
#include "common/events.h"
|
||||
#include "common/util.h"
|
||||
#include "scumm/scumm.h"
|
||||
|
||||
|
@ -799,7 +800,7 @@ void OSystem_MorphOS::SwitchScalerTo(SCALERTYPE newScaler)
|
|||
}
|
||||
}
|
||||
|
||||
bool OSystem_MorphOS::pollEvent(Event &event)
|
||||
bool OSystem_MorphOS::pollEvent(Common::Event &event)
|
||||
{
|
||||
IntuiMessage *ScummMsg;
|
||||
|
||||
|
@ -819,14 +820,14 @@ bool OSystem_MorphOS::pollEvent(Event &event)
|
|||
FakedIEvent.ie_Code = ScummMsg->Code;
|
||||
|
||||
if (ScummMsg->Qualifier & (IEQUALIFIER_LALT | IEQUALIFIER_RALT))
|
||||
qual |= KBD_ALT;
|
||||
qual |= Common::KBD_ALT;
|
||||
if (ScummMsg->Qualifier & (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT))
|
||||
qual |= KBD_SHIFT;
|
||||
qual |= Common::KBD_SHIFT;
|
||||
if (ScummMsg->Qualifier & IEQUALIFIER_CONTROL)
|
||||
qual |= KBD_CTRL;
|
||||
qual |= Common::KBD_CTRL;
|
||||
event.kbd.flags = qual;
|
||||
|
||||
event.type = (ScummMsg->Code & IECODE_UP_PREFIX) ? EVENT_KEYUP : EVENT_KEYDOWN;
|
||||
event.type = (ScummMsg->Code & IECODE_UP_PREFIX) ? Common::EVENT_KEYUP : Common::EVENT_KEYDOWN;
|
||||
ScummMsg->Code &= ~IECODE_UP_PREFIX;
|
||||
|
||||
if (ScummMsg->Code >= RAWKEY_F1 && ScummMsg->Code <= RAWKEY_F10)
|
||||
|
@ -850,16 +851,16 @@ bool OSystem_MorphOS::pollEvent(Event &event)
|
|||
/*
|
||||
* Wheelmouse event
|
||||
*/
|
||||
event.type = (ScummMsg->Code == NM_WHEEL_UP) ? EVENT_WHEELUP : EVENT_WHEELDOWN;
|
||||
event.type = (ScummMsg->Code == NM_WHEEL_UP) ? Common::EVENT_WHEELUP : Common::EVENT_WHEELDOWN;
|
||||
}
|
||||
else if (MapRawKey(&FakedIEvent, &charbuf, 1, NULL) == 1)
|
||||
{
|
||||
if (qual == KBD_CTRL && charbuf == 'z')
|
||||
if (qual == Common::KBD_CTRL && charbuf == 'z')
|
||||
{
|
||||
event.type = EVENT_QUIT;
|
||||
event.type = Common::EVENT_QUIT;
|
||||
break;
|
||||
}
|
||||
else if (qual == KBD_ALT)
|
||||
else if (qual == Common::KBD_ALT)
|
||||
{
|
||||
if (charbuf >= '0' && charbuf <= '9')
|
||||
{
|
||||
|
@ -871,7 +872,7 @@ bool OSystem_MorphOS::pollEvent(Event &event)
|
|||
}
|
||||
else if (charbuf == 'x')
|
||||
{
|
||||
event.type = EVENT_QUIT;
|
||||
event.type = Common::EVENT_QUIT;
|
||||
break;
|
||||
}
|
||||
else if (charbuf == 0x0d)
|
||||
|
@ -916,7 +917,7 @@ bool OSystem_MorphOS::pollEvent(Event &event)
|
|||
else if (FullScreenMode)
|
||||
newy = newy <? (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 @@ bool OSystem_MorphOS::pollEvent(Event &event)
|
|||
switch (ScummMsg->Code)
|
||||
{
|
||||
case SELECTDOWN:
|
||||
event.type = EVENT_LBUTTONDOWN;
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
break;
|
||||
|
||||
case SELECTUP:
|
||||
event.type = EVENT_LBUTTONUP;
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
break;
|
||||
|
||||
case MENUDOWN:
|
||||
event.type = EVENT_RBUTTONDOWN;
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
break;
|
||||
|
||||
case MENUUP:
|
||||
event.type = EVENT_RBUTTONUP;
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -958,7 +959,7 @@ bool OSystem_MorphOS::pollEvent(Event &event)
|
|||
}
|
||||
|
||||
case IDCMP_CLOSEWINDOW:
|
||||
event.type = EVENT_QUIT;
|
||||
event.type = Common::EVENT_QUIT;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ class OSystem_MorphOS : public OSystem
|
|||
|
||||
// Get the next event.
|
||||
// Returns true if an event was retrieved.
|
||||
virtual bool pollEvent(Event &event);
|
||||
virtual bool pollEvent(Common::Event &event);
|
||||
|
||||
// Moves mouse pointer to specified position
|
||||
virtual void warpMouse(int x, int y);
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
virtual void warpMouse(int x, int y);
|
||||
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255);
|
||||
|
||||
virtual bool pollEvent(Event &event);
|
||||
virtual bool pollEvent(Common::Event &event);
|
||||
virtual uint32 getMillis();
|
||||
virtual void delayMillis(uint msecs);
|
||||
|
||||
|
@ -232,7 +232,7 @@ void OSystem_NULL::warpMouse(int x, int y) {
|
|||
void OSystem_NULL::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor) {
|
||||
}
|
||||
|
||||
bool OSystem_NULL::pollEvent(Event &event) {
|
||||
bool OSystem_NULL::pollEvent(Common::Event &event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "backends/platform/ps2/ps2pad.h"
|
||||
#include "backends/platform/ps2/systemps2.h"
|
||||
#include "backends/platform/ps2/sdlkeys.h"
|
||||
#include "common/events.h"
|
||||
#include "common/system.h"
|
||||
|
||||
Ps2Input::Ps2Input(OSystem_PS2 *system, bool mouseLoaded, bool kbdLoaded) {
|
||||
|
@ -98,7 +99,7 @@ int Ps2Input::mapKey(int key, int mod) { // copied from sdl backend
|
|||
return key - SDLK_KP0 + '0';
|
||||
} else if (key >= SDLK_UP && key <= SDLK_PAGEDOWN) {
|
||||
return key;
|
||||
} else if (key >= 'a' && key <= 'z' && mod & OSystem::KBD_SHIFT) {
|
||||
} else if (key >= 'a' && key <= 'z' && mod & Common::KBD_SHIFT) {
|
||||
return key & ~0x20;
|
||||
} else if (key >= SDLK_NUMLOCK && key <= SDLK_EURO) {
|
||||
return 0;
|
||||
|
@ -106,7 +107,7 @@ int Ps2Input::mapKey(int key, int mod) { // copied from sdl backend
|
|||
return key;
|
||||
}
|
||||
|
||||
bool Ps2Input::pollEvent(OSystem::Event *event) {
|
||||
bool Ps2Input::pollEvent(Common::Event *event) {
|
||||
bool checkPadMouse, checkPadKbd;
|
||||
checkPadMouse = checkPadKbd = _pad->padAlive();
|
||||
|
||||
|
@ -116,7 +117,7 @@ bool Ps2Input::pollEvent(OSystem::Event *event) {
|
|||
if ((_posX != mData.x) || (_posY != mData.y)) {
|
||||
event->mouse.x = _posX = mData.x;
|
||||
event->mouse.y = _posY = mData.y;
|
||||
event->type = OSystem::EVENT_MOUSEMOVE;
|
||||
event->type = Common::EVENT_MOUSEMOVE;
|
||||
return true;
|
||||
}
|
||||
if (mData.buttons != _mButtons) {
|
||||
|
@ -124,9 +125,9 @@ bool Ps2Input::pollEvent(OSystem::Event *event) {
|
|||
_mButtons = mData.buttons;
|
||||
if (change & (PS2MOUSE_BTN1 | PS2MOUSE_BTN2)) {
|
||||
if (change & PS2MOUSE_BTN1)
|
||||
event->type = (_mButtons & PS2MOUSE_BTN1) ? OSystem::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP;
|
||||
event->type = (_mButtons & PS2MOUSE_BTN1) ? Common::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP;
|
||||
else
|
||||
event->type = (_mButtons & PS2MOUSE_BTN2) ? OSystem::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP;
|
||||
event->type = (_mButtons & PS2MOUSE_BTN2) ? Common::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP;
|
||||
event->mouse.x = _posX;
|
||||
event->mouse.y = _posY;
|
||||
return true;
|
||||
|
@ -140,24 +141,24 @@ bool Ps2Input::pollEvent(OSystem::Event *event) {
|
|||
if (_usbToSdlk[key.key]) {
|
||||
if ((_usbToSdlk[key.key] == SDLK_LSHIFT) || (_usbToSdlk[key.key] == SDLK_RSHIFT)) {
|
||||
if (key.state & 1)
|
||||
_keyFlags |= OSystem::KBD_SHIFT;
|
||||
_keyFlags |= Common::KBD_SHIFT;
|
||||
else
|
||||
_keyFlags &= ~OSystem::KBD_SHIFT;
|
||||
_keyFlags &= ~Common::KBD_SHIFT;
|
||||
} else if ((_usbToSdlk[key.key] == SDLK_LCTRL) || (_usbToSdlk[key.key] == SDLK_RCTRL)) {
|
||||
if (key.state & 1)
|
||||
_keyFlags |= OSystem::KBD_CTRL;
|
||||
_keyFlags |= Common::KBD_CTRL;
|
||||
else
|
||||
_keyFlags &= ~OSystem::KBD_CTRL;
|
||||
_keyFlags &= ~Common::KBD_CTRL;
|
||||
} else if ((_usbToSdlk[key.key] == SDLK_LALT) || (_usbToSdlk[key.key] == SDLK_RALT)) {
|
||||
if (key.state & 1)
|
||||
_keyFlags |= OSystem::KBD_ALT;
|
||||
_keyFlags |= Common::KBD_ALT;
|
||||
else
|
||||
_keyFlags &= ~OSystem::KBD_ALT;
|
||||
_keyFlags &= ~Common::KBD_ALT;
|
||||
}
|
||||
if (key.state & 1) // down
|
||||
event->type = OSystem::EVENT_KEYDOWN;
|
||||
event->type = Common::EVENT_KEYDOWN;
|
||||
else
|
||||
event->type = OSystem::EVENT_KEYUP;
|
||||
event->type = Common::EVENT_KEYUP;
|
||||
event->kbd.flags = 0;
|
||||
event->kbd.keycode = _usbToSdlk[key.key];
|
||||
event->kbd.ascii = mapKey(_usbToSdlk[key.key], _keyFlags);
|
||||
|
@ -176,9 +177,9 @@ bool Ps2Input::pollEvent(OSystem::Event *event) {
|
|||
if (checkPadMouse) {
|
||||
if (btnChange & (PAD_CROSS | PAD_CIRCLE)) {
|
||||
if (btnChange & PAD_CROSS)
|
||||
event->type = (buttons & PAD_CROSS) ? OSystem::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP;
|
||||
event->type = (buttons & PAD_CROSS) ? Common::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP;
|
||||
else
|
||||
event->type = (buttons & PAD_CIRCLE) ? OSystem::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP;
|
||||
event->type = (buttons & PAD_CIRCLE) ? Common::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP;
|
||||
event->mouse.x = _posX;
|
||||
event->mouse.y = _posY;
|
||||
_padLastButtons = buttons;
|
||||
|
@ -211,7 +212,7 @@ bool Ps2Input::pollEvent(OSystem::Event *event) {
|
|||
newX = ((newX < (int16)_minx) ? (_minx) : ((newX > (int16)_maxx) ? (_maxx) : ((int16)newX)));
|
||||
newY = ((newY < (int16)_miny) ? (_miny) : ((newY > (int16)_maxy) ? (_maxy) : ((int16)newY)));
|
||||
if ((_posX != newX) || (_posY != newY)) {
|
||||
event->type = OSystem::EVENT_MOUSEMOVE;
|
||||
event->type = Common::EVENT_MOUSEMOVE;
|
||||
event->mouse.x = _posX = newX;
|
||||
event->mouse.y = _posY = newY;
|
||||
return true;
|
||||
|
@ -228,7 +229,7 @@ bool Ps2Input::pollEvent(OSystem::Event *event) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Ps2Input::getKeyEvent(OSystem::Event *event, uint16 buttonCode, bool down) {
|
||||
bool Ps2Input::getKeyEvent(Common::Event *event, uint16 buttonCode, bool down) {
|
||||
// for simulating key presses with the pad
|
||||
if (buttonCode) {
|
||||
uint8 entry = 0;
|
||||
|
@ -237,7 +238,7 @@ bool Ps2Input::getKeyEvent(OSystem::Event *event, uint16 buttonCode, bool down)
|
|||
buttonCode >>= 1;
|
||||
}
|
||||
if (_padCodes[entry]) {
|
||||
event->type = (down) ? OSystem::EVENT_KEYDOWN : OSystem::EVENT_KEYUP;
|
||||
event->type = (down) ? Common::EVENT_KEYDOWN : OSystem::EVENT_KEYUP;
|
||||
event->kbd.keycode = _padCodes[entry];
|
||||
event->kbd.flags = _padFlags[entry];
|
||||
event->kbd.ascii = mapKey(_padCodes[entry], _padFlags[entry]);
|
||||
|
|
|
@ -33,11 +33,11 @@ public:
|
|||
Ps2Input(OSystem_PS2 *system, bool mouseLoaded, bool kbdLoaded);
|
||||
~Ps2Input(void);
|
||||
void newRange(uint16 minx, uint16 miny, uint16 maxx, uint16 maxy);
|
||||
bool pollEvent(OSystem::Event *event);
|
||||
bool pollEvent(Common::Event *event);
|
||||
void warpTo(uint16 x, uint16 y);
|
||||
private:
|
||||
int mapKey(int key, int mod);
|
||||
bool getKeyEvent(OSystem::Event *event, uint16 buttonCode, bool down);
|
||||
bool getKeyEvent(Common::Event *event, uint16 buttonCode, bool down);
|
||||
OSystem_PS2 *_system;
|
||||
Ps2Pad *_pad;
|
||||
|
||||
|
|
|
@ -649,9 +649,9 @@ int OSystem_PS2::getDefaultGraphicsMode(void) const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool OSystem_PS2::pollEvent(Event &event) {
|
||||
bool OSystem_PS2::pollEvent(Common::Event &event) {
|
||||
bool res = _input->pollEvent(&event);
|
||||
if (res && (event.type == EVENT_MOUSEMOVE))
|
||||
if (res && (event.type == Common::EVENT_MOUSEMOVE))
|
||||
_screen->setMouseXy(event.mouse.x, event.mouse.y);
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
virtual uint32 getMillis();
|
||||
virtual void delayMillis(uint msecs);
|
||||
virtual void setTimerCallback(TimerProc callback, int interval);
|
||||
virtual bool pollEvent(Event &event);
|
||||
virtual bool pollEvent(Common::Event &event);
|
||||
|
||||
virtual bool setSoundCallback(SoundProc proc, void *param);
|
||||
virtual void clearSoundCallback();
|
||||
|
|
|
@ -417,7 +417,7 @@ void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
|
|||
#define PAD_CHECK_TIME 40
|
||||
#define PAD_DIR_MASK (PSP_CTRL_UP | PSP_CTRL_DOWN | PSP_CTRL_LEFT | PSP_CTRL_RIGHT)
|
||||
|
||||
bool OSystem_PSP::pollEvent(Event &event) {
|
||||
bool OSystem_PSP::pollEvent(Common::Event &event) {
|
||||
s8 analogStepAmountX = 0;
|
||||
s8 analogStepAmountY = 0;
|
||||
/*
|
||||
|
@ -431,14 +431,14 @@ bool OSystem_PSP::pollEvent(Event &event) {
|
|||
|
||||
if (buttonsChanged & (PSP_CTRL_CROSS | PSP_CTRL_CIRCLE | PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER | PSP_CTRL_START | PSP_CTRL_SELECT | PSP_CTRL_SQUARE)) {
|
||||
if (buttonsChanged & PSP_CTRL_CROSS) {
|
||||
event.type = (pad.Buttons & PSP_CTRL_CROSS) ? OSystem::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP;
|
||||
event.type = (pad.Buttons & PSP_CTRL_CROSS) ? Common::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP;
|
||||
}
|
||||
else if (buttonsChanged & PSP_CTRL_CIRCLE) {
|
||||
event.type = (pad.Buttons & PSP_CTRL_CIRCLE) ? OSystem::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP;
|
||||
event.type = (pad.Buttons & PSP_CTRL_CIRCLE) ? Common::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP;
|
||||
}
|
||||
else {
|
||||
//any of the other buttons.
|
||||
event.type = buttonsChanged & pad.Buttons ? OSystem::EVENT_KEYDOWN : OSystem::EVENT_KEYUP;
|
||||
event.type = buttonsChanged & pad.Buttons ? Common::EVENT_KEYDOWN : OSystem::EVENT_KEYUP;
|
||||
event.kbd.flags = 0;
|
||||
|
||||
if (buttonsChanged & PSP_CTRL_LTRIGGER) {
|
||||
|
@ -537,7 +537,7 @@ bool OSystem_PSP::pollEvent(Event &event) {
|
|||
}
|
||||
|
||||
if ((_mouseX != newX) || (_mouseY != newY)) {
|
||||
event.type = OSystem::EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
event.mouse.x = _mouseX = newX;
|
||||
event.mouse.y = _mouseY = newY;
|
||||
return true;
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
virtual void warpMouse(int x, int y);
|
||||
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int cursorTargetScale = 1);
|
||||
|
||||
virtual bool pollEvent(Event &event);
|
||||
virtual bool pollEvent(Common::Event &event);
|
||||
virtual uint32 getMillis();
|
||||
virtual void delayMillis(uint msecs);
|
||||
|
||||
|
|
|
@ -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 @@ void OSystem_PSP_GU::updateScreen() {
|
|||
//sceKernelDcacheWritebackAll();
|
||||
}
|
||||
|
||||
bool OSystem_PSP_GU::pollEvent(Event &event) {
|
||||
bool OSystem_PSP_GU::pollEvent(Common::Event &event) {
|
||||
float nub_angle = -1;
|
||||
int x, y;
|
||||
|
||||
|
@ -522,7 +523,7 @@ bool OSystem_PSP_GU::pollEvent(Event &event) {
|
|||
_kbdClut[_keySelected] = 0xffff;
|
||||
|
||||
if (buttonsChanged & PSP_CTRL_CROSS) {
|
||||
event.type = (pad.Buttons & PSP_CTRL_CROSS) ? OSystem::EVENT_KEYDOWN : OSystem::EVENT_KEYUP;
|
||||
event.type = (pad.Buttons & PSP_CTRL_CROSS) ? Common::EVENT_KEYDOWN : OSystem::EVENT_KEYUP;
|
||||
if(_keySelected > 26) {
|
||||
event.kbd.flags = 0;
|
||||
switch(_keySelected) {
|
||||
|
@ -553,7 +554,7 @@ bool OSystem_PSP_GU::pollEvent(Event &event) {
|
|||
case CAPS_LOCK:
|
||||
event.kbd.ascii = 'A'+_keySelected-1;
|
||||
event.kbd.keycode = SDLK_a + _keySelected-1;
|
||||
event.kbd.flags = KBD_SHIFT;
|
||||
event.kbd.flags = Common::KBD_SHIFT;
|
||||
break;
|
||||
case SYMBOLS:
|
||||
if (_keySelected < 21) {
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale);
|
||||
void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) ;
|
||||
void setPalette(const byte *colors, uint start, uint num);
|
||||
bool pollEvent(Event &event);
|
||||
bool pollEvent(Common::Event &event);
|
||||
int _graphicMode;
|
||||
struct Vertex *_vertices;
|
||||
unsigned short* _clut;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "backends/platform/sdl/sdl-common.h"
|
||||
#include "common/util.h"
|
||||
#include "common/events.h"
|
||||
|
||||
// FIXME move joystick defines out and replace with confile file options
|
||||
// we should really allow users to map any key to a joystick button
|
||||
|
@ -64,7 +65,7 @@ static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode)
|
|||
return key;
|
||||
}
|
||||
|
||||
void OSystem_SDL::fillMouseEvent(Event &event, int x, int y) {
|
||||
void OSystem_SDL::fillMouseEvent(Common::Event &event, int x, int y) {
|
||||
event.mouse.x = x;
|
||||
event.mouse.y = y;
|
||||
|
||||
|
@ -156,30 +157,30 @@ static byte SDLModToOSystemKeyFlags(SDLMod mod) {
|
|||
// Yopy has no ALT key, steal the SHIFT key
|
||||
// (which isn't used much anyway)
|
||||
if (mod & KMOD_SHIFT)
|
||||
b |= OSystem::KBD_ALT;
|
||||
b |= Common::KBD_ALT;
|
||||
#else
|
||||
if (mod & KMOD_SHIFT)
|
||||
b |= OSystem::KBD_SHIFT;
|
||||
b |= Common::KBD_SHIFT;
|
||||
if (mod & KMOD_ALT)
|
||||
b |= OSystem::KBD_ALT;
|
||||
b |= Common::KBD_ALT;
|
||||
#endif
|
||||
if (mod & KMOD_CTRL)
|
||||
b |= OSystem::KBD_CTRL;
|
||||
b |= Common::KBD_CTRL;
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
bool OSystem_SDL::pollEvent(Event &event) {
|
||||
bool OSystem_SDL::pollEvent(Common::Event &event) {
|
||||
SDL_Event ev;
|
||||
int axis;
|
||||
byte b = 0;
|
||||
|
||||
handleKbdMouse();
|
||||
|
||||
// If the screen mode changed, send an EVENT_SCREEN_CHANGED
|
||||
// If the screen mode changed, send an Common::EVENT_SCREEN_CHANGED
|
||||
if (_modeChanged) {
|
||||
_modeChanged = false;
|
||||
event.type = EVENT_SCREEN_CHANGED;
|
||||
event.type = Common::EVENT_SCREEN_CHANGED;
|
||||
_screenChangeCount++;
|
||||
return true;
|
||||
}
|
||||
|
@ -190,7 +191,7 @@ bool OSystem_SDL::pollEvent(Event &event) {
|
|||
b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());
|
||||
|
||||
// Alt-Return and Alt-Enter toggle full screen mode
|
||||
if (b == KBD_ALT && (ev.key.keysym.sym == SDLK_RETURN
|
||||
if (b == Common::KBD_ALT && (ev.key.keysym.sym == SDLK_RETURN
|
||||
|| ev.key.keysym.sym == SDLK_KP_ENTER)) {
|
||||
setFullscreenMode(!_fullscreen);
|
||||
#ifdef USE_OSD
|
||||
|
@ -204,7 +205,7 @@ bool OSystem_SDL::pollEvent(Event &event) {
|
|||
}
|
||||
|
||||
// Alt-S: Create a screenshot
|
||||
if (b == KBD_ALT && ev.key.keysym.sym == 's') {
|
||||
if (b == Common::KBD_ALT && ev.key.keysym.sym == 's') {
|
||||
char filename[20];
|
||||
|
||||
for (int n = 0;; n++) {
|
||||
|
@ -224,7 +225,7 @@ bool OSystem_SDL::pollEvent(Event &event) {
|
|||
}
|
||||
|
||||
// Ctrl-m toggles mouse capture
|
||||
if (b == KBD_CTRL && ev.key.keysym.sym == 'm') {
|
||||
if (b == Common::KBD_CTRL && ev.key.keysym.sym == 'm') {
|
||||
toggleMouseGrab();
|
||||
break;
|
||||
}
|
||||
|
@ -233,25 +234,25 @@ bool OSystem_SDL::pollEvent(Event &event) {
|
|||
// On Macintosh', Cmd-Q quits
|
||||
// On Amigas, Amiga-Q quits
|
||||
if ((ev.key.keysym.mod & KMOD_META) && ev.key.keysym.sym == 'q') {
|
||||
event.type = EVENT_QUIT;
|
||||
event.type = Common::EVENT_QUIT;
|
||||
return true;
|
||||
}
|
||||
#elif defined(UNIX)
|
||||
// On other unices, Control-Q quits
|
||||
if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'q') {
|
||||
event.type = EVENT_QUIT;
|
||||
event.type = Common::EVENT_QUIT;
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
// Ctrl-z and Alt-X quit
|
||||
if ((b == KBD_CTRL && ev.key.keysym.sym == 'z') || (b == KBD_ALT && ev.key.keysym.sym == 'x')) {
|
||||
event.type = EVENT_QUIT;
|
||||
if ((b == Common::KBD_CTRL && ev.key.keysym.sym == 'z') || (b == Common::KBD_ALT && ev.key.keysym.sym == 'x')) {
|
||||
event.type = Common::EVENT_QUIT;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Ctrl-Alt-<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 @@ bool OSystem_SDL::pollEvent(Event &event) {
|
|||
if (event_complete)
|
||||
return true;
|
||||
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = ev.key.keysym.sym;
|
||||
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
|
||||
|
||||
|
@ -274,13 +275,13 @@ bool OSystem_SDL::pollEvent(Event &event) {
|
|||
if (event_complete)
|
||||
return true;
|
||||
|
||||
event.type = EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
event.kbd.keycode = ev.key.keysym.sym;
|
||||
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
|
||||
b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());
|
||||
|
||||
// Ctrl-Alt-<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 @@ bool OSystem_SDL::pollEvent(Event &event) {
|
|||
return true;
|
||||
}
|
||||
case SDL_MOUSEMOTION:
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, ev.motion.x, ev.motion.y);
|
||||
|
||||
setMousePos(event.mouse.x, event.mouse.y);
|
||||
|
@ -296,14 +297,14 @@ bool OSystem_SDL::pollEvent(Event &event) {
|
|||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
if (ev.button.button == SDL_BUTTON_LEFT)
|
||||
event.type = EVENT_LBUTTONDOWN;
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
else if (ev.button.button == SDL_BUTTON_RIGHT)
|
||||
event.type = EVENT_RBUTTONDOWN;
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
|
||||
else if (ev.button.button == SDL_BUTTON_WHEELUP)
|
||||
event.type = EVENT_WHEELUP;
|
||||
event.type = Common::EVENT_WHEELUP;
|
||||
else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
|
||||
event.type = EVENT_WHEELDOWN;
|
||||
event.type = Common::EVENT_WHEELDOWN;
|
||||
#endif
|
||||
else
|
||||
break;
|
||||
|
@ -314,9 +315,9 @@ bool OSystem_SDL::pollEvent(Event &event) {
|
|||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if (ev.button.button == SDL_BUTTON_LEFT)
|
||||
event.type = EVENT_LBUTTONUP;
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
else if (ev.button.button == SDL_BUTTON_RIGHT)
|
||||
event.type = EVENT_RBUTTONUP;
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
else
|
||||
break;
|
||||
fillMouseEvent(event, ev.button.x, ev.button.y);
|
||||
|
@ -325,13 +326,13 @@ bool OSystem_SDL::pollEvent(Event &event) {
|
|||
|
||||
case SDL_JOYBUTTONDOWN:
|
||||
if (ev.jbutton.button == JOY_BUT_LMOUSE) {
|
||||
event.type = EVENT_LBUTTONDOWN;
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
} else if (ev.jbutton.button == JOY_BUT_RMOUSE) {
|
||||
event.type = EVENT_RBUTTONDOWN;
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
} else {
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
switch (ev.jbutton.button) {
|
||||
case JOY_BUT_ESCAPE:
|
||||
event.kbd.keycode = SDLK_ESCAPE;
|
||||
|
@ -355,13 +356,13 @@ bool OSystem_SDL::pollEvent(Event &event) {
|
|||
|
||||
case SDL_JOYBUTTONUP:
|
||||
if (ev.jbutton.button == JOY_BUT_LMOUSE) {
|
||||
event.type = EVENT_LBUTTONUP;
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
} else if (ev.jbutton.button == JOY_BUT_RMOUSE) {
|
||||
event.type = EVENT_RBUTTONUP;
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
} else {
|
||||
event.type = EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
switch (ev.jbutton.button) {
|
||||
case JOY_BUT_ESCAPE:
|
||||
event.kbd.keycode = SDLK_ESCAPE;
|
||||
|
@ -387,10 +388,10 @@ bool OSystem_SDL::pollEvent(Event &event) {
|
|||
axis = ev.jaxis.value;
|
||||
if ( axis > JOY_DEADZONE) {
|
||||
axis -= JOY_DEADZONE;
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
} else if ( axis < -JOY_DEADZONE ) {
|
||||
axis += JOY_DEADZONE;
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
} else
|
||||
axis = 0;
|
||||
|
||||
|
@ -435,37 +436,37 @@ bool OSystem_SDL::pollEvent(Event &event) {
|
|||
break;
|
||||
|
||||
case SDL_QUIT:
|
||||
event.type = EVENT_QUIT;
|
||||
event.type = Common::EVENT_QUIT;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSystem_SDL::remapKey(SDL_Event &ev,Event &event) {
|
||||
bool OSystem_SDL::remapKey(SDL_Event &ev,Common::Event &event) {
|
||||
#ifdef LINUPY
|
||||
// On Yopy map the End button to quit
|
||||
if ((ev.key.keysym.sym == 293)) {
|
||||
event.type = EVENT_QUIT;
|
||||
event.type = Common::EVENT_QUIT;
|
||||
return true;
|
||||
}
|
||||
// Map menu key to f5 (scumm menu)
|
||||
if (ev.key.keysym.sym == 306) {
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = SDLK_F5;
|
||||
event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
|
||||
return true;
|
||||
}
|
||||
// Map action key to action
|
||||
if (ev.key.keysym.sym == 291) {
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = SDLK_TAB;
|
||||
event.kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0);
|
||||
return true;
|
||||
}
|
||||
// Map OK key to skip cinematic
|
||||
if (ev.key.keysym.sym == 292) {
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = SDLK_ESCAPE;
|
||||
event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
|
||||
return true;
|
||||
|
@ -475,13 +476,13 @@ bool OSystem_SDL::remapKey(SDL_Event &ev,Event &event) {
|
|||
#ifdef QTOPIA
|
||||
// Quit on fn+backspace on zaurus
|
||||
if (ev.key.keysym.sym == 127) {
|
||||
event.type = EVENT_QUIT;
|
||||
event.type = Common::EVENT_QUIT;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Map menu key (f11) to f5 (scumm menu)
|
||||
if (ev.key.keysym.sym == SDLK_F11) {
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = SDLK_F5;
|
||||
event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
|
||||
}
|
||||
|
@ -489,20 +490,20 @@ bool OSystem_SDL::remapKey(SDL_Event &ev,Event &event) {
|
|||
// I wanted to map the calendar button but the calendar comes up
|
||||
//
|
||||
else if (ev.key.keysym.sym == SDLK_SPACE) {
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = SDLK_TAB;
|
||||
event.kbd.ascii = mapKey(SDLK_TAB, ev.key.keysym.mod, 0);
|
||||
}
|
||||
// Since we stole space (pause) above we'll rebind it to the tab key on the keyboard
|
||||
else if (ev.key.keysym.sym == SDLK_TAB) {
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = SDLK_SPACE;
|
||||
event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
|
||||
} else {
|
||||
// Let the events fall through if we didn't change them, this may not be the best way to
|
||||
// set it up, but i'm not sure how sdl would like it if we let if fall through then redid it though.
|
||||
// and yes i have an huge terminal size so i dont wrap soon enough.
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = ev.key.keysym.sym;
|
||||
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
|
|||
if (_transactionMode != kTransactionCommit)
|
||||
internUpdateScreen();
|
||||
|
||||
// Make sure that an EVENT_SCREEN_CHANGED gets sent later
|
||||
// Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
|
||||
_modeChanged = true;
|
||||
|
||||
return true;
|
||||
|
@ -500,7 +500,7 @@ void OSystem_SDL::hotswapGFXMode() {
|
|||
// Blit everything to the screen
|
||||
internUpdateScreen();
|
||||
|
||||
// Make sure that an EVENT_SCREEN_CHANGED gets sent later
|
||||
// Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
|
||||
_modeChanged = true;
|
||||
}
|
||||
|
||||
|
@ -727,7 +727,7 @@ void OSystem_SDL::setFullscreenMode(bool enable) {
|
|||
// Blit everything to the screen
|
||||
internUpdateScreen();
|
||||
|
||||
// Make sure that an EVENT_SCREEN_CHANGED gets sent later
|
||||
// Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
|
||||
_modeChanged = true;
|
||||
}
|
||||
#endif
|
||||
|
@ -754,7 +754,7 @@ void OSystem_SDL::setAspectRatioCorrection(bool enable) {
|
|||
hotswapGFXMode();
|
||||
}
|
||||
|
||||
// Make sure that an EVENT_SCREEN_CHANGED gets sent later
|
||||
// Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
|
||||
_modeChanged = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
|
||||
// Get the next event.
|
||||
// Returns true if an event was retrieved.
|
||||
virtual bool pollEvent(Event &event); // overloaded by CE backend
|
||||
virtual bool pollEvent(Common::Event &event); // overloaded by CE backend
|
||||
|
||||
// Set function that generates samples
|
||||
typedef void (*SoundProc)(void *param, byte *buf, int len);
|
||||
|
@ -382,7 +382,7 @@ protected:
|
|||
|
||||
/** Set the position of the virtual mouse cursor. */
|
||||
void setMousePos(int x, int y);
|
||||
virtual void fillMouseEvent(Event &event, int x, int y); // overloaded by CE backend
|
||||
virtual void fillMouseEvent(Common::Event &event, int x, int y); // overloaded by CE backend
|
||||
void toggleMouseGrab();
|
||||
|
||||
virtual void internUpdateScreen(); // overloaded by CE backend
|
||||
|
@ -404,7 +404,7 @@ protected:
|
|||
void setupIcon();
|
||||
void handleKbdMouse();
|
||||
|
||||
virtual bool remapKey(SDL_Event &ev, Event &event);
|
||||
virtual bool remapKey(SDL_Event &ev, Common::Event &event);
|
||||
|
||||
void handleScalerHotkeys(const SDL_KeyboardEvent &key);
|
||||
};
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "backends/platform/symbian/src/SymbianOS.h"
|
||||
#include "backends/platform/symbian/src/SymbianActions.h"
|
||||
#include "common/config-manager.h"
|
||||
#include "common/events.h"
|
||||
#include "gui/Actions.h"
|
||||
#include "gui/Key.h"
|
||||
#include "gui/message.h"
|
||||
|
@ -248,9 +249,9 @@ void OSystem_SDL_Symbian::symbianMix(byte *samples, int len) {
|
|||
* This is an implementation by the remapKey function
|
||||
* @param SDL_Event to remap
|
||||
* @param ScumVM event to modify if special result is requested
|
||||
* @return true if Event has a valid return status
|
||||
* @return true if Common::Event has a valid return status
|
||||
*/
|
||||
bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) {
|
||||
bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Common::Event &event) {
|
||||
if (GUI::Actions::Instance()->mappingActive() || ev.key.keysym.sym <= SDLK_UNKNOWN)
|
||||
return false;
|
||||
|
||||
|
@ -267,7 +268,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) {
|
|||
_km.y_vel = 0;
|
||||
_km.y_down_count = 0;
|
||||
}
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
|
||||
return true;
|
||||
|
@ -280,7 +281,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) {
|
|||
_km.y_vel = 0;
|
||||
_km.y_down_count = 0;
|
||||
}
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
|
||||
return true;
|
||||
|
@ -293,7 +294,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) {
|
|||
_km.x_vel = 0;
|
||||
_km.x_down_count = 0;
|
||||
}
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
|
||||
return true;
|
||||
|
@ -306,19 +307,19 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) {
|
|||
_km.x_vel = 0;
|
||||
_km.x_down_count = 0;
|
||||
}
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
|
||||
return true;
|
||||
|
||||
case GUI::ACTION_LEFTCLICK:
|
||||
event.type = (ev.type == SDL_KEYDOWN ? EVENT_LBUTTONDOWN : EVENT_LBUTTONUP);
|
||||
event.type = (ev.type == SDL_KEYDOWN ? Common::EVENT_LBUTTONDOWN : Common::EVENT_LBUTTONUP);
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
|
||||
return true;
|
||||
|
||||
case GUI::ACTION_RIGHTCLICK:
|
||||
event.type = (ev.type == SDL_KEYDOWN ? EVENT_RBUTTONDOWN : EVENT_RBUTTONUP);
|
||||
event.type = (ev.type == SDL_KEYDOWN ? Common::EVENT_RBUTTONDOWN : Common::EVENT_RBUTTONUP);
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
|
||||
return true;
|
||||
|
@ -338,7 +339,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) {
|
|||
_currentZone++;
|
||||
if (_currentZone >= TOTAL_ZONES)
|
||||
_currentZone = 0;
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _mouseXZone[_currentZone], _mouseYZone[_currentZone]);
|
||||
SDL_WarpMouse(event.mouse.x, event.mouse.y);
|
||||
}
|
||||
|
@ -359,20 +360,20 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) {
|
|||
ev.key.keysym.scancode= key.keycode();
|
||||
ev.key.keysym.mod = (SDLMod) key.flags();
|
||||
|
||||
// Translate from SDL keymod event to Scummvm Key Mod Event.
|
||||
// Translate from SDL keymod event to Scummvm Key Mod Common::Event.
|
||||
// This codes is also present in GP32 backend and in SDL backend as a static function
|
||||
// Perhaps it should be shared.
|
||||
if(key.flags() != 0) {
|
||||
event.kbd.flags = 0;
|
||||
|
||||
if (ev.key.keysym.mod & KMOD_SHIFT)
|
||||
event.kbd.flags |= OSystem::KBD_SHIFT;
|
||||
event.kbd.flags |= Common::KBD_SHIFT;
|
||||
|
||||
if (ev.key.keysym.mod & KMOD_ALT)
|
||||
event.kbd.flags |= OSystem::KBD_ALT;
|
||||
event.kbd.flags |= Common::KBD_ALT;
|
||||
|
||||
if (ev.key.keysym.mod & KMOD_CTRL)
|
||||
event.kbd.flags |= OSystem::KBD_CTRL;
|
||||
event.kbd.flags |= Common::KBD_CTRL;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -104,9 +104,9 @@ protected:
|
|||
// This is an implementation by the remapKey function
|
||||
// @param SDL_Event to remap
|
||||
// @param ScumVM event to modify if special result is requested
|
||||
// @return true if Event has a valid return status
|
||||
// @return true if Common::Event has a valid return status
|
||||
//
|
||||
bool remapKey(SDL_Event &ev, Event &event);
|
||||
bool remapKey(SDL_Event &ev, Common::Event &event);
|
||||
|
||||
void setWindowCaption(const char *caption);
|
||||
|
||||
|
|
|
@ -1325,7 +1325,7 @@ void OSystem_WINCE3::hotswapGFXMode() {
|
|||
// Blit everything to the screen
|
||||
internUpdateScreen();
|
||||
|
||||
// Make sure that an EVENT_SCREEN_CHANGED gets sent later
|
||||
// Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
|
||||
_modeChanged = true;
|
||||
}
|
||||
|
||||
|
@ -1970,7 +1970,7 @@ void OSystem_WINCE3::drawMouse() {
|
|||
internDrawMouse();
|
||||
}
|
||||
|
||||
void OSystem_WINCE3::fillMouseEvent(Event &event, int x, int y) {
|
||||
void OSystem_WINCE3::fillMouseEvent(Common::Event &event, int x, int y) {
|
||||
event.mouse.x = x;
|
||||
event.mouse.y = y;
|
||||
|
||||
|
@ -2060,22 +2060,22 @@ void OSystem_WINCE3::addDirtyRect(int x, int y, int w, int h, bool mouseRect) {
|
|||
// FIXME
|
||||
// See if some SDL mapping can be useful for HPCs
|
||||
|
||||
bool OSystem_WINCE3::pollEvent(Event &event) {
|
||||
bool OSystem_WINCE3::pollEvent(Common::Event &event) {
|
||||
SDL_Event ev;
|
||||
byte b = 0;
|
||||
Event temp_event;
|
||||
Common::Event temp_event;
|
||||
DWORD currentTime;
|
||||
bool keyEvent = false;
|
||||
|
||||
memset(&temp_event, 0, sizeof(Event));
|
||||
memset(&event, 0, sizeof(Event));
|
||||
memset(&temp_event, 0, sizeof(Common::Event));
|
||||
memset(&event, 0, sizeof(Common::Event));
|
||||
|
||||
handleKbdMouse();
|
||||
|
||||
// If the screen mode changed, send an EVENT_SCREEN_CHANGED
|
||||
// If the screen mode changed, send an Common::EVENT_SCREEN_CHANGED
|
||||
if (_modeChanged) {
|
||||
_modeChanged = false;
|
||||
event.type = EVENT_SCREEN_CHANGED;
|
||||
event.type = Common::EVENT_SCREEN_CHANGED;
|
||||
_screenChangeCount++;
|
||||
return true;
|
||||
}
|
||||
|
@ -2098,7 +2098,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
|
|||
return true;
|
||||
}
|
||||
|
||||
event.type = EVENT_KEYDOWN;
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = ev.key.keysym.sym;
|
||||
event.kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
|
||||
|
||||
|
@ -2117,7 +2117,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
|
|||
return true;
|
||||
}
|
||||
|
||||
event.type = EVENT_KEYUP;
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
event.kbd.keycode = ev.key.keysym.sym;
|
||||
event.kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
|
||||
|
||||
|
@ -2127,16 +2127,16 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
|
|||
return true;
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
event.type = EVENT_MOUSEMOVE;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, ev.motion.x, ev.motion.y);
|
||||
setMousePos(event.mouse.x, event.mouse.y);
|
||||
return true;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
if (ev.button.button == SDL_BUTTON_LEFT)
|
||||
temp_event.type = EVENT_LBUTTONDOWN;
|
||||
temp_event.type = Common::EVENT_LBUTTONDOWN;
|
||||
else if (ev.button.button == SDL_BUTTON_RIGHT)
|
||||
temp_event.type = EVENT_RBUTTONDOWN;
|
||||
temp_event.type = Common::EVENT_RBUTTONDOWN;
|
||||
else
|
||||
break;
|
||||
|
||||
|
@ -2159,7 +2159,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
|
|||
if (temp_event.mouse.y <= 20 && _panelInitialized) { // panel double tap?
|
||||
swap_panel_visibility();
|
||||
} else { // simulate right click
|
||||
temp_event.type = EVENT_RBUTTONDOWN;
|
||||
temp_event.type = Common::EVENT_RBUTTONDOWN;
|
||||
_rbutton = true;
|
||||
}
|
||||
}
|
||||
|
@ -2183,21 +2183,21 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
|
|||
}
|
||||
} else {
|
||||
if (!_freeLook)
|
||||
memcpy(&event, &temp_event, sizeof(Event));
|
||||
memcpy(&event, &temp_event, sizeof(Common::Event));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if (ev.button.button == SDL_BUTTON_LEFT)
|
||||
temp_event.type = EVENT_LBUTTONUP;
|
||||
temp_event.type = Common::EVENT_LBUTTONUP;
|
||||
else if (ev.button.button == SDL_BUTTON_RIGHT)
|
||||
temp_event.type = EVENT_RBUTTONUP;
|
||||
temp_event.type = Common::EVENT_RBUTTONUP;
|
||||
else
|
||||
break;
|
||||
|
||||
if (_rbutton) {
|
||||
temp_event.type = EVENT_RBUTTONUP;
|
||||
temp_event.type = Common::EVENT_RBUTTONUP;
|
||||
_rbutton = false;
|
||||
}
|
||||
|
||||
|
@ -2208,7 +2208,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
|
|||
internUpdateScreen();
|
||||
} else {
|
||||
if (!_freeLook)
|
||||
memcpy(&event, &temp_event, sizeof(Event));
|
||||
memcpy(&event, &temp_event, sizeof(Common::Event));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -2218,7 +2218,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
|
|||
break;
|
||||
|
||||
case SDL_QUIT:
|
||||
event.type = EVENT_QUIT;
|
||||
event.type = Common::EVENT_QUIT;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,11 +69,11 @@ public:
|
|||
void initBackend();
|
||||
|
||||
// Overloaded from SDL_Common (toolbar handling)
|
||||
bool pollEvent(Event &event);
|
||||
bool pollEvent(Common::Event &event);
|
||||
// Overloaded from SDL_Common (toolbar handling)
|
||||
void drawMouse();
|
||||
// Overloaded from SDL_Common (mouse and new scaler handling)
|
||||
void fillMouseEvent(Event &event, int x, int y);
|
||||
void fillMouseEvent(Common::Event &event, int x, int y);
|
||||
// Overloaded from SDL_Common (new scaler handling)
|
||||
void addDirtyRect(int x, int y, int w, int h, bool mouseRect = false);
|
||||
// Overloaded from SDL_Common (new scaler handling)
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "common/stdafx.h"
|
||||
#include "common/scummsys.h"
|
||||
#include "common/events.h"
|
||||
#include "common/system.h"
|
||||
#include "common/util.h"
|
||||
#include "base/main.h"
|
||||
|
@ -753,7 +754,7 @@ void OSystem_X11::delayMillis(uint msecs) {
|
|||
usleep(msecs * 1000);
|
||||
}
|
||||
|
||||
bool OSystem_X11::pollEvent(Event &scumm_event) {
|
||||
bool OSystem_X11::pollEvent(Common::Event &scumm_event) {
|
||||
/* First, handle timers */
|
||||
uint32 current_msecs = getMillis();
|
||||
|
||||
|
@ -812,11 +813,11 @@ bool OSystem_X11::pollEvent(Event &scumm_event) {
|
|||
byte mode = 0;
|
||||
|
||||
if (event.xkey.state & 0x01)
|
||||
mode |= KBD_SHIFT;
|
||||
mode |= Common::KBD_SHIFT;
|
||||
if (event.xkey.state & 0x04)
|
||||
mode |= KBD_CTRL;
|
||||
mode |= Common::KBD_CTRL;
|
||||
if (event.xkey.state & 0x08)
|
||||
mode |= KBD_ALT;
|
||||
mode |= Common::KBD_ALT;
|
||||
switch (event.xkey.keycode) {
|
||||
|
||||
case 9: /* Escape on my PC */
|
||||
|
@ -852,7 +853,7 @@ bool OSystem_X11::pollEvent(Event &scumm_event) {
|
|||
}
|
||||
}
|
||||
if (keycode != -1) {
|
||||
scumm_event.type = EVENT_KEYDOWN;
|
||||
scumm_event.type = Common::EVENT_KEYDOWN;
|
||||
scumm_event.kbd.keycode = keycode;
|
||||
scumm_event.kbd.ascii = (ascii != -1 ? ascii : keycode);
|
||||
scumm_event.kbd.flags = mode;
|
||||
|
@ -870,11 +871,11 @@ bool OSystem_X11::pollEvent(Event &scumm_event) {
|
|||
byte mode = 0;
|
||||
|
||||
if (event.xkey.state & 0x01)
|
||||
mode |= KBD_SHIFT;
|
||||
mode |= Common::KBD_SHIFT;
|
||||
if (event.xkey.state & 0x04)
|
||||
mode |= KBD_CTRL;
|
||||
mode |= Common::KBD_CTRL;
|
||||
if (event.xkey.state & 0x08)
|
||||
mode |= KBD_ALT;
|
||||
mode |= Common::KBD_ALT;
|
||||
switch (event.xkey.keycode) {
|
||||
case 132: /* 'Q' on the iPAQ */
|
||||
_report_presses = 1;
|
||||
|
@ -894,7 +895,7 @@ bool OSystem_X11::pollEvent(Event &scumm_event) {
|
|||
}
|
||||
}
|
||||
if (keycode != -1) {
|
||||
scumm_event.type = EVENT_KEYUP;
|
||||
scumm_event.type = Common::EVENT_KEYUP;
|
||||
scumm_event.kbd.keycode = keycode;
|
||||
scumm_event.kbd.ascii = (ascii != -1 ? ascii : keycode);
|
||||
scumm_event.kbd.flags = mode;
|
||||
|
@ -907,12 +908,12 @@ bool OSystem_X11::pollEvent(Event &scumm_event) {
|
|||
if (_report_presses != 0) {
|
||||
if (event.xbutton.button == 1) {
|
||||
if (_fake_right_mouse == 0) {
|
||||
scumm_event.type = EVENT_LBUTTONDOWN;
|
||||
scumm_event.type = Common::EVENT_LBUTTONDOWN;
|
||||
} else {
|
||||
scumm_event.type = EVENT_RBUTTONDOWN;
|
||||
scumm_event.type = Common::EVENT_RBUTTONDOWN;
|
||||
}
|
||||
} else if (event.xbutton.button == 3)
|
||||
scumm_event.type = EVENT_RBUTTONDOWN;
|
||||
scumm_event.type = Common::EVENT_RBUTTONDOWN;
|
||||
scumm_event.mouse.x = event.xbutton.x - _scumm_x;
|
||||
scumm_event.mouse.y = event.xbutton.y - _scumm_y;
|
||||
return true;
|
||||
|
@ -923,12 +924,12 @@ bool OSystem_X11::pollEvent(Event &scumm_event) {
|
|||
if (_report_presses != 0) {
|
||||
if (event.xbutton.button == 1) {
|
||||
if (_fake_right_mouse == 0) {
|
||||
scumm_event.type = EVENT_LBUTTONUP;
|
||||
scumm_event.type = Common::EVENT_LBUTTONUP;
|
||||
} else {
|
||||
scumm_event.type = EVENT_RBUTTONUP;
|
||||
scumm_event.type = Common::EVENT_RBUTTONUP;
|
||||
}
|
||||
} else if (event.xbutton.button == 3)
|
||||
scumm_event.type = EVENT_RBUTTONUP;
|
||||
scumm_event.type = Common::EVENT_RBUTTONUP;
|
||||
scumm_event.mouse.x = event.xbutton.x - _scumm_x;
|
||||
scumm_event.mouse.y = event.xbutton.y - _scumm_y;
|
||||
return true;
|
||||
|
@ -936,7 +937,7 @@ bool OSystem_X11::pollEvent(Event &scumm_event) {
|
|||
break;
|
||||
|
||||
case MotionNotify:
|
||||
scumm_event.type = EVENT_MOUSEMOVE;
|
||||
scumm_event.type = Common::EVENT_MOUSEMOVE;
|
||||
scumm_event.mouse.x = event.xmotion.x - _scumm_x;
|
||||
scumm_event.mouse.y = event.xmotion.y - _scumm_y;
|
||||
set_mouse_pos(scumm_event.mouse.x, scumm_event.mouse.y);
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
// Get the next event.
|
||||
// Returns true if an event was retrieved.
|
||||
bool pollEvent(Event &event);
|
||||
bool pollEvent(Common::Event &event);
|
||||
|
||||
// Set function that generates samples
|
||||
bool setSoundCallback(SoundProc proc, void *param);
|
||||
|
|
114
common/events.h
114
common/events.h
|
@ -29,6 +29,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,
|
||||
|
@ -49,7 +161,7 @@ public:
|
|||
* @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 */
|
||||
|
|
116
common/system.h
116
common/system.h
|
@ -38,6 +38,7 @@ namespace Graphics {
|
|||
}
|
||||
|
||||
namespace Common {
|
||||
struct Event;
|
||||
class EventManager;
|
||||
class SaveFileManager;
|
||||
class TimerManager;
|
||||
|
@ -676,126 +677,15 @@ public:
|
|||
/** @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. */
|
||||
|
|
|
@ -58,60 +58,60 @@ void AgiEngine::allowSynthetic(bool allow) {
|
|||
}
|
||||
|
||||
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') {
|
||||
if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'd') {
|
||||
_console->attach();
|
||||
break;
|
||||
}
|
||||
|
||||
if (event.kbd.flags & OSystem::KBD_CTRL)
|
||||
if (event.kbd.flags & Common::KBD_CTRL)
|
||||
_keyControl = 1;
|
||||
|
||||
if (event.kbd.flags & OSystem::KBD_ALT)
|
||||
if (event.kbd.flags & Common::KBD_ALT)
|
||||
_keyAlt = 1;
|
||||
|
||||
switch (key = event.kbd.keycode) {
|
||||
|
@ -221,7 +221,7 @@ void AgiEngine::processEvents() {
|
|||
key = (key & ~0x20) - 0x40;
|
||||
else if (_keyAlt)
|
||||
key = scancodeTable[(key & ~0x20) - 0x41] << 8;
|
||||
else if (event.kbd.flags & OSystem::KBD_SHIFT)
|
||||
else if (event.kbd.flags & Common::KBD_SHIFT)
|
||||
key = event.kbd.ascii;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -233,29 +233,29 @@ void MoviePlayer::handleNextFrame() {
|
|||
_vm->_system->updateScreen();
|
||||
_frameNum++;
|
||||
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
Common::EventManager *eventMan = _vm->_system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.ascii == 27) {
|
||||
_leftButtonDown = true;
|
||||
_rightButtonDown = true;
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
_leftButtonDown = true;
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
_rightButtonDown = true;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
_leftButtonDown = false;
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
_rightButtonDown = false;
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
_vm->_system->quit();
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -299,7 +299,7 @@ void AGOSEngine::scrollEvent() {
|
|||
}
|
||||
|
||||
void AGOSEngine::delay(uint amount) {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
uint32 start = _system->getMillis();
|
||||
uint32 cur = start;
|
||||
|
@ -335,10 +335,10 @@ void AGOSEngine::delay(uint amount) {
|
|||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.keycode >= '0' && event.kbd.keycode <='9'
|
||||
&& (event.kbd.flags == OSystem::KBD_ALT ||
|
||||
event.kbd.flags == OSystem::KBD_CTRL)) {
|
||||
&& (event.kbd.flags == Common::KBD_ALT ||
|
||||
event.kbd.flags == Common::KBD_CTRL)) {
|
||||
_saveLoadSlot = event.kbd.keycode - '0';
|
||||
|
||||
// There is no save slot 0
|
||||
|
@ -346,13 +346,13 @@ void AGOSEngine::delay(uint amount) {
|
|||
_saveLoadSlot = 10;
|
||||
|
||||
sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
|
||||
_saveLoadType = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2;
|
||||
_saveLoadType = (event.kbd.flags == Common::KBD_ALT) ? 1 : 2;
|
||||
|
||||
// We should only allow a load or save when it was possible in original
|
||||
// This stops load/save during copy protection, conversations and cut scenes
|
||||
if (!_mouseHideCount && !_showPreposition)
|
||||
quickLoadOrSave();
|
||||
} else if (event.kbd.flags == OSystem::KBD_CTRL) {
|
||||
} else if (event.kbd.flags == Common::KBD_CTRL) {
|
||||
if (event.kbd.keycode == 'a') {
|
||||
GUI::Dialog *_aboutDialog;
|
||||
_aboutDialog = new GUI::AboutDialog();
|
||||
|
@ -364,7 +364,7 @@ void AGOSEngine::delay(uint amount) {
|
|||
}
|
||||
|
||||
if (getGameType() == GType_PP) {
|
||||
if (event.kbd.flags == OSystem::KBD_SHIFT)
|
||||
if (event.kbd.flags == Common::KBD_SHIFT)
|
||||
_variableArray[41] = 0;
|
||||
else
|
||||
_variableArray[41] = 1;
|
||||
|
@ -376,11 +376,11 @@ void AGOSEngine::delay(uint amount) {
|
|||
else
|
||||
_keyPressed = (byte)event.kbd.ascii;
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
_sdlMouseX = event.mouse.x;
|
||||
_sdlMouseY = event.mouse.y;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
if (getGameType() == GType_FF)
|
||||
setBitFlag(89, true);
|
||||
_leftButtonDown++;
|
||||
|
@ -391,19 +391,19 @@ void AGOSEngine::delay(uint amount) {
|
|||
_sdlMouseY = event.mouse.y;
|
||||
#endif
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
if (getGameType() == GType_FF)
|
||||
setBitFlag(89, false);
|
||||
|
||||
_leftButton = 0;
|
||||
_leftButtonCount = 0;
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
if (getGameType() == GType_FF)
|
||||
setBitFlag(92, false);
|
||||
_rightButtonDown++;
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
shutdown();
|
||||
return;
|
||||
default:
|
||||
|
|
|
@ -46,25 +46,25 @@ uint16 mouseUpdateStatus;
|
|||
uint16 dummyU16;
|
||||
|
||||
void manageEvents(int count) {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
Common::EventManager *eventMan = g_system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
mouseLeft = 1;
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
mouseRight = 1;
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
mouseData.X = event.mouse.x;
|
||||
mouseData.Y = event.mouse.y;
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
g_system->quit();
|
||||
break;
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
switch (event.kbd.keycode) {
|
||||
case '\n':
|
||||
case '\r':
|
||||
|
|
|
@ -140,32 +140,32 @@ int16 Util::getRandom(int16 max) {
|
|||
}
|
||||
|
||||
void Util::processInput() {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
Common::EventManager *eventMan = g_system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
_mouseX = event.mouse.x;
|
||||
_mouseY = event.mouse.y;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
_mouseButtons |= 1;
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
_mouseButtons |= 2;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
_mouseButtons &= ~1;
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
_mouseButtons &= ~2;
|
||||
break;
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
addKeyToBuffer(event.kbd.keycode);
|
||||
break;
|
||||
case OSystem::EVENT_KEYUP:
|
||||
case Common::EVENT_KEYUP:
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
_vm->_quitRequested = true;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -800,7 +800,7 @@ void KyraEngine::calcCoords(Menu &menu) {
|
|||
}
|
||||
|
||||
void KyraEngine::gui_getInput() {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
static uint32 lastScreenUpdate = 0;
|
||||
uint32 now = _system->getMillis();
|
||||
|
||||
|
@ -808,16 +808,16 @@ void KyraEngine::gui_getInput() {
|
|||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
quitGame();
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
_mousePressFlag = true;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
_mousePressFlag = false;
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
_mouseX = event.mouse.x;
|
||||
_mouseY = event.mouse.y;
|
||||
if (_flags.useHiResOverlay) {
|
||||
|
@ -827,13 +827,13 @@ void KyraEngine::gui_getInput() {
|
|||
_system->updateScreen();
|
||||
lastScreenUpdate = now;
|
||||
break;
|
||||
case OSystem::EVENT_WHEELUP:
|
||||
case Common::EVENT_WHEELUP:
|
||||
_mouseWheel = -1;
|
||||
break;
|
||||
case OSystem::EVENT_WHEELDOWN:
|
||||
case Common::EVENT_WHEELDOWN:
|
||||
_mouseWheel = 1;
|
||||
break;
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
_keyPressed = event.kbd.ascii;
|
||||
break;
|
||||
default:
|
||||
|
@ -1471,15 +1471,15 @@ void KyraEngine::gui_updateMainMenuAnimation() {
|
|||
}
|
||||
|
||||
bool KyraEngine::gui_mainMenuGetInput() {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
quitGame();
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
_mouseX = event.mouse.x;
|
||||
_mouseY = event.mouse.y;
|
||||
if (_flags.useHiResOverlay) {
|
||||
|
@ -1487,7 +1487,7 @@ bool KyraEngine::gui_mainMenuGetInput() {
|
|||
_mouseY >>= 1;
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -603,7 +603,7 @@ void KyraEngine::delayUntil(uint32 timestamp, bool updateTimers, bool update, bo
|
|||
}
|
||||
|
||||
void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
char saveLoadSlot[20];
|
||||
char savegameName[14];
|
||||
|
||||
|
@ -612,17 +612,17 @@ void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) {
|
|||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.keycode >= '1' && event.kbd.keycode <= '9' &&
|
||||
(event.kbd.flags == OSystem::KBD_CTRL || event.kbd.flags == OSystem::KBD_ALT) && isMainLoop) {
|
||||
(event.kbd.flags == Common::KBD_CTRL || event.kbd.flags == Common::KBD_ALT) && isMainLoop) {
|
||||
sprintf(saveLoadSlot, "%s.00%d", _targetName.c_str(), event.kbd.keycode - '0');
|
||||
if (event.kbd.flags == OSystem::KBD_CTRL)
|
||||
if (event.kbd.flags == Common::KBD_CTRL)
|
||||
loadGame(saveLoadSlot);
|
||||
else {
|
||||
sprintf(savegameName, "Quicksave %d", event.kbd.keycode - '0');
|
||||
saveGame(saveLoadSlot, savegameName);
|
||||
}
|
||||
} else if (event.kbd.flags == OSystem::KBD_CTRL) {
|
||||
} else if (event.kbd.flags == Common::KBD_CTRL) {
|
||||
if (event.kbd.keycode == 'd')
|
||||
_debugger->attach();
|
||||
else if (event.kbd.keycode == 'q')
|
||||
|
@ -635,7 +635,7 @@ void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) {
|
|||
}
|
||||
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
_mouseX = event.mouse.x;
|
||||
_mouseY = event.mouse.y;
|
||||
if (_flags.useHiResOverlay) {
|
||||
|
@ -644,13 +644,13 @@ void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) {
|
|||
}
|
||||
_animator->_updateScreen = true;
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
quitGame();
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
_mousePressFlag = true;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
_mousePressFlag = false;
|
||||
|
||||
_mouseX = event.mouse.x;
|
||||
|
@ -705,22 +705,22 @@ void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) {
|
|||
|
||||
void KyraEngine::waitForEvent() {
|
||||
bool finished = false;
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
while (!finished && !_quitFlag) {
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
finished = true;
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
_mouseX = event.mouse.x;
|
||||
_mouseY = event.mouse.y;
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
quitGame();
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
finished = true;
|
||||
_skipFlag = true;
|
||||
break;
|
||||
|
|
|
@ -1148,7 +1148,7 @@ void KyraEngine::seq_playCredits() {
|
|||
_screen->copyRegion(8, 32, 8, 32, 312, 128, 4, 0, Screen::CR_NO_P_CHECK);
|
||||
_screen->fadePalette(_screen->_currentPalette, 0x5A);
|
||||
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
bool finished = false;
|
||||
int bottom = 201;
|
||||
while (!finished) {
|
||||
|
@ -1174,10 +1174,10 @@ void KyraEngine::seq_playCredits() {
|
|||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
finished = true;
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
quitGame();
|
||||
finished = true;
|
||||
break;
|
||||
|
|
|
@ -40,7 +40,7 @@ void KyraEngine::waitForChatToFinish(int vocFile, int16 chatDuration, const char
|
|||
bool runLoop = true;
|
||||
bool drawText = textEnabled();
|
||||
uint8 currPage;
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
//while (towns_isEscKeyPressed() )
|
||||
//towns_getKey();
|
||||
|
@ -121,15 +121,15 @@ void KyraEngine::waitForChatToFinish(int vocFile, int16 chatDuration, const char
|
|||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.keycode == '.')
|
||||
_skipFlag = true;
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
quitGame();
|
||||
runLoop = false;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
runLoop = false;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -661,16 +661,16 @@ void VQAMovie::play() {
|
|||
if (elapsedTime >= (i * 1000) / _header.frameRate)
|
||||
break;
|
||||
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.ascii == 27)
|
||||
return;
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
_vm->quitGame();
|
||||
return;
|
||||
default:
|
||||
|
|
|
@ -38,12 +38,12 @@ AnimAbortType AnimationSequence::delay(uint32 milliseconds) {
|
|||
|
||||
while (_system.getMillis() < delayCtr) {
|
||||
while (events.pollEvent()) {
|
||||
if (events.type() == OSystem::EVENT_KEYDOWN) {
|
||||
if (events.type() == Common::EVENT_KEYDOWN) {
|
||||
if (events.event().kbd.keycode == 27) return ABORT_END_INTRO;
|
||||
else return ABORT_NEXT_SCENE;
|
||||
} else if (events.type() == OSystem::EVENT_LBUTTONDOWN)
|
||||
} else if (events.type() == Common::EVENT_LBUTTONDOWN)
|
||||
return ABORT_NEXT_SCENE;
|
||||
else if (events.type() == OSystem::EVENT_QUIT)
|
||||
else if (events.type() == Common::EVENT_QUIT)
|
||||
return ABORT_END_INTRO;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ bool get_string(char *buffer, uint32 maxSize, bool isNumeric, uint16 x, uint16 y
|
|||
}
|
||||
|
||||
if (e.pollEvent()) {
|
||||
if (e.type() == OSystem::EVENT_KEYDOWN) {
|
||||
if (e.type() == Common::EVENT_KEYDOWN) {
|
||||
char ch = e.event().kbd.ascii;
|
||||
uint16 keycode = e.event().kbd.keycode;
|
||||
|
||||
|
|
|
@ -50,21 +50,21 @@ Mouse::Mouse() {
|
|||
Mouse::~Mouse() {
|
||||
}
|
||||
|
||||
void Mouse::handleEvent(OSystem::Event event) {
|
||||
void Mouse::handleEvent(Common::Event event) {
|
||||
_x = (int16) event.mouse.x;
|
||||
_y = (int16) event.mouse.y;
|
||||
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
_lButton = true;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
_lButton = false;
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
_rButton = true;
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
_rButton = false;
|
||||
break;
|
||||
default:
|
||||
|
@ -153,17 +153,17 @@ bool Events::pollEvent() {
|
|||
|
||||
// Handle keypress
|
||||
switch (_event.type) {
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
quitFlag = true;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case OSystem::EVENT_RBUTTONUP:
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case OSystem::EVENT_WHEELUP:
|
||||
case OSystem::EVENT_WHEELDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_WHEELUP:
|
||||
case Common::EVENT_WHEELDOWN:
|
||||
Mouse::getReference().handleEvent(_event);
|
||||
break;
|
||||
|
||||
|
@ -178,10 +178,10 @@ void Events::waitForPress() {
|
|||
bool keyButton = false;
|
||||
while (!keyButton) {
|
||||
if (pollEvent()) {
|
||||
if (_event.type == OSystem::EVENT_QUIT) return;
|
||||
else if (_event.type == OSystem::EVENT_KEYDOWN) keyButton = true;
|
||||
else if ((_event.type == OSystem::EVENT_LBUTTONDOWN) ||
|
||||
(_event.type == OSystem::EVENT_RBUTTONDOWN)) {
|
||||
if (_event.type == Common::EVENT_QUIT) return;
|
||||
else if (_event.type == Common::EVENT_KEYDOWN) keyButton = true;
|
||||
else if ((_event.type == Common::EVENT_LBUTTONDOWN) ||
|
||||
(_event.type == Common::EVENT_RBUTTONDOWN)) {
|
||||
keyButton = true;
|
||||
Mouse::getReference().waitForRelease();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#define LURE_EVENTS_H
|
||||
|
||||
#include "common/stdafx.h"
|
||||
#include "common/events.h"
|
||||
#include "common/str.h"
|
||||
#include "lure/luredefs.h"
|
||||
#include "lure/disk.h"
|
||||
|
@ -39,7 +40,7 @@ public:
|
|||
Mouse();
|
||||
~Mouse();
|
||||
static Mouse &getReference();
|
||||
void handleEvent(OSystem::Event event);
|
||||
void handleEvent(Common::Event event);
|
||||
|
||||
void cursorOn();
|
||||
void cursorOff();
|
||||
|
@ -59,7 +60,7 @@ public:
|
|||
|
||||
class Events {
|
||||
private:
|
||||
OSystem::Event _event;
|
||||
Common::Event _event;
|
||||
public:
|
||||
bool quitFlag;
|
||||
|
||||
|
@ -68,8 +69,8 @@ public:
|
|||
|
||||
bool pollEvent();
|
||||
void waitForPress();
|
||||
OSystem::Event event() { return _event; }
|
||||
OSystem::EventType type() { return _event.type; }
|
||||
Common::Event event() { return _event; }
|
||||
Common::EventType type() { return _event.type; }
|
||||
};
|
||||
|
||||
} // End of namespace Lure
|
||||
|
|
|
@ -124,10 +124,10 @@ void Game::execute() {
|
|||
res.delayList().tick();
|
||||
|
||||
while (events.pollEvent()) {
|
||||
if (events.type() == OSystem::EVENT_KEYDOWN) {
|
||||
if (events.type() == Common::EVENT_KEYDOWN) {
|
||||
uint16 roomNum = room.roomNumber();
|
||||
|
||||
if ((events.event().kbd.flags == OSystem::KBD_CTRL) &&
|
||||
if ((events.event().kbd.flags == Common::KBD_CTRL) &&
|
||||
(events.event().kbd.keycode == 'd')) {
|
||||
// Activate the debugger
|
||||
_debugger->attach();
|
||||
|
@ -171,8 +171,8 @@ void Game::execute() {
|
|||
}
|
||||
}
|
||||
|
||||
if ((events.type() == OSystem::EVENT_LBUTTONDOWN) ||
|
||||
(events.type() == OSystem::EVENT_RBUTTONDOWN))
|
||||
if ((events.type() == Common::EVENT_LBUTTONDOWN) ||
|
||||
(events.type() == Common::EVENT_RBUTTONDOWN))
|
||||
handleClick();
|
||||
}
|
||||
|
||||
|
@ -778,7 +778,7 @@ void Game::doQuit() {
|
|||
char key = '\0';
|
||||
do {
|
||||
if (events.pollEvent()) {
|
||||
if (events.event().type == OSystem::EVENT_KEYDOWN) {
|
||||
if (events.event().type == Common::EVENT_KEYDOWN) {
|
||||
key = events.event().kbd.ascii;
|
||||
if ((key >= 'A') && (key <= 'Z')) key += 'a' - 'A';
|
||||
}
|
||||
|
|
|
@ -68,9 +68,9 @@ bool Introduction::delay(uint32 milliseconds) {
|
|||
if (events.quitFlag) return true;
|
||||
|
||||
if (events.pollEvent()) {
|
||||
if (events.type() == OSystem::EVENT_KEYDOWN)
|
||||
if (events.type() == Common::EVENT_KEYDOWN)
|
||||
return events.event().kbd.keycode == 27;
|
||||
else if (events.type() == OSystem::EVENT_LBUTTONDOWN)
|
||||
else if (events.type() == Common::EVENT_LBUTTONDOWN)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -474,7 +474,7 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
|
|||
goto bail_out;
|
||||
}
|
||||
|
||||
else if (e.type() == OSystem::EVENT_KEYDOWN) {
|
||||
else if (e.type() == Common::EVENT_KEYDOWN) {
|
||||
byte ch = e.event().kbd.ascii;
|
||||
uint16 keycode = e.event().kbd.keycode;
|
||||
|
||||
|
@ -492,11 +492,11 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
|
|||
goto bail_out;
|
||||
}
|
||||
|
||||
} else if (e.type() == OSystem::EVENT_LBUTTONDOWN) {
|
||||
} else if (e.type() == Common::EVENT_LBUTTONDOWN) {
|
||||
//mouse.waitForRelease();
|
||||
goto bail_out;
|
||||
|
||||
} else if (e.type() == OSystem::EVENT_RBUTTONDOWN) {
|
||||
} else if (e.type() == Common::EVENT_RBUTTONDOWN) {
|
||||
mouse.waitForRelease();
|
||||
selectedIndex = 0xffff;
|
||||
goto bail_out;
|
||||
|
|
|
@ -415,7 +415,7 @@ bool Surface::getString(Common::String &line, uint32 maxSize, bool isNumeric, bo
|
|||
if (abortFlag) break;
|
||||
|
||||
if (events.pollEvent()) {
|
||||
if (events.type() == OSystem::EVENT_KEYDOWN) {
|
||||
if (events.type() == Common::EVENT_KEYDOWN) {
|
||||
char ch = events.event().kbd.ascii;
|
||||
uint16 keycode = events.event().kbd.keycode;
|
||||
|
||||
|
@ -684,12 +684,12 @@ bool SaveRestoreDialog::show(bool saveDialog) {
|
|||
if (abortFlag) break;
|
||||
|
||||
if (events.pollEvent()) {
|
||||
if ((events.type() == OSystem::EVENT_KEYDOWN) &&
|
||||
if ((events.type() == Common::EVENT_KEYDOWN) &&
|
||||
(events.event().kbd.ascii == 27)) {
|
||||
abortFlag = true;
|
||||
break;
|
||||
}
|
||||
if (events.type() == OSystem::EVENT_MOUSEMOVE) {
|
||||
if (events.type() == Common::EVENT_MOUSEMOVE) {
|
||||
// Mouse movement
|
||||
int lineNum;
|
||||
if ((mouse.x() < (SAVE_DIALOG_X + DIALOG_EDGE_SIZE)) ||
|
||||
|
|
|
@ -430,14 +430,14 @@ void runDialogue(SpeakData *data) {
|
|||
0
|
||||
);
|
||||
|
||||
OSystem::Event e;
|
||||
Common::Event e;
|
||||
|
||||
while (e.kbd.ascii != 0xD && passwordLen < MAX_PASSWORD_LENGTH) {
|
||||
|
||||
// FIXME: see comment for updateInput()
|
||||
if (!g_system->getEventManager()->pollEvent(e)) continue;
|
||||
if (e.type != OSystem::EVENT_KEYDOWN) continue;
|
||||
if (e.type != OSystem::EVENT_QUIT) g_system->quit();
|
||||
if (e.type != Common::EVENT_KEYDOWN) continue;
|
||||
if (e.type != Common::EVENT_QUIT) g_system->quit();
|
||||
if (!isdigit(e.kbd.ascii)) continue;
|
||||
|
||||
password[passwordLen] = e.kbd.ascii;
|
||||
|
|
|
@ -283,7 +283,7 @@ void Parallaction::initGlobals() {
|
|||
//
|
||||
uint16 Parallaction::updateInput() {
|
||||
|
||||
OSystem::Event e;
|
||||
Common::Event e;
|
||||
uint16 KeyDown = 0;
|
||||
|
||||
_mouseButtons = kMouseNone;
|
||||
|
@ -292,33 +292,33 @@ uint16 Parallaction::updateInput() {
|
|||
while (eventMan->pollEvent(e)) {
|
||||
|
||||
switch (e.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (e.kbd.ascii == 'l') KeyDown = kEvLoadGame;
|
||||
if (e.kbd.ascii == 's') KeyDown = kEvSaveGame;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
_mouseButtons = kMouseLeftDown;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
_mouseButtons = kMouseLeftUp;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
_mouseButtons = kMouseRightDown;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_RBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
_mouseButtons = kMouseRightUp;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
_mousePos._x = e.mouse.x;
|
||||
_mousePos._y = e.mouse.y;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
_system->quit();
|
||||
break;
|
||||
|
||||
|
@ -336,16 +336,16 @@ uint16 Parallaction::updateInput() {
|
|||
// FIXME: see comment for updateInput()
|
||||
void waitUntilLeftClick() {
|
||||
|
||||
OSystem::Event e;
|
||||
Common::Event e;
|
||||
|
||||
Common::EventManager *eventMan = g_system->getEventManager();
|
||||
for (;;) {
|
||||
eventMan->pollEvent(e);
|
||||
|
||||
if (e.type == OSystem::EVENT_LBUTTONUP)
|
||||
if (e.type == Common::EVENT_LBUTTONUP)
|
||||
break;
|
||||
|
||||
if (e.type == OSystem::EVENT_QUIT) {
|
||||
if (e.type == Common::EVENT_QUIT) {
|
||||
g_system->quit();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -91,13 +91,13 @@ void Input::delay(uint amount) {
|
|||
}
|
||||
uint32 end = _system->getMillis() + amount;
|
||||
do {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
_idleTime = 0;
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
if (event.kbd.flags == OSystem::KBD_CTRL) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.flags == Common::KBD_CTRL) {
|
||||
if (event.kbd.keycode == 'd') {
|
||||
_debugger = true;
|
||||
} else if (event.kbd.keycode == 'f') {
|
||||
|
@ -108,24 +108,24 @@ void Input::delay(uint amount) {
|
|||
}
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
_mouse_x = event.mouse.x;
|
||||
_mouse_y = event.mouse.y;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
_mouseButton |= MOUSE_LBUTTON;
|
||||
_mouse_x = event.mouse.x;
|
||||
_mouse_y = event.mouse.y;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
_mouseButton |= MOUSE_RBUTTON;
|
||||
_mouse_x = event.mouse.x;
|
||||
_mouse_y = event.mouse.y;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
_system->quit();
|
||||
break;
|
||||
|
||||
|
|
|
@ -65,23 +65,23 @@ void Journal::use() {
|
|||
|
||||
_quitMode = QM_LOOP;
|
||||
while (_quitMode == QM_LOOP) {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
handleKeyDown(event.kbd.ascii, event.kbd.keycode);
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
handleMouseDown(event.mouse.x, event.mouse.y);
|
||||
break;
|
||||
case OSystem::EVENT_WHEELUP:
|
||||
case Common::EVENT_WHEELUP:
|
||||
handleMouseWheel(-1);
|
||||
break;
|
||||
case OSystem::EVENT_WHEELDOWN:
|
||||
case Common::EVENT_WHEELDOWN:
|
||||
handleMouseWheel(1);
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
_system->quit();
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -38,15 +38,15 @@
|
|||
namespace Saga {
|
||||
|
||||
int SagaEngine::processInput() {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
// Point imousePt;
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
if (event.kbd.flags == OSystem::KBD_CTRL) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.flags == Common::KBD_CTRL) {
|
||||
if (event.kbd.keycode == 'd')
|
||||
_console->attach();
|
||||
}
|
||||
|
@ -121,32 +121,32 @@ int SagaEngine::processInput() {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
_leftMouseButtonPressed = false;
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
_rightMouseButtonPressed = false;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
_leftMouseButtonPressed = true;
|
||||
_mousePos = event.mouse;
|
||||
_interface->update(_mousePos, UPDATE_LEFTBUTTONCLICK);
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
_rightMouseButtonPressed = true;
|
||||
_mousePos = event.mouse;
|
||||
_interface->update(_mousePos, UPDATE_RIGHTBUTTONCLICK);
|
||||
break;
|
||||
case OSystem::EVENT_WHEELUP:
|
||||
case Common::EVENT_WHEELUP:
|
||||
_interface->update(_mousePos, UPDATE_WHEELUP);
|
||||
break;
|
||||
case OSystem::EVENT_WHEELDOWN:
|
||||
case Common::EVENT_WHEELDOWN:
|
||||
_interface->update(_mousePos, UPDATE_WHEELDOWN);
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
_mousePos = event.mouse;
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
shutDown();
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -55,16 +55,16 @@ enum MouseButtonStatus {
|
|||
};
|
||||
|
||||
void ScummEngine::parseEvents() {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.keycode >= '0' && event.kbd.keycode <= '9'
|
||||
&& (event.kbd.flags == OSystem::KBD_ALT ||
|
||||
event.kbd.flags == OSystem::KBD_CTRL)) {
|
||||
&& (event.kbd.flags == Common::KBD_ALT ||
|
||||
event.kbd.flags == Common::KBD_CTRL)) {
|
||||
_saveLoadSlot = event.kbd.keycode - '0';
|
||||
|
||||
// don't overwrite autosave (slot 0)
|
||||
|
@ -72,9 +72,9 @@ void ScummEngine::parseEvents() {
|
|||
_saveLoadSlot = 10;
|
||||
|
||||
sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
|
||||
_saveLoadFlag = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2;
|
||||
_saveLoadFlag = (event.kbd.flags == Common::KBD_ALT) ? 1 : 2;
|
||||
_saveTemporaryState = false;
|
||||
} else if (event.kbd.flags == OSystem::KBD_CTRL) {
|
||||
} else if (event.kbd.flags == Common::KBD_CTRL) {
|
||||
if (event.kbd.keycode == 'f')
|
||||
_fastMode ^= 1;
|
||||
else if (event.kbd.keycode == 'g')
|
||||
|
@ -85,7 +85,7 @@ void ScummEngine::parseEvents() {
|
|||
_res->resourceStats();
|
||||
else
|
||||
_keyPressed = event.kbd.ascii; // Normal key press, pass on to the game.
|
||||
} else if (event.kbd.flags & OSystem::KBD_ALT) {
|
||||
} else if (event.kbd.flags & Common::KBD_ALT) {
|
||||
// The result must be 273 for Alt-W
|
||||
// because that's what MI2 looks for in
|
||||
// its "instant win" cheat.
|
||||
|
@ -126,10 +126,10 @@ void ScummEngine::parseEvents() {
|
|||
if (event.kbd.ascii == 274) // Down
|
||||
_keyState |= 8;
|
||||
|
||||
if (event.kbd.flags == OSystem::KBD_SHIFT)
|
||||
if (event.kbd.flags == Common::KBD_SHIFT)
|
||||
_keyState |= 16;
|
||||
|
||||
if (event.kbd.flags == OSystem::KBD_CTRL)
|
||||
if (event.kbd.flags == Common::KBD_CTRL)
|
||||
_keyState |= 32;
|
||||
|
||||
VAR(VAR_KEY_STATE) = _keyState;
|
||||
|
@ -141,8 +141,8 @@ void ScummEngine::parseEvents() {
|
|||
_keyDownMap[_keyPressed] = true;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_KEYUP:
|
||||
// FIXME: for some reason OSystem::KBD_ALT is set sometimes
|
||||
case Common::EVENT_KEYUP:
|
||||
// FIXME: for some reason Common::KBD_ALT is set sometimes
|
||||
// possible to a bug in sdl-common.cpp
|
||||
if (event.kbd.ascii >= 512)
|
||||
debugC(DEBUG_GENERAL, "keyPressed > 512 (%d)", event.kbd.ascii);
|
||||
|
@ -153,12 +153,12 @@ void ScummEngine::parseEvents() {
|
|||
|
||||
// We update the mouse position whenever the mouse moves or a click occurs.
|
||||
// The latter is done to accomodate systems with a touchpad / pen controller.
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
if (event.type == OSystem::EVENT_LBUTTONDOWN)
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
if (event.type == Common::EVENT_LBUTTONDOWN)
|
||||
_leftBtnPressed |= msClicked|msDown;
|
||||
else if (event.type == OSystem::EVENT_RBUTTONDOWN)
|
||||
else if (event.type == Common::EVENT_RBUTTONDOWN)
|
||||
_rightBtnPressed |= msClicked|msDown;
|
||||
_mouse.x = event.mouse.x;
|
||||
_mouse.y = event.mouse.y;
|
||||
|
@ -169,11 +169,11 @@ void ScummEngine::parseEvents() {
|
|||
_mouse.y = _mouse.y * 4 / 7;
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
_leftBtnPressed &= ~msDown;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_RBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
_rightBtnPressed &= ~msDown;
|
||||
break;
|
||||
|
||||
|
@ -182,15 +182,15 @@ void ScummEngine::parseEvents() {
|
|||
// as nothing else uses the wheel don't bother
|
||||
// checking the gameid. Values are taken from script-14.
|
||||
|
||||
case OSystem::EVENT_WHEELDOWN:
|
||||
case Common::EVENT_WHEELDOWN:
|
||||
_keyPressed = 55;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_WHEELUP:
|
||||
case Common::EVENT_WHEELUP:
|
||||
_keyPressed = 54;
|
||||
break;
|
||||
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
if (ConfMan.getBool("confirm_exit"))
|
||||
confirmExitDialog();
|
||||
else
|
||||
|
|
|
@ -849,12 +849,12 @@ int ScummEngine_vCUPhe::go() {
|
|||
}
|
||||
|
||||
void ScummEngine_vCUPhe::parseEvents() {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
_quit = true;
|
||||
break;
|
||||
|
||||
|
|
|
@ -1547,7 +1547,7 @@ void Control::restartGame(void) {
|
|||
|
||||
void Control::delay(unsigned int amount) {
|
||||
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
uint32 start = _system->getMillis();
|
||||
uint32 cur = start;
|
||||
|
@ -1557,32 +1557,32 @@ void Control::delay(unsigned int amount) {
|
|||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
// Make sure backspace works right (this fixes a small issue on OS X)
|
||||
if (event.kbd.keycode == 8)
|
||||
_keyPressed = 8;
|
||||
else
|
||||
_keyPressed = (byte)event.kbd.ascii;
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
if (!(SkyEngine::_systemVars.systemFlags & SF_MOUSE_LOCKED))
|
||||
_skyMouse->mouseMoved(event.mouse.x, event.mouse.y);
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
_mouseClicked = true;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
_mouseClicked = false;
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
break;
|
||||
case OSystem::EVENT_WHEELUP:
|
||||
case Common::EVENT_WHEELUP:
|
||||
_mouseWheel = -1;
|
||||
break;
|
||||
case OSystem::EVENT_WHEELDOWN:
|
||||
case Common::EVENT_WHEELDOWN:
|
||||
_mouseWheel = 1;
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
SkyEngine::_systemVars.quitGame = true;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -900,7 +900,7 @@ void Intro::restoreScreen(void) {
|
|||
bool Intro::escDelay(uint32 msecs) {
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
if (_relDelay == 0) // first call, init with system time
|
||||
_relDelay = (int32)_system->getMillis();
|
||||
|
||||
|
@ -909,10 +909,10 @@ bool Intro::escDelay(uint32 msecs) {
|
|||
int32 nDelay = 0;
|
||||
do {
|
||||
while (eventMan->pollEvent(event)) {
|
||||
if (event.type == OSystem::EVENT_KEYDOWN) {
|
||||
if (event.type == Common::EVENT_KEYDOWN) {
|
||||
if (event.kbd.keycode == 27)
|
||||
return false;
|
||||
} else if (event.type == OSystem::EVENT_QUIT) {
|
||||
} else if (event.type == Common::EVENT_QUIT) {
|
||||
_quitProg = true;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ void Mouse::waitMouseNotPressed(int minDelay) {
|
|||
|
||||
bool mousePressed = true;
|
||||
uint32 now = _system->getMillis();
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (mousePressed || _system->getMillis() < now + minDelay) {
|
||||
|
||||
|
@ -187,7 +187,7 @@ void Mouse::waitMouseNotPressed(int minDelay) {
|
|||
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.ascii == 27) {
|
||||
minDelay = 0;
|
||||
mousePressed = false;
|
||||
|
|
|
@ -394,7 +394,7 @@ void Screen::waitForTimer(void) {
|
|||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
_gotTick = false;
|
||||
while (!_gotTick) {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
_system->delayMillis(10);
|
||||
while (eventMan->pollEvent(event));
|
||||
|
@ -404,7 +404,7 @@ void Screen::waitForTimer(void) {
|
|||
void Screen::waitForSequence(void) {
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (_seqInfo.running) {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
_system->delayMillis(20);
|
||||
while (eventMan->pollEvent(event));
|
||||
|
|
|
@ -222,7 +222,7 @@ void SkyEngine::handleKey(void) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (_keyFlags == OSystem::KBD_CTRL) {
|
||||
if (_keyFlags == Common::KBD_CTRL) {
|
||||
if (_keyPressed == 'f')
|
||||
_fastMode ^= 1;
|
||||
else if (_keyPressed == 'g')
|
||||
|
@ -512,7 +512,7 @@ void SkyEngine::gotTimerTick(void) {
|
|||
void SkyEngine::delay(int32 amount) {
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
uint32 start = _system->getMillis();
|
||||
_keyFlags = _keyPressed = 0; //reset
|
||||
|
@ -523,28 +523,28 @@ void SkyEngine::delay(int32 amount) {
|
|||
do {
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
_keyFlags = event.kbd.flags;
|
||||
if (_keyFlags == OSystem::KBD_CTRL)
|
||||
if (_keyFlags == Common::KBD_CTRL)
|
||||
_keyPressed = event.kbd.keycode;
|
||||
else
|
||||
_keyPressed = (byte)event.kbd.ascii;
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
if (!(_systemVars.systemFlags & SF_MOUSE_LOCKED))
|
||||
_skyMouse->mouseMoved(event.mouse.x, event.mouse.y);
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
if (!(_systemVars.systemFlags & SF_MOUSE_LOCKED))
|
||||
_skyMouse->mouseMoved(event.mouse.x, event.mouse.y);
|
||||
_skyMouse->buttonPressed(2);
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
if (!(_systemVars.systemFlags & SF_MOUSE_LOCKED))
|
||||
_skyMouse->mouseMoved(event.mouse.x, event.mouse.y);
|
||||
_skyMouse->buttonPressed(1);
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
_systemVars.quitGame = true;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -200,19 +200,19 @@ void MoviePlayer::play(void) {
|
|||
syncFrame();
|
||||
updateScreen();
|
||||
_currentFrame++;
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_SCREEN_CHANGED:
|
||||
case Common::EVENT_SCREEN_CHANGED:
|
||||
handleScreenChanged();
|
||||
break;
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.keycode == 27) {
|
||||
_snd->stopHandle(_bgSoundHandle);
|
||||
terminated = true;
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
_sys->quit();
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1028,7 +1028,7 @@ void Control::doRestore(void) {
|
|||
}
|
||||
|
||||
void Control::delay(uint32 msecs) {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
uint32 now = _system->getMillis();
|
||||
uint32 endTime = now + msecs;
|
||||
|
@ -1039,7 +1039,7 @@ void Control::delay(uint32 msecs) {
|
|||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
|
||||
// Make sure backspace works right (this fixes a small issue on OS X)
|
||||
if (event.kbd.keycode == 8)
|
||||
|
@ -1049,11 +1049,11 @@ void Control::delay(uint32 msecs) {
|
|||
// we skip the rest of the delay and return immediately
|
||||
// to handle keyboard input
|
||||
return;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
_mouseX = event.mouse.x;
|
||||
_mouseY = event.mouse.y;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
_mouseDown = true;
|
||||
_mouseState |= BS1L_BUTTON_DOWN;
|
||||
#if defined(_WIN32_WCE) || defined(PALMOS_MODE)
|
||||
|
@ -1061,19 +1061,19 @@ void Control::delay(uint32 msecs) {
|
|||
_mouseY = event.mouse.y;
|
||||
#endif
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
_mouseDown = false;
|
||||
_mouseState |= BS1L_BUTTON_UP;
|
||||
break;
|
||||
case OSystem::EVENT_WHEELUP:
|
||||
case Common::EVENT_WHEELUP:
|
||||
_mouseDown = false;
|
||||
_mouseState |= BS1_WHEEL_UP;
|
||||
break;
|
||||
case OSystem::EVENT_WHEELDOWN:
|
||||
case Common::EVENT_WHEELDOWN:
|
||||
_mouseDown = false;
|
||||
_mouseState |= BS1_WHEEL_DOWN;
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
SwordEngine::_systemVars.engineQuit = true;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -272,13 +272,13 @@ uint8 CreditsPlayer::getPalIdx(uint8 r, uint8 g, uint8 b) {
|
|||
|
||||
void CreditsPlayer::delay(int msecs) {
|
||||
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
uint32 start = _system->getMillis();
|
||||
do {
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
SwordEngine::_systemVars.engineQuit = true;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -702,45 +702,45 @@ uint8 SwordEngine::mainLoop(void) {
|
|||
|
||||
void SwordEngine::delay(int32 amount) { //copied and mutilated from sky.cpp
|
||||
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
uint32 start = _system->getMillis();
|
||||
|
||||
do {
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
// Make sure backspace works right (this fixes a small issue on OS X)
|
||||
if (event.kbd.keycode == 8)
|
||||
_keyPressed = 8;
|
||||
else
|
||||
_keyPressed = (uint8)event.kbd.ascii;
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
_mouseX = event.mouse.x;
|
||||
_mouseY = event.mouse.y;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
_mouseState |= BS1L_BUTTON_DOWN;
|
||||
#if defined(_WIN32_WCE) || defined(PALMOS_MODE)
|
||||
_mouseX = event.mouse.x;
|
||||
_mouseY = event.mouse.y;
|
||||
#endif
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
_mouseState |= BS1R_BUTTON_DOWN;
|
||||
#if defined(_WIN32_WCE) || defined(PALMOS_MODE)
|
||||
_mouseX = event.mouse.x;
|
||||
_mouseY = event.mouse.y;
|
||||
#endif
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
_mouseState |= BS1L_BUTTON_UP;
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
_mouseState |= BS1R_BUTTON_UP;
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
_systemVars.engineQuit = true;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -407,19 +407,19 @@ void MoviePlayer::play(SequenceTextInfo *textList, uint32 numLines, int32 leadIn
|
|||
drawFrame();
|
||||
updateScreen();
|
||||
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_SCREEN_CHANGED:
|
||||
case Common::EVENT_SCREEN_CHANGED:
|
||||
handleScreenChanged();
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
_vm->closeGame();
|
||||
terminate = true;
|
||||
break;
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.keycode == 27)
|
||||
terminate = true;
|
||||
break;
|
||||
|
|
|
@ -375,9 +375,9 @@ int Sword2Engine::go() {
|
|||
KeyboardEvent *ke = keyboardEvent();
|
||||
|
||||
if (ke) {
|
||||
if ((ke->modifiers == OSystem::KBD_CTRL && ke->keycode == 'd') || ke->ascii == '#' || ke->ascii == '~') {
|
||||
if ((ke->modifiers == Common::KBD_CTRL && ke->keycode == 'd') || ke->ascii == '#' || ke->ascii == '~') {
|
||||
_debugger->attach();
|
||||
} else if (ke->modifiers == 0 || ke->modifiers == OSystem::KBD_SHIFT) {
|
||||
} else if (ke->modifiers == 0 || ke->modifiers == Common::KBD_SHIFT) {
|
||||
switch (ke->keycode) {
|
||||
case 'p':
|
||||
if (_gamePaused)
|
||||
|
@ -532,13 +532,13 @@ uint32 Sword2Engine::setInputEventFilter(uint32 filter) {
|
|||
*/
|
||||
|
||||
void Sword2Engine::parseInputEvents() {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
if (event.kbd.flags == OSystem::KBD_CTRL) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.flags == Common::KBD_CTRL) {
|
||||
if (event.kbd.keycode == 'f') {
|
||||
if (_gameSpeed == 1)
|
||||
_gameSpeed = 2;
|
||||
|
@ -553,48 +553,48 @@ void Sword2Engine::parseInputEvents() {
|
|||
_keyboardEvent.modifiers = event.kbd.flags;
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
if (!(_inputEventFilter & RD_KEYDOWN)) {
|
||||
_mouse->setPos(event.mouse.x, event.mouse.y - MENUDEEP);
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
if (!(_inputEventFilter & RD_LEFTBUTTONDOWN)) {
|
||||
_mouseEvent.pending = true;
|
||||
_mouseEvent.buttons = RD_LEFTBUTTONDOWN;
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
if (!(_inputEventFilter & RD_RIGHTBUTTONDOWN)) {
|
||||
_mouseEvent.pending = true;
|
||||
_mouseEvent.buttons = RD_RIGHTBUTTONDOWN;
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
if (!(_inputEventFilter & RD_LEFTBUTTONUP)) {
|
||||
_mouseEvent.pending = true;
|
||||
_mouseEvent.buttons = RD_LEFTBUTTONUP;
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
if (!(_inputEventFilter & RD_RIGHTBUTTONUP)) {
|
||||
_mouseEvent.pending = true;
|
||||
_mouseEvent.buttons = RD_RIGHTBUTTONUP;
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_WHEELUP:
|
||||
case Common::EVENT_WHEELUP:
|
||||
if (!(_inputEventFilter & RD_WHEELUP)) {
|
||||
_mouseEvent.pending = true;
|
||||
_mouseEvent.buttons = RD_WHEELUP;
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_WHEELDOWN:
|
||||
case Common::EVENT_WHEELDOWN:
|
||||
if (!(_inputEventFilter & RD_WHEELDOWN)) {
|
||||
_mouseEvent.pending = true;
|
||||
_mouseEvent.buttons = RD_WHEELDOWN;
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
closeGame();
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -275,14 +275,14 @@ void ToucheEngine::mainLoop() {
|
|||
}
|
||||
|
||||
void ToucheEngine::processEvents(bool handleKeyEvents) {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
_flagsTable[611] = 1;
|
||||
break;
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (!handleKeyEvents) {
|
||||
break;
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ void ToucheEngine::processEvents(bool handleKeyEvents) {
|
|||
} else if (event.kbd.keycode == 291) { // F10
|
||||
_fastWalkMode = false;
|
||||
}
|
||||
if (event.kbd.flags == OSystem::KBD_CTRL) {
|
||||
if (event.kbd.flags == Common::KBD_CTRL) {
|
||||
if (event.kbd.keycode == 'd') {
|
||||
// enable debugging stuff ?
|
||||
_flagsTable[777] = 1;
|
||||
|
@ -319,25 +319,25 @@ void ToucheEngine::processEvents(bool handleKeyEvents) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
_inp_mousePos.x = event.mouse.x;
|
||||
_inp_mousePos.y = event.mouse.y;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
_inp_mousePos.x = event.mouse.x;
|
||||
_inp_mousePos.y = event.mouse.y;
|
||||
_inp_leftMouseButtonPressed = true;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
_inp_mousePos.x = event.mouse.x;
|
||||
_inp_mousePos.y = event.mouse.y;
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
_inp_mousePos.x = event.mouse.x;
|
||||
_inp_mousePos.y = event.mouse.y;
|
||||
_inp_rightMouseButtonPressed = true;
|
||||
break;
|
||||
case OSystem::EVENT_RBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
_inp_mousePos.x = event.mouse.x;
|
||||
_inp_mousePos.y = event.mouse.y;
|
||||
_inp_rightMouseButtonPressed = false;
|
||||
|
|
|
@ -377,23 +377,23 @@ void ToucheEngine::handleOptions(int forceDisplay) {
|
|||
}
|
||||
}
|
||||
redrawMenu(&menuData);
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
const Button *button = 0;
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
menuData.quit = true;
|
||||
menuData.exit = true;
|
||||
_flagsTable[611] = 1;
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
button = menuData.findButtonUnderCursor(event.mouse.x, event.mouse.y);
|
||||
if (button) {
|
||||
handleMenuAction(&menuData, button->action);
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (menuData.mode == kMenuSaveStateMode) {
|
||||
if (event.kbd.keycode == 8) {
|
||||
menuData.removeLastCharFromDescription(_saveLoadCurrentSlot);
|
||||
|
@ -402,10 +402,10 @@ void ToucheEngine::handleOptions(int forceDisplay) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case OSystem::EVENT_WHEELUP:
|
||||
case Common::EVENT_WHEELUP:
|
||||
handleMenuAction(&menuData, kActionScrollUpSaves);
|
||||
break;
|
||||
case OSystem::EVENT_WHEELDOWN:
|
||||
case Common::EVENT_WHEELDOWN:
|
||||
handleMenuAction(&menuData, kActionScrollDownSaves);
|
||||
break;
|
||||
default:
|
||||
|
@ -536,15 +536,15 @@ int ToucheEngine::displayQuitDialog() {
|
|||
int ret = 0;
|
||||
bool quitLoop = false;
|
||||
while (!quitLoop) {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
quitLoop = true;
|
||||
ret = 1;
|
||||
break;
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
quitLoop = true;
|
||||
switch (_language) {
|
||||
case Common::FR_FRA:
|
||||
|
|
|
@ -270,10 +270,10 @@ void AboutDialog::handleTickle() {
|
|||
int modifiers = g_system->getEventManager()->getModifierState();
|
||||
|
||||
// Scroll faster when shift is pressed
|
||||
if (modifiers & OSystem::KBD_SHIFT)
|
||||
if (modifiers & Common::KBD_SHIFT)
|
||||
scrollOffset *= 4;
|
||||
// Reverse scrolling when alt is pressed
|
||||
if (modifiers & OSystem::KBD_ALT)
|
||||
if (modifiers & Common::KBD_ALT)
|
||||
scrollOffset *= -1;
|
||||
_scrollPos += scrollOffset;
|
||||
_scrollTime = t;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "engines/engine.h"
|
||||
#include "base/version.h"
|
||||
|
||||
#include "common/events.h"
|
||||
#include "common/system.h"
|
||||
|
||||
#include "graphics/font.h"
|
||||
|
@ -347,7 +348,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
|
|||
drawLine(pos2line(_currentPos));
|
||||
break;
|
||||
case 256 + 24: // pageup
|
||||
if (modifiers == OSystem::KBD_SHIFT) {
|
||||
if (modifiers == Common::KBD_SHIFT) {
|
||||
_scrollLine -= _linesPerPage - 1;
|
||||
if (_scrollLine < _firstLineInBuffer + _linesPerPage - 1)
|
||||
_scrollLine = _firstLineInBuffer + _linesPerPage - 1;
|
||||
|
@ -356,7 +357,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
|
|||
}
|
||||
break;
|
||||
case 256 + 25: // pagedown
|
||||
if (modifiers == OSystem::KBD_SHIFT) {
|
||||
if (modifiers == Common::KBD_SHIFT) {
|
||||
_scrollLine += _linesPerPage - 1;
|
||||
if (_scrollLine > _promptEndPos / kCharsPerLine) {
|
||||
_scrollLine = _promptEndPos / kCharsPerLine;
|
||||
|
@ -368,7 +369,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
|
|||
}
|
||||
break;
|
||||
case 256 + 22: // home
|
||||
if (modifiers == OSystem::KBD_SHIFT) {
|
||||
if (modifiers == Common::KBD_SHIFT) {
|
||||
_scrollLine = _firstLineInBuffer + _linesPerPage - 1;
|
||||
updateScrollBuffer();
|
||||
} else {
|
||||
|
@ -377,7 +378,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
|
|||
draw();
|
||||
break;
|
||||
case 256 + 23: // end
|
||||
if (modifiers == OSystem::KBD_SHIFT) {
|
||||
if (modifiers == Common::KBD_SHIFT) {
|
||||
_scrollLine = _promptEndPos / kCharsPerLine;
|
||||
if (_scrollLine < _linesPerPage - 1)
|
||||
_scrollLine = _linesPerPage - 1;
|
||||
|
@ -406,7 +407,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
|
|||
default:
|
||||
if (ascii == '~' || ascii == '#') {
|
||||
slideUpAndClose();
|
||||
} else if (modifiers == OSystem::KBD_CTRL) {
|
||||
} else if (modifiers == Common::KBD_CTRL) {
|
||||
specialKeys(keycode);
|
||||
} else if ((ascii >= 32 && ascii <= 127) || (ascii >= 160 && ascii <= 255)) {
|
||||
for (i = _promptEndPos - 1; i >= _currentPos; i--)
|
||||
|
|
|
@ -620,7 +620,7 @@ void LauncherDialog::updateListing() {
|
|||
|
||||
void LauncherDialog::addGame() {
|
||||
int modifiers = g_system->getEventManager()->getModifierState();
|
||||
bool massAdd = (modifiers & OSystem::KBD_SHIFT) != 0;
|
||||
bool massAdd = (modifiers & Common::KBD_SHIFT) != 0;
|
||||
|
||||
if (massAdd) {
|
||||
MessageDialog alert("Do you really want to run the mass game detector? "
|
||||
|
@ -866,7 +866,7 @@ void LauncherDialog::updateButtons() {
|
|||
|
||||
// Update the label of the "Add" button depending on whether shift is pressed or not
|
||||
int modifiers = g_system->getEventManager()->getModifierState();
|
||||
const char *newAddButtonLabel = ((modifiers & OSystem::KBD_SHIFT) != 0)
|
||||
const char *newAddButtonLabel = ((modifiers & Common::KBD_SHIFT) != 0)
|
||||
? "Mass Add..."
|
||||
: "Add Game...";
|
||||
|
||||
|
|
|
@ -242,11 +242,11 @@ void NewGui::runLoop() {
|
|||
_theme->drawAll();
|
||||
_system->updateScreen();
|
||||
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
uint32 time = _system->getMillis();
|
||||
|
||||
while (eventMan->pollEvent(event)) {
|
||||
if (activeDialog != getTopDialog() && event.type != OSystem::EVENT_QUIT && event.type != OSystem::EVENT_SCREEN_CHANGED)
|
||||
if (activeDialog != getTopDialog() && event.type != Common::EVENT_QUIT && event.type != Common::EVENT_SCREEN_CHANGED)
|
||||
continue;
|
||||
|
||||
Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y);
|
||||
|
@ -266,19 +266,19 @@ void NewGui::runLoop() {
|
|||
}
|
||||
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_KEYDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
activeDialog->handleKeyDown(event.kbd.ascii, event.kbd.keycode, event.kbd.flags);
|
||||
break;
|
||||
case OSystem::EVENT_KEYUP:
|
||||
case Common::EVENT_KEYUP:
|
||||
activeDialog->handleKeyUp(event.kbd.ascii, event.kbd.keycode, event.kbd.flags);
|
||||
break;
|
||||
case OSystem::EVENT_MOUSEMOVE:
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
activeDialog->handleMouseMoved(mouse.x, mouse.y, 0);
|
||||
break;
|
||||
// We don't distinguish between mousebuttons (for now at least)
|
||||
case OSystem::EVENT_LBUTTONDOWN:
|
||||
case OSystem::EVENT_RBUTTONDOWN:
|
||||
button = (event.type == OSystem::EVENT_LBUTTONDOWN ? 1 : 2);
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
button = (event.type == Common::EVENT_LBUTTONDOWN ? 1 : 2);
|
||||
if (_lastClick.count && (time < _lastClick.time + kDoubleClickDelay)
|
||||
&& ABS(_lastClick.x - event.mouse.x) < 3
|
||||
&& ABS(_lastClick.y - event.mouse.y) < 3) {
|
||||
|
@ -291,21 +291,21 @@ void NewGui::runLoop() {
|
|||
_lastClick.time = time;
|
||||
activeDialog->handleMouseDown(mouse.x, mouse.y, button, _lastClick.count);
|
||||
break;
|
||||
case OSystem::EVENT_LBUTTONUP:
|
||||
case OSystem::EVENT_RBUTTONUP:
|
||||
button = (event.type == OSystem::EVENT_LBUTTONUP ? 1 : 2);
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
button = (event.type == Common::EVENT_LBUTTONUP ? 1 : 2);
|
||||
activeDialog->handleMouseUp(mouse.x, mouse.y, button, _lastClick.count);
|
||||
break;
|
||||
case OSystem::EVENT_WHEELUP:
|
||||
case Common::EVENT_WHEELUP:
|
||||
activeDialog->handleMouseWheel(mouse.x, mouse.y, -1);
|
||||
break;
|
||||
case OSystem::EVENT_WHEELDOWN:
|
||||
case Common::EVENT_WHEELDOWN:
|
||||
activeDialog->handleMouseWheel(mouse.x, mouse.y, 1);
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
_system->quit();
|
||||
return;
|
||||
case OSystem::EVENT_SCREEN_CHANGED:
|
||||
case Common::EVENT_SCREEN_CHANGED:
|
||||
screenChange();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -112,11 +112,11 @@ public:
|
|||
};
|
||||
|
||||
static int eatSystemEvents() {
|
||||
OSystem::Event event;
|
||||
Common::Event event;
|
||||
Common::EventManager *eventMan = g_system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case OSystem::EVENT_QUIT:
|
||||
case Common::EVENT_QUIT:
|
||||
return 1;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue