Refactor positioning of FPS and memory counters for mobile
This commit is contained in:
+3
-3
@@ -184,7 +184,7 @@ class Main extends Sprite
|
||||
{
|
||||
fpsCounter.scaleX = fpsCounter.scaleY = #if android (scale > 1 ? scale : 1) #else (scale < 1 ? scale : 1) #end;
|
||||
#if mobile
|
||||
fpsCounter.x = 10 + FullScreenScaleMode.notchSize.x;
|
||||
fpsCounter.x = FlxG.game.x + FullScreenScaleMode.notchSize.x +;
|
||||
#end
|
||||
}
|
||||
|
||||
@@ -192,9 +192,9 @@ class Main extends Sprite
|
||||
{
|
||||
memoryCounter.scaleX = memoryCounter.scaleY = scale;
|
||||
|
||||
memoryCounter.y = 13 * #if android (scale > 1 ? scale : 1) #else (scale < 1 ? scale : 1) #end;
|
||||
memoryCounter.y = FlxG.game.y + (13 * #if android (scale > 1 ? scale : 1) #else (scale < 1 ? scale : 1) #end);
|
||||
#if mobile
|
||||
memoryCounter.x = 10 + FullScreenScaleMode.notchSize.x;
|
||||
memoryCounter.x = FlxG.game.x + FullScreenScaleMode.notchSize.x + 10;
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,8 +156,8 @@ class FullScreenScaleMode extends flixel.system.scaleModes.BaseScaleMode
|
||||
{
|
||||
final game = FlxG.game;
|
||||
|
||||
cutoutBitmaps[i] = bitmap = new Bitmap(new BitmapData(ratioAxis == X ? Math.ceil(cutoutSize.x / 2) : Math.ceil(instance.gameSize.x),
|
||||
ratioAxis == Y ? Math.ceil(cutoutSize.y / 2) : Math.ceil(instance.gameSize.y), true, 0xFF000000));
|
||||
cutoutBitmaps[i] = bitmap = new Bitmap(new BitmapData(ratioAxis == X ? Math.ceil(cutoutSize.x / 2) : Math.ceil(FlxG.scaleMode.gameSize.x),
|
||||
ratioAxis == Y ? Math.ceil(cutoutSize.y / 2) : Math.ceil(FlxG.scaleMode.gameSize.y), true, 0xFF000000));
|
||||
game.parent.addChildAt(bitmap, game.parent.getChildIndex(game) + 1);
|
||||
}
|
||||
|
||||
@@ -166,8 +166,8 @@ class FullScreenScaleMode extends flixel.system.scaleModes.BaseScaleMode
|
||||
|
||||
if (ratioAxis == X)
|
||||
{
|
||||
bitmap.x = (i == 0) ? -bitmap.width : instance.gameSize.x;
|
||||
targetX = (i == 0) ? 0 : instance.gameSize.x - bitmap.width;
|
||||
bitmap.x = (i == 0) ? -bitmap.width : FlxG.scaleMode.gameSize.x;
|
||||
targetX = (i == 0) ? 0 : FlxG.scaleMode.gameSize.x - bitmap.width;
|
||||
bitmap.y = 0;
|
||||
targetY = 0;
|
||||
}
|
||||
@@ -175,8 +175,8 @@ class FullScreenScaleMode extends flixel.system.scaleModes.BaseScaleMode
|
||||
{
|
||||
bitmap.x = 0;
|
||||
targetX = 0;
|
||||
bitmap.y = (i == 0) ? -bitmap.height : instance.gameSize.y;
|
||||
targetY = (i == 0) ? 0 : instance.gameSize.y - bitmap.height;
|
||||
bitmap.y = (i == 0) ? -bitmap.height : FlxG.scaleMode.gameSize.y;
|
||||
targetY = (i == 0) ? 0 : FlxG.scaleMode.gameSize.y - bitmap.height;
|
||||
}
|
||||
|
||||
bitmap.alpha = 0;
|
||||
@@ -206,12 +206,12 @@ class FullScreenScaleMode extends flixel.system.scaleModes.BaseScaleMode
|
||||
{
|
||||
if (bitmap == null)
|
||||
{
|
||||
trace("[WARNING] Tried to remove a cutout bar but there don't seem to be any cuout bars.");
|
||||
trace("[WARNING] Tried to remove a cutout bar but there don't seem to be any.");
|
||||
continue;
|
||||
}
|
||||
|
||||
final targetX:Float = (i == 0 || ratioAxis == Y) ? ratioAxis == Y ? 0 : -bitmap.width : instance.gameSize.x;
|
||||
final targetY:Float = (i == 0 || ratioAxis == X) ? ratioAxis == X ? 0 : -bitmap.height : instance.gameSize.y;
|
||||
final targetX:Float = (i == 0 || ratioAxis == Y) ? ratioAxis == Y ? 0 : -bitmap.width : FlxG.scaleMode.gameSize.x;
|
||||
final targetY:Float = (i == 0 || ratioAxis == X) ? ratioAxis == X ? 0 : -bitmap.height : FlxG.scaleMode.gameSize.y;
|
||||
|
||||
if (tweenDuration > 0.0)
|
||||
{
|
||||
|
||||
@@ -398,36 +398,20 @@ class Preferences
|
||||
if (show)
|
||||
{
|
||||
// Enable the debug display.
|
||||
#if mobile
|
||||
FlxG.game.addChild(Main.fpsCounter);
|
||||
#else
|
||||
FlxG.stage.addChild(Main.fpsCounter);
|
||||
#end
|
||||
|
||||
#if !html5
|
||||
#if mobile
|
||||
FlxG.game.addChild(Main.memoryCounter);
|
||||
#else
|
||||
FlxG.stage.addChild(Main.memoryCounter);
|
||||
#end
|
||||
#end
|
||||
}
|
||||
else
|
||||
{
|
||||
// Disable the debug display.
|
||||
#if mobile
|
||||
FlxG.game.removeChild(Main.fpsCounter);
|
||||
#else
|
||||
FlxG.stage.removeChild(Main.fpsCounter);
|
||||
#end
|
||||
|
||||
#if !html5
|
||||
#if mobile
|
||||
FlxG.game.removeChild(Main.memoryCounter);
|
||||
#else
|
||||
FlxG.stage.removeChild(Main.memoryCounter);
|
||||
#end
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user