aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ps2
diff options
context:
space:
mode:
authorMax Horn2007-03-17 19:02:05 +0000
committerMax Horn2007-03-17 19:02:05 +0000
commited54ea9155961d8ca5d5fb3c7777fc57a29f2751 (patch)
tree467b926af11cd4129ba003d04ba01de044c7a6df /backends/platform/ps2
parentf272d1957084098c5b53975ad3501074f6971af8 (diff)
downloadscummvm-rg350-ed54ea9155961d8ca5d5fb3c7777fc57a29f2751.tar.gz
scummvm-rg350-ed54ea9155961d8ca5d5fb3c7777fc57a29f2751.tar.bz2
scummvm-rg350-ed54ea9155961d8ca5d5fb3c7777fc57a29f2751.zip
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
Diffstat (limited to 'backends/platform/ps2')
-rw-r--r--backends/platform/ps2/ps2input.cpp37
-rw-r--r--backends/platform/ps2/ps2input.h4
-rw-r--r--backends/platform/ps2/systemps2.cpp4
-rw-r--r--backends/platform/ps2/systemps2.h2
4 files changed, 24 insertions, 23 deletions
diff --git a/backends/platform/ps2/ps2input.cpp b/backends/platform/ps2/ps2input.cpp
index bfca9f83be..5297b38747 100644
--- a/backends/platform/ps2/ps2input.cpp
+++ b/backends/platform/ps2/ps2input.cpp
@@ -29,6 +29,7 @@
#include "backends/platform/ps2/ps2pad.h"
#include "backends/platform/ps2/systemps2.h"
#include "backends/platform/ps2/sdlkeys.h"
+#include "common/events.h"
#include "common/system.h"
Ps2Input::Ps2Input(OSystem_PS2 *system, bool mouseLoaded, bool kbdLoaded) {
@@ -98,7 +99,7 @@ int Ps2Input::mapKey(int key, int mod) { // copied from sdl backend
return key - SDLK_KP0 + '0';
} else if (key >= SDLK_UP && key <= SDLK_PAGEDOWN) {
return key;
- } else if (key >= 'a' && key <= 'z' && mod & OSystem::KBD_SHIFT) {
+ } else if (key >= 'a' && key <= 'z' && mod & Common::KBD_SHIFT) {
return key & ~0x20;
} else if (key >= SDLK_NUMLOCK && key <= SDLK_EURO) {
return 0;
@@ -106,7 +107,7 @@ int Ps2Input::mapKey(int key, int mod) { // copied from sdl backend
return key;
}
-bool Ps2Input::pollEvent(OSystem::Event *event) {
+bool Ps2Input::pollEvent(Common::Event *event) {
bool checkPadMouse, checkPadKbd;
checkPadMouse = checkPadKbd = _pad->padAlive();
@@ -116,7 +117,7 @@ bool Ps2Input::pollEvent(OSystem::Event *event) {
if ((_posX != mData.x) || (_posY != mData.y)) {
event->mouse.x = _posX = mData.x;
event->mouse.y = _posY = mData.y;
- event->type = OSystem::EVENT_MOUSEMOVE;
+ event->type = Common::EVENT_MOUSEMOVE;
return true;
}
if (mData.buttons != _mButtons) {
@@ -124,9 +125,9 @@ bool Ps2Input::pollEvent(OSystem::Event *event) {
_mButtons = mData.buttons;
if (change & (PS2MOUSE_BTN1 | PS2MOUSE_BTN2)) {
if (change & PS2MOUSE_BTN1)
- event->type = (_mButtons & PS2MOUSE_BTN1) ? OSystem::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP;
+ event->type = (_mButtons & PS2MOUSE_BTN1) ? Common::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP;
else
- event->type = (_mButtons & PS2MOUSE_BTN2) ? OSystem::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP;
+ event->type = (_mButtons & PS2MOUSE_BTN2) ? Common::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP;
event->mouse.x = _posX;
event->mouse.y = _posY;
return true;
@@ -140,24 +141,24 @@ bool Ps2Input::pollEvent(OSystem::Event *event) {
if (_usbToSdlk[key.key]) {
if ((_usbToSdlk[key.key] == SDLK_LSHIFT) || (_usbToSdlk[key.key] == SDLK_RSHIFT)) {
if (key.state & 1)
- _keyFlags |= OSystem::KBD_SHIFT;
+ _keyFlags |= Common::KBD_SHIFT;
else
- _keyFlags &= ~OSystem::KBD_SHIFT;
+ _keyFlags &= ~Common::KBD_SHIFT;
} else if ((_usbToSdlk[key.key] == SDLK_LCTRL) || (_usbToSdlk[key.key] == SDLK_RCTRL)) {
if (key.state & 1)
- _keyFlags |= OSystem::KBD_CTRL;
+ _keyFlags |= Common::KBD_CTRL;
else
- _keyFlags &= ~OSystem::KBD_CTRL;
+ _keyFlags &= ~Common::KBD_CTRL;
} else if ((_usbToSdlk[key.key] == SDLK_LALT) || (_usbToSdlk[key.key] == SDLK_RALT)) {
if (key.state & 1)
- _keyFlags |= OSystem::KBD_ALT;
+ _keyFlags |= Common::KBD_ALT;
else
- _keyFlags &= ~OSystem::KBD_ALT;
+ _keyFlags &= ~Common::KBD_ALT;
}
if (key.state & 1) // down
- event->type = OSystem::EVENT_KEYDOWN;
+ event->type = Common::EVENT_KEYDOWN;
else
- event->type = OSystem::EVENT_KEYUP;
+ event->type = Common::EVENT_KEYUP;
event->kbd.flags = 0;
event->kbd.keycode = _usbToSdlk[key.key];
event->kbd.ascii = mapKey(_usbToSdlk[key.key], _keyFlags);
@@ -176,9 +177,9 @@ bool Ps2Input::pollEvent(OSystem::Event *event) {
if (checkPadMouse) {
if (btnChange & (PAD_CROSS | PAD_CIRCLE)) {
if (btnChange & PAD_CROSS)
- event->type = (buttons & PAD_CROSS) ? OSystem::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP;
+ event->type = (buttons & PAD_CROSS) ? Common::EVENT_LBUTTONDOWN : OSystem::EVENT_LBUTTONUP;
else
- event->type = (buttons & PAD_CIRCLE) ? OSystem::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP;
+ event->type = (buttons & PAD_CIRCLE) ? Common::EVENT_RBUTTONDOWN : OSystem::EVENT_RBUTTONUP;
event->mouse.x = _posX;
event->mouse.y = _posY;
_padLastButtons = buttons;
@@ -211,7 +212,7 @@ bool Ps2Input::pollEvent(OSystem::Event *event) {
newX = ((newX < (int16)_minx) ? (_minx) : ((newX > (int16)_maxx) ? (_maxx) : ((int16)newX)));
newY = ((newY < (int16)_miny) ? (_miny) : ((newY > (int16)_maxy) ? (_maxy) : ((int16)newY)));
if ((_posX != newX) || (_posY != newY)) {
- event->type = OSystem::EVENT_MOUSEMOVE;
+ event->type = Common::EVENT_MOUSEMOVE;
event->mouse.x = _posX = newX;
event->mouse.y = _posY = newY;
return true;
@@ -228,7 +229,7 @@ bool Ps2Input::pollEvent(OSystem::Event *event) {
return false;
}
-bool Ps2Input::getKeyEvent(OSystem::Event *event, uint16 buttonCode, bool down) {
+bool Ps2Input::getKeyEvent(Common::Event *event, uint16 buttonCode, bool down) {
// for simulating key presses with the pad
if (buttonCode) {
uint8 entry = 0;
@@ -237,7 +238,7 @@ bool Ps2Input::getKeyEvent(OSystem::Event *event, uint16 buttonCode, bool down)
buttonCode >>= 1;
}
if (_padCodes[entry]) {
- event->type = (down) ? OSystem::EVENT_KEYDOWN : OSystem::EVENT_KEYUP;
+ event->type = (down) ? Common::EVENT_KEYDOWN : OSystem::EVENT_KEYUP;
event->kbd.keycode = _padCodes[entry];
event->kbd.flags = _padFlags[entry];
event->kbd.ascii = mapKey(_padCodes[entry], _padFlags[entry]);
diff --git a/backends/platform/ps2/ps2input.h b/backends/platform/ps2/ps2input.h
index c7a29c7bfd..6a6bdfe2e9 100644
--- a/backends/platform/ps2/ps2input.h
+++ b/backends/platform/ps2/ps2input.h
@@ -33,11 +33,11 @@ public:
Ps2Input(OSystem_PS2 *system, bool mouseLoaded, bool kbdLoaded);
~Ps2Input(void);
void newRange(uint16 minx, uint16 miny, uint16 maxx, uint16 maxy);
- bool pollEvent(OSystem::Event *event);
+ bool pollEvent(Common::Event *event);
void warpTo(uint16 x, uint16 y);
private:
int mapKey(int key, int mod);
- bool getKeyEvent(OSystem::Event *event, uint16 buttonCode, bool down);
+ bool getKeyEvent(Common::Event *event, uint16 buttonCode, bool down);
OSystem_PS2 *_system;
Ps2Pad *_pad;
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index 6c479f30d7..4ba426590c 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -649,9 +649,9 @@ int OSystem_PS2::getDefaultGraphicsMode(void) const {
return 0;
}
-bool OSystem_PS2::pollEvent(Event &event) {
+bool OSystem_PS2::pollEvent(Common::Event &event) {
bool res = _input->pollEvent(&event);
- if (res && (event.type == EVENT_MOUSEMOVE))
+ if (res && (event.type == Common::EVENT_MOUSEMOVE))
_screen->setMouseXy(event.mouse.x, event.mouse.y);
return res;
}
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index 4c51e78c66..f3821cee66 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -70,7 +70,7 @@ public:
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
virtual void setTimerCallback(TimerProc callback, int interval);
- virtual bool pollEvent(Event &event);
+ virtual bool pollEvent(Common::Event &event);
virtual bool setSoundCallback(SoundProc proc, void *param);
virtual void clearSoundCallback();