|
@@ -24,62 +24,49 @@
|
|
|
// initializeCanvas
|
|
|
// Constructs and initializes the default canvas window.
|
|
|
//------------------------------------------------------------------------------
|
|
|
-$canvasCreated = false;
|
|
|
function initializeCanvas(%windowName)
|
|
|
{
|
|
|
// Don't duplicate the canvas.
|
|
|
- if($canvasCreated)
|
|
|
+ if(!isObject(Canvas))
|
|
|
{
|
|
|
- error("Cannot instantiate more than one canvas!");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- videoSetGammaCorrection($pref::OpenGL::gammaCorrection);
|
|
|
-
|
|
|
- if ( !createCanvas(%windowName) )
|
|
|
- {
|
|
|
- error("Canvas creation failed. Shutting down.");
|
|
|
- quit();
|
|
|
- }
|
|
|
+ videoSetGammaCorrection($pref::OpenGL::gammaCorrection);
|
|
|
|
|
|
- $pref::iOS::ScreenDepth = 32;
|
|
|
+ if ( !createCanvas(%windowName) )
|
|
|
+ {
|
|
|
+ error("Canvas creation failed. Shutting down.");
|
|
|
+ quit();
|
|
|
+ }
|
|
|
|
|
|
- if ($platform $= "iOS")
|
|
|
- {
|
|
|
- %resolution = $pref::iOS::Width SPC $pref::iOS::Height SPC 32;
|
|
|
- }
|
|
|
- else if ($platform $= "Android")
|
|
|
- {
|
|
|
- %resolution = GetAndroidResolution();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if ( $pref::Video::windowedRes !$= "" )
|
|
|
- %resolution = $pref::Video::windowedRes;
|
|
|
- else
|
|
|
- %resolution = $pref::Video::defaultResolution;
|
|
|
- }
|
|
|
+ if ($platform $= "iOS")
|
|
|
+ {
|
|
|
+ %resolution = $pref::iOS::Width SPC $pref::iOS::Height SPC $pref::iOS::ScreenDepth;
|
|
|
+ }
|
|
|
+ else if ($platform $= "Android")
|
|
|
+ {
|
|
|
+ %resolution = GetAndroidResolution();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if ( $pref::Video::windowedRes !$= "" )
|
|
|
+ %resolution = $pref::Video::windowedRes;
|
|
|
+ else
|
|
|
+ %resolution = $pref::Video::defaultResolution;
|
|
|
+ }
|
|
|
|
|
|
- if ($platform $= "windows" || $platform $= "macos")
|
|
|
- {
|
|
|
- setScreenMode( %resolution._0, %resolution._1, %resolution._2, $pref::Video::fullScreen );
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- setScreenMode( %resolution._0, %resolution._1, %resolution._2, false );
|
|
|
- }
|
|
|
-
|
|
|
- $canvasCreated = true;
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-// resetCanvas
|
|
|
-// Forces the canvas to redraw itself.
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-function resetCanvas()
|
|
|
-{
|
|
|
- if (isObject(Canvas))
|
|
|
- Canvas.repaint();
|
|
|
+ if ($platform $= "windows" || $platform $= "macos")
|
|
|
+ {
|
|
|
+ setScreenMode( %resolution._0, %resolution._1, %resolution._2, $pref::Video::fullScreen );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ setScreenMode( %resolution._0, %resolution._1, %resolution._2, false );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Canvas.setCanvasTitle(%windowName);
|
|
|
+ Canvas.repaint();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
@@ -91,7 +78,7 @@ function iOSResolutionFromSetting( %deviceType, %deviceScreenOrientation )
|
|
|
// A helper function to get a string based resolution from the settings given.
|
|
|
%x = 0;
|
|
|
%y = 0;
|
|
|
-
|
|
|
+
|
|
|
%scaleFactor = $pref::iOS::RetinaEnabled ? 2 : 1;
|
|
|
|
|
|
switch(%deviceType)
|
|
@@ -132,6 +119,6 @@ function iOSResolutionFromSetting( %deviceType, %deviceScreenOrientation )
|
|
|
%y = $iOS::constant::iPhone5Width;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return %x @ " " @ %y;
|
|
|
}
|