[Scummvm-cvs-logs] scummvm master -> 781132aabcfd38cb14d517d1d4b2598d4bd5f791

CeRiAl ikhatib at gmail.com
Sat Jun 11 23:31:31 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
781132aabc WINCE: Some cleanup (public vs. private scopes), fix freelook


Commit: 781132aabcfd38cb14d517d1d4b2598d4bd5f791
    https://github.com/scummvm/scummvm/commit/781132aabcfd38cb14d517d1d4b2598d4bd5f791
Author: CeRiAl (ikhatib at gmail.com)
Date: 2011-06-11T14:29:52-07:00

Commit Message:
WINCE: Some cleanup (public vs. private scopes), fix freelook

Changed paths:
    backends/events/wincesdl/wincesdl-events.cpp
    backends/events/wincesdl/wincesdl-events.h
    backends/graphics/wincesdl/wincesdl-graphics.cpp
    backends/graphics/wincesdl/wincesdl-graphics.h
    backends/platform/wince/CEActionsPocket.cpp
    backends/platform/wince/CEActionsPocket.h
    backends/platform/wince/CEActionsSmartphone.cpp
    backends/platform/wince/CEActionsSmartphone.h
    backends/platform/wince/wince-sdl.cpp



diff --git a/backends/events/wincesdl/wincesdl-events.cpp b/backends/events/wincesdl/wincesdl-events.cpp
index f15a416..4fab47a 100644
--- a/backends/events/wincesdl/wincesdl-events.cpp
+++ b/backends/events/wincesdl/wincesdl-events.cpp
@@ -35,7 +35,7 @@
 
 WINCESdlEventSource::WINCESdlEventSource()
 	: _tapTime(0), _closeClick(false), _rbutton(false),
-	  _freeLook(false), _graphicsMan(0) {
+	  _graphicsMan(0) {
 }
 
 void WINCESdlEventSource::init(WINCESdlGraphicsManager *graphicsMan) {
@@ -64,6 +64,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
 	ev.type = SDL_NOEVENT;
 	DWORD currentTime;
 	bool keyEvent = false;
+	bool freeLookActive = _graphicsMan->getFreeLookState();
 	int deltaX, deltaY;
 
 	memset(&event, 0, sizeof(Common::Event));
@@ -199,7 +200,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
 				}
 			}
 
-			if (_freeLook && !_closeClick) {
+			if (freeLookActive && !_closeClick) {
 				_rbutton = false;
 				_tapTime = 0;
 				_tapX = event.mouse.x;
@@ -241,7 +242,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
 
 			fillMouseEvent(event, ev.button.x, ev.button.y);
 
-			if (_freeLook && !_closeClick) {
+			if (freeLookActive && !_closeClick) {
 				_tapX = event.mouse.x;
 				_tapY = event.mouse.y;
 				event.type = Common::EVENT_MOUSEMOVE;
@@ -322,8 +323,4 @@ int WINCESdlEventSource::mapKeyCE(SDLKey key, SDLMod mod, Uint16 unicode, bool u
 	return key;
 }
 
-void WINCESdlEventSource::swap_freeLook() {
-	_freeLook = !_freeLook;
-}
-
 #endif /* _WIN32_WCE */
diff --git a/backends/events/wincesdl/wincesdl-events.h b/backends/events/wincesdl/wincesdl-events.h
index 734cc89..deeee61 100644
--- a/backends/events/wincesdl/wincesdl-events.h
+++ b/backends/events/wincesdl/wincesdl-events.h
@@ -45,8 +45,6 @@ public:
 	// Overloaded from SDL backend (mouse and new scaler handling)
 	void fillMouseEvent(Common::Event &event, int x, int y);
 
-	void swap_freeLook();
-
 protected:
 
 private:
@@ -61,8 +59,6 @@ private:
 
 	bool _closeClick;           // flag when taps are spatially close together
 	bool _rbutton;              // double tap -> right button simulation
-	bool _freeLook;             // freeLook mode (do not send mouse button events)
-
 };
 
 #endif
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.cpp b/backends/graphics/wincesdl/wincesdl-graphics.cpp
index 80b04ca..8ba7b58 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.cpp
+++ b/backends/graphics/wincesdl/wincesdl-graphics.cpp
@@ -49,8 +49,8 @@ WINCESdlGraphicsManager::WINCESdlGraphicsManager(SdlEventSource *sdlEventSource)
 	  _panelVisible(true), _saveActiveToolbar(NAME_MAIN_PANEL), _panelStateForced(false),
 	  _canBeAspectScaled(false), _scalersChanged(false), _saveToolbarState(false),
 	  _mouseBackupOld(NULL), _mouseBackupDim(0), _mouseBackupToolbar(NULL),
-	  _usesEmulatedMouse(false), _forceHideMouse(false), _hasfocus(true),
-	  _zoomUp(false), _zoomDown(false) {
+	  _usesEmulatedMouse(false), _forceHideMouse(false), _freeLook(false),
+	  _hasfocus(true), _zoomUp(false), _zoomDown(false) {
 	memset(&_mouseCurState, 0, sizeof(_mouseCurState));
 	if (_isSmartphone) {
 		_mouseCurState.x = 20;
@@ -444,7 +444,6 @@ void WINCESdlGraphicsManager::update_game_settings() {
 		// Skip
 		panel->add(NAME_ITEM_SKIP, new CEGUI::ItemAction(ITEM_SKIP, POCKET_ACTION_SKIP));
 		// sound
-//__XXX__       panel->add(NAME_ITEM_SOUND, new CEGUI::ItemSwitch(ITEM_SOUND_OFF, ITEM_SOUND_ON, &_soundMaster));
 		panel->add(NAME_ITEM_SOUND, new CEGUI::ItemSwitch(ITEM_SOUND_OFF, ITEM_SOUND_ON, &OSystem_WINCE3::_soundMaster));
 
 		// bind keys
@@ -1627,6 +1626,14 @@ void WINCESdlGraphicsManager::create_toolbar() {
 	_toolbarHandler.setVisible(false);
 }
 
+void WINCESdlGraphicsManager::swap_freeLook() {
+	_freeLook = !_freeLook;
+}
+
+bool WINCESdlGraphicsManager::getFreeLookState() {
+	return _freeLook;
+}
+
 WINCESdlGraphicsManager::zoneDesc WINCESdlGraphicsManager::_zones[TOTAL_ZONES] = {
 	{ 0, 0, 320, 145 },
 	{ 0, 145, 150, 55 },
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.h b/backends/graphics/wincesdl/wincesdl-graphics.h
index b3a8d66..2727bc0 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.h
+++ b/backends/graphics/wincesdl/wincesdl-graphics.h
@@ -56,6 +56,8 @@ public:
 	void unloadGFXMode();
 	bool hotswapGFXMode();
 
+	void update_game_settings();
+
 	// Overloaded from SDL backend (toolbar handling)
 	void drawMouse();
 	// Overloaded from SDL backend (new scaler handling)
@@ -88,7 +90,8 @@ public:
 	void swap_zoom_up();
 	void swap_zoom_down();
 	void swap_mouse_visibility();
-
+	void swap_freeLook();
+	bool getFreeLookState();
 
 //#ifdef WIN32_PLATFORM_WFSP
 	void move_cursor_up();
@@ -96,7 +99,6 @@ public:
 	void move_cursor_left();
 	void move_cursor_right();
 
-	void retrieve_mouse_location(int &x, int &y);
 	void switch_zone();
 
 	void add_right_click(bool pushed);
@@ -106,6 +108,11 @@ public:
 	void smartphone_rotate_display();
 //#endif
 
+	bool hasPocketPCResolution();
+	bool hasDesktopResolution();
+	bool hasSquareQVGAResolution();
+	bool hasWideResolution() const;
+
 	bool _panelInitialized; // only initialize the toolbar once
 	bool _noDoubleTapRMB;   // disable double tap -> rmb click
 
@@ -122,11 +129,6 @@ public:
 
 	bool _hasfocus;         // scummvm has the top window
 
-	bool hasPocketPCResolution();
-	bool hasDesktopResolution();
-	bool hasSquareQVGAResolution();
-	bool hasWideResolution() const;
-
 	MousePos _mouseCurState;
 
 	bool _zoomUp;           // zooming up mode
@@ -158,8 +160,8 @@ protected:
 
 private:
 	bool update_scalers();
-	void update_game_settings();
 	void drawToolbarMouse(SDL_Surface *surf, bool draw);
+	void retrieve_mouse_location(int &x, int &y);
 
 	void create_toolbar();
 	bool _panelVisible;         // panel visibility
@@ -186,6 +188,7 @@ private:
 	uint16 _mouseBackupDim;
 
 	bool _forceHideMouse;       // force invisible mouse cursor
+	bool _freeLook;             // freeLook mode (do not send mouse button events)
 
 	// Smartphone specific variables
 	void loadDeviceConfigurationElement(Common::String element, int &value, int defaultValue);
diff --git a/backends/platform/wince/CEActionsPocket.cpp b/backends/platform/wince/CEActionsPocket.cpp
index f2c461f..a4786d3 100644
--- a/backends/platform/wince/CEActionsPocket.cpp
+++ b/backends/platform/wince/CEActionsPocket.cpp
@@ -233,15 +233,15 @@ CEActionsPocket::~CEActionsPocket() {
 bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
 	static bool keydialogrunning = false, quitdialog = false;
 
+	_graphicsMan = ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager());
+
 	if (!pushed) {
 		switch (action) {
 		case POCKET_ACTION_RIGHTCLICK:
-			//_CESystem->add_right_click(false);
-			((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(false);
+			_graphicsMan->add_right_click(false);
 			return true;
 		case POCKET_ACTION_LEFTCLICK:
-			//_CESystem->add_left_click(false);
-			((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(false);
+			_graphicsMan->add_left_click(false);
 			return true;
 		case POCKET_ACTION_PAUSE:
 		case POCKET_ACTION_SAVE:
@@ -249,7 +249,6 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
 		case POCKET_ACTION_MULTI:
 			EventsBuffer::simulateKey(&_key_action[action], false);
 			return true;
-
 		}
 		return false;
 	}
@@ -271,55 +270,43 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
 		EventsBuffer::simulateKey(&_key_action[action], true);
 		return true;
 	case POCKET_ACTION_KEYBOARD:
-		//_CESystem->swap_panel();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_panel();
+		_graphicsMan->swap_panel();
 		return true;
 	case POCKET_ACTION_HIDE:
-		//_CESystem->swap_panel_visibility();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_panel_visibility();
+		_graphicsMan->swap_panel_visibility();
 		return true;
 	case POCKET_ACTION_SOUND:
 		_CESystem->swap_sound_master();
 		return true;
 	case POCKET_ACTION_RIGHTCLICK:
-		//_CESystem->add_right_click(true);
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(true);
+		_graphicsMan->add_right_click(true);
 		return true;
 	case POCKET_ACTION_CURSOR:
-		//_CESystem->swap_mouse_visibility();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_mouse_visibility();
+		_graphicsMan->swap_mouse_visibility();
 		return true;
 	case POCKET_ACTION_FREELOOK:
-		//_CESystem->swap_freeLook();
-		((WINCESdlEventSource *)((OSystem_SDL *)g_system)->getEventManager())->swap_freeLook();
+		_graphicsMan->swap_freeLook();
 		return true;
 	case POCKET_ACTION_ZOOM_UP:
-		//_CESystem->swap_zoom_up();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_zoom_up();
+		_graphicsMan->swap_zoom_up();
 		return true;
 	case POCKET_ACTION_ZOOM_DOWN:
-		//_CESystem->swap_zoom_down();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_zoom_down();
+		_graphicsMan->swap_zoom_down();
 		return true;
 	case POCKET_ACTION_LEFTCLICK:
-		//_CESystem->add_left_click(true);
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(true);
+		_graphicsMan->add_left_click(true);
 		return true;
 	case POCKET_ACTION_UP:
-		//_CESystem->move_cursor_up();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_up();
+		_graphicsMan->move_cursor_up();
 		return true;
 	case POCKET_ACTION_DOWN:
-		//_CESystem->move_cursor_down();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_down();
+		_graphicsMan->move_cursor_down();
 		return true;
 	case POCKET_ACTION_LEFT:
-		//_CESystem->move_cursor_left();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_left();
+		_graphicsMan->move_cursor_left();
 		return true;
 	case POCKET_ACTION_RIGHT:
-		//_CESystem->move_cursor_right();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_right();
+		_graphicsMan->move_cursor_right();
 		return true;
 	case POCKET_ACTION_QUIT:
 		if (!quitdialog) {
diff --git a/backends/platform/wince/CEActionsPocket.h b/backends/platform/wince/CEActionsPocket.h
index fd97c0b..e1f52b6 100644
--- a/backends/platform/wince/CEActionsPocket.h
+++ b/backends/platform/wince/CEActionsPocket.h
@@ -28,6 +28,7 @@
 #include "common/str.h"
 #include "gui/Key.h"
 #include "gui/Actions.h"
+#include "backends/graphics/wincesdl/wincesdl-graphics.h"
 
 #define POCKET_ACTION_VERSION 5
 
@@ -80,6 +81,7 @@ public:
 	~CEActionsPocket();
 private:
 	CEActionsPocket(const Common::String &gameid);
+	WINCESdlGraphicsManager *_graphicsMan;
 	bool _right_click_needed;
 	bool _hide_toolbar_needed;
 	bool _zoom_needed;
diff --git a/backends/platform/wince/CEActionsSmartphone.cpp b/backends/platform/wince/CEActionsSmartphone.cpp
index fdd52cf..b12dada 100644
--- a/backends/platform/wince/CEActionsSmartphone.cpp
+++ b/backends/platform/wince/CEActionsSmartphone.cpp
@@ -199,15 +199,15 @@ CEActionsSmartphone::~CEActionsSmartphone() {
 bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
 	static bool keydialogrunning = false, quitdialog = false;
 
+	_graphicsMan = ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager());
+
 	if (!pushed) {
 		switch (action) {
 		case SMARTPHONE_ACTION_RIGHTCLICK:
-			//_CESystem->add_right_click(false);
-			((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(false);
+			_graphicsMan->add_right_click(false);
 			return true;
 		case SMARTPHONE_ACTION_LEFTCLICK:
-			//_CESystem->add_left_click(false);
-			((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(false);
+			_graphicsMan->add_left_click(false);
 			return true;
 		case SMARTPHONE_ACTION_SAVE:
 		case SMARTPHONE_ACTION_SKIP:
@@ -234,32 +234,25 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
 		EventsBuffer::simulateKey(&_key_action[action], true);
 		return true;
 	case SMARTPHONE_ACTION_RIGHTCLICK:
-		//_CESystem->add_right_click(true);
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(true);
+		_graphicsMan->add_right_click(true);
 		return true;
 	case SMARTPHONE_ACTION_LEFTCLICK:
-		//_CESystem->add_left_click(true);
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(true);
+		_graphicsMan->add_left_click(true);
 		return true;
 	case SMARTPHONE_ACTION_UP:
-		//_CESystem->move_cursor_up();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_up();
+		_graphicsMan->move_cursor_up();
 		return true;
 	case SMARTPHONE_ACTION_DOWN:
-		//_CESystem->move_cursor_down();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_down();
+		_graphicsMan->move_cursor_down();
 		return true;
 	case SMARTPHONE_ACTION_LEFT:
-		//_CESystem->move_cursor_left();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_left();
+		_graphicsMan->move_cursor_left();
 		return true;
 	case SMARTPHONE_ACTION_RIGHT:
-		//_CESystem->move_cursor_right();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_right();
+		_graphicsMan->move_cursor_right();
 		return true;
 	case SMARTPHONE_ACTION_ZONE:
-		//_CESystem->switch_zone();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->switch_zone();
+		_graphicsMan->switch_zone();
 		return true;
 	case SMARTPHONE_ACTION_BINDKEYS:
 		if (!keydialogrunning) {
@@ -271,12 +264,10 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
 		}
 		return true;
 	case SMARTPHONE_ACTION_KEYBOARD:
-		//_CESystem->swap_smartphone_keyboard();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_smartphone_keyboard();
+		_graphicsMan->swap_smartphone_keyboard();
 		return true;
 	case SMARTPHONE_ACTION_ROTATE:
-		//_CESystem->smartphone_rotate_display();
-		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->smartphone_rotate_display();
+		_graphicsMan->smartphone_rotate_display();
 		return true;
 	case SMARTPHONE_ACTION_QUIT:
 		if (!quitdialog) {
diff --git a/backends/platform/wince/CEActionsSmartphone.h b/backends/platform/wince/CEActionsSmartphone.h
index 5535ce1..3da46d3 100644
--- a/backends/platform/wince/CEActionsSmartphone.h
+++ b/backends/platform/wince/CEActionsSmartphone.h
@@ -28,6 +28,7 @@
 #include "common/str.h"
 #include "gui/Key.h"
 #include "gui/Actions.h"
+#include "backends/graphics/wincesdl/wincesdl-graphics.h"
 
 #define SMARTPHONE_ACTION_VERSION 5
 
@@ -68,6 +69,7 @@ public:
 	~CEActionsSmartphone();
 private:
 	CEActionsSmartphone();
+	WINCESdlGraphicsManager *_graphicsMan;
 	bool _right_click_needed;
 	OSystem_WINCE3 *_CESystem;
 };
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index d5f5c20..3ab9dc8 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -466,7 +466,7 @@ void OSystem_WINCE3::swap_sound_master() {
 void OSystem_WINCE3::engineInit() {
 	check_mappings(); // called here to initialize virtual keys handling
 
-	//update_game_settings();
+	((WINCESdlGraphicsManager *)_graphicsManager)->update_game_settings();
 	// finalize mixer init
 	_mixerManager->init();
 }






More information about the Scummvm-git-logs mailing list