[Scummvm-cvs-logs] SF.net SVN: scummvm:[49899] scummvm/branches/gsoc2010-opengl/backends

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Wed Jun 16 06:34:44 CEST 2010


Revision: 49899
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49899&view=rev
Author:   vgvgf
Date:     2010-06-16 04:34:44 +0000 (Wed, 16 Jun 2010)

Log Message:
-----------
Fixed some disabled code that was with problems after modularization.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-opengl/backends/events/sdl/sdl-events.cpp
    scummvm/branches/gsoc2010-opengl/backends/events/sdl/sdl-events.h
    scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h

Modified: scummvm/branches/gsoc2010-opengl/backends/events/sdl/sdl-events.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/events/sdl/sdl-events.cpp	2010-06-16 01:53:27 UTC (rev 49898)
+++ scummvm/branches/gsoc2010-opengl/backends/events/sdl/sdl-events.cpp	2010-06-16 04:34:44 UTC (rev 49899)
@@ -52,6 +52,7 @@
 	:
 	_scrollLock(false),
 	_joystick(0),
+	_lastScreenID(0),
 	DefaultEventManager(boss) {
 
 	// reset mouse state
@@ -104,12 +105,7 @@
 	_km.y = y;
 
 	// Adjust for the screen scaling
-	/*if (!_overlayVisible) { // FIXME
-		event.mouse.x /= _videoMode.scaleFactor;
-		event.mouse.y /= _videoMode.scaleFactor;
-		if (_videoMode.aspectRatioCorrection)
-			event.mouse.y = aspect2Real(event.mouse.y);
-	}*/
+	((OSystem_SDL *)g_system)->getGraphicsManager()->adjustMouseEvent(event);
 }
 
 void SdlEventManager::handleKbdMouse() {
@@ -211,12 +207,13 @@
 
 	handleKbdMouse();
 
-	// If the screen mode changed, send an Common::EVENT_SCREEN_CHANGED
-	/*if (_graphicsManager->_modeChanged) { // TODO: use getScreenChangeID
-		_graphicsManager->_modeChanged = false;
+	// If the screen changed, send an Common::EVENT_SCREEN_CHANGED
+	int screenID = ((OSystem_SDL *)g_system)->getGraphicsManager()->getScreenChangeID();
+	if (screenID != _lastScreenID) {
+		_lastScreenID = screenID;
 		event.type = Common::EVENT_SCREEN_CHANGED;
 		return true;
-	}*/
+	}
 
 	while (SDL_PollEvent(&ev)) {
 		preprocessEvents(&ev);
@@ -271,24 +268,13 @@
 		event.kbd.flags |= Common::KBD_SCRL;
 
 	// Alt-Return and Alt-Enter toggle full screen mode
-	// TODO: make a function in graphics manager for this
-	/*if (event.kbd.hasFlags(Common::KBD_ALT) && (ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_KP_ENTER)) {
-		beginGFXTransaction();
-			setFullscreenMode(!_videoMode.fullscreen);
-		endGFXTransaction();
-#ifdef USE_OSD
-		if (_videoMode.fullscreen)
-			displayMessageOnOSD("Fullscreen mode");
-		else
-			displayMessageOnOSD("Windowed mode");
-#endif
-
+	if (event.kbd.hasFlags(Common::KBD_ALT) && (ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_KP_ENTER)) {
+		((OSystem_SDL *) g_system)->getGraphicsManager()->toggleFullScreen();
 		return false;
-	}*/
+	}
 
 	// Alt-S: Create a screenshot
-	// TODO: make a function in graphics manager for this
-	/*if (event.kbd.hasFlags(Common::KBD_ALT) && ev.key.keysym.sym == 's') {
+	if (event.kbd.hasFlags(Common::KBD_ALT) && ev.key.keysym.sym == 's') {
 		char filename[20];
 
 		for (int n = 0;; n++) {
@@ -300,12 +286,12 @@
 				break;
 			SDL_RWclose(file);
 		}
-		if (saveScreenshot(filename))
+		if (((OSystem_SDL *) g_system)->getGraphicsManager()->saveScreenshot(filename))
 			printf("Saved '%s'\n", filename);
 		else
 			printf("Could not save screenshot!\n");
 		return false;
-	}*/
+	}
 
 	// Ctrl-m toggles mouse capture
 	if (event.kbd.hasFlags(Common::KBD_CTRL) && ev.key.keysym.sym == 'm') {
@@ -608,4 +594,11 @@
 		SDL_WM_GrabInput(SDL_GRAB_OFF);
 }
 
+void SdlEventManager::resetKeyboadEmulation(int16 x_max, int16 y_max) {
+	_km.x_max = x_max;
+	_km.y_max = y_max;
+	_km.delay_time = 25;
+	_km.last_time = 0;
+}
+
 #endif

Modified: scummvm/branches/gsoc2010-opengl/backends/events/sdl/sdl-events.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/events/sdl/sdl-events.h	2010-06-16 01:53:27 UTC (rev 49898)
+++ scummvm/branches/gsoc2010-opengl/backends/events/sdl/sdl-events.h	2010-06-16 04:34:44 UTC (rev 49899)
@@ -41,6 +41,8 @@
 
 	virtual bool pollSdlEvent(Common::Event &event);
 
+	void resetKeyboadEmulation(int16 x_max, int16 y_max);
+
 protected:
 	virtual void preprocessEvents(SDL_Event *event) {}
 
@@ -80,6 +82,8 @@
 
 	void handleKbdMouse();
 	virtual bool remapKey(SDL_Event &ev, Common::Event &event);
+
+	int _lastScreenID;
 };
 
 #endif

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp	2010-06-16 01:53:27 UTC (rev 49898)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp	2010-06-16 04:34:44 UTC (rev 49899)
@@ -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 @@
 	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 @@
 }
 #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 @@
 	_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

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h	2010-06-16 01:53:27 UTC (rev 49898)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h	2010-06-16 04:34:44 UTC (rev 49899)
@@ -128,10 +128,13 @@
 
 	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 @@
 
 	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 @@
 	void setFullscreenMode(bool enable);
 	void setAspectRatioCorrection(bool enable);
 
-	virtual bool saveScreenshot(const char *filename); // overloaded by CE backend
-
 	int effectiveScreenHeight() const;
 };
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list