Browse Source

More changes for first pass on android platform

Tim Newell 12 years ago
parent
commit
211cd4d4b0

+ 0 - 36
engine/compilers/android/bin/AndroidManifest.xml

@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest package="com.garagegames.torque2d"
-    android:versionCode="1"
-    android:versionName="3.0" xmlns:android="http://schemas.android.com/apk/res/android">
-    
-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
-
-    <uses-sdk
-        android:minSdkVersion="9"
-        android:targetSdkVersion="15" />   
-    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
-
-    <application
-        android:allowBackup="true"
-        android:icon="@drawable/ic_launcher"
-        android:label="@string/app_name"
-        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-        android:hardwareAccelerated="true">
-        <activity
-            android:name="android.app.NativeActivity"
-            android:label="@string/app_name"
-            android:screenOrientation="sensorLandscape" >
-            <!-- Tell NativeActivity the name of or .so -->
-            <meta-data android:name="android.app.lib_name"
-                    android:value="torque2d" />
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-
-</manifest>

+ 0 - 6
engine/compilers/android/gen/com/garagegames/torque2d/BuildConfig.java

@@ -1,6 +0,0 @@
-/** Automatically generated file. DO NOT MODIFY */
-package com.garagegames.torque2d;
-
-public final class BuildConfig {
-    public final static boolean DEBUG = true;
-}

+ 0 - 50
engine/compilers/android/gen/com/garagegames/torque2d/R.java

@@ -1,50 +0,0 @@
-/* AUTO-GENERATED FILE.  DO NOT MODIFY.
- *
- * This class was automatically generated by the
- * aapt tool from the resource data it found.  It
- * should not be modified by hand.
- */
-
-package com.garagegames.torque2d;
-
-public final class R {
-    public static final class attr {
-    }
-    public static final class drawable {
-        public static final int ic_launcher=0x7f020000;
-    }
-    public static final class menu {
-        public static final int activity_main=0x7f050000;
-    }
-    public static final class string {
-        public static final int app_name=0x7f030000;
-    }
-    public static final class style {
-        /** 
-        Base application theme, dependent on API level. This theme is replaced
-        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-    
-
-            Theme customizations available in newer API levels can go in
-            res/values-vXX/styles.xml, while customizations related to
-            backward-compatibility can go here.
-        
-
-        Base application theme for API 11+. This theme completely replaces
-        AppBaseTheme from res/values/styles.xml on API 11+ devices.
-    
- API 11 theme customizations can go here. 
-
-        Base application theme for API 14+. This theme completely replaces
-        AppBaseTheme from BOTH res/values/styles.xml and
-        res/values-v11/styles.xml on API 14+ devices.
-    
- API 14 theme customizations can go here. 
-         */
-        public static final int AppBaseTheme=0x7f040000;
-        /**  Application theme. 
- All customizations that are NOT specific to a particular API-level can go here. 
-         */
-        public static final int AppTheme=0x7f040001;
-    }
-}

+ 11 - 4
engine/compilers/android/jni/Android.mk

@@ -33,11 +33,13 @@ LOCAL_SRC_FILES := lib/libjpeg.a
 include $(PREBUILT_STATIC_LIBRARY)
 include $(PREBUILT_STATIC_LIBRARY)
 
 
 LOCAL_PATH := $(MY_LOCAL_PATH)
 LOCAL_PATH := $(MY_LOCAL_PATH)
-include $(CLEAR_VARS)
+#include $(CLEAR_VARS)
 
 
 LOCAL_MODULE    := torque2d
 LOCAL_MODULE    := torque2d
 LOCAL_C_INCLUDES := $(LOCAL_PATH) \
 LOCAL_C_INCLUDES := $(LOCAL_PATH) \
-    				$(LOCAL_PATH)/../../../source/torqueConfig.h \
+					$(LOCAL_PATH)/include/libjpeg \
+					$(LOCAL_PATH)/include/libpng \
+    				$(LOCAL_PATH)/../../../source \
     				$(LOCAL_PATH)/../../../source/2d \
     				$(LOCAL_PATH)/../../../source/2d \
     				$(LOCAL_PATH)/../../../source/2d/assets \
     				$(LOCAL_PATH)/../../../source/2d/assets \
     				$(LOCAL_PATH)/../../../source/2d/controllers \
     				$(LOCAL_PATH)/../../../source/2d/controllers \
@@ -414,7 +416,12 @@ LOCAL_SRC_FILES :=  ../../../source/2d/assets/AnimationAsset.cc \
 					../../../source/platformAndroid/AndroidThread.cpp \
 					../../../source/platformAndroid/AndroidThread.cpp \
 					../../../source/platformAndroid/AndroidTime.cpp \
 					../../../source/platformAndroid/AndroidTime.cpp \
 					../../../source/platformAndroid/AndroidUtil.cpp \
 					../../../source/platformAndroid/AndroidUtil.cpp \
-					
+					../../../source/platformAndroid/AndroidWindow.cpp \
+					../../../source/platformAndroid/main.cpp \
+					../../../source/platformAndroid/SoundEngine.cpp \
+					../../../source/platformAndroid/T2DAppDelegate.cpp \
+					../../../source/platformAndroid/T2DView.cpp \
+					../../../source/platformAndroid/T2DViewController.cpp \
 					../../../source/sim/scriptGroup.cc \
 					../../../source/sim/scriptGroup.cc \
 					../../../source/sim/scriptObject.cc \
 					../../../source/sim/scriptObject.cc \
 					../../../source/sim/simBase.cc \
 					../../../source/sim/simBase.cc \
@@ -470,7 +477,7 @@ LOCAL_SRC_FILES :=  ../../../source/2d/assets/AnimationAsset.cc \
 					../../../source/testing/unitTesting.cc
 					../../../source/testing/unitTesting.cc
  
  
 			   
 			   
-LOCAL_CFLAGS := -DENABLE_CONSOLE_MSGS -D__ANDROID__ -O0 -fsigned-char
+LOCAL_CFLAGS := -DENABLE_CONSOLE_MSGS -D__ANDROID__ -DTORQUE_OS_ANDROID -O0 -fsigned-char
 				   
 				   
 LOCAL_LDLIBS    := -llog -landroid -lEGL -lGLESv2 -lz -lOpenSLES
 LOCAL_LDLIBS    := -llog -landroid -lEGL -lGLESv2 -lz -lOpenSLES
 LOCAL_STATIC_LIBRARIES := android_native_app_glue libpng libjpeg
 LOCAL_STATIC_LIBRARIES := android_native_app_glue libpng libjpeg

+ 2 - 2
engine/source/2d/assets/ParticleAssetEmitter.h

@@ -47,7 +47,7 @@ class ParticleAsset;
 
 
 class ParticleAssetEmitter : public SimObject, protected AssetPtrCallback
 class ParticleAssetEmitter : public SimObject, protected AssetPtrCallback
 {
 {
-    friend ParticleAsset;
+    friend class ParticleAsset;
 
 
 public:
 public:
     enum ParticleOrientationType
     enum ParticleOrientationType
@@ -320,4 +320,4 @@ protected:
     static bool     writeAlphaTest( void* obj, StringTableEntry pFieldName )            { return static_cast<ParticleAssetEmitter*>(obj)->getAlphaTest() >= 0.0f; }
     static bool     writeAlphaTest( void* obj, StringTableEntry pFieldName )            { return static_cast<ParticleAssetEmitter*>(obj)->getAlphaTest() >= 0.0f; }
 };
 };
 
 
-#endif // _PARTICLE_ASSET_EMITTER_H_
+#endif // _PARTICLE_ASSET_EMITTER_H_

+ 4 - 2
engine/source/audio/audioBuffer.h

@@ -42,7 +42,8 @@ class AudioBuffer: public ResourceInstance
 private:
 private:
    StringTableEntry  mFilename;
    StringTableEntry  mFilename;
    bool              mLoading;
    bool              mLoading;
-   ALuint            malBuffer;
+   //TODO: android
+   //ALuint            malBuffer;
 
 
    bool readRIFFchunk(Stream &s, const char *seekLabel, U32 *size);
    bool readRIFFchunk(Stream &s, const char *seekLabel, U32 *size);
    bool readWAV(ResourceObject *obj);
    bool readWAV(ResourceObject *obj);
@@ -50,7 +51,8 @@ private:
 public:
 public:
    AudioBuffer(StringTableEntry filename);
    AudioBuffer(StringTableEntry filename);
    ~AudioBuffer();
    ~AudioBuffer();
-   ALuint getALBuffer();
+   //TODO: android
+   //ALuint getALBuffer();
    bool isLoading() {return(mLoading);}
    bool isLoading() {return(mLoading);}
 
 
    static Resource<AudioBuffer> find(const char *filename);
    static Resource<AudioBuffer> find(const char *filename);

+ 4 - 0
engine/source/console/ConsoleTypeValidators.cc

@@ -32,7 +32,11 @@ void ConsoleTypeValidator::consoleError(SimObject *object, const char *format, .
    char buffer[1024];
    char buffer[1024];
    va_list argptr;
    va_list argptr;
    va_start(argptr, format);
    va_start(argptr, format);
+#ifdef TORQUE_OS_ANDROID
+   dVsprintf(buffer, sizeof(buffer), format, &argptr);
+#else
    dVsprintf(buffer, sizeof(buffer), format, argptr);
    dVsprintf(buffer, sizeof(buffer), format, argptr);
+#endif
    va_end(argptr);
    va_end(argptr);
 
 
    AbstractClassRep *rep = object->getClassRep();
    AbstractClassRep *rep = object->getClassRep();

+ 1 - 1
engine/source/graphics/dgl.h

@@ -312,7 +312,7 @@ bool dglCheckState(const S32 mvDepth, const S32 pDepth,
 extern signed int gFSAASamples;
 extern signed int gFSAASamples;
 
 
 
 
-#ifdef TORQUE_OS_IOS
+#ifdef TORQUE_OS_IOS || TORQUE_OS_ANDROID
 
 
 //Luma: Add some additional commands here so that it works in all cases
 //Luma: Add some additional commands here so that it works in all cases
 extern GLfloat gVertexFloats[8];
 extern GLfloat gVertexFloats[8];

+ 2 - 0
engine/source/platform/platformAL.h

@@ -31,6 +31,8 @@
 #include <OpenAL/al.h>
 #include <OpenAL/al.h>
 #include <OpenAL/alc.h>
 #include <OpenAL/alc.h>
 #include "platform/eaxtypes.h"
 #include "platform/eaxtypes.h"
+#elif defined(TORQUE_OS_ANDROID)
+//TODO: android
 #elif defined(TORQUE_OS_IOS)
 #elif defined(TORQUE_OS_IOS)
 #include <OpenAL/al.h>
 #include <OpenAL/al.h>
 #include <OpenAL/alc.h>
 #include <OpenAL/alc.h>

+ 18 - 6
engine/source/platform/platformAudio.h

@@ -101,6 +101,8 @@ void alxStopAll();
 // one-shot helper alxPlay functions, create and play in one call
 // one-shot helper alxPlay functions, create and play in one call
 AUDIOHANDLE alxPlay(const AudioAsset *profile, const MatrixF *transform=NULL, const Point3F *velocity=NULL);
 AUDIOHANDLE alxPlay(const AudioAsset *profile, const MatrixF *transform=NULL, const Point3F *velocity=NULL);
 
 
+//TODO: android
+/*
 // Source
 // Source
 void alxSourcef(AUDIOHANDLE handle, ALenum pname, ALfloat value);
 void alxSourcef(AUDIOHANDLE handle, ALenum pname, ALfloat value);
 void alxSourcefv(AUDIOHANDLE handle, ALenum pname, ALfloat *values);
 void alxSourcefv(AUDIOHANDLE handle, ALenum pname, ALfloat *values);
@@ -112,36 +114,46 @@ void alxGetSourcef(AUDIOHANDLE handle, ALenum pname, ALfloat *value);
 void alxGetSourcefv(AUDIOHANDLE handle, ALenum pname, ALfloat *values);
 void alxGetSourcefv(AUDIOHANDLE handle, ALenum pname, ALfloat *values);
 void alxGetSource3f(AUDIOHANDLE handle, ALenum pname, ALfloat *value1, ALfloat *value2, ALfloat *value3);
 void alxGetSource3f(AUDIOHANDLE handle, ALenum pname, ALfloat *value1, ALfloat *value2, ALfloat *value3);
 void alxGetSourcei(AUDIOHANDLE handle, ALenum pname, ALint *value);
 void alxGetSourcei(AUDIOHANDLE handle, ALenum pname, ALint *value);
-
+*/
 /**   alSource3f access extension for use with Point3F's
 /**   alSource3f access extension for use with Point3F's
 */
 */
+//TODO: android
+/*
 inline void alxSourcePoint3F(AUDIOHANDLE handle, ALenum pname, const Point3F *value)
 inline void alxSourcePoint3F(AUDIOHANDLE handle, ALenum pname, const Point3F *value)
 {
 {
    alxSource3f(handle, pname, value->x, value->y, value->z);
    alxSource3f(handle, pname, value->x, value->y, value->z);
 }
 }
-
+*/
 /**   alGetSource3f access extension for use with Point3F's
 /**   alGetSource3f access extension for use with Point3F's
 */
 */
+//TODO: android
+/*
 inline void alxSourceGetPoint3F(AUDIOHANDLE handle, ALenum pname, Point3F * value)
 inline void alxSourceGetPoint3F(AUDIOHANDLE handle, ALenum pname, Point3F * value)
 {
 {
    alxGetSource3f(handle, pname, &value->x, &value->y, &value->z);
    alxGetSource3f(handle, pname, &value->x, &value->y, &value->z);
 }
 }
-
+*/
 // Listener
 // Listener
+//TODO: android
+/*
 void alxListenerMatrixF(const MatrixF *transform);
 void alxListenerMatrixF(const MatrixF *transform);
 void alxListenerf(ALenum param, ALfloat value);
 void alxListenerf(ALenum param, ALfloat value);
 void alxGetListenerf(ALenum param, ALfloat *value);
 void alxGetListenerf(ALenum param, ALfloat *value);
 
 
-
+*/
 /**   alListener3f access extension for use with Point3F's
 /**   alListener3f access extension for use with Point3F's
 */
 */
+//TODO: android
+/*
 inline void alxListenerPoint3F(ALenum pname, const Point3F *value)
 inline void alxListenerPoint3F(ALenum pname, const Point3F *value)
 {
 {
    alListener3f(pname, value->x, value->y, value->z);   
    alListener3f(pname, value->x, value->y, value->z);   
 }
 }
-
+*/
 /**   alGetListener3f access extension for use with Point3F's
 /**   alGetListener3f access extension for use with Point3F's
 */
 */
+//TODO: android
+/*
 inline void alxGetListenerPoint3F(ALenum pname, Point3F *value)
 inline void alxGetListenerPoint3F(ALenum pname, Point3F *value)
 {
 {
    alGetListener3f(pname, &value->x, &value->y, &value->z);
    alGetListener3f(pname, &value->x, &value->y, &value->z);
@@ -152,7 +164,7 @@ void alxEnvironmenti(ALenum pname, ALint value);
 void alxEnvironmentf(ALenum pname, ALfloat value);
 void alxEnvironmentf(ALenum pname, ALfloat value);
 void alxGetEnvironmenti(ALenum pname, ALint * value);
 void alxGetEnvironmenti(ALenum pname, ALint * value);
 void alxGetEnvironmentf(ALenum pname, ALfloat * value);
 void alxGetEnvironmentf(ALenum pname, ALfloat * value);
-
+*/
 void alxSetEnvironment(const AudioEnvironment * environment);
 void alxSetEnvironment(const AudioEnvironment * environment);
 const AudioEnvironment * alxGetEnvironment();
 const AudioEnvironment * alxGetEnvironment();
 
 

+ 2 - 0
engine/source/platform/platformGL.h

@@ -30,5 +30,7 @@
 #include "platformX86UNIX/platformGL.h"
 #include "platformX86UNIX/platformGL.h"
 #elif defined(TORQUE_OS_IOS)
 #elif defined(TORQUE_OS_IOS)
 #include "platformiOS/platformGL.h"
 #include "platformiOS/platformGL.h"
+#elif defined(TORQUE_OS_ANDROID)
+#include "platformAndroid/platformGL.h"
 #endif
 #endif
 #endif
 #endif

+ 4 - 0
engine/source/platform/types.gcc.h

@@ -83,6 +83,10 @@ typedef unsigned long long  U64;
 #  define TORQUE_SUPPORTS_GCC_INLINE_X86_ASM
 #  define TORQUE_SUPPORTS_GCC_INLINE_X86_ASM
 #  include "platform/types.posix.h"
 #  include "platform/types.posix.h"
 
 
+#elif defined(__ANDROID__)
+#  define TORQUE_OS_ANDROID
+#  include "platform/types.arm.h"
+
 #elif defined(TORQUE_OS_IOS)
 #elif defined(TORQUE_OS_IOS)
 	#ifndef TORQUE_OS_IOS
 	#ifndef TORQUE_OS_IOS
 		#define TORQUE_OS_IOS
 		#define TORQUE_OS_IOS

+ 12 - 75
engine/source/platformAndroid/AndroidWindow.cpp

@@ -127,8 +127,8 @@ void Platform::init()
     Input::init();
     Input::init();
 
 
     // allow users to specify whether to capture the display or not when going fullscreen
     // allow users to specify whether to capture the display or not when going fullscreen
-    Con::addVariable("pref::mac::captureDisplay", TypeBool, &platState.captureDisplay);
-    Con::addVariable("pref::mac::fadeWindows", TypeBool, &platState.fadeWindows);
+    Con::addVariable("pref::Android::captureDisplay", TypeBool, &platState.captureDisplay);
+    Con::addVariable("pref::Android::fadeWindows", TypeBool, &platState.fadeWindows);
 
 
     // create the opengl display device
     // create the opengl display device
     DisplayDevice *dev = NULL;
     DisplayDevice *dev = NULL;
@@ -233,8 +233,9 @@ void Platform::initWindow(const Point2I &initialSize, const char *name)
 
 
     glView = (T2DView *) platState.Window;
     glView = (T2DView *) platState.Window;
     
     
-    if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2)
-        glView.contentScaleFactor = [[UIScreen mainScreen] scale];
+    //TODO: android
+    //if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2)
+    //    glView.contentScaleFactor = [[UIScreen mainScreen] scale];
     
     
     platState.ctx = glView;
     platState.ctx = glView;
     
     
@@ -287,66 +288,16 @@ bool appIsRunning(int batchId)
 
 
 bool Platform::openWebBrowser(const char *webAddress)
 bool Platform::openWebBrowser(const char *webAddress)
 {
 {
-    NSString *string = [[NSString alloc] initWithUTF8String:webAddress];
+	//TODO: android
+    /*NSString *string = [[NSString alloc] initWithUTF8String:webAddress];
     NSURL *url = [[NSURL alloc] initWithString:string];
     NSURL *url = [[NSURL alloc] initWithString:string];
     bool ret = [platState.application openURL:url];
     bool ret = [platState.application openURL:url];
 
 
     return ret;// this bails on the application, switching to Safari
     return ret;// this bails on the application, switching to Safari
+    */
+	return false;
 }
 }
 
 
-bool isStatusBarHidden()
-{
-    if (platState.application.statusBarHidden == YES)
-    {
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-bool setStatusBarHidden(bool hidden)
-{
-    if (hidden)
-    {
-        platState.application.statusBarHidden = YES;
-        gStatusBarHidden = true;
-
-        return true;
-    }
-    else
-    {
-        platState.application.statusBarHidden = NO;
-        gStatusBarHidden = false;
-
-        return false;
-    }
-}
-
-void setStatusBarType(S32 type)
-{
-    switch (type)
-    {
-        case 0: //Hidden
-            setStatusBarHidden(true);
-            break;
-        case 1: //Black Opaque
-            platState.application.statusBarStyle = UIStatusBarStyleBlackOpaque;
-            setStatusBarHidden(false);
-            break;
-        case 2: //Black Transparent
-            platState.application.statusBarStyle = UIStatusBarStyleBlackTranslucent;
-            setStatusBarHidden(false);
-            break;
-        default:
-            platState.application.statusBarStyle = UIStatusBarStyleDefault;
-    }
-
-    gStatusBarType = type;
-}
-
-
 bool setScreenOrientation(bool portrait, bool upsidedown)
 bool setScreenOrientation(bool portrait, bool upsidedown)
 {
 {
     bool success = false;
     bool success = false;
@@ -364,7 +315,8 @@ bool setScreenOrientation(bool portrait, bool upsidedown)
     }
     }
 
 
 
 
-    [platState.ctx centerOnPoint:point];
+    //TODO: android
+    /*[platState.ctx centerOnPoint:point];
 
 
     if (portrait)
     if (portrait)
     {//normal upright
     {//normal upright
@@ -393,7 +345,7 @@ bool setScreenOrientation(bool portrait, bool upsidedown)
             success = true;
             success = true;
         }
         }
     }
     }
-
+*/
     return success;
     return success;
 }
 }
 
 
@@ -401,18 +353,3 @@ ConsoleFunction(setScreenOrientation, bool, 3, 3, "Sets the orientation of the s
         "@(bool portrait, bool upside_down)"){
         "@(bool portrait, bool upside_down)"){
     return setScreenOrientation(dAtob(argv[1]), dAtob(argv[2]));
     return setScreenOrientation(dAtob(argv[1]), dAtob(argv[2]));
 }
 }
-
-
-ConsoleFunction(getStatusBarHidden, bool, 1, 1, " Checks whether the status bar is hidden\n"
-        "@return Returns true if hidden and false if not"){
-    return isStatusBarHidden();
-}
-
-ConsoleFunction(setStatusBarHidden, bool, 2, 2, " Hides/unhides the Android status bar \n"
-        "@return true == status bar is hidden, false == status bar is visible"){
-    return setStatusBarHidden(dAtob(argv[1]));
-}
-
-ConsoleFunction(setStatusBarType, void, 2, 2, " Set the status bar type. 0 hidden, 1 Black Opaque, 2 Black Translucent \n"){
-    return setStatusBarType(dAtoi(argv[1]));
-}

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

@@ -87,15 +87,13 @@
 //	Includes
 //	Includes
 //==================================================================================================
 //==================================================================================================
 
 
+//TODO: replace openal with OpenSL ES
+/*
+
 //	System Includes
 //	System Includes
-#include <AudioToolbox/AudioToolbox.h>
-#include <CoreFoundation/CFURL.h>
-#include <OpenAL/al.h>
-#include <OpenAL/alc.h>
 #include <map>
 #include <map>
 #include <vector>
 #include <vector>
 #include <pthread.h>
 #include <pthread.h>
-#include <mach/mach.h>
 
 
 // Local Includes
 // Local Includes
 #include "SoundEngine.h"
 #include "SoundEngine.h"
@@ -772,7 +770,7 @@ class BackgroundTrackMgr
             AssertNoError("Error getting packet upper bound size", end);
             AssertNoError("Error getting packet upper bound size", end);
             bool isFormatVBR = (inFileInfo->mFileFormat.mBytesPerPacket == 0 || inFileInfo->mFileFormat.mFramesPerPacket == 0);
             bool isFormatVBR = (inFileInfo->mFileFormat.mBytesPerPacket == 0 || inFileInfo->mFileFormat.mFramesPerPacket == 0);
             
             
-            CalculateBytesForTime(inFileInfo->mFileFormat, maxPacketSize, 0.5/*seconds*/, &mBufferByteSize, &mNumPacketsToRead);
+            CalculateBytesForTime(inFileInfo->mFileFormat, maxPacketSize, 0.5, &mBufferByteSize, &mNumPacketsToRead);
             
             
             // if the file is smaller than the capacity of all the buffer queues, always load it at once
             // if the file is smaller than the capacity of all the buffer queues, always load it at once
             if ((mBufferByteSize * numBuffersToQueue) > inFileInfo->mFileDataSize)
             if ((mBufferByteSize * numBuffersToQueue) > inFileInfo->mFileDataSize)
@@ -1601,3 +1599,4 @@ bool LoadSoundFile(const char *inFilePath, UInt32 *outEffectID)
 }
 }
     
     
 }//namespace SoundEngine
 }//namespace SoundEngine
+*/

+ 87 - 91
engine/source/platformAndroid/SoundEngine.h

@@ -80,7 +80,8 @@
 /*============================================================================= =====================
 /*============================================================================= =====================
  SoundEngine.h
  SoundEngine.h
  =============================================================================== ===================*/
  =============================================================================== ===================*/
-
+//TODO: replace openal with opensl es
+/*
 #ifndef SOUND_ENGINE_H
 #ifndef SOUND_ENGINE_H
 #define SOUND_ENGINE_H
 #define SOUND_ENGINE_H
 
 
@@ -96,16 +97,16 @@ namespace SoundEngine {
 //Sound Engine
 //Sound Engine
 //============================================================================= =====================
 //============================================================================= =====================
 	
 	
-/*!
-	 @enum SoundEngine error codes
-	 @abstract   These are the error codes returned from the SoundEngine API.
-	 @constant   kSoundEngineErrUnitialized 	 The SoundEngine has not been initialized. Use SoundEngine_Initialize().
-	 @constant   kSoundEngineErrInvalidID 	 The specified EffectID was not found. This can occur if the effect has not been loaded, or
-	 if an unloaded is trying to be accessed.
-	 @constant   kSoundEngineErrFileNotFound 	 The specified file was not found.
-	 @constant   kSoundEngineErrInvalidFileFormat 	 The format of the file is invalid. Effect data must be little-endian 8 or 16 bit LPCM.
-	 @constant   kSoundEngineErrDeviceNotFound 	 The output device was not found.
- */
+
+//	 @enum SoundEngine error codes
+//	 @abstract   These are the error codes returned from the SoundEngine API.
+//	 @constant   kSoundEngineErrUnitialized 	 The SoundEngine has not been initialized. Use SoundEngine_Initialize().
+//	 @constant   kSoundEngineErrInvalidID 	 The specified EffectID was not found. This can occur if the effect has not been loaded, or
+//	 if an unloaded is trying to be accessed.
+//	 @constant   kSoundEngineErrFileNotFound 	 The specified file was not found.
+//	 @constant   kSoundEngineErrInvalidFileFormat 	 The format of the file is invalid. Effect data must be little-endian 8 or 16 bit LPCM.
+//	 @constant   kSoundEngineErrDeviceNotFound 	 The output device was not found.
+
 	
 	
 	enum {
 	enum {
 		kSoundEngineErrUnitialized = 1,
 		kSoundEngineErrUnitialized = 1,
@@ -115,103 +116,97 @@ namespace SoundEngine {
 		kSoundEngineErrDeviceNotFound = 5
 		kSoundEngineErrDeviceNotFound = 5
 	};
 	};
 	
 	
-	/*!
-	 @function       SoundEngine_Initialize
-	 @abstract       Initializes and sets up the sound engine. Calling after a previous initialize will
-	 reset the state of the SoundEngine, with all previous effects and music tracks
-	 erased. Note: This is not required, loading an effect or background track will 
-	 initialize as necessary.
-	 @param          inMixerOutputRate
-	 & nbsp;          A Float32 that represents the output sample rate of the mixer unit. Setting this to 
-	 0 will use the default rate (the sample rate of the device)
-	 @result         A OSStatus indicating success or failure.
-	 */
+
+//	 @function       SoundEngine_Initialize
+//	 @abstract       Initializes and sets up the sound engine. Calling after a previous initialize will
+//	 reset the state of the SoundEngine, with all previous effects and music tracks
+//	 erased. Note: This is not required, loading an effect or background track will
+//	 initialize as necessary.
+//	 @param          inMixerOutputRate
+//	 & nbsp;          A Float32 that represents the output sample rate of the mixer unit. Setting this to
+//	 0 will use the default rate (the sample rate of the device)
+//	 @result         A OSStatus indicating success or failure.
+
 	OSStatus  SoundEngine_Initialize(Float32 inMixerOutputRate);
 	OSStatus  SoundEngine_Initialize(Float32 inMixerOutputRate);
 	
 	
-	/*!
-	 @function       SoundEngine_Teardown
-	 @abstract       Tearsdown the sound engine.
-	 @result         A OSStatus indicating success or failure.
-	 */
+//	 @function       SoundEngine_Teardown
+//	 @abstract       Tearsdown the sound engine.
+//	 @result         A OSStatus indicating success or failure.
+
 	OSStatus  SoundEngine_Teardown();
 	OSStatus  SoundEngine_Teardown();
 	
 	
-	/*!
-	 @function       SoundEngine_SetMasterVolume
-	 @abstract       Sets the overall volume of all sounds coming from the process
-	 @param          inValue
-	 & nbsp;          A Float32 that represents the level. The range is between 0.0 and 1.0 (inclusive).
-	 @result         A OSStatus indicating success or failure.
-	 */
+//	 @function       SoundEngine_SetMasterVolume
+//	 @abstract       Sets the overall volume of all sounds coming from the process
+//	 @param          inValue
+//	 & nbsp;          A Float32 that represents the level. The range is between 0.0 and 1.0 (inclusive).
+//	 @result         A OSStatus indicating success or failure.
+
 	OSStatus  SoundEngine_SetMasterVolume(Float32 inValue);
 	OSStatus  SoundEngine_SetMasterVolume(Float32 inValue);
-	/*!
-	 @function       SoundEngine_SetListenerPosition
-	 @abstract       Sets the position of the listener in the 3D space
-	 @param          inX
-	 & nbsp;          A Float32 that represents the listener's position along the X axis.
-	 @param          inY
-	 & nbsp;          A Float32 that represents the listener's position along the Y axis.
-	 @param          inZ
-	 & nbsp;          A Float32 that represents the listener's position along the Z axis.
-	 @result         A OSStatus indicating success or failure.
-	 */
+
+//	 @function       SoundEngine_SetListenerPosition
+//	 @abstract       Sets the position of the listener in the 3D space
+//	 @param          inX
+//	 & nbsp;          A Float32 that represents the listener's position along the X axis.
+//	 @param          inY
+//	 & nbsp;          A Float32 that represents the listener's position along the Y axis.
+//	 @param          inZ
+//	 & nbsp;          A Float32 that represents the listener's position along the Z axis.
+//	 @result         A OSStatus indicating success or failure.
+
 	OSStatus  SoundEngine_SetListenerPosition(Float32 inX, Float32 inY, Float32 inZ);
 	OSStatus  SoundEngine_SetListenerPosition(Float32 inX, Float32 inY, Float32 inZ);
 	
 	
-	/*!
-	 @function       SoundEngine_SetListenerGain
-	 @abstract       Sets the gain of the listener. Must be >= 0.0
-	 @param          inValue
-	 & nbsp;          A Float32 that represents the listener's gain
-	 @result         A OSStatus indicating success or failure.
-	 */
+
+//	 @function       SoundEngine_SetListenerGain
+//	 @abstract       Sets the gain of the listener. Must be >= 0.0
+//	 @param          inValue
+//	 & nbsp;          A Float32 that represents the listener's gain
+//	 @result         A OSStatus indicating success or failure.
+
 	OSStatus  SoundEngine_SetListenerGain(Float32 inValue);
 	OSStatus  SoundEngine_SetListenerGain(Float32 inValue);
 	
 	
-	/*!
-	 @function       SoundEngine_LoadBackgroundMusicTrack
-	 @abstract       Tells the background music player which file to play
-	 @param          inPath
-	 & nbsp;          The absolute path to the file to play.
-	 @param          inAddToQueue
-	 & nbsp;          If true, file will be added to the current background music queue. If
-	 false, queue will be cleared and only loop the specified file.
-	 @param          inLoadAtOnce
-	 & nbsp;          If true, file will be loaded completely into memory. If false, data will be 
-	 streamed from the file as needed. For games without large memory pressure and/or
-	 small background music files, this can save memory access and improve power efficiency
-	 @result         A OSStatus indicating success or failure.
-	 */
+//	 @function       SoundEngine_LoadBackgroundMusicTrack
+//	 @abstract       Tells the background music player which file to play
+//	 @param          inPath
+//	 & nbsp;          The absolute path to the file to play.
+//	 @param          inAddToQueue
+//	 & nbsp;          If true, file will be added to the current background music queue. If
+//	 false, queue will be cleared and only loop the specified file.
+//	 @param          inLoadAtOnce
+//	 & nbsp;          If true, file will be loaded completely into memory. If false, data will be
+//	 streamed from the file as needed. For games without large memory pressure and/or
+//	 small background music files, this can save memory access and improve power efficiency
+//	 @result         A OSStatus indicating success or failure.
+
 	OSStatus  SoundEngine_LoadBackgroundMusicTrack(const char* inPath, Boolean inAddToQueue, Boolean inLoadAtOnce);
 	OSStatus  SoundEngine_LoadBackgroundMusicTrack(const char* inPath, Boolean inAddToQueue, Boolean inLoadAtOnce);
 	
 	
-	/*!
-	 @function       SoundEngine_UnloadBackgroundMusicTrack
-	 @abstract       Tells the background music player to release all resources and stop playing.
-	 @result         A OSStatus indicating success or failure.
-	 */
+//	 @function       SoundEngine_UnloadBackgroundMusicTrack
+//	 @abstract       Tells the background music player to release all resources and stop playing.
+//	 @result         A OSStatus indicating success or failure.
+
 	OSStatus  SoundEngine_UnloadBackgroundMusicTrack();
 	OSStatus  SoundEngine_UnloadBackgroundMusicTrack();
 	
 	
-	/*!
-	 @function       SoundEngine_StartBackgroundMusic
-	 @abstract       Tells the background music player to start playing.
-	 @result         A OSStatus indicating success or failure.
-	 */
+
+//	 @function       SoundEngine_StartBackgroundMusic
+//	 @abstract       Tells the background music player to start playing.
+//	 @result         A OSStatus indicating success or failure.
+
 	OSStatus  SoundEngine_StartBackgroundMusic();
 	OSStatus  SoundEngine_StartBackgroundMusic();
 	
 	
-	/*!
-	 @function       SoundEngine_StopBackgroundMusic
-	 @abstract       Tells the background music player to stop playing.
-	 @param          inAddToQueue
-	 & nbsp;          If true, playback will stop when all tracks have completed. If false, playback
-	 will stop immediately.
-	 @result         A OSStatus indicating success or failure.
-	 */
+//	 @function       SoundEngine_StopBackgroundMusic
+//	 @abstract       Tells the background music player to stop playing.
+//	 @param          inAddToQueue
+//	 & nbsp;          If true, playback will stop when all tracks have completed. If false, playback
+//	 will stop immediately.
+//	 @result         A OSStatus indicating success or failure.
+
 	OSStatus  SoundEngine_StopBackgroundMusic(Boolean inStopAtEnd);
 	OSStatus  SoundEngine_StopBackgroundMusic(Boolean inStopAtEnd);
 	
 	
-	/*!
-	 @function       SoundEngine_SetBackgroundMusicVolume
-	 @abstract       Sets the volume for the background music player
-	 @param          inValue
-	 & nbsp;          A Float32 that represents the level. The range is between 0.0 and 1.0 (inclusive).
-	 @result         A OSStatus indicating success or failure.
-	 */
+//	 @function       SoundEngine_SetBackgroundMusicVolume
+//	 @abstract       Sets the volume for the background music player
+//	 @param          inValue
+//	 & nbsp;          A Float32 that represents the level. The range is between 0.0 and 1.0 (inclusive).
+//	 @result         A OSStatus indicating success or failure.
+
 	OSStatus  SoundEngine_SetBackgroundMusicVolume(Float32 inValue);
 	OSStatus  SoundEngine_SetBackgroundMusicVolume(Float32 inValue);
 	
 	
 	//-Mat for loading caf files, this creates a soundeffect and sets outEffectID to it's alGenBuffer ID
 	//-Mat for loading caf files, this creates a soundeffect and sets outEffectID to it's alGenBuffer ID
@@ -219,3 +214,4 @@ namespace SoundEngine {
 }
 }
 }
 }
 #endif //SOUND_ENGINE_H
 #endif //SOUND_ENGINE_H
+*/

+ 17 - 31
engine/source/platformAndroid/T2DAppDelegate.cpp

@@ -20,22 +20,24 @@
 // IN THE SOFTWARE.
 // IN THE SOFTWARE.
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
 
-#import "platformiOS/T2DAppDelegate.h"
+#import "platformAndroid/T2DAppDelegate.h"
 
 
 #include "platform/platformInput.h"
 #include "platform/platformInput.h"
-#include "platformiOS/iOSUtil.h"
+#include "platformAndroid/AndroidUtil.h"
 #include "console/console.h"
 #include "console/console.h"
 
 
-extern void _iOSGameInnerLoop();
-extern void _iOSGameResignActive();
-extern void _iOSGameBecomeActive();
-extern void _iOSGameWillTerminate();
+extern void _AndroidGameInnerLoop();
+extern void _AndroidGameResignActive();
+extern void _AndroidGameBecomeActive();
+extern void _AndroidGameWillTerminate();
 
 
 // Store current orientation for easy access
 // Store current orientation for easy access
-extern void _iOSGameChangeOrientation(S32 newOrientation);
+extern void _AndroidGameChangeOrientation(S32 newOrientation);
+//TODO: android
+/*
 UIDeviceOrientation currentOrientation;
 UIDeviceOrientation currentOrientation;
 
 
-bool _iOSTorqueFatalError = false;
+bool _AndroidTorqueFatalError = false;
 
 
 @implementation T2DAppDelegate
 @implementation T2DAppDelegate
 
 
@@ -56,33 +58,18 @@ bool _iOSTorqueFatalError = false;
 
 
 - (void)applicationWillResignActive:(UIApplication *)application
 - (void)applicationWillResignActive:(UIApplication *)application
 {
 {
-    _iOSGameResignActive();
-}
-
-- (void)applicationDidEnterBackground:(UIApplication *)application
-{
-    /*
-     Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
-     If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
-     */
-}
-
-- (void)applicationWillEnterForeground:(UIApplication *)application
-{
-    /*
-     Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
-     */
+    _AndroidGameResignActive();
 }
 }
 
 
 - (void)applicationDidBecomeActive:(UIApplication *)application
 - (void)applicationDidBecomeActive:(UIApplication *)application
 {
 {
-    if(!_iOSTorqueFatalError)
-        _iOSGameBecomeActive();
+    if(!_AndroidTorqueFatalError)
+        _AndroidGameBecomeActive();
 }
 }
 
 
 - (void)applicationWillTerminate:(UIApplication *)application
 - (void)applicationWillTerminate:(UIApplication *)application
 {
 {
-    _iOSGameWillTerminate();
+    _AndroidGameWillTerminate();
 	
 	
 	[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
 	[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
 }
 }
@@ -96,13 +83,12 @@ bool _iOSTorqueFatalError = false;
 		//Change the orientation
 		//Change the orientation
 		currentOrientation = orientation;
 		currentOrientation = orientation;
 		//Tell the rest of the engine
 		//Tell the rest of the engine
-		_iOSGameChangeOrientation(currentOrientation);
+		_AndroidGameChangeOrientation(currentOrientation);
 	}
 	}
 }
 }
 
 
 - (void) runMainLoop
 - (void) runMainLoop
 {
 {
-	_iOSGameInnerLoop();
+	_AndroidGameInnerLoop();
 }
 }
-
-@end
+*/

+ 3 - 1
engine/source/platformAndroid/T2DAppDelegate.h

@@ -19,7 +19,8 @@
 // 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.
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-
+//TODO: android
+/*
 #import <UIKit/UIKit.h>
 #import <UIKit/UIKit.h>
 #import <GLKit/GLKit.h>
 #import <GLKit/GLKit.h>
 
 
@@ -30,3 +31,4 @@
 @property (nonatomic, strong) UIWindow *window;
 @property (nonatomic, strong) UIWindow *window;
 
 
 @end
 @end
+*/

+ 17 - 14
engine/source/platformAndroid/T2DView.cpp

@@ -20,13 +20,13 @@
 // IN THE SOFTWARE.
 // IN THE SOFTWARE.
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
 
-#import "platformiOS/T2DView.h"
+#import "platformAndroid/T2DView.h"
 //#import <QuartzCore/QuartzCore.h>
 //#import <QuartzCore/QuartzCore.h>
 //#include "platformiPhone/iPhoneEvents.h"
 //#include "platformiPhone/iPhoneEvents.h"
 
 
-#import "platformiOS/platformiOS.h"
-#import "platformiOS/platformGL.h"
-#import "platformiOS/iOSOGLVideo.h"
+#import "platformAndroid/platformAndroid.h"
+#import "platformAndroid/platformGL.h"
+#import "platformAndroid/AndroidOGLVideo.h"
 #include "console/console.h"
 #include "console/console.h"
 #include "math/mPoint.h"
 #include "math/mPoint.h"
 #include "platform/event.h"
 #include "platform/event.h"
@@ -34,8 +34,8 @@
 #include "console/consoleInternal.h"
 #include "console/consoleInternal.h"
 #include "console/ast.h"
 #include "console/ast.h"
 #include "io/fileStream.h"
 #include "io/fileStream.h"
-#include "platformiOS/iOSUtil.h"
-#include "platformiOS/iOSEvents.h"
+#include "platformAndroid/AndroidUtil.h"
+#include "platformAndroid/AndroidEvents.h"
 #include "graphics/dgl.h"
 #include "graphics/dgl.h"
 #include "debug/profiler.h"
 #include "debug/profiler.h"
 
 
@@ -46,6 +46,8 @@ extern bool createMouseDownEvent(S32 touchNumber, S32 x, S32 y, U32 numTouches);
 extern bool createMouseUpEvent(S32 touchNumber, S32 x, S32 y, S32 lastX, S32 lastY, U32 numTouches); //EFM
 extern bool createMouseUpEvent(S32 touchNumber, S32 x, S32 y, S32 lastX, S32 lastY, U32 numTouches); //EFM
 extern void createMouseTapEvent( S32 nbrTaps, S32 x, S32 y );
 extern void createMouseTapEvent( S32 nbrTaps, S32 x, S32 y );
 
 
+//TODO: android
+/*
 bool retinaEnabled;
 bool retinaEnabled;
 
 
 void ConvertToRetina(CGPoint *p)
 void ConvertToRetina(CGPoint *p)
@@ -104,10 +106,10 @@ void ConvertToRetina(CGPoint *p)
             ConvertToRetina(&point);
             ConvertToRetina(&point);
         }
         }
         
         
-        S32 orientation = _iOSGameGetOrientation();
+        S32 orientation = _AndroidGameGetOrientation();
         if (UIDeviceOrientationIsPortrait(orientation))
         if (UIDeviceOrientationIsPortrait(orientation))
         {
         {
-            point.y -= _iOSGetPortraitTouchoffset();
+            point.y -= _AndroidGetPortraitTouchoffset();
         }
         }
         
         
         int numTouches = [touch tapCount];
         int numTouches = [touch tapCount];
@@ -136,11 +138,11 @@ extern Vector<Event *> TouchMoveEvents;
             ConvertToRetina(&prevPoint);
             ConvertToRetina(&prevPoint);
         }
         }
         
         
-        S32 orientation = _iOSGameGetOrientation();
+        S32 orientation = _AndroidGameGetOrientation();
         if (UIDeviceOrientationIsPortrait(orientation))
         if (UIDeviceOrientationIsPortrait(orientation))
         {
         {
-            point.y -= _iOSGetPortraitTouchoffset();
-            prevPoint.y -= _iOSGetPortraitTouchoffset();
+            point.y -= _AndroidGetPortraitTouchoffset();
+            prevPoint.y -= _AndroidGetPortraitTouchoffset();
         }
         }
         
         
         createMouseMoveEvent(touchCount, point.x, point.y, prevPoint.x, prevPoint.y);
         createMouseMoveEvent(touchCount, point.x, point.y, prevPoint.x, prevPoint.y);
@@ -165,11 +167,11 @@ extern Vector<Event *> TouchMoveEvents;
             ConvertToRetina(&prevPoint);
             ConvertToRetina(&prevPoint);
         }
         }
         
         
-        S32 orientation = _iOSGameGetOrientation();
+        S32 orientation = _AndroidGameGetOrientation();
         if (UIDeviceOrientationIsPortrait(orientation))
         if (UIDeviceOrientationIsPortrait(orientation))
         {
         {
-            point.y -= _iOSGetPortraitTouchoffset();
-            prevPoint.y -= _iOSGetPortraitTouchoffset();
+            point.y -= _AndroidGetPortraitTouchoffset();
+            prevPoint.y -= _AndroidGetPortraitTouchoffset();
         }
         }
         
         
         int tc = [touch tapCount];
         int tc = [touch tapCount];
@@ -203,3 +205,4 @@ int currentRotate = 0;
 #define ROTATE_RIGHT	1
 #define ROTATE_RIGHT	1
 #define ROTATE_UP		2
 #define ROTATE_UP		2
 @end
 @end
+*/

+ 3 - 1
engine/source/platformAndroid/T2DView.h

@@ -19,7 +19,8 @@
 // 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.
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-
+//TODO: android
+/*
 #import <GLKit/GLKit.h>
 #import <GLKit/GLKit.h>
 
 
 @interface T2DView : GLKView {
 @interface T2DView : GLKView {
@@ -36,3 +37,4 @@
 
 
 
 
 @end
 @end
+*/

+ 14 - 11
engine/source/platformAndroid/T2DViewController.cpp

@@ -21,12 +21,12 @@
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
 
 #import "T2DViewController.h"
 #import "T2DViewController.h"
-#import "platformiOS/platformGL.h"
-#include "platformiOS/iOSWindow.h"
-#include "platformiOS/platformiOS.h"
+#import "platformAndroid/platformGL.h"
+#include "platformAndroid/AndroidWindow.h"
+#include "platformAndroid/platformAndroid.h"
 #include "graphics/dgl.h"
 #include "graphics/dgl.h"
 
 
-extern iOSPlatState platState;
+extern AndroidPlatState platState;
 
 
 
 
 #define USE_DEPTH_BUFFER 0
 #define USE_DEPTH_BUFFER 0
@@ -35,13 +35,15 @@ extern bool retinaEnabled;
 
 
 extern void ConvertToRetina (CGPoint *p);
 extern void ConvertToRetina (CGPoint *p);
 
 
-extern bool _iOSTorqueFatalError;
-extern int _iOSRunTorqueMain( id appID,  UIView *Window, T2DViewController *Controller );
+extern bool _AndroidTorqueFatalError;
+extern int _AndroidRunTorqueMain( id appID,  UIView *Window, T2DViewController *Controller );
 
 
 //-Mat we should update the accelereometer once per frame
 //-Mat we should update the accelereometer once per frame
 extern U32  AccelerometerUpdateMS;
 extern U32  AccelerometerUpdateMS;
-extern void _iOSGameInnerLoop();
+extern void _AndroidGameInnerLoop();
 
 
+//TODO: android
+/*
 @implementation T2DViewController
 @implementation T2DViewController
 
 
 @synthesize context = _context;
 @synthesize context = _context;
@@ -158,10 +160,10 @@ extern void _iOSGameInnerLoop();
     UIApplication * application = [UIApplication sharedApplication];
     UIApplication * application = [UIApplication sharedApplication];
     id appDelegate = [application delegate];
     id appDelegate = [application delegate];
     
     
-	_iOSTorqueFatalError = false;
-	if(!_iOSRunTorqueMain( appDelegate, self.view, self ))
+	_AndroidTorqueFatalError = false;
+	if(!_AndroidRunTorqueMain( appDelegate, self.view, self ))
 	{
 	{
-		_iOSTorqueFatalError = true;
+		_AndroidTorqueFatalError = true;
 		return;
 		return;
 	};
 	};
 }
 }
@@ -179,7 +181,7 @@ extern void _iOSGameInnerLoop();
 
 
 - (void)update
 - (void)update
 {
 {
-    _iOSGameInnerLoop();
+    _AndroidGameInnerLoop();
 }
 }
 
 
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
@@ -257,3 +259,4 @@ ConsoleFunction(supportPortrait, void, 2, 2, "supportPortrait( bool ) "
 }
 }
 
 
 @end
 @end
+*/

+ 6 - 4
engine/source/platformAndroid/T2DViewController.h

@@ -19,19 +19,20 @@
 // 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.
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-
+//TODO: android
+/*
 #import <GLKit/GLKit.h>
 #import <GLKit/GLKit.h>
 
 
 
 
 @interface T2DViewController : GLKViewController {
 @interface T2DViewController : GLKViewController {
-	/* The pixel dimensions of the backbuffer */
+	// The pixel dimensions of the backbuffer
 	GLint backingWidth;
 	GLint backingWidth;
 	GLint backingHeight;
 	GLint backingHeight;
 	
 	
-    /* OpenGL names for the renderbuffer and framebuffers used to render to this view */
+    // OpenGL names for the renderbuffer and framebuffers used to render to this view
 	GLuint viewRenderbuffer, viewFramebuffer;
 	GLuint viewRenderbuffer, viewFramebuffer;
 	
 	
-	/* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */
+	/ OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist)
 	GLuint depthRenderbuffer;
 	GLuint depthRenderbuffer;
     
     
     GLuint _vertexBuffer;
     GLuint _vertexBuffer;
@@ -57,3 +58,4 @@
 void supportLandscape( bool );
 void supportLandscape( bool );
 void supportPortrait( bool );
 void supportPortrait( bool );
 @end
 @end
+*/

+ 36 - 37
engine/source/platformAndroid/main.cpp

@@ -19,13 +19,10 @@
 // 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.
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-
-#import <UIKit/UIKit.h>
-
-#import "platformiOS/platformiOS.h"
-#import "platformiOS/T2DAppDelegate.h"
-#import "platformiOS/iOSEvents.h"
-#import "platformiOS/iOSUtil.h"
+#import "platformAndroid/platformAndroid.h"
+#import "platformAndroid/T2DAppDelegate.h"
+#import "platformAndroid/AndroidEvents.h"
+#import "platformAndroid/AndroidUtil.h"
 #include "platform/threads/thread.h"
 #include "platform/threads/thread.h"
 #include "game/gameInterface.h"
 #include "game/gameInterface.h"
 #include "io/fileObject.h"
 #include "io/fileObject.h"
@@ -36,9 +33,10 @@ S32 gLastStart = 0;
 
 
 bool appIsRunning = true;
 bool appIsRunning = true;
 
 
-int _iOSRunTorqueMain( id appID, UIView * Window, T2DViewController *viewController)
+int _AndroidRunTorqueMain( id appID, UIView * Window, T2DViewController *viewController)
 {
 {
-    UIApplication *app = [UIApplication sharedApplication];
+	//TODO: android
+    /*UIApplication *app = [UIApplication sharedApplication];
     platState.viewController = viewController;
     platState.viewController = viewController;
     
     
 	platState.appID = appID;
 	platState.appID = appID;
@@ -57,11 +55,11 @@ int _iOSRunTorqueMain( id appID, UIView * Window, T2DViewController *viewControl
 	{
 	{
 		return 0;
 		return 0;
 	}
 	}
-
+*/
     return true;
     return true;
 }
 }
 
 
-void _iOSGameInnerLoop()
+void _AndroidGameInnerLoop()
 {
 {
     if (!appIsRunning)
     if (!appIsRunning)
     {
     {
@@ -85,28 +83,28 @@ void _iOSGameInnerLoop()
 	}
 	}
 }
 }
 
 
-void _iOSGameResignActive()
+void _AndroidGameResignActive()
 {
 {
-    if ( Con::isFunction("oniOSResignActive") )
-        Con::executef( 1, "oniOSResignActive" );
+    if ( Con::isFunction("onAndroidResignActive") )
+        Con::executef( 1, "onAndroidResignActive" );
     
     
     appIsRunning = false;
     appIsRunning = false;
 }
 }
 
 
-void _iOSGameBecomeActive()
+void _AndroidGameBecomeActive()
 {
 {
 	clearPendingMultitouchEvents( );
 	clearPendingMultitouchEvents( );
     
     
-    if ( Con::isFunction("oniOSBecomeActive") )
-        Con::executef( 1, "oniOSBecomeActive" );
+    if ( Con::isFunction("onAndroidBecomeActive") )
+        Con::executef( 1, "onAndroidBecomeActive" );
     
     
     appIsRunning = true;
     appIsRunning = true;
 }
 }
 
 
-void _iOSGameWillTerminate()
+void _AndroidGameWillTerminate()
 {
 {
-    if ( Con::isFunction("oniOSWillTerminate") )
-        Con::executef( 1, "oniOSWillTerminate" );
+    if ( Con::isFunction("onAndroidWillTerminate") )
+        Con::executef( 1, "onAndroidWillTerminate" );
     
     
 	Con::executef( 1, "onExit" );
 	Con::executef( 1, "onExit" );
     
     
@@ -114,15 +112,15 @@ void _iOSGameWillTerminate()
 }
 }
 
 
 // Store current orientation for easy access
 // Store current orientation for easy access
-void _iOSGameChangeOrientation(S32 newOrientation)
+void _AndroidGameChangeOrientation(S32 newOrientation)
 {    
 {    
-	_iOSGameSetCurrentOrientation(newOrientation);
+	_AndroidGameSetCurrentOrientation(newOrientation);
     
     
     return;
     return;
-    
-    bool enableAutoOrientation = Con::getBoolVariable("$pref::iOS::EnableOrientationRotation");
-    int screenOrientation = Con::getIntVariable("$pref::iOS::ScreenOrientation");
-    bool allowOtherOrientation = Con::getBoolVariable("$pref::iOS::EnableOtherOrientationRotation");
+    /*
+    bool enableAutoOrientation = Con::getBoolVariable("$pref::Android::EnableOrientationRotation");
+    int screenOrientation = Con::getIntVariable("$pref::Android::ScreenOrientation");
+    bool allowOtherOrientation = Con::getBoolVariable("$pref::Android::EnableOtherOrientationRotation");
 
 
     // The rotation matching the project orientation must be allowed for any to occur
     // The rotation matching the project orientation must be allowed for any to occur
     if (enableAutoOrientation)
     if (enableAutoOrientation)
@@ -136,7 +134,7 @@ void _iOSGameChangeOrientation(S32 newOrientation)
             if (newOrientation == UIDeviceOrientationLandscapeLeft)
             if (newOrientation == UIDeviceOrientationLandscapeLeft)
             {
             {
                 platState.Window.transform = CGAffineTransformMakeRotation(M_PI*1.5);
                 platState.Window.transform = CGAffineTransformMakeRotation(M_PI*1.5);
-                Con::executef(1, "oniOSOrientationToLandscapeLeft");
+                Con::executef(1, "onAndroidOrientationToLandscapeLeft");
                 //  Show animations
                 //  Show animations
                 [UIView commitAnimations];
                 [UIView commitAnimations];
                 
                 
@@ -146,7 +144,7 @@ void _iOSGameChangeOrientation(S32 newOrientation)
             if (newOrientation == UIDeviceOrientationLandscapeRight)
             if (newOrientation == UIDeviceOrientationLandscapeRight)
             {
             {
                 platState.Window.transform = CGAffineTransformMakeRotation(M_PI_2);
                 platState.Window.transform = CGAffineTransformMakeRotation(M_PI_2);
-                Con::executef(1, "oniOSOrientationToLandscapeRight");
+                Con::executef(1, "onAndroidOrientationToLandscapeRight");
                 //  Show animations
                 //  Show animations
                 [UIView commitAnimations];
                 [UIView commitAnimations];
                 
                 
@@ -160,7 +158,7 @@ void _iOSGameChangeOrientation(S32 newOrientation)
             if (newOrientation == UIDeviceOrientationPortrait)
             if (newOrientation == UIDeviceOrientationPortrait)
             {
             {
                 platState.Window.transform = CGAffineTransformMakeRotation(M_PI*1.5);
                 platState.Window.transform = CGAffineTransformMakeRotation(M_PI*1.5);
-                Con::executef(1, "oniOSOrientationToPortrait");
+                Con::executef(1, "onAndroidOrientationToPortrait");
                 //  Show animations
                 //  Show animations
                 [UIView commitAnimations];
                 [UIView commitAnimations];
                 
                 
@@ -170,7 +168,7 @@ void _iOSGameChangeOrientation(S32 newOrientation)
             if (newOrientation == UIDeviceOrientationPortraitUpsideDown)
             if (newOrientation == UIDeviceOrientationPortraitUpsideDown)
             {
             {
                 platState.Window.transform = CGAffineTransformMakeRotation(M_PI_2);
                 platState.Window.transform = CGAffineTransformMakeRotation(M_PI_2);
-                Con::executef(1, "oniOSOrientationToPortraitUpsideDown");
+                Con::executef(1, "onAndroidOrientationToPortraitUpsideDown");
                 //  Show animations
                 //  Show animations
                 [UIView commitAnimations];
                 [UIView commitAnimations];
                 
                 
@@ -180,10 +178,10 @@ void _iOSGameChangeOrientation(S32 newOrientation)
         
         
         // Show animations
         // Show animations
         [UIView commitAnimations];
         [UIView commitAnimations];
-    }
+    }*/
 }
 }
 
 
-static void _iOSGetTxtFileArgs(int &argc, char** argv, int maxargc)
+static void _AndroidGetTxtFileArgs(int &argc, char** argv, int maxargc)
 {
 {
     argc = 0;
     argc = 0;
     
     
@@ -196,7 +194,7 @@ static void _iOSGetTxtFileArgs(int &argc, char** argv, int maxargc)
     // Open the file, kick out if we can't
     // Open the file, kick out if we can't
     File cmdfile;
     File cmdfile;
     
     
-    File::Status err = cmdfile.open("iOSCmdLine.txt", cmdfile.Read);
+    File::Status err = cmdfile.open("AndroidCmdLine.txt", cmdfile.Read);
     
     
     // Re-organise function to handle memory deletion better
     // Re-organise function to handle memory deletion better
     if (err == File::Ok)
     if (err == File::Ok)
@@ -238,8 +236,8 @@ static void _iOSGetTxtFileArgs(int &argc, char** argv, int maxargc)
 
 
 int main(int argc, char *argv[])
 int main(int argc, char *argv[])
 {
 {
-    @autoreleasepool
-    {
+    //TODO: android
+	/*
         int kMaxCmdlineArgs = 32; //Arbitrary
         int kMaxCmdlineArgs = 32; //Arbitrary
         
         
         printf("Initial Command Line\n");
         printf("Initial Command Line\n");
@@ -271,7 +269,7 @@ int main(int argc, char *argv[])
         S32 textArgc;
         S32 textArgc;
         char* textArgv[kMaxCmdlineArgs];
         char* textArgv[kMaxCmdlineArgs];
         
         
-        _iOSGetTxtFileArgs(textArgc, textArgv, kMaxCmdlineArgs);
+        _AndroidGetTxtFileArgs(textArgc, textArgv, kMaxCmdlineArgs);
         
         
         // merge them
         // merge them
         int i=0;
         int i=0;
@@ -297,5 +295,6 @@ int main(int argc, char *argv[])
         
         
         printf("exiting...\n");
         printf("exiting...\n");
         return(platState.appReturn);
         return(platState.appReturn);
-    }
+
+    */
 }
 }

+ 22 - 22
engine/source/platformAndroid/platformAndroid.h

@@ -20,36 +20,35 @@
 // IN THE SOFTWARE.
 // IN THE SOFTWARE.
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
 
-#ifndef _PLATFORMIOS_H_
-#define _PLATFORMIOS_H_
-
-#import "UIKit/UIKit.h"
-
+#ifndef _PLATFORMANDROID_H_
+#define _PLATFORMANDROID_H_
 
 
 #include "platform/platform.h"
 #include "platform/platform.h"
 #include "math/mMath.h"
 #include "math/mMath.h"
-#include "platformiOS/iOSEvents.h"
+#include "platformAndroid/AndroidEvents.h"
 
 
-#include "platformiOS/iOSOGLVideo.h"
+#include "platformAndroid/AndroidOGLVideo.h"
 
 
-#include "platformiOS/T2DView.h"
-#include "platformiOS/T2DViewController.h"
+#include "platformAndroid/T2DView.h"
+#include "platformAndroid/T2DViewController.h"
 
 
 // Mich Note: Do not try to spend too much time analyzing this class.
 // Mich Note: Do not try to spend too much time analyzing this class.
-// It is planned to refactor the iOS platform layer and replace this
+// It is planned to refactor the Android platform layer and replace this
 // with a platform state similar to what OS X uses.
 // with a platform state similar to what OS X uses.
-class iOSPlatState
+class AndroidPlatState
 {
 {
 public:
 public:
     bool              captureDisplay;
     bool              captureDisplay;
     bool              fadeWindows;
     bool              fadeWindows;
 
 
-    id				 appID;
-    UIView			 *Window;
+    //TODO: android
+    //id				 appID;
+    //UIView			 *Window;
     char              appWindowTitle[256];
     char              appWindowTitle[256];
     bool              quit;
     bool              quit;
-    T2DView           *ctx;
-    T2DViewController *viewController;
+    //TODO: android
+    //T2DView           *ctx;
+    //T2DViewController *viewController;
     bool              ctxNeedsUpdate;
     bool              ctxNeedsUpdate;
 
 
     bool			portrait;
     bool			portrait;
@@ -91,17 +90,18 @@ public:
 
 
     StringTableEntry  mainDotCsDir;
     StringTableEntry  mainDotCsDir;
 
 
-    NSTimer			 *mainLoopTimer;
-    NSTimeInterval	 timerInterval;
-    UIApplication	*application;
+    //TODO: android
+    //NSTimer			 *mainLoopTimer;
+    //NSTimeInterval	 timerInterval;
+    //UIApplication	*application;
     //-Mat
     //-Mat
     bool		multipleTouchesEnabled;
     bool		multipleTouchesEnabled;
 
 
-    iOSPlatState();
+    AndroidPlatState();
 };
 };
 
 
 /// Global singleton that encapsulates a lot of mac platform state & globals.
 /// Global singleton that encapsulates a lot of mac platform state & globals.
-extern iOSPlatState platState;
+extern AndroidPlatState platState;
 
 
 /// @name Misc Mac Plat Functions
 /// @name Misc Mac Plat Functions
 /// Functions that are used by multiple files in the mac plat, but too trivial
 /// Functions that are used by multiple files in the mac plat, but too trivial
@@ -115,7 +115,7 @@ void getGLCapabilities(void);
 /// calls FileDialog::Execute() on \p dialog
 /// calls FileDialog::Execute() on \p dialog
 /// @param dialog The FileDialog object to Execute. A void* is used to cut down on header dependencies.
 /// @param dialog The FileDialog object to Execute. A void* is used to cut down on header dependencies.
 /// @see platform/nativeDialogs/fileDialog.h
 /// @see platform/nativeDialogs/fileDialog.h
-void iOSShowDialog(void* dialog);
+void AndroidShowDialog(void* dialog);
 
 
 /// Translates a Mac keycode to a Torque keycode
 /// Translates a Mac keycode to a Torque keycode
 U8 TranslateOSKeyCode(U8 vcode);
 U8 TranslateOSKeyCode(U8 vcode);
@@ -137,5 +137,5 @@ const S32 kTMouseWheelMagnificationFactor = 25;
 
 
 
 
 
 
-#endif //_PLATFORMIOS_H_
+#endif //_PLATFORMANDROID_H_
 
 

+ 11 - 18
engine/source/platformAndroid/platformGL.h

@@ -24,22 +24,15 @@
 #ifndef _PLATFORMGL_H_
 #ifndef _PLATFORMGL_H_
 #define _PLATFORMGL_H_
 #define _PLATFORMGL_H_
 
 
-#ifdef __OBJC__
-	#import <QuartzCore/QuartzCore.h>
-//#import <OpenGLES/EAGL.h>
-	#import <OpenGLES/ES1/gl.h>
-	#import <OpenGLES/ES1/glext.h>
-#else
 #include <QuartzCore/QuartzCore.h>
 #include <QuartzCore/QuartzCore.h>
 //#include <OpenGLES/EAGL.h>
 //#include <OpenGLES/EAGL.h>
 #include <OpenGLES/ES1/gl.h>
 #include <OpenGLES/ES1/gl.h>
 #include <OpenGLES/ES1/glext.h>
 #include <OpenGLES/ES1/glext.h>
-#endif
 
 
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 /// Overrides and implentations of opengl API to account for ogles differences
 /// Overrides and implentations of opengl API to account for ogles differences
 // Include after OpenGLES headers
 // Include after OpenGLES headers
-#include "platformiOS/iOSGL2ES.h"
+#include "platformAndroid/AndroidGL2ES.h"
 
 
 
 
 /// Using aglMacro.h gives us signifigant performance gains in opengl immediate mode ( glVertex etc )
 /// Using aglMacro.h gives us signifigant performance gains in opengl immediate mode ( glVertex etc )
@@ -61,23 +54,23 @@ extern AGLContext agl_ctx;
 #define MIN_RESOLUTION_BIT_DEPTH		16
 #define MIN_RESOLUTION_BIT_DEPTH		16
 #define MIN_RESOLUTION_XY_STRING		"480 320"
 #define MIN_RESOLUTION_XY_STRING		"480 320"
 
 
-#define IOS_DEFAULT_RESOLUTION_X		480
-#define IOS_DEFAULT_RESOLUTION_Y		480
+#define ANDROID_DEFAULT_RESOLUTION_X		480
+#define ANDROID_DEFAULT_RESOLUTION_Y		480
 
 
-#define IOS_MAX_RESOLUTION_X			2048
-#define IOS_MAX_RESOLUTION_Y			2048
+#define ANDROID_MAX_RESOLUTION_X			2048
+#define ANDROID_MAX_RESOLUTION_Y			2048
 
 
-#define IOS_DEFAULT_RESOLUTION_BIT_DEPTH	32
+#define ANDROID_DEFAULT_RESOLUTION_BIT_DEPTH	32
 
 
-#define IOS_SCREEN_PORTRAIT			0
-#define IOS_SCREEN_LANDSCAPE			1
-#define IOS_SCREEN_RIGHT_SIDE_UP		3
-#define IOS_SCREEN_UPSIDE_DOWN		4
+#define ANDROID_SCREEN_PORTRAIT			0
+#define ANDROID_SCREEN_LANDSCAPE			1
+#define ANDROID_SCREEN_RIGHT_SIDE_UP		3
+#define ANDROID_SCREEN_UPSIDE_DOWN		4
 
 
 
 
 /// Allows outline mode drawing via a function pointer swapping trick.
 /// Allows outline mode drawing via a function pointer swapping trick.
 /// Must be included AFTER all the OpenGL headers.
 /// Must be included AFTER all the OpenGL headers.
-#include "platformiOS/iOSOutlineGL.h"
+#include "platformAndroid/AndroidOutlineGL.h"
 
 
 
 
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------