Przeglądaj źródła

Fixed icon, fixed font rendering issue, and a few other small issues

Tim Newell 12 lat temu
rodzic
commit
4dafef89ea

+ 1 - 1
engine/compilers/Xcode/Torque2D.xcodeproj/xcshareddata/xcschemes/Torque2D.xcscheme

@@ -44,7 +44,7 @@
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"
       launchStyle = "0"
       useCustomWorkingDirectory = "NO"
       useCustomWorkingDirectory = "NO"
-      buildConfiguration = "Debug"
+      buildConfiguration = "Release"
       ignoresPersistentStateOnLaunch = "NO"
       ignoresPersistentStateOnLaunch = "NO"
       debugDocumentVersioning = "YES"
       debugDocumentVersioning = "YES"
       allowLocationSimulation = "YES">
       allowLocationSimulation = "YES">

BIN
engine/compilers/android/res/drawable-hdpi/ic_launcher.png


BIN
engine/compilers/android/res/drawable-ldpi/ic_launcher.png


BIN
engine/compilers/android/res/drawable-mdpi/ic_launcher.png


BIN
engine/compilers/android/res/drawable-xhdpi/ic_launcher.png


+ 0 - 1
engine/source/gui/guiCanvas.cc

@@ -416,7 +416,6 @@ GuiCanvas::GuiCanvas()
 #ifdef TORQUE_OS_IOS
 #ifdef TORQUE_OS_IOS
    mBounds.set(0, 0, IOS_DEFAULT_RESOLUTION_X, IOS_DEFAULT_RESOLUTION_Y);
    mBounds.set(0, 0, IOS_DEFAULT_RESOLUTION_X, IOS_DEFAULT_RESOLUTION_Y);
 #elif TORQUE_OS_ANDROID
 #elif TORQUE_OS_ANDROID
-   //TODO: this need to access something else?
    mBounds.set(0, 0, _AndroidGetScreenWidth(), _AndroidGetScreenHeight());
    mBounds.set(0, 0, _AndroidGetScreenWidth(), _AndroidGetScreenHeight());
 #else
 #else
    mBounds.set(0, 0, MIN_RESOLUTION_X, MIN_RESOLUTION_Y);
    mBounds.set(0, 0, MIN_RESOLUTION_X, MIN_RESOLUTION_Y);

+ 0 - 2
engine/source/gui/guiTextEditCtrl.cc

@@ -710,7 +710,6 @@ bool GuiTextEditCtrl::onKeyDown(const GuiEvent &event)
          }
          }
 
 
          // End added UNIX emacs key bindings
          // End added UNIX emacs key bindings
-         //TODO: android?
 #if !(defined(TORQUE_OS_OSX) || defined(TORQUE_OS_IOS))
 #if !(defined(TORQUE_OS_OSX) || defined(TORQUE_OS_IOS))
          // windows style cut / copy / paste / undo keybinds
          // windows style cut / copy / paste / undo keybinds
          case KEY_C:
          case KEY_C:
@@ -759,7 +758,6 @@ bool GuiTextEditCtrl::onKeyDown(const GuiEvent &event)
             return false;
             return false;
       }
       }
    }
    }
-   //TODO: android?
 #if (defined(TORQUE_OS_OSX) || defined(TORQUE_OS_IOS))
 #if (defined(TORQUE_OS_OSX) || defined(TORQUE_OS_IOS))
    // mac style cut / copy / paste / undo keybinds
    // mac style cut / copy / paste / undo keybinds
    else if (event.modifier & SI_ALT)
    else if (event.modifier & SI_ALT)

+ 0 - 1
engine/source/platform/platformFileIO.cc

@@ -417,7 +417,6 @@ StringTableEntry Platform::stripBasePath(const char *path)
 StringTableEntry Platform::getPrefsPath(const char *file /* = NULL */)
 StringTableEntry Platform::getPrefsPath(const char *file /* = NULL */)
 {
 {
     char buf[1024];
     char buf[1024];
-    //TODO: should android have its own define?
 #if defined(TORQUE_OS_IOS) || defined(TORQUE_OS_ANDROID)
 #if defined(TORQUE_OS_IOS) || defined(TORQUE_OS_ANDROID)
     
     
     if ( file )
     if ( file )

+ 11 - 2
engine/source/platform/platformVideo.cc

@@ -27,7 +27,10 @@
 
 
 extern void GameDeactivate( bool noRender );
 extern void GameDeactivate( bool noRender );
 extern void GameReactivate();
 extern void GameReactivate();
-
+#ifdef TORQUE_OS_ANDROID
+extern int _AndroidGetScreenWidth();
+extern int _AndroidGetScreenHeight();
+#endif
 // Static class data:
 // Static class data:
 Vector<DisplayDevice*>  Video::smDeviceList;
 Vector<DisplayDevice*>  Video::smDeviceList;
 DisplayDevice*          Video::smCurrentDevice;
 DisplayDevice*          Video::smCurrentDevice;
@@ -414,7 +417,6 @@ bool Video::setScreenMode( U32 width, U32 height, U32 bpp, bool fullScreen )
    if ( smCurrentDevice )
    if ( smCurrentDevice )
    {
    {
        //MIN_RESOLUTION defined in platformWin32/platformGL.h
        //MIN_RESOLUTION defined in platformWin32/platformGL.h
-	   //TODO: android?
 #ifdef TORQUE_OS_IOS
 #ifdef TORQUE_OS_IOS
       if(width == 0)
       if(width == 0)
          width = IOS_DEFAULT_RESOLUTION_X;
          width = IOS_DEFAULT_RESOLUTION_X;
@@ -429,6 +431,13 @@ bool Video::setScreenMode( U32 width, U32 height, U32 bpp, bool fullScreen )
       //    height *=2;
       //    height *=2;
       //}
       //}
        
        
+#elif TORQUE_OS_ANDROID
+      if(width == 0)
+	     width = _AndroidGetScreenWidth();
+	  if(height == 0)
+	     height = _AndroidGetScreenHeight();
+	  if(bpp == 0)
+	     bpp = ANDROID_DEFAULT_RESOLUTION_BIT_DEPTH;
 #else
 #else
       if(width == 0)
       if(width == 0)
          width = MIN_RESOLUTION_X;
          width = MIN_RESOLUTION_X;

+ 2 - 2
engine/source/platformAndroid/AndroidConsole.cpp

@@ -107,8 +107,8 @@ bool AndroidConsole::isEnabled()
 
 
 AndroidConsole::AndroidConsole()
 AndroidConsole::AndroidConsole()
 {
 {
-	//TODO: change back to false?
-   consoleEnabled = true;
+   consoleEnabled = false;
+
    clearInBuf();
    clearInBuf();
    
    
    Con::addConsumer(AndroidConsoleConsumer);
    Con::addConsumer(AndroidConsoleConsumer);

+ 0 - 1
engine/source/platformAndroid/AndroidFileio.cpp

@@ -466,7 +466,6 @@ StringTableEntry Platform::getExecutablePath()
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 StringTableEntry Platform::getExecutableName()
 StringTableEntry Platform::getExecutableName()
 {
 {
-   //TODO: does this need anything further?
    return StringTable->insert("Torque2D");
    return StringTable->insert("Torque2D");
 }
 }
 
 

+ 15 - 14
engine/source/platformAndroid/AndroidFont.cpp

@@ -62,13 +62,9 @@ bool AndroidFont::create( const char* name, U32 size, U32 charset )
 {
 {
     // Sanity!
     // Sanity!
     AssertFatal( name != NULL, "Cannot create a NULL font name." );
     AssertFatal( name != NULL, "Cannot create a NULL font name." );
-    //TODO: font create
-    /*
-    // Generate compatible font name.
-    CFStringRef fontName = CFStringCreateWithCString( kCFAllocatorDefault, name, kCFStringEncodingUTF8 );
-    
+
     // Sanity!
     // Sanity!
-    if ( !fontName )
+    if ( !name )
     {
     {
         Con::errorf("Could not handle font name of '%s'.", name );
         Con::errorf("Could not handle font name of '%s'.", name );
         return false;
         return false;
@@ -78,19 +74,24 @@ bool AndroidFont::create( const char* name, U32 size, U32 charset )
     F32 scaledSize = size * (72.0f/96.0f);
     F32 scaledSize = size * (72.0f/96.0f);
     scaledSize = mRound(scaledSize);
     scaledSize = mRound(scaledSize);
     
     
+
+    //TODO: generating font cache on android does not work.  Need to generate cache on desktop first.
+    //freetype2 would need to be added to generate on device.
     // Create the font reference.
     // Create the font reference.
-    mFontRef = CTFontCreateWithName( fontName, scaledSize, NULL );
+    //mFontRef = CTFontCreateWithName( fontName, scaledSize, NULL );
     
     
     // Sanity!
     // Sanity!
-    if ( !mFontRef )
+    /*if ( !mFontRef )
     {
     {
         Con::errorf( "Could not generate a font reference to font name '%s' of size '%d'", name, size );
         Con::errorf( "Could not generate a font reference to font name '%s' of size '%d'", name, size );
         return false;
         return false;
-    }
+    }*/
     
     
     // Fetch font metrics.
     // Fetch font metrics.
-    CGFloat ascent = CTFontGetAscent( mFontRef );
-    CGFloat descent = CTFontGetDescent( mFontRef );
+    //CGFloat ascent = CTFontGetAscent( mFontRef );
+    //CGFloat descent = CTFontGetDescent( mFontRef );
+    float ascent = 0;
+    float descent = 0;
     
     
     // Set baseline.
     // Set baseline.
     mBaseline = (U32)mRound(ascent);
     mBaseline = (U32)mRound(ascent);
@@ -99,8 +100,8 @@ bool AndroidFont::create( const char* name, U32 size, U32 charset )
     mHeight = (U32)mRound( ascent + descent );
     mHeight = (U32)mRound( ascent + descent );
     
     
     // Create a gray-scale color-space.
     // Create a gray-scale color-space.
-    mColorSpace = CGColorSpaceCreateDeviceGray();
-    */
+    //mColorSpace = CGColorSpaceCreateDeviceGray();
+
     // Return status.
     // Return status.
     return true;
     return true;
 }
 }
@@ -146,7 +147,7 @@ PlatformFont::CharInfo& AndroidFont::getCharInfo(const UTF16 character) const
     characterInfo.xOffset = 0;
     characterInfo.xOffset = 0;
     characterInfo.yOffset = 0;
     characterInfo.yOffset = 0;
     
     
-    //TODO: getcharinfo
+    //TODO: getcharinfo if freetype2 font creation on device is added
     /*
     /*
     CGGlyph characterGlyph;
     CGGlyph characterGlyph;
     CGRect characterBounds;
     CGRect characterBounds;

+ 2 - 2
engine/source/platformAndroid/AndroidPlatform.cpp

@@ -60,7 +60,7 @@ S32 Platform::messageBox(const UTF8 *title, const UTF8 *message, MBButtons butto
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 bool Platform::pathCopy(const char* source, const char* dest, bool nooverwrite)
 bool Platform::pathCopy(const char* source, const char* dest, bool nooverwrite)
 {
 {
-	//TODO: Not used on android?
+	Con::errorf("pathCopy is not supported on Android due to assets being in a zip file");
 	return false;
 	return false;
    
    
 }
 }
@@ -68,7 +68,7 @@ bool Platform::pathCopy(const char* source, const char* dest, bool nooverwrite)
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 bool Platform::fileRename(const char *source, const char *dest)
 bool Platform::fileRename(const char *source, const char *dest)
 {
 {
-   //TODO: not used on android?
+	Con::errorf("fileRename is not supported on Android due to assets being in a zip file");
    return false;
    return false;
 }
 }
 
 

+ 1 - 21
engine/source/platformAndroid/AndroidProcessControl.cpp

@@ -56,26 +56,6 @@ void Platform::restartInstance()
       Con::errorf("The game is still running, we cant relaunch now!");
       Con::errorf("The game is still running, we cant relaunch now!");
       return;
       return;
    }
    }
-   //TODO: is this needed on android?
-   /*
-   // get the path to the torque executable
-   CFBundleRef mainBundle =  CFBundleGetMainBundle();
-   CFURLRef execURL = CFBundleCopyExecutableURL(mainBundle);
-   CFStringRef execString = CFURLCopyFileSystemPath(execURL, kCFURLPOSIXPathStyle);
-
-   // append ampersand so that we can launch without blocking.
-   // encase in quotes so that spaces in the path are accepted.
-   CFMutableStringRef mut = CFStringCreateMutableCopy(NULL, 0, execString);
-   CFStringInsert(mut, 0, CFSTR("\""));
-   CFStringAppend(mut, CFSTR("\" & "));
-   
-   U32 len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(mut), kCFStringEncodingUTF8);
-   char *execCString = new char[len+1];
-   CFStringGetCString(mut, execCString, len, kCFStringEncodingUTF8);
-   execCString[len - 1] = '\0';
    
    
-   Con::printf("---- %s -----",execCString);
-   system(execCString);
-   delete[] execCString;
-   */
+   Con::errorf("restartInstance is not supported on Android");
 }
 }

+ 1 - 7
engine/source/platformAndroid/AndroidStrings.cpp

@@ -412,14 +412,8 @@ void dQsort(void *base, U32 nelem, U32 width, int (QSORT_CALLBACK *fcmp)(const v
    qsort(base, nelem, width, fcmp);
    qsort(base, nelem, width, fcmp);
 }   
 }   
 
 
-//TODO: need this?
 StringTableEntry Platform::createUUID( void )
 StringTableEntry Platform::createUUID( void )
 {
 {
-    /*CFUUIDRef ref = CFUUIDCreate(nil);
-    NSString* uuid = (__bridge_transfer NSString *)CFUUIDCreateString(nil,ref);
-    CFRelease(ref);
-
-    StringTableEntry uuidString = StringTable->insert([uuid UTF8String]);
-    return uuidString;*/
+    Con::errorf("createUUID not supported on Android");
 	return StringTable->insert("");
 	return StringTable->insert("");
 }
 }

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

@@ -886,12 +886,14 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
 
 
                 if (bSuspended == true) {
                 if (bSuspended == true) {
 					glViewport(0, 0, engine->width, engine->height);
 					glViewport(0, 0, engine->width, engine->height);
+					Game->textureResurrect();
 					bSuspended = false;
 					bSuspended = false;
 				}
 				}
             }
             }
             break;
             break;
         case APP_CMD_TERM_WINDOW:
         case APP_CMD_TERM_WINDOW:
 			bSuspended = true;
 			bSuspended = true;
+			Game->textureKill();
             // The window is being hidden or closed, clean it up.
             // The window is being hidden or closed, clean it up.
             engine_term_display(engine, false);
             engine_term_display(engine, false);
             break;
             break;
@@ -972,7 +974,6 @@ void android_main(struct android_app* state) {
     //store the cache dir
     //store the cache dir
     activity.loadCacheDir();
     activity.loadCacheDir();
 
 
-    //TODO: anything we need to do with these?
     platState.argc = 0;
     platState.argc = 0;
     //platState.argv
     //platState.argv
 
 

+ 1 - 1
modules/Sandbox/1/gui/guiProfiles.cs

@@ -21,7 +21,7 @@
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
 
 $platformFontType = ($platform $= "windows") ? "lucida console" : "monaco";
 $platformFontType = ($platform $= "windows") ? "lucida console" : "monaco";
-$platformFontSize = ($platform $= "ios" || $platform $= "Android") ? 18 : 12;
+$platformFontSize = ($platform $= "ios") ? 18 : 12;
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------