aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/sdl
diff options
context:
space:
mode:
authorAlejandro Marzini2010-06-16 04:34:44 +0000
committerAlejandro Marzini2010-06-16 04:34:44 +0000
commit99c0f8260848ff758da3e40d9d816dc51974f793 (patch)
tree0f7f56da2aa4c740661609b71d1411cd4f6ec8d7 /backends/graphics/sdl
parent54377bbb308dc89337d1473cb1c5b5e84b470aff (diff)
downloadscummvm-rg350-99c0f8260848ff758da3e40d9d816dc51974f793.tar.gz
scummvm-rg350-99c0f8260848ff758da3e40d9d816dc51974f793.tar.bz2
scummvm-rg350-99c0f8260848ff758da3e40d9d816dc51974f793.zip
Fixed some disabled code that was with problems after modularization.
svn-id: r49899
Diffstat (limited to 'backends/graphics/sdl')
-rw-r--r--backends/graphics/sdl/sdl-graphics.cpp37
-rw-r--r--backends/graphics/sdl/sdl-graphics.h11
2 files changed, 32 insertions, 16 deletions
diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index 206e04166c..e5d4c7521b 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -26,6 +26,7 @@
#if defined(WIN32) || defined(UNIX) || defined(MACOSX)
#include "backends/graphics/sdl/sdl-graphics.h"
+#include "common/system.h"
#include "common/config-manager.h"
#include "common/mutex.h"
#include "common/util.h"
@@ -37,7 +38,7 @@
#include "graphics/scaler.h"
#include "graphics/scaler/aspect.h"
#include "graphics/surface.h"
-#include "backends/events/default/default-events.h"
+#include "backends/events/sdl/sdl-events.h"
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
{"1x", "Normal (no scaling)", GFX_NORMAL},
@@ -790,11 +791,9 @@ bool SdlGraphicsManager::loadGFXMode() {
SDL_SetColorKey(_osdSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, kOSDColorKey);
#endif
- // keyboard cursor control, some other better place for it? - FIXME
- /*_km.x_max = _videoMode.screenWidth * _videoMode.scaleFactor - 1;
- _km.y_max = effectiveScreenHeight() - 1;
- _km.delay_time = 25;
- _km.last_time = 0;*/
+ ((SdlEventManager *)g_system->getEventManager())->resetKeyboadEmulation(
+ _videoMode.screenWidth * _videoMode.scaleFactor - 1,
+ effectiveScreenHeight() - 1);
// Distinguish 555 and 565 mode
if (_hwscreen->format->Rmask == 0x7C00)
@@ -1964,11 +1963,6 @@ void SdlGraphicsManager::displayMessageOnOSD(const char *msg) {
}
#endif
-
-#pragma mark -
-#pragma mark --- Misc ---
-#pragma mark -
-
bool SdlGraphicsManager::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
// Ctrl-Alt-a toggles aspect ratio correction
if (key.keysym.sym == 'a') {
@@ -2074,4 +2068,25 @@ void SdlGraphicsManager::forceFullRedraw() {
_forceFull = true;
}
+void SdlGraphicsManager::adjustMouseEvent(Common::Event &event) {
+ if (!_overlayVisible) {
+ event.mouse.x /= _videoMode.scaleFactor;
+ event.mouse.y /= _videoMode.scaleFactor;
+ if (_videoMode.aspectRatioCorrection)
+ event.mouse.y = aspect2Real(event.mouse.y);
+ }
+}
+
+void SdlGraphicsManager::toggleFullScreen() {
+ beginGFXTransaction();
+ setFullscreenMode(!_videoMode.fullscreen);
+ endGFXTransaction();
+#ifdef USE_OSD
+ if (_videoMode.fullscreen)
+ displayMessageOnOSD("Fullscreen mode");
+ else
+ displayMessageOnOSD("Windowed mode");
+#endif
+}
+
#endif
diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h
index 84bb439783..04f95ff721 100644
--- a/backends/graphics/sdl/sdl-graphics.h
+++ b/backends/graphics/sdl/sdl-graphics.h
@@ -128,10 +128,13 @@ public:
void forceFullRedraw();
- bool handleScalerHotkeys(const SDL_KeyboardEvent &key); // Move this?
- bool isScalerHotkey(const Common::Event &event); // Move this?
+ bool handleScalerHotkeys(const SDL_KeyboardEvent &key);
+ bool isScalerHotkey(const Common::Event &event);
+ void adjustMouseEvent(Common::Event &event);
void setMousePos(int x, int y);
+ void toggleFullScreen();
+ virtual bool saveScreenshot(const char *filename); // overloaded by CE backend
protected:
#ifdef USE_OSD
@@ -203,7 +206,7 @@ protected:
virtual void setGraphicsModeIntern(); // overloaded by CE backend
- /** Force full redraw on next updateScreen */
+ // Force full redraw on next updateScreen
bool _forceFull;
ScalerProc *_scalerProc;
@@ -299,8 +302,6 @@ protected:
void setFullscreenMode(bool enable);
void setAspectRatioCorrection(bool enable);
- virtual bool saveScreenshot(const char *filename); // overloaded by CE backend
-
int effectiveScreenHeight() const;
};