diff options
author | Max Horn | 2010-11-28 14:56:31 +0000 |
---|---|---|
committer | Max Horn | 2010-11-28 14:56:31 +0000 |
commit | 7760077cf530c35c969f9286145d9a36d0440d70 (patch) | |
tree | 34c67abbacefa26792ca77fc9f5360c77a34663d /backends/platform/samsungtv | |
parent | 284b49aabc54590e1444f06561a815c2a3c5de7e (diff) | |
parent | 74a53df11b51fa4956745c086b2e6351b8383568 (diff) | |
download | scummvm-rg350-7760077cf530c35c969f9286145d9a36d0440d70.tar.gz scummvm-rg350-7760077cf530c35c969f9286145d9a36d0440d70.tar.bz2 scummvm-rg350-7760077cf530c35c969f9286145d9a36d0440d70.zip |
Merging the gsoc2010-opengl branch
svn-id: r54518
Diffstat (limited to 'backends/platform/samsungtv')
-rw-r--r-- | backends/platform/samsungtv/events.cpp | 73 | ||||
-rw-r--r-- | backends/platform/samsungtv/main.cpp | 9 | ||||
-rw-r--r-- | backends/platform/samsungtv/module.mk | 1 | ||||
-rw-r--r-- | backends/platform/samsungtv/samsungtv.cpp | 34 | ||||
-rw-r--r-- | backends/platform/samsungtv/samsungtv.h | 25 |
5 files changed, 42 insertions, 100 deletions
diff --git a/backends/platform/samsungtv/events.cpp b/backends/platform/samsungtv/events.cpp deleted file mode 100644 index af39e67fe5..0000000000 --- a/backends/platform/samsungtv/events.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* 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$ - * - */ - -#include "backends/platform/samsungtv/samsungtv.h" -#include "common/util.h" -#include "common/events.h" - -#if defined(SAMSUNGTV) - -bool OSystem_SDL_SamsungTV::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; - } - } - - return false; -} - -#endif diff --git a/backends/platform/samsungtv/main.cpp b/backends/platform/samsungtv/main.cpp index 2c025b750c..3beb97165f 100644 --- a/backends/platform/samsungtv/main.cpp +++ b/backends/platform/samsungtv/main.cpp @@ -34,16 +34,23 @@ extern "C" int Game_Main(char *path, char *) { chdir(path); + // Create OSystem instance g_system = new OSystem_SDL_SamsungTV(); assert(g_system); + // Pre initialize the backend + ((OSystem_SDL_SamsungTV *)g_system)->init(); + #ifdef DYNAMIC_MODULES PluginManager::instance().addPluginProvider(new SDLPluginProvider()); #endif // Invoke the actual ScummVM main entry point: int res = scummvm_main(0, 0); - ((OSystem_SDL *)g_system)->deinit(); + + // Free OSystem + delete g_system; + return res; } diff --git a/backends/platform/samsungtv/module.mk b/backends/platform/samsungtv/module.mk index d7ebe75080..36ad75da6d 100644 --- a/backends/platform/samsungtv/module.mk +++ b/backends/platform/samsungtv/module.mk @@ -1,7 +1,6 @@ MODULE := backends/platform/samsungtv MODULE_OBJS := \ - events.o \ main.o \ samsungtv.o diff --git a/backends/platform/samsungtv/samsungtv.cpp b/backends/platform/samsungtv/samsungtv.cpp index 909734d719..b007d1d594 100644 --- a/backends/platform/samsungtv/samsungtv.cpp +++ b/backends/platform/samsungtv/samsungtv.cpp @@ -24,19 +24,34 @@ */ #include "backends/platform/samsungtv/samsungtv.h" +#include "backends/events/samsungtvsdl/samsungtvsdl-events.h" #if defined(SAMSUNGTV) +OSystem_SDL_SamsungTV::OSystem_SDL_SamsungTV() + : + OSystem_POSIX("/dtv/usb/sda1/.scummvmrc") { +} + bool OSystem_SDL_SamsungTV::hasFeature(Feature f) { return - (f == kFeatureAspectRatioCorrection) || - (f == kFeatureCursorHasPalette); + (f == OSystem::kFeatureAspectRatioCorrection) || + (f == OSystem::kFeatureCursorHasPalette); +} + +void OSystem_SDL_SamsungTV::initBackend() { + // Create the events manager + if (_eventManager == 0) + _eventManager = new SamsungTVSdlEventManager(this); + + // Call parent implementation of this method + OSystem_SDL::initBackend(); } void OSystem_SDL_SamsungTV::setFeatureState(Feature f, bool enable) { switch (f) { - case kFeatureAspectRatioCorrection: - setAspectRatioCorrection(enable); + case OSystem::kFeatureAspectRatioCorrection: + _graphicsManager->setFeatureState(f, enable); break; default: break; @@ -44,11 +59,9 @@ void OSystem_SDL_SamsungTV::setFeatureState(Feature f, bool enable) { } bool OSystem_SDL_SamsungTV::getFeatureState(Feature f) { - assert (_transactionMode == kTransactionNone); - switch (f) { - case kFeatureAspectRatioCorrection: - return _videoMode.aspectRatioCorrection; + case OSystem::kFeatureAspectRatioCorrection: + return _graphicsManager->getFeatureState(f); default: return false; } @@ -59,4 +72,9 @@ void OSystem_SDL_SamsungTV::fatalError() { for (;;) {} } +void OSystem_SDL_SamsungTV::quit() { + // FIXME + deinit(); +} + #endif diff --git a/backends/platform/samsungtv/samsungtv.h b/backends/platform/samsungtv/samsungtv.h index 59d1c24cbe..c5c8a4f65a 100644 --- a/backends/platform/samsungtv/samsungtv.h +++ b/backends/platform/samsungtv/samsungtv.h @@ -23,32 +23,23 @@ * */ -#ifndef SDL_SAMSUNGTV_COMMON_H -#define SDL_SAMSUNGTV_COMMON_H +#ifndef PLATFORM_SDL_SAMSUNGTV_H +#define PLATFORM_SDL_SAMSUNGTV_H -#include <SDL.h> +#include "backends/platform/sdl/posix/posix.h" -#include "backends/base-backend.h" -#include "backends/platform/sdl/sdl.h" - -#if defined(SAMSUNGTV) +class OSystem_SDL_SamsungTV : public OSystem_POSIX { +public: + OSystem_SDL_SamsungTV(); -namespace Audio { - class MixerImpl; -} + virtual void initBackend(); -class OSystem_SDL_SamsungTV : public OSystem_SDL { -public: virtual bool hasFeature(Feature f); virtual void setFeatureState(Feature f, bool enable); virtual bool getFeatureState(Feature f); virtual void fatalError(); -protected: - - virtual bool remapKey(SDL_Event &ev, Common::Event &event); + virtual void quit(); }; #endif - -#endif |