[Scummvm-cvs-logs] SF.net SVN: scummvm:[41840] scummvm/branches/gsoc2009-draci/engines/draci

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Thu Jun 25 01:58:30 CEST 2009


Revision: 41840
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41840&view=rev
Author:   dkasak13
Date:     2009-06-24 23:58:30 +0000 (Wed, 24 Jun 2009)

Log Message:
-----------
Started work on the Mouse class.

Modified Paths:
--------------
    scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
    scummvm/branches/gsoc2009-draci/engines/draci/draci.h
    scummvm/branches/gsoc2009-draci/engines/draci/module.mk

Added Paths:
-----------
    scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp
    scummvm/branches/gsoc2009-draci/engines/draci/mouse.h

Modified: scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp	2009-06-24 21:49:37 UTC (rev 41839)
+++ scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp	2009-06-24 23:58:30 UTC (rev 41840)
@@ -38,6 +38,7 @@
 #include "draci/font.h"
 #include "draci/sprite.h"
 #include "draci/screen.h"
+#include "draci/mouse.h"
 
 namespace Draci {
 
@@ -65,6 +66,7 @@
 	// Initialize graphics using following:
 	initGraphics(kScreenWidth, kScreenHeight, false);
 
+	_mouse = new Mouse(this);
 	_screen = new Screen(this);
 	_font = new Font();
 
@@ -208,10 +210,8 @@
 			switch (event.type) {
 			case Common::EVENT_QUIT:
 				quit = true;
-			case Common::EVENT_MOUSEMOVE:
-				_system->warpMouse(event.mouse.x, event.mouse.y);
 			default:
-				break;
+				_mouse->handleEvent(event);
 			}
 		}
 		_screen->copyToScreen();

Modified: scummvm/branches/gsoc2009-draci/engines/draci/draci.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/draci.h	2009-06-24 21:49:37 UTC (rev 41839)
+++ scummvm/branches/gsoc2009-draci/engines/draci/draci.h	2009-06-24 23:58:30 UTC (rev 41840)
@@ -30,6 +30,7 @@
 #include "engines/engine.h"
 #include "engines/advancedDetector.h"
 
+#include "draci/mouse.h"
 #include "draci/screen.h"
 #include "draci/font.h"
 
@@ -48,6 +49,7 @@
 
 	Font *_font;
 	Screen *_screen;
+	Mouse *_mouse;
 
 private:
 	Common::RandomSource _rnd;

Modified: scummvm/branches/gsoc2009-draci/engines/draci/module.mk
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/module.mk	2009-06-24 21:49:37 UTC (rev 41839)
+++ scummvm/branches/gsoc2009-draci/engines/draci/module.mk	2009-06-24 23:58:30 UTC (rev 41840)
@@ -8,7 +8,8 @@
 	font.o \
 	sprite.o \
 	screen.o \
-	surface.o
+	surface.o \
+	mouse.o
  
 MODULE_DIRS += \
 	engines/draci

Added: scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp	2009-06-24 23:58:30 UTC (rev 41840)
@@ -0,0 +1,85 @@
+/* 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 "draci/draci.h"
+#include "draci/mouse.h"
+
+namespace Draci {
+
+Mouse::Mouse(DraciEngine *vm) {
+	_x = 0;
+	_y = 0;
+	_lButton = false;
+	_rButton = false;
+	_cursorNum = kNormalCursor;
+	_vm = vm;
+}
+
+void Mouse::handleEvent(Common::Event event) {
+	_x = (uint16) event.mouse.x;
+	_y = (uint16) event.mouse.y;
+
+	switch (event.type) {
+	case Common::EVENT_LBUTTONDOWN:
+		debugC(6, kDraciGeneralDebugLevel, "Left button down (x: %u y: %u)", _x, _y);
+		_lButton = true;
+		break;
+	case Common::EVENT_LBUTTONUP:
+		debugC(6, kDraciGeneralDebugLevel, "Left up down (x: %u y: %u)", _x, _y);
+		_lButton = false;
+		break;
+	case Common::EVENT_RBUTTONDOWN:
+		debugC(6, kDraciGeneralDebugLevel, "Right button down (x: %u y: %u)", _x, _y);
+		_rButton = true;
+		break;
+	case Common::EVENT_RBUTTONUP:
+		debugC(6, kDraciGeneralDebugLevel, "Right button up (x: %u y: %u)", _x, _y);
+		_rButton = false;
+		break;
+	case Common::EVENT_MOUSEMOVE:
+		setPosition(_x, _y);
+		break;	
+	default:
+		break;
+	}
+}
+
+void Mouse::cursorOn() {
+	CursorMan.showMouse(true);
+}
+
+void Mouse::cursorOff() {
+	CursorMan.showMouse(false);
+}
+
+void Mouse::setPosition(uint16 x, uint16 y) {
+	_vm->_system->warpMouse(x, y);
+}
+
+// FIXME: stub
+void Mouse::setCursorNum(CursorType cursorNum) {
+}
+
+}


Property changes on: scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: scummvm/branches/gsoc2009-draci/engines/draci/mouse.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/mouse.h	                        (rev 0)
+++ scummvm/branches/gsoc2009-draci/engines/draci/mouse.h	2009-06-24 23:58:30 UTC (rev 41840)
@@ -0,0 +1,68 @@
+/* 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 DRACI_MOUSE_H
+#define DRACI_MOUSE_H
+
+#include "common/events.h"
+#include "graphics/cursorman.h"
+
+namespace Draci {
+
+enum CursorType { 
+	kNormalCursor, kArrowCursor1, 
+	kArrowCursor2, kArrowCursor3, 
+	kArrowCursor4, kDialogCursor,
+	kHighlightedCursor, kMainMenuCursor
+};
+
+class DraciEngine;
+
+class Mouse {
+public:
+	Mouse(DraciEngine *vm);
+	~Mouse() {};
+
+	void handleEvent(Common::Event event);
+	void cursorOn();
+	void cursorOff();
+	void setPosition(uint16 x, uint16 y);
+	void setCursorNum(CursorType cursorNum);
+	CursorType getCursorNum() { return _cursorNum; }
+	bool lButtonPressed() { return _lButton; }
+	bool rButtonPressed() { return _rButton; }
+	uint16 getPosX() { return _x; }
+	uint16 getPosY() { return _y; }
+
+private:
+	uint16 _x, _y;
+	bool _lButton, _rButton;
+	CursorType _cursorNum;
+	DraciEngine *_vm;
+};
+
+}
+
+#endif // DRACI_MOUSE_H


Property changes on: scummvm/branches/gsoc2009-draci/engines/draci/mouse.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native


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