Browse Source

more android fixes

Tim Newell 12 years ago
parent
commit
18cbd790e1

+ 1 - 4
engine/source/platformAndroid/AndroidAudio.cpp

@@ -49,9 +49,6 @@ namespace Audio
 
 
 
 
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//TODO: ???
-//TODO: android
-/*
 typedef ALvoid	AL_APIENTRY	(*alcMacOSXMixerOutputRateProcPtr) (const ALdouble value);
 typedef ALvoid	AL_APIENTRY	(*alcMacOSXMixerOutputRateProcPtr) (const ALdouble value);
 ALvoid  alcMacOSXMixerOutputRateProc(const ALdouble value)
 ALvoid  alcMacOSXMixerOutputRateProc(const ALdouble value)
 {
 {
@@ -66,4 +63,4 @@ ALvoid  alcMacOSXMixerOutputRateProc(const ALdouble value)
 	
 	
     return;
     return;
 }
 }
-*/
+

+ 0 - 3
engine/source/platformAndroid/AndroidFont.cpp

@@ -48,9 +48,6 @@ void PlatformFont::enumeratePlatformFonts( Vector<StringTableEntry>& fonts )
 
 
 AndroidFont::AndroidFont()
 AndroidFont::AndroidFont()
 {
 {
-    // Reset the rendering color-space.
-    //TODO: android
-	//mColorSpace = NULL;
 }
 }
 
 
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------

+ 3 - 4
engine/source/platformAndroid/AndroidGL.cpp

@@ -150,10 +150,9 @@ void getGLCapabilities( )
       // Anisotropic filtering ========================================
       // Anisotropic filtering ========================================
       gGLState.suppTexAnisotropic    = (dStrstr(pExtString, (const char*)"GL_EXT_texture_filter_anisotropic") != NULL);
       gGLState.suppTexAnisotropic    = (dStrstr(pExtString, (const char*)"GL_EXT_texture_filter_anisotropic") != NULL);
 
 
-      //TODO: android
-      /*if (gGLState.suppTexAnisotropic)
+      if (gGLState.suppTexAnisotropic)
          glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gGLState.maxAnisotropy);
          glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gGLState.maxAnisotropy);
-*/
+
       // Binary states, i.e., no supporting functions  ========================================
       // Binary states, i.e., no supporting functions  ========================================
       // NOTE:
       // NOTE:
       // Some of these have multiple representations, via EXT and|or ARB and|or NV and|or SGIS ... etc.
       // Some of these have multiple representations, via EXT and|or ARB and|or NV and|or SGIS ... etc.
@@ -168,7 +167,7 @@ void getGLCapabilities( )
       gGLState.suppEdgeClamp         = (dStrstr(pExtString, (const char*)"GL_EXT_texture_edge_clamp") != NULL);
       gGLState.suppEdgeClamp         = (dStrstr(pExtString, (const char*)"GL_EXT_texture_edge_clamp") != NULL);
       gGLState.suppEdgeClamp        |= (dStrstr(pExtString, (const char*)"GL_SGIS_texture_edge_clamp") != NULL);
       gGLState.suppEdgeClamp        |= (dStrstr(pExtString, (const char*)"GL_SGIS_texture_edge_clamp") != NULL);
       gGLState.suppEdgeClamp        |= (dStrstr(pExtString, (const char*)"GL_ARB_texture_border_clamp") != NULL);
       gGLState.suppEdgeClamp        |= (dStrstr(pExtString, (const char*)"GL_ARB_texture_border_clamp") != NULL);
-	   gGLState.suppEdgeClamp		= true; //TODO does android support edge clamp?
+	   gGLState.suppEdgeClamp		= true;
 
 
       gGLState.suppTexEnvAdd         = (dStrstr(pExtString, (const char*)"GL_ARB_texture_env_add") != NULL);
       gGLState.suppTexEnvAdd         = (dStrstr(pExtString, (const char*)"GL_ARB_texture_env_add") != NULL);
       gGLState.suppTexEnvAdd        |= (dStrstr(pExtString, (const char*)"GL_EXT_texture_env_add") != NULL);
       gGLState.suppTexEnvAdd        |= (dStrstr(pExtString, (const char*)"GL_EXT_texture_env_add") != NULL);

+ 2 - 1
engine/source/platformAndroid/AndroidInput.cpp

@@ -783,7 +783,8 @@ bool activateKeyboard()
    /*OSStatus status = noErr;
    /*OSStatus status = noErr;
    if (status==noErr)
    if (status==noErr)
       gKBActive = true;
       gKBActive = true;
-*/
+      */
+
    return( gKBActive );
    return( gKBActive );
 }
 }
 
 

+ 2 - 3
engine/source/platformAndroid/AndroidOGLVideo.cpp

@@ -38,6 +38,7 @@
 #include "platformAndroid/AndroidEvents.h"
 #include "platformAndroid/AndroidEvents.h"
 #include "graphics/dgl.h"
 #include "graphics/dgl.h"
 #include "debug/profiler.h"
 #include "debug/profiler.h"
+#include "platformAndroid/T2DActivity.h"
 
 
 //Luma: Tap support
 //Luma: Tap support
 extern void createMouseTapEvent(S32 nbrTaps, S32 x, S32 y);
 extern void createMouseTapEvent(S32 nbrTaps, S32 x, S32 y);
@@ -49,7 +50,6 @@ extern bool setScreenOrientation(bool, bool);
 extern StringTableEntry gScreenOrientation;
 extern StringTableEntry gScreenOrientation;
 extern bool gScreenUpsideDown;
 extern bool gScreenUpsideDown;
 
 
-
 //-Mat we should update the accelereometer once per frame
 //-Mat we should update the accelereometer once per frame
 U32 AccelerometerUpdateMS = sgTimeManagerProcessInterval; // defines period between accelerometer updates updates in Milliseconds
 U32 AccelerometerUpdateMS = sgTimeManagerProcessInterval; // defines period between accelerometer updates updates in Milliseconds
 
 
@@ -233,8 +233,7 @@ bool OpenGLDevice::setScreenMode(U32 width, U32 height, U32 bpp, bool fullScreen
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 void OpenGLDevice::swapBuffers()
 void OpenGLDevice::swapBuffers()
 {
 {
-	//TODO: android
-    //[platState.ctx swapBuffers];
+	 eglSwapBuffers(engine.display, engine.surface);
 }
 }
 
 
 
 

+ 2 - 5
engine/source/platformAndroid/SoundEngine.cpp

@@ -82,14 +82,11 @@
  Copyright (C) 2008 Apple Inc. All Rights Reserved.
  Copyright (C) 2008 Apple Inc. All Rights Reserved.
  
  
  */
  */
-
+//TODO: android
+/*
 //==================================================================================================
 //==================================================================================================
 //	Includes
 //	Includes
 //==================================================================================================
 //==================================================================================================
-
-//TODO: replace openal with OpenSL ES
-/*
-
 //	System Includes
 //	System Includes
 #include <map>
 #include <map>
 #include <vector>
 #include <vector>

+ 1 - 1
engine/source/platformAndroid/SoundEngine.h

@@ -80,7 +80,7 @@
 /*============================================================================= =====================
 /*============================================================================= =====================
  SoundEngine.h
  SoundEngine.h
  =============================================================================== ===================*/
  =============================================================================== ===================*/
-//TODO: replace openal with opensl es
+//TODO: do we need this?
 /*
 /*
 #ifndef SOUND_ENGINE_H
 #ifndef SOUND_ENGINE_H
 #define SOUND_ENGINE_H
 #define SOUND_ENGINE_H

+ 1 - 37
engine/source/platformAndroid/T2DActivity.cpp

@@ -20,48 +20,12 @@
 // IN THE SOFTWARE.
 // IN THE SOFTWARE.
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
 
+#include "platformAndroid/T2DActivity.h"
 #include "platformAndroid/platformGL.h"
 #include "platformAndroid/platformGL.h"
 #include "platformAndroid/AndroidWindow.h"
 #include "platformAndroid/AndroidWindow.h"
 #include "platformAndroid/platformAndroid.h"
 #include "platformAndroid/platformAndroid.h"
 #include "graphics/dgl.h"
 #include "graphics/dgl.h"
 
 
-#include <errno.h>
-#include <EGL/egl.h>
-//#include <android/sensor.h>
-#include <android/log.h>
-#include <android_native_app_glue.h>
-#include <android/asset_manager.h>
-#include <sstream>
-#include <list>
-#include <unistd.h>
-#include <time.h>
-
-/**
- * Our saved state data.
- */
-struct saved_state {
-    float angle;
-    int32_t x;
-    int32_t y;
-};
-
-/**
- * Shared state for our app.
- */
-struct engine {
-    struct android_app* app;
-
-    int animating;
-    EGLDisplay display;
-    EGLSurface surface;
-    EGLContext context;
-    int32_t width;
-    int32_t height;
-    struct saved_state state;
-};
-
-static struct engine engine;
-
 extern AndroidPlatState platState;
 extern AndroidPlatState platState;
 
 
 bool keyboardShowing = false;
 bool keyboardShowing = false;

+ 39 - 0
engine/source/platformAndroid/T2DActivity.h

@@ -19,10 +19,48 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 // IN THE SOFTWARE.
 // IN THE SOFTWARE.
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
+#ifndef T2DACTIVITY_H
+#define T2DACTIVITY_H
 #include "platformAndroid/AndroidGL2ES.h"
 #include "platformAndroid/AndroidGL2ES.h"
+#include <errno.h>
+#include <EGL/egl.h>
+//#include <android/sensor.h>
+#include <android/log.h>
+#include <android_native_app_glue.h>
+#include <android/asset_manager.h>
+#include <sstream>
+#include <list>
+#include <unistd.h>
+#include <time.h>
 
 
 extern void adprintf(const char* fmt,...);
 extern void adprintf(const char* fmt,...);
 
 
+/**
+ * Our saved state data.
+ */
+struct saved_state {
+    float angle;
+    int32_t x;
+    int32_t y;
+};
+
+/**
+ * Shared state for our app.
+ */
+struct engine {
+    struct android_app* app;
+
+    int animating;
+    EGLDisplay display;
+    EGLSurface surface;
+    EGLContext context;
+    int32_t width;
+    int32_t height;
+    struct saved_state state;
+};
+
+static struct engine engine;
+
 class T2DActivity {
 class T2DActivity {
 
 
 private:
 private:
@@ -59,3 +97,4 @@ public:
     void finishShutdown();
     void finishShutdown();
     void finishGLSetup();
     void finishGLSetup();
 };
 };
+#endif