mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix few touch things
This commit is contained in:
parent
1a99b32e55
commit
85ce3b2102
5 changed files with 33 additions and 13 deletions
10
src/Main.hx
10
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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue