Browse Source

Fixed button problem related to screen mode being set wrong due to android virtual bar

Tim Newell 12 years ago
parent
commit
4835dcff08

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

@@ -163,7 +163,6 @@ void OpenGLDevice::shutdown()
 //
 //
 bool OpenGLDevice::setScreenMode(U32 width, U32 height, U32 bpp, bool fullScreen, bool forceIt, bool repaint)
 bool OpenGLDevice::setScreenMode(U32 width, U32 height, U32 bpp, bool fullScreen, bool forceIt, bool repaint)
 {
 {
-    
     Con::printf(" set screen mode %i x %i x %i, %s, %s, %s", width, height, bpp,
     Con::printf(" set screen mode %i x %i x %i, %s, %s, %s", width, height, bpp,
                 fullScreen ? "fullscreen" : "windowed",
                 fullScreen ? "fullscreen" : "windowed",
                 forceIt ? "force it" : "dont force it",
                 forceIt ? "force it" : "dont force it",

+ 16 - 0
engine/source/platformAndroid/T2DActivity.cpp

@@ -1332,6 +1332,22 @@ U32 android_GetFileSize(const char* pFilePath)
 	return 0;
 	return 0;
 }
 }
 
 
+ConsoleFunction(GetAndroidResolution, const char*, 1, 1, "Returns the resolution for the android device")
+{
+
+    S32 width = _AndroidGetScreenWidth();
+    S32 height = _AndroidGetScreenHeight();
+	S32 bitdepth = ANDROID_DEFAULT_RESOLUTION_BIT_DEPTH;
+
+	char buf[80];
+	dSprintf(buf, sizeof(buf), "%d %d %d", width, height, bitdepth);
+
+	char* buffer = Con::getReturnBuffer(strlen(buf) + 1);
+	dStrcpy(buffer, buf);
+
+	return buffer;
+}
+
 ConsoleFunction(doDeviceVibrate, void, 1, 1, "Makes the device do a quick vibration. Only works on devices with vibration functionality.")
 ConsoleFunction(doDeviceVibrate, void, 1, 1, "Makes the device do a quick vibration. Only works on devices with vibration functionality.")
 {
 {
 	// Vibrate for 500 milliseconds
 	// Vibrate for 500 milliseconds

+ 5 - 1
modules/AppCore/1/scripts/canvas.cs

@@ -48,6 +48,10 @@ function initializeCanvas(%windowName)
     {
     {
         %resolution = iOSResolutionFromSetting($pref::iOS::DeviceType, $pref::iOS::ScreenOrientation);
         %resolution = iOSResolutionFromSetting($pref::iOS::DeviceType, $pref::iOS::ScreenOrientation);
     }
     }
+    else if ($platform $= "Android")
+    {
+    	%resolution = GetAndroidResolution();
+    }
     else
     else
     {
     {
         if ( $pref::Video::windowedRes !$= "" )
         if ( $pref::Video::windowedRes !$= "" )
@@ -130,4 +134,4 @@ function iOSResolutionFromSetting( %deviceType, %deviceScreenOrientation )
     }
     }
    
    
     return %x @ " " @ %y;
     return %x @ " " @ %y;
-}
+}

+ 2 - 2
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") ? 18 : 12;
+$platformFontSize = ($platform $= "ios" || $platform $= "Android") ? 18 : 12;
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
 
@@ -458,4 +458,4 @@ if (!isObject(GuiSunkenContainerProfile)) new GuiControlProfile (GuiSunkenContai
     border = -2;
     border = -2;
     bitmap = "^Sandbox/gui/images/sunkenContainer";
     bitmap = "^Sandbox/gui/images/sunkenContainer";
     borderColor = "40 40 40 10";
     borderColor = "40 40 40 10";
-};
+};

+ 1 - 1
modules/Sandbox/1/scripts/toolbox.cs

@@ -382,7 +382,7 @@ function updateToolboxOptions()
     
     
     // Is this on the desktop?
     // Is this on the desktop?
     //if ( $platform $= "windows" || $platform $= "macos" )
     //if ( $platform $= "windows" || $platform $= "macos" )
-    if ( $platform !$= "iOS" )
+    if ( $platform !$= "iOS" && $platform !$= "Android" )
     {
     {
         // Set the fullscreen check-box.
         // Set the fullscreen check-box.
         FullscreenOptionButton.setStateOn( $pref::Video::fullScreen );
         FullscreenOptionButton.setStateOn( $pref::Video::fullScreen );