[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49267] branches/soc-2012-swiss_cheese/ intern/ghost/intern: Adding ghost sensor support for Android.

Alexander Kuznetsov kuzsasha at gmail.com
Fri Jul 27 00:15:28 CEST 2012


Revision: 49267
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49267
Author:   alexk
Date:     2012-07-26 22:15:24 +0000 (Thu, 26 Jul 2012)
Log Message:
-----------
Adding ghost sensor support for Android.

Modified Paths:
--------------
    branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_System.h
    branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.cpp
    branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.h

Modified: branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_System.h
===================================================================
--- branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_System.h	2012-07-26 21:49:58 UTC (rev 49266)
+++ branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_System.h	2012-07-26 22:15:24 UTC (rev 49267)
@@ -230,6 +230,25 @@
 	 * @return			Indication of success.
 	 */
 	virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const;
+
+	/***************************************************************************************
+	 * Hardware Sensor operations
+	 ***************************************************************************************/
+
+	/**
+	 * Returns the availability of sensor.
+	 * @param type		The type of sensor.
+	 * @return			Indication of availability.
+	 */
+	virtual GHOST_TSuccess getSensorsAvailability(GHOST_TSensorTypes type);
+
+	/**
+	 * Enables or disables specific sensor.
+	 * @param type		The type of sensor.
+	 * @param enable	1 = enable, 0 = disable
+	 * @return			Indication of success.
+	 */
+	virtual GHOST_TSuccess setSensorsState(GHOST_TSensorTypes type, int enable);
 	
 	/***************************************************************************************
 	 * Other (internal) functionality.

Modified: branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.cpp
===================================================================
--- branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.cpp	2012-07-26 21:49:58 UTC (rev 49266)
+++ branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.cpp	2012-07-26 22:15:24 UTC (rev 49267)
@@ -34,6 +34,7 @@
 #include "GHOST_EventKey.h"
 #include "GHOST_EventButton.h"
 #include "GHOST_EventWheel.h"
+#include "GHOST_EventSensor.h"
 
 #include <sys/time.h>
 
@@ -46,10 +47,10 @@
 
 GHOST_SystemAndroid::GHOST_SystemAndroid()
     :
-	  GHOST_System()
+	  GHOST_System(),
+	  mainwindow(NULL)
 {
 
-
 	// compute the initial time
 	timeval tv;
 	if (gettimeofday(&tv, NULL) == -1) {
@@ -170,6 +171,7 @@
 	GHOST_Event *g_event = NULL;
 
 	if (!window) {
+
 		return;
 
 
@@ -216,7 +218,6 @@
 									ae->WindowSize.size[0], ae->WindowSize.size[1]
 									);
 				g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window);
-	pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
 
 				break;
 			}
@@ -253,6 +254,11 @@
 				}
 				break;
 			}
+			case ET_SENSOR:
+			{
+				g_event = new  GHOST_EventSensor(getMilliSeconds(), window, (GHOST_TSensorTypes)ae->Sensor.type, ae->Sensor.sv);
+				break;
+			}
 
 
 			default: {
@@ -354,7 +360,16 @@
 
 
 
+GHOST_TSuccess GHOST_SystemAndroid::getSensorsAvailability(GHOST_TSensorTypes type)
+{
+	return aGetSensorsAvailability(type) ? GHOST_kSuccess : GHOST_kFailure;
+}
 
+GHOST_TSuccess GHOST_SystemAndroid::setSensorsState(GHOST_TSensorTypes type, int enable)
+{
+	return aSetSensorsState(type, enable) ? GHOST_kSuccess : GHOST_kFailure;
+}
+
 GHOST_TSuccess GHOST_SystemAndroid::getButtons(GHOST_Buttons& buttons) const
 {
 

Modified: branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.h
===================================================================
--- branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.h	2012-07-26 21:49:58 UTC (rev 49266)
+++ branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.h	2012-07-26 22:15:24 UTC (rev 49267)
@@ -83,6 +83,13 @@
 	getMainDisplayDimensions(GHOST_TUns32& width,
 	                         GHOST_TUns32& height) const;
 
+
+
+
+	GHOST_TSuccess getSensorsAvailability(GHOST_TSensorTypes type);
+
+	GHOST_TSuccess setSensorsState(GHOST_TSensorTypes type, int enable);
+
 private:
 
 	/// The vector of windows that need to be updated.




More information about the Bf-blender-cvs mailing list