bkaradzic 12 лет назад
Родитель
Сommit
ba55084ad8
5 измененных файлов с 33 добавлено и 27 удалено
  1. 18 10
      README.md
  2. 8 11
      examples/common/dbg.cpp
  3. 1 0
      examples/common/entry_android.cpp
  4. 2 2
      include/bgfxplatform.h
  5. 4 4
      src/bgfx.cpp

+ 18 - 10
README.md

@@ -53,14 +53,29 @@ Windows users download GNU make utility from:
 	cd bgfx
 	make
 
-After calling make, .build/projects/* directory will be generated. All
+After calling `make`, .build/projects/* directory will be generated. All
 intermediate files generated by compiler will be inside .build directory
 structure. Deleting .build directory at any time is safe.
 
+### Prerequisites for Android
+
+Download AndroidNDK from:  
+[https://developer.android.com/tools/sdk/ndk/index.html](https://developer.android.com/tools/sdk/ndk/index.html)
+
+	setx ANDROID_NDK_ROOT <path to AndroidNDK directory>
+	setx ANDROID_NDK_ARM <path to AndroidNDK directory>\toolchains\arm-linux-androideabi-4.7\prebuilt\windows-x86_64
+
 ### Prerequisites for Linux
 
 	sudo apt-get install libgl1-mesa-dev
 
+### Prerequisites for Native Client (Pepper 22) on Windows
+
+Download Native Client SDK from:  
+[https://developers.google.com/native-client/sdk/download](https://developers.google.com/native-client/sdk/download)
+
+	setx NACL <path to Native Client SDK directory>\toolchain\win_x86_newlib
+
 ### Prerequisites for Windows
 
 When building on Windows, you have to set DXSDK_DIR environment variable to
@@ -77,13 +92,6 @@ directory link to directory without spaces in the path.
 	mklink /D <path to DirectX SDK directory> c:\dxsdk
 	setx DXSDK_DIR c:\dxsdk
 
-### Prerequisites for Native Client (Pepper 22) on Windows
-
-Download Native Client SDK from:  
-[https://developers.google.com/native-client/sdk/download](https://developers.google.com/native-client/sdk/download)
-
-	setx NACL <path to Native Client SDK directory>\toolchain\win_x86_newlib
-
 ### Building
 
 Visual Studio 2008 command line:
@@ -102,9 +110,9 @@ Other platforms:
 
 	make <configuration>
 
-Configuration is `<platform>-<debug/release><32/64>`. For example:
+Configuration is `<platform>-<debug/release>[32/64]`. For example:
 
-	linux-release32, nacl-debug64, android-release32, etc.
+	linux-release32, nacl-debug64, android-release, etc.
 
 Examples
 --------

+ 8 - 11
examples/common/dbg.cpp

@@ -13,20 +13,17 @@
 #include "dbg.h"
 #include <bx/string.h>
 
-#if BX_COMPILER_MSVC
-#	define snprintf _snprintf
-#endif // BX_COMPILER_MSVC
-
-#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360
-extern "C"
-{
-	__declspec(dllimport) void __stdcall OutputDebugStringA(const char* _str);
-}
+#if BX_PLATFORM_ANDROID
+#	include <android/log.h>
+#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360
+extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* _str);
 #endif // BX_PLATFORM_WINDOWS
 
 void dbgOutput(const char* _out)
 {
-#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360
+#if BX_PLATFORM_ANDROID
+	__android_log_write(ANDROID_LOG_DEBUG, "", _out);
+#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360
 	OutputDebugStringA(_out);
 #elif BX_PLATFORM_NACL || BX_PLATFORM_LINUX || BX_PLATFORM_OSX
 	fputs(_out, stderr);
@@ -80,7 +77,7 @@ void dbgPrintfData(const void* _data, uint32_t _size, const char* _format, ...)
 		uint32_t asciiPos = 0;
 		for (uint32_t ii = 0; ii < _size; ++ii)
 		{
-			snprintf(&hex[hexPos], sizeof(hex)-hexPos, "%02x ", data[asciiPos]);
+			bx::snprintf(&hex[hexPos], sizeof(hex)-hexPos, "%02x ", data[asciiPos]);
 			hexPos += 3;
 
 			ascii[asciiPos] = isprint(data[asciiPos]) ? data[asciiPos] : '.';

+ 1 - 0
examples/common/entry_android.cpp

@@ -222,6 +222,7 @@ extern int _main_(int _argc, char** _argv);
 
 extern "C" void android_main(android_app* _app)
 {
+	DBG("entry_android");
 	using namespace entry;
 	app_dummy();
 	s_ctx.run(_app);

+ 2 - 2
include/bgfxplatform.h

@@ -44,7 +44,7 @@ namespace bgfx
 
 namespace bgfx
 {
-	void osxSetNSWindow(void* _nsWindow);
+	void osxSetNSWindow(void* _window);
 } // namespace bgfx
 
 #elif BX_PLATFORM_WINDOWS
@@ -52,7 +52,7 @@ namespace bgfx
 
 namespace bgfx
 {
-	void winSetHwnd(::HWND _hwnd);
+	void winSetHwnd(::HWND _window);
 } // namespace bgfx
 
 #endif // BX_PLATFORM_

+ 4 - 4
src/bgfx.cpp

@@ -42,16 +42,16 @@ namespace bgfx
 #elif BX_PLATFORM_OSX
 	void* g_bgfxNSWindow = NULL;
 	
-	void osxSetNSWindow(void* _nsWindow)
+	void osxSetNSWindow(void* _window)
 	{
-		g_bgfxNSWindow = _nsWindow;
+		g_bgfxNSWindow = _window;
 	}
 #elif BX_PLATFORM_WINDOWS
 	::HWND g_bgfxHwnd = NULL;
 
-	void winSetHwnd(::HWND _hwnd)
+	void winSetHwnd(::HWND _window)
 	{
-		g_bgfxHwnd = _hwnd;
+		g_bgfxHwnd = _window;
 	}
 #endif // BX_PLATFORM_*