diff --git a/src/Main.hx b/src/Main.hx index fc3b5d16..28196708 100644 --- a/src/Main.hx +++ b/src/Main.hx @@ -53,8 +53,16 @@ class Main extends hxd.App { s2d.scaleMode = Zoom(zoomRatio); #end #if android - var zoomRatio = Window.getInstance().height / 700; + var zoomRatio = Math.min(Window.getInstance().height, Window.getInstance().width) / 700; s2d.scaleMode = Zoom(zoomRatio); + + trace("Initial Window resized to " + + Window.getInstance().width + + "x" + + Window.getInstance().height + + " (Zoom " + + zoomRatio + + ")"); #end #if android diff --git a/src/Settings.hx b/src/Settings.hx index 92efc888..712de4cc 100644 --- a/src/Settings.hx +++ b/src/Settings.hx @@ -237,7 +237,7 @@ class Settings { return null; } - @:hlNative public static function open_url(url:String):Void {} + @:hlNative public static function open_web_url(url:String):Void {} #end public static function applySettings() { @@ -506,9 +506,26 @@ class Settings { public static function init() { load(); #if hl - Window.getInstance().resize(Window.getInstance().width, Window.getInstance().height); + var wnd = Window.getInstance(); + // var zoomRatio = Window.getInstance().windowToPixelRatio; + // Window.getInstance().resize(Window.getInstance().width, Window.getInstance().height); // Window.getInstance().resize(optionsSettings.screenWidth, optionsSettings.screenHeight); - Window.getInstance().displayMode = optionsSettings.isFullScreen ? FullscreenResize : Windowed; + // Window.getInstance().displayMode = optionsSettings.isFullScreen ? FullscreenResize : Windowed; + var zoomRatio = Math.min(Window.getInstance().height, Window.getInstance().width) / 700; + Settings.zoomRatio = zoomRatio; + #if hl + Settings.optionsSettings.screenWidth = cast wnd.width; + Settings.optionsSettings.screenHeight = cast wnd.height; + #end + trace("Window resized to " + + Settings.optionsSettings.screenWidth + + "x" + + Settings.optionsSettings.screenHeight + + " (Zoom " + + zoomRatio + + ")"); + + // MarbleGame.canvas.scene2d.scaleMode = Zoom(zoomRatio); #end #if js Window.getInstance().propagateKeyEvents = true; diff --git a/src/gui/MainMenuGui.hx b/src/gui/MainMenuGui.hx index efd9c75f..96b60802 100644 --- a/src/gui/MainMenuGui.hx +++ b/src/gui/MainMenuGui.hx @@ -163,7 +163,7 @@ class MainMenuGui extends GuiImage { kofi.extent = new Vector(143, 36); kofi.pressedAction = (sender) -> { #if sys - Settings.open_url("https://ko-fi.com/H2H5FRTTL"); + Settings.open_web_url("https://ko-fi.com/H2H5FRTTL"); #end #if js js.Browser.window.open("https://ko-fi.com/H2H5FRTTL"); @@ -178,7 +178,7 @@ class MainMenuGui extends GuiImage { github.extent = new Vector(94, 38); github.pressedAction = (sender) -> { #if sys - Settings.open_url("https://github.com/RandomityGuy/MBHaxe"); + Settings.open_web_url("https://github.com/RandomityGuy/MBHaxe"); #end #if js js.Browser.window.open("https://github.com/RandomityGuy/MBHaxe"); diff --git a/src/gui/PlayMissionGui.hx b/src/gui/PlayMissionGui.hx index 0d8b1e6c..06707317 100644 --- a/src/gui/PlayMissionGui.hx +++ b/src/gui/PlayMissionGui.hx @@ -1054,7 +1054,7 @@ class PlayMissionGui extends GuiImage { kofi.extent = new Vector(143, 36); kofi.pressedAction = (sender) -> { #if sys - Settings.open_url("https://ko-fi.com/H2H5FRTTL"); + Settings.open_web_url("https://ko-fi.com/H2H5FRTTL"); #end #if js js.Browser.window.open("https://ko-fi.com/H2H5FRTTL"); diff --git a/src/gui/TouchOptionsGui.hx b/src/gui/TouchOptionsGui.hx index cdd2a6da..63331d21 100644 --- a/src/gui/TouchOptionsGui.hx +++ b/src/gui/TouchOptionsGui.hx @@ -24,12 +24,7 @@ class TouchOptionsGui extends GuiImage { this.position = new Vector(); this.extent = new Vector(640, 480); - #if hl - var scene2d = hxd.Window.getInstance(); - #end - #if js - var scene2d = MarbleGame.instance.scene2d; - #end + var scene2d = MarbleGame.canvas.scene2d; var offsetX = (scene2d.width - 1280) / 2; var offsetY = (scene2d.height - 720) / 2;