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