diff options
author | Alejandro Marzini | 2010-06-25 05:02:40 +0000 |
---|---|---|
committer | Alejandro Marzini | 2010-06-25 05:02:40 +0000 |
commit | d04a2a266dff688cc88931b4e11432ae8f4a7130 (patch) | |
tree | 29915d8c641c80afc4e5848584b7c1ee93855c00 /backends/events | |
parent | 96b9c3aa08d47bd0e6714b201ed5ac561633b9f7 (diff) | |
download | scummvm-rg350-d04a2a266dff688cc88931b4e11432ae8f4a7130.tar.gz scummvm-rg350-d04a2a266dff688cc88931b4e11432ae8f4a7130.tar.bz2 scummvm-rg350-d04a2a266dff688cc88931b4e11432ae8f4a7130.zip |
Modularized Samsung TV port.
svn-id: r50258
Diffstat (limited to 'backends/events')
-rw-r--r-- | backends/events/samsungtv/samsungtv-events.cpp | 78 | ||||
-rw-r--r-- | backends/events/samsungtv/samsungtv-events.h | 40 | ||||
-rw-r--r-- | backends/events/sdl/sdl-events.h | 8 |
3 files changed, 122 insertions, 4 deletions
diff --git a/backends/events/samsungtv/samsungtv-events.cpp b/backends/events/samsungtv/samsungtv-events.cpp new file mode 100644 index 0000000000..c36684122f --- /dev/null +++ b/backends/events/samsungtv/samsungtv-events.cpp @@ -0,0 +1,78 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#if defined(SAMSUNGTV) + +#include "backends/events/samsungtv/samsungtv-events.h" + +SdlSamsungTVEventManager::SdlSamsungTVEventManager(Common::EventSource *boss) + : + SdlEventManager(boss) { + +} + +bool SdlSamsungTVEventManager::remapKey(SDL_Event &ev, Common::Event &event) { + switch (ev.type) { + case SDL_KEYDOWN:{ + if (ev.key.keysym.sym == SDLK_POWER) { + event.type = Common::EVENT_QUIT; + return true; + } else if (ev.key.keysym.sym == SDLK_F1 && ev.key.keysym.scancode == 20) { + event.type = Common::EVENT_KEYDOWN; + event.kbd.keycode = Common::KEYCODE_F5; + event.kbd.ascii = Common::ASCII_F5; + return true; + } else if (ev.key.keysym.sym == SDLK_F2 && ev.key.keysym.scancode == 21) { + event.type = Common::EVENT_KEYDOWN; + event.kbd.keycode = Common::KEYCODE_F7; + event.kbd.ascii = Common::ASCII_F7; + return true; + } + break; + } + case SDL_KEYUP: { + if (ev.key.keysym.sym == SDLK_POWER) { + event.type = Common::EVENT_QUIT; + return true; + } else if (ev.key.keysym.sym == SDLK_F1 && ev.key.keysym.scancode == 20) { + event.type = Common::EVENT_KEYUP; + event.kbd.keycode = Common::KEYCODE_F5; + event.kbd.ascii = Common::ASCII_F5; + return true; + } else if (ev.key.keysym.sym == SDLK_F2 && ev.key.keysym.scancode == 21) { + event.type = Common::EVENT_KEYUP; + event.kbd.keycode = Common::KEYCODE_F7; + event.kbd.ascii = Common::ASCII_F7; + return true; + } + break; + } + } + + // Invoke parent implementation of this method + return SdlEventManager::remapKey(ev, event); +} + +#endif diff --git a/backends/events/samsungtv/samsungtv-events.h b/backends/events/samsungtv/samsungtv-events.h new file mode 100644 index 0000000000..1c7e38984f --- /dev/null +++ b/backends/events/samsungtv/samsungtv-events.h @@ -0,0 +1,40 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#if !defined(BACKEND_EVENTS_SDL_SAMSUNGTV_H) && !defined(DISABLE_DEFAULT_EVENTMANAGER) +#define BACKEND_EVENTS_SDL_SAMSUNGTV_H + +#include "backends/events/sdl/sdl-events.h" + +class SdlSamsungTVEventManager : public SdlEventManager { +public: + SdlSamsungTVEventManager(Common::EventSource *boss); + ~SdlSamsungTVEventManager() {} + +protected: + bool remapKey(SDL_Event &ev, Common::Event &event); +}; + +#endif diff --git a/backends/events/sdl/sdl-events.h b/backends/events/sdl/sdl-events.h index 8dd2840e1d..7a399cc186 100644 --- a/backends/events/sdl/sdl-events.h +++ b/backends/events/sdl/sdl-events.h @@ -37,11 +37,11 @@ class SdlEventManager : public DefaultEventManager { public: SdlEventManager(Common::EventSource *boss); - ~SdlEventManager(); + virtual ~SdlEventManager(); virtual bool pollSdlEvent(Common::Event &event); - void resetKeyboadEmulation(int16 x_max, int16 y_max); + virtual void resetKeyboadEmulation(int16 x_max, int16 y_max); protected: virtual void preprocessEvents(SDL_Event *event) {} @@ -78,9 +78,9 @@ protected: virtual bool handleJoyAxisMotion(SDL_Event &ev, Common::Event &event); virtual void fillMouseEvent(Common::Event &event, int x, int y); // overloaded by CE backend - void toggleMouseGrab(); + virtual void toggleMouseGrab(); - void handleKbdMouse(); + virtual void handleKbdMouse(); virtual bool remapKey(SDL_Event &ev, Common::Event &event); int _lastScreenID; |