aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/sdl
diff options
context:
space:
mode:
Diffstat (limited to 'backends/graphics/sdl')
-rw-r--r--backends/graphics/sdl/basesdl-graphics.h79
-rw-r--r--backends/graphics/sdl/sdl-graphics.cpp17
-rw-r--r--backends/graphics/sdl/sdl-graphics.h12
3 files changed, 18 insertions, 90 deletions
diff --git a/backends/graphics/sdl/basesdl-graphics.h b/backends/graphics/sdl/basesdl-graphics.h
deleted file mode 100644
index 6e25e095f4..0000000000
--- a/backends/graphics/sdl/basesdl-graphics.h
+++ /dev/null
@@ -1,79 +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$
- *
- */
-
-#ifndef BACKENDS_GRAPHICS_BASESDL_H
-#define BACKENDS_GRAPHICS_BASESDL_H
-
-#include "backends/graphics/graphics.h"
-
-#if defined(__SYMBIAN32__)
-#include <esdl\SDL.h>
-#else
-#include <SDL.h>
-#endif
-
-/**
- * Base SDL graphics manager, contains common functions
- * used by other SDL managers
- */
-class BaseSdlGraphicsManager : public GraphicsManager {
-public:
- /**
- * Marks the screen for a full redraw
- */
- virtual void forceFullRedraw() = 0;
-
- /**
- * Handles the scalar hotkeys
- */
- virtual bool handleScalerHotkeys(const SDL_KeyboardEvent &key) = 0;
-
- /**
- * Returns if the event passed is a hotkey for the graphics scalers
- */
- virtual bool isScalerHotkey(const Common::Event &event) = 0;
-
- /**
- * Adjusts mouse event coords for the current scaler
- */
- virtual void adjustMouseEvent(Common::Event &event) = 0;
-
- /**
- * Updates the mouse cursor position
- */
- virtual void setMousePos(int x, int y) = 0;
-
- /**
- * Toggles fullscreen
- */
- virtual void toggleFullScreen() = 0;
-
- /**
- * Saves a screenshot to a file
- */
- virtual bool saveScreenshot(const char *filename) = 0;
-};
-
-#endif
diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index 51283f4494..26a5a6302c 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -1967,9 +1967,10 @@ void SdlGraphicsManager::displayMessageOnOSD(const char *msg) {
}
#endif
-bool SdlGraphicsManager::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
+bool SdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) {
+
// Ctrl-Alt-a toggles aspect ratio correction
- if (key.keysym.sym == 'a') {
+ if (key == 'a') {
beginGFXTransaction();
setFeatureState(OSystem::kFeatureAspectRatioCorrection, !_videoMode.aspectRatioCorrection);
endGFXTransaction();
@@ -1995,18 +1996,18 @@ bool SdlGraphicsManager::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
int factor = _videoMode.scaleFactor - 1;
// Increase/decrease the scale factor
- if (key.keysym.sym == SDLK_EQUALS || key.keysym.sym == SDLK_PLUS || key.keysym.sym == SDLK_MINUS ||
- key.keysym.sym == SDLK_KP_PLUS || key.keysym.sym == SDLK_KP_MINUS) {
- factor += (key.keysym.sym == SDLK_MINUS || key.keysym.sym == SDLK_KP_MINUS) ? -1 : +1;
+ if (key == SDLK_EQUALS || key == SDLK_PLUS || key == SDLK_MINUS ||
+ key == SDLK_KP_PLUS || key == SDLK_KP_MINUS) {
+ factor += (key == SDLK_MINUS || key == SDLK_KP_MINUS) ? -1 : +1;
if (0 <= factor && factor <= 3) {
newMode = s_gfxModeSwitchTable[_scalerType][factor];
}
}
- const bool isNormalNumber = (SDLK_1 <= key.keysym.sym && key.keysym.sym <= SDLK_9);
- const bool isKeypadNumber = (SDLK_KP1 <= key.keysym.sym && key.keysym.sym <= SDLK_KP9);
+ const bool isNormalNumber = (SDLK_1 <= key && key <= SDLK_9);
+ const bool isKeypadNumber = (SDLK_KP1 <= key && key <= SDLK_KP9);
if (isNormalNumber || isKeypadNumber) {
- _scalerType = key.keysym.sym - (isNormalNumber ? SDLK_1 : SDLK_KP1);
+ _scalerType = key - (isNormalNumber ? SDLK_1 : SDLK_KP1);
if (_scalerType >= ARRAYSIZE(s_gfxModeSwitchTable))
return false;
diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h
index b5bb23d247..4ca92e9d30 100644
--- a/backends/graphics/sdl/sdl-graphics.h
+++ b/backends/graphics/sdl/sdl-graphics.h
@@ -26,10 +26,16 @@
#ifndef BACKENDS_GRAPHICS_SDL_H
#define BACKENDS_GRAPHICS_SDL_H
-#include "backends/graphics/sdl/basesdl-graphics.h"
+#include "backends/graphics/graphics.h"
#include "common/system.h"
#include "graphics/scaler.h"
+#if defined(__SYMBIAN32__)
+#include <esdl\SDL.h>
+#else
+#include <SDL.h>
+#endif
+
#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
// Uncomment this to enable the 'on screen display' code.
#define USE_OSD 1
@@ -66,7 +72,7 @@ public:
/**
* SDL graphics manager
*/
-class SdlGraphicsManager : public BaseSdlGraphicsManager {
+class SdlGraphicsManager : public GraphicsManager {
public:
SdlGraphicsManager();
virtual ~SdlGraphicsManager();
@@ -122,7 +128,7 @@ public:
#endif
virtual void forceFullRedraw();
- virtual bool handleScalerHotkeys(const SDL_KeyboardEvent &key);
+ virtual bool handleScalerHotkeys(Common::KeyCode key);
virtual bool isScalerHotkey(const Common::Event &event);
virtual void adjustMouseEvent(Common::Event &event);
virtual void setMousePos(int x, int y);