Ver código fonte

Fixes Android builds on MacOSX.
Changes deprecated std::auto_ptr usage replacing with std::unique_ptr from C++11.

= 11 anos atrás
pai
commit
a221f011d1

+ 16 - 16
gameplay/src/Base.h

@@ -179,7 +179,10 @@ extern int strcmpnocase(const char* s1, const char* s2);
 #endif
 
 // Audio (OpenAL)
-#ifdef WIN32
+#ifdef __ANDROID__
+    #include <AL/al.h>
+    #include <AL/alc.h>
+#elif WIN32
     #include <al.h>
     #include <alc.h>
 #elif __linux__
@@ -188,9 +191,6 @@ extern int strcmpnocase(const char* s1, const char* s2);
 #elif __APPLE__
     #include <OpenAL/al.h>
     #include <OpenAL/alc.h>
-#elif __ANDROID__
-    #include <AL/al.h>
-    #include <AL/alc.h>
 #endif
 
 // Compressed Media
@@ -206,7 +206,18 @@ using std::va_list;
 #define WINDOW_VSYNC        1
 
 // Graphics (OpenGL)
-#ifdef WIN32
+#ifdef __ANDROID__
+    #include <EGL/egl.h>
+    #include <GLES2/gl2.h>
+    #include <GLES2/gl2ext.h>
+    extern PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray;
+    extern PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays;
+    extern PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays;
+    extern PFNGLISVERTEXARRAYOESPROC glIsVertexArray;
+    #define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
+    #define glClearDepth glClearDepthf
+    #define OPENGL_ES
+#elif WIN32
         #define WIN32_LEAN_AND_MEAN
         #define GLEW_STATIC
         #include <GL/glew.h>
@@ -239,17 +250,6 @@ using std::va_list;
     #else
         #error "Unsupported Apple Device"
     #endif
-#elif __ANDROID__
-        #include <EGL/egl.h>
-        #include <GLES2/gl2.h>
-        #include <GLES2/gl2ext.h>
-        extern PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray;
-        extern PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays;
-        extern PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays;
-        extern PFNGLISVERTEXARRAYOESPROC glIsVertexArray;
-        #define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
-        #define glClearDepth glClearDepthf
-        #define OPENGL_ES
 #endif
 
 // Graphics (GLSL)

+ 1 - 1
gameplay/src/Effect.cpp

@@ -219,7 +219,7 @@ static void writeShaderToErrorFile(const char* filePath, const char* source)
 {
     std::string path = filePath;
     path += ".err";
-    std::auto_ptr<Stream> stream(FileSystem::open(path.c_str(), FileSystem::WRITE));
+    std::unique_ptr<Stream> stream(FileSystem::open(path.c_str(), FileSystem::WRITE));
     if (stream.get() != NULL && stream->canWrite())
     {
         stream->write(source, 1, strlen(source));

+ 1 - 1
gameplay/src/FileSystem.cpp

@@ -412,7 +412,7 @@ char* FileSystem::readAll(const char* filePath, int* fileSize)
     GP_ASSERT(filePath);
 
     // Open file for reading.
-    std::auto_ptr<Stream> stream(open(filePath));
+    std::unique_ptr<Stream> stream(open(filePath));
     if (stream.get() == NULL)
     {
         GP_ERROR("Failed to load file: %s", filePath);

+ 1 - 1
gameplay/src/Image.cpp

@@ -19,7 +19,7 @@ Image* Image::create(const char* path)
     GP_ASSERT(path);
 
     // Open the file.
-    std::auto_ptr<Stream> stream(FileSystem::open(path));
+    std::unique_ptr<Stream> stream(FileSystem::open(path));
     if (stream.get() == NULL || !stream->canRead())
     {
         GP_ERROR("Failed to open image file '%s'.", path);

+ 1 - 1
gameplay/src/Properties.cpp

@@ -80,7 +80,7 @@ Properties* Properties::create(const char* url)
     std::vector<std::string> namespacePath;
     calculateNamespacePath(urlString, fileString, namespacePath);
 
-    std::auto_ptr<Stream> stream(FileSystem::open(fileString.c_str()));
+    std::unique_ptr<Stream> stream(FileSystem::open(fileString.c_str()));
     if (stream.get() == NULL)
     {
         GP_WARN("Failed to open file '%s'.", fileString.c_str());

+ 2 - 2
gameplay/src/Texture.cpp

@@ -234,7 +234,7 @@ static unsigned int computePVRTCDataSize(int width, int height, int bpp)
 
 Texture* Texture::createCompressedPVRTC(const char* path)
 {
-    std::auto_ptr<Stream> stream(FileSystem::open(path));
+    std::unique_ptr<Stream> stream(FileSystem::open(path));
     if (stream.get() == NULL || !stream->canRead())
     {
         GP_ERROR("Failed to load file '%s'.", path);
@@ -557,7 +557,7 @@ Texture* Texture::createCompressedDDS(const char* path)
     Texture* texture = NULL;
 
     // Read DDS file.
-    std::auto_ptr<Stream> stream(FileSystem::open(path));
+    std::unique_ptr<Stream> stream(FileSystem::open(path));
     if (stream.get() == NULL || !stream->canRead())
     {
         GP_ERROR("Failed to open file '%s'.", path);