[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48863] branches/soc-2012-swiss_cheese/ intern/ghost: Adding initial native Android ghost lib.
Alexander Kuznetsov
kuzsasha at gmail.com
Thu Jul 12 16:38:36 CEST 2012
Revision: 48863
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48863
Author: alexk
Date: 2012-07-12 14:38:36 +0000 (Thu, 12 Jul 2012)
Log Message:
-----------
Adding initial native Android ghost lib. WITH_ANDROID shoud be enabled and WITH_GHOST_SDL should be disabled.
Only one window is allowed.
Events: only clicks are supported right now.
Modified Paths:
--------------
branches/soc-2012-swiss_cheese/intern/ghost/CMakeLists.txt
branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_ISystem.cpp
branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_ISystemPaths.cpp
Added Paths:
-----------
branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_DisplayManagerAndroid.cpp
branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_DisplayManagerAndroid.h
branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.cpp
branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.h
branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemPathsAndroid.cpp
branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemPathsAndroid.h
branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_WindowAndroid.cpp
branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_WindowAndroid.h
Modified: branches/soc-2012-swiss_cheese/intern/ghost/CMakeLists.txt
===================================================================
--- branches/soc-2012-swiss_cheese/intern/ghost/CMakeLists.txt 2012-07-12 12:12:21 UTC (rev 48862)
+++ branches/soc-2012-swiss_cheese/intern/ghost/CMakeLists.txt 2012-07-12 14:38:36 UTC (rev 48863)
@@ -123,7 +123,25 @@
)
endif()
-if(WITH_HEADLESS OR WITH_GHOST_SDL)
+if(WITH_ANDROID AND NOT WITH_GHOST_SDL)
+
+list(APPEND SRC
+ intern/GHOST_DisplayManagerAndroid.cpp
+ intern/GHOST_SystemAndroid.cpp
+ intern/GHOST_WindowAndroid.cpp
+ intern/GHOST_SystemPathsAndroid.cpp
+
+ intern/GHOST_DisplayManagerAndroid.h
+ intern/GHOST_SystemAndroid.h
+ intern/GHOST_WindowAndroid.h
+ intern/GHOST_SystemPathsAndroid.h
+)
+
+list(APPEND INC_SYS
+ ${ANDROID_APP_INCLUDE_DIR}
+)
+
+elseif(WITH_HEADLESS OR WITH_GHOST_SDL)
if(WITH_HEADLESS)
list(APPEND SRC
intern/GHOST_DisplayManagerNULL.h
Added: branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_DisplayManagerAndroid.cpp
===================================================================
--- branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_DisplayManagerAndroid.cpp (rev 0)
+++ branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_DisplayManagerAndroid.cpp 2012-07-12 14:38:36 UTC (rev 48863)
@@ -0,0 +1,82 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * Contributor(s): Alexandr Kuznetsov
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file ghost/intern/GHOST_DisplayManagerAndroid.cpp
+ * \ingroup GHOST
+ */
+
+#include "GHOST_SystemAndroid.h"
+#include "GHOST_DisplayManagerAndroid.h"
+
+#include "GHOST_WindowManager.h"
+
+GHOST_DisplayManagerAndroid::GHOST_DisplayManagerAndroid(GHOST_SystemAndroid *system)
+ :
+ GHOST_DisplayManager()
+{
+ //memset(&m_mode, 0, sizeof m_mode);
+}
+
+GHOST_TSuccess
+GHOST_DisplayManagerAndroid::getNumDisplays(GHOST_TUns8& numDisplays) const
+{
+
+ //numDisplays = 1;
+ return GHOST_kSuccess;
+}
+
+
+GHOST_TSuccess GHOST_DisplayManagerAndroid::getNumDisplaySettings(GHOST_TUns8 display,
+ GHOST_TInt32& numSettings) const
+{
+
+ return GHOST_kFailure;
+}
+
+
+GHOST_TSuccess
+GHOST_DisplayManagerAndroid::getDisplaySetting(GHOST_TUns8 display,
+ GHOST_TInt32 index,
+ GHOST_DisplaySetting& setting) const
+{
+
+
+
+
+ return GHOST_kFailure;
+}
+
+GHOST_TSuccess
+GHOST_DisplayManagerAndroid::getCurrentDisplaySetting(GHOST_TUns8 display,
+ GHOST_DisplaySetting& setting) const
+{
+
+ return GHOST_kFailure;
+}
+
+
+GHOST_TSuccess
+GHOST_DisplayManagerAndroid:: setCurrentDisplaySetting(GHOST_TUns8 display,
+ const GHOST_DisplaySetting& setting)
+{
+return GHOST_kFailure;
+}
Added: branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_DisplayManagerAndroid.h
===================================================================
--- branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_DisplayManagerAndroid.h (rev 0)
+++ branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_DisplayManagerAndroid.h 2012-07-12 14:38:36 UTC (rev 48863)
@@ -0,0 +1,67 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * Contributor(s): Alexandr Kuznetsov
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file ghost/intern/GHOST_DisplayManagerAndroid.h
+ * \ingroup GHOST
+ * Declaration of GHOST_DisplayManagerAndroid class.
+ */
+
+#ifndef __GHOST_DISPLAYMANAGERANDROID_H__
+#define __GHOST_DISPLAYMANAGERANDROID_H__
+
+#include "GHOST_DisplayManager.h"
+
+
+class GHOST_SystemAndroid;
+
+class GHOST_DisplayManagerAndroid : public GHOST_DisplayManager
+{
+public:
+ GHOST_DisplayManagerAndroid(GHOST_SystemAndroid *system);
+
+ GHOST_TSuccess
+ getNumDisplays(GHOST_TUns8& numDisplays) const;
+
+ GHOST_TSuccess
+ getNumDisplaySettings(GHOST_TUns8 display,
+ GHOST_TInt32& numSettings) const;
+
+ GHOST_TSuccess
+ getDisplaySetting(GHOST_TUns8 display,
+ GHOST_TInt32 index,
+ GHOST_DisplaySetting& setting) const;
+
+ GHOST_TSuccess
+ getCurrentDisplaySetting(GHOST_TUns8 display,
+ GHOST_DisplaySetting& setting) const;
+
+
+
+ GHOST_TSuccess
+ setCurrentDisplaySetting(GHOST_TUns8 display,
+ const GHOST_DisplaySetting& setting);
+
+private:
+
+};
+
+#endif /* __GHOST_DISPLAYMANAGERANDROID_H__ */
Modified: branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_ISystem.cpp
===================================================================
--- branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_ISystem.cpp 2012-07-12 12:12:21 UTC (rev 48862)
+++ branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_ISystem.cpp 2012-07-12 14:38:36 UTC (rev 48863)
@@ -42,6 +42,8 @@
# include "GHOST_SystemNULL.h"
#elif defined(WITH_GHOST_SDL)
# include "GHOST_SystemSDL.h"
+#elif defined(WITH_ANDROID)
+# include "GHOST_SystemAndroid.h"
#elif defined(WIN32)
# include "GHOST_SystemWin32.h"
#else
@@ -68,6 +70,8 @@
m_system = new GHOST_SystemNULL();
#elif defined(WITH_GHOST_SDL)
m_system = new GHOST_SystemSDL();
+#elif defined(WITH_ANDROID)
+ m_system = new GHOST_SystemAndroid();
#elif defined(WIN32)
m_system = new GHOST_SystemWin32();
#else
Modified: branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_ISystemPaths.cpp
===================================================================
--- branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_ISystemPaths.cpp 2012-07-12 12:12:21 UTC (rev 48862)
+++ branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_ISystemPaths.cpp 2012-07-12 14:38:36 UTC (rev 48863)
@@ -40,6 +40,8 @@
#ifdef WIN32
# include "GHOST_SystemPathsWin32.h"
+#elif defined(WITH_ANDROID) && !defined(WITH_GHOST_SDL)
+# include "GHOST_SystemPathsAndroid.h"
#else
# ifdef __APPLE__
# ifdef GHOST_COCOA
@@ -62,6 +64,8 @@
if (!m_systemPaths) {
#ifdef WIN32
m_systemPaths = new GHOST_SystemPathsWin32();
+#elif defined(WITH_ANDROID) && !defined(WITH_GHOST_SDL)
+ m_systemPaths = new GHOST_SystemPathsAndroid();
#else
# ifdef __APPLE__
# ifdef GHOST_COCOA
Added: branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.cpp
===================================================================
--- branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.cpp (rev 0)
+++ branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.cpp 2012-07-12 14:38:36 UTC (rev 48863)
@@ -0,0 +1,364 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file ghost/intern/GHOST_SystemAndroid.cpp
+ * \ingroup GHOST
+ */
+
+#include <assert.h>
+
+#include "GHOST_SystemAndroid.h"
+
+#include "GHOST_WindowManager.h"
+
+#include "GHOST_EventCursor.h"
+#include "GHOST_EventKey.h"
+#include "GHOST_EventButton.h"
+#include "GHOST_EventWheel.h"
+
+#include <sys/time.h>
+
+#include <unistd.h>
+#include <GLES/gl.h>
+#include <android/log.h>
+#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "blender", __VA_ARGS__))
+#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "blender", __VA_ARGS__))
+
+
+GHOST_SystemAndroid::GHOST_SystemAndroid()
+ :
+ GHOST_System()
+{
+
+
+ // compute the initial time
+ timeval tv;
+ if (gettimeofday(&tv, NULL) == -1) {
+ GHOST_ASSERT(false, "Could not instantiate timer!");
+ }
+
+ // Taking care not to overflow the tv.tv_sec*1000
+ m_start_time = GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000;
+
+}
+
+GHOST_SystemAndroid::~GHOST_SystemAndroid()
+{
+
+}
+
+GHOST_IWindow *
+GHOST_SystemAndroid::createWindow(const STR_String& title,
+ GHOST_TInt32 left,
+ GHOST_TInt32 top,
+ GHOST_TUns32 width,
+ GHOST_TUns32 height,
+ GHOST_TWindowState state,
+ GHOST_TDrawingContextType type,
+ bool stereoVisual,
+ const GHOST_TUns16 numOfAASamples,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list