From ed54ea9155961d8ca5d5fb3c7777fc57a29f2751 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 17 Mar 2007 19:02:05 +0000 Subject: 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 --- backends/platform/dc/dc.h | 2 +- backends/platform/dc/input.cpp | 27 ++++++++++++++------------- backends/platform/dc/selector.cpp | 2 +- backends/platform/dc/softkbd.cpp | 7 ++++--- 4 files changed, 20 insertions(+), 18 deletions(-) (limited to 'backends/platform/dc') diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index bda9d36def..0b723992f3 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -114,7 +114,7 @@ class OSystem_Dreamcast : public OSystem { // Get the next event. // Returns true if an event was retrieved. - bool pollEvent(Event &event); + bool pollEvent(Common::Event &event); // Determine the output sample rate. Audio data provided by the sound // callback will be played using this rate. diff --git a/backends/platform/dc/input.cpp b/backends/platform/dc/input.cpp index 49b6a56e6f..08d3c95e9f 100644 --- a/backends/platform/dc/input.cpp +++ b/backends/platform/dc/input.cpp @@ -25,6 +25,7 @@ #include #include +#include "common/events.h" #include "dc.h" int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, @@ -84,9 +85,9 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, int key = pad->cond.kbd.key[p]; if(shift & 0x08) lmb++; if(shift & 0x80) rmb++; - if(shift & 0x11) shiftFlags |= OSystem::KBD_CTRL; - if(shift & 0x44) shiftFlags |= OSystem::KBD_ALT; - if(shift & 0x22) shiftFlags |= OSystem::KBD_SHIFT; + if(shift & 0x11) shiftFlags |= Common::KBD_CTRL; + if(shift & 0x44) shiftFlags |= Common::KBD_ALT; + if(shift & 0x22) shiftFlags |= Common::KBD_SHIFT; if(key >= 4 && key <= 0x1d) newkey = key+('a'-4); else if(key >= 0x1e && key <= 0x26) @@ -143,26 +144,26 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, if(lmb && !lastlmb) { lastlmb = 1; - return -OSystem::EVENT_LBUTTONDOWN; + return -Common::EVENT_LBUTTONDOWN; } else if(lastlmb && !lmb) { lastlmb = 0; - return -OSystem::EVENT_LBUTTONUP; + return -Common::EVENT_LBUTTONUP; } if(rmb && !lastrmb) { lastrmb = 1; - return -OSystem::EVENT_RBUTTONDOWN; + return -Common::EVENT_RBUTTONDOWN; } else if(lastrmb && !rmb) { lastrmb = 0; - return -OSystem::EVENT_RBUTTONUP; + return -Common::EVENT_RBUTTONUP; } if(mouse_wheel != lastwheel) if(((int8)(mouse_wheel - lastwheel)) > 0) { lastwheel++; - return -OSystem::EVENT_WHEELDOWN; + return -Common::EVENT_WHEELDOWN; } else { --lastwheel; - return -OSystem::EVENT_WHEELUP; + return -Common::EVENT_WHEELUP; } if(newkey && inter && newkey != lastkey) { @@ -187,7 +188,7 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, return 0; } -bool OSystem_Dreamcast::pollEvent(Event &event) +bool OSystem_Dreamcast::pollEvent(Common::Event &event) { unsigned int t = Timer(); @@ -224,9 +225,9 @@ bool OSystem_Dreamcast::pollEvent(Event &event) bool processed = false, down = !(e&(1<<30)); e &= ~(1<<30); if(e < 1000) { - event.type = (down? EVENT_KEYDOWN : EVENT_KEYUP); + event.type = (down? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP); event.kbd.keycode = e; - event.kbd.ascii = (e>='a' && e<='z' && (event.kbd.flags & KBD_SHIFT)? + event.kbd.ascii = (e>='a' && e<='z' && (event.kbd.flags & Common::KBD_SHIFT)? e &~ 0x20 : e); processed = true; } else if(down) { @@ -236,7 +237,7 @@ bool OSystem_Dreamcast::pollEvent(Event &event) } return processed; } else if(_ms_cur_x != _ms_old_x || _ms_cur_y != _ms_old_y) { - event.type = EVENT_MOUSEMOVE; + event.type = Common::EVENT_MOUSEMOVE; _ms_old_x = _ms_cur_x; _ms_old_y = _ms_cur_y; return true; diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp index ac6b828105..7abcd2704c 100644 --- a/backends/platform/dc/selector.cpp +++ b/backends/platform/dc/selector.cpp @@ -361,7 +361,7 @@ int gameMenu(Game *games, int num_games) event = handleInput(locked_get_pads(), mousex, mousey, shiftFlags); setimask(mask); - if(event==-OSystem::EVENT_LBUTTONDOWN || event==13 || event==319) { + if(event==-Common::EVENT_LBUTTONDOWN || event==13 || event==319) { int selected_game = top_game + selector_pos; for(int fade=0; fade<=256; fade+=4) { diff --git a/backends/platform/dc/softkbd.cpp b/backends/platform/dc/softkbd.cpp index f0bf4a777c..3a842e8b1b 100644 --- a/backends/platform/dc/softkbd.cpp +++ b/backends/platform/dc/softkbd.cpp @@ -23,6 +23,7 @@ #include #include +#include "common/events.h" #include "engines/engine.h" #include @@ -58,7 +59,7 @@ static const short key_codes[] = K('h','H'), K('j','J'), K('k','K'), K('l','L'), K(';','+'), K(':','*'), K('z','Z'), K('x','X'), K('c','C'), K('v','V'), K('b','B'), K('n','N'), K('m','M'), K(',','<'), K('.','>'), K('/','?'), K('\\','_'), - ~OSystem::KBD_SHIFT, ~OSystem::KBD_CTRL, ~OSystem::KBD_ALT, ' ', 8, 13 + ~Common::KBD_SHIFT, ~Common::KBD_CTRL, ~Common::KBD_ALT, ' ', 8, 13 }; SoftKeyboard::SoftKeyboard(const OSystem_Dreamcast *_os) @@ -96,7 +97,7 @@ void SoftKeyboard::draw(float x, float y, int transp) draw_trans_quad(x, y, x+w, y+24.0, bg, bg, bg, bg); if(key_codes[i]<0 && (shiftState & ~key_codes[i])) labels[0][i].draw(x+2, y+5, txt_alpha_mask|0xffffff, 0.5); - else if(key_codes[i]>8192 && (shiftState & OSystem::KBD_SHIFT)) + else if(key_codes[i]>8192 && (shiftState & Common::KBD_SHIFT)) labels[1][i].draw(x+2, y+5, txt_alpha_mask|0x000000, 0.5); else labels[0][i].draw(x+2, y+5, txt_alpha_mask|0x000000, 0.5); @@ -148,7 +149,7 @@ int SoftKeyboard::key(int k, byte &shiftFlags) else { shiftFlags = shiftState; if(key_codes[keySel] > 8192) - return ((shiftState & OSystem::KBD_SHIFT)? (key_codes[keySel]>>8): + return ((shiftState & Common::KBD_SHIFT)? (key_codes[keySel]>>8): key_codes[keySel]) & 0xff; else return key_codes[keySel]; -- cgit v1.2.3