mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
highdpi support test
This commit is contained in:
parent
609c5dc1b7
commit
82ca9cde8e
9 changed files with 15 additions and 12 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
-cp src
|
-cp src
|
||||||
-lib heaps
|
-lib heaps
|
||||||
-lib hlsdl
|
-lib hlsdl
|
||||||
|
-D highDPI
|
||||||
-hl native/marblegame.c
|
-hl native/marblegame.c
|
||||||
--main Main
|
--main Main
|
||||||
|
|
@ -6,5 +6,6 @@
|
||||||
--js marblegame.js
|
--js marblegame.js
|
||||||
-D windowSize=1280x720
|
-D windowSize=1280x720
|
||||||
-D js-es=6
|
-D js-es=6
|
||||||
|
-D highDPI
|
||||||
--dce full
|
--dce full
|
||||||
--main Main
|
--main Main
|
||||||
|
|
@ -6,5 +6,6 @@
|
||||||
-D windowSize=1280x720
|
-D windowSize=1280x720
|
||||||
-D js-es=6
|
-D js-es=6
|
||||||
-D keep-inline-positions
|
-D keep-inline-positions
|
||||||
|
-D highDPI
|
||||||
--main Main
|
--main Main
|
||||||
-debug
|
-debug
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
-cp src
|
-cp src
|
||||||
-lib heaps
|
-lib heaps
|
||||||
-lib hlsdl
|
-lib hlsdl
|
||||||
|
-D highDPI
|
||||||
-hl native/marblegame.c
|
-hl native/marblegame.c
|
||||||
-D MACOS_BUNDLE
|
-D MACOS_BUNDLE
|
||||||
--main Main
|
--main Main
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,6 @@
|
||||||
-hl marblegame.hl
|
-hl marblegame.hl
|
||||||
-D windowSize=1280x720
|
-D windowSize=1280x720
|
||||||
-D keep-inline-positions
|
-D keep-inline-positions
|
||||||
|
-D highDPI
|
||||||
--main Main
|
--main Main
|
||||||
-debug
|
-debug
|
||||||
|
|
@ -115,7 +115,7 @@ class CameraController extends Object {
|
||||||
_ignoreCursor = false;
|
_ignoreCursor = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var scaleFactor = 1.0;
|
var scaleFactor = 1.0 / Window.getInstance().windowToPixelRatio;
|
||||||
#if js
|
#if js
|
||||||
scaleFactor = 1 / js.Browser.window.devicePixelRatio;
|
scaleFactor = 1 / js.Browser.window.devicePixelRatio;
|
||||||
#end
|
#end
|
||||||
|
|
|
||||||
|
|
@ -316,8 +316,7 @@ class ResourceLoader {
|
||||||
texObj.flags.set(MipMapped);
|
texObj.flags.set(MipMapped);
|
||||||
}
|
}
|
||||||
var tex = img.toTexture();
|
var tex = img.toTexture();
|
||||||
tex.mipMap = Linear;
|
tex.mipMap = Nearest;
|
||||||
tex.filter = Linear;
|
|
||||||
// tex.filter = Nearest;
|
// tex.filter = Nearest;
|
||||||
var textureresource = new Resource(tex, path, textureCache, tex -> tex.dispose());
|
var textureresource = new Resource(tex, path, textureCache, tex -> tex.dispose());
|
||||||
textureCache.set(path, textureresource);
|
textureCache.set(path, textureresource);
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,6 @@ class Settings {
|
||||||
public static var settingsDir = ".";
|
public static var settingsDir = ".";
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
public static function applySettings() {
|
public static function applySettings() {
|
||||||
#if hl
|
#if hl
|
||||||
Window.getInstance().resize(optionsSettings.screenWidth, optionsSettings.screenHeight);
|
Window.getInstance().resize(optionsSettings.screenWidth, optionsSettings.screenHeight);
|
||||||
|
|
@ -354,7 +353,7 @@ class Settings {
|
||||||
// @:privateAccess Window.getInstance().window.center();
|
// @:privateAccess Window.getInstance().window.center();
|
||||||
Window.getInstance().addResizeEvent(() -> {
|
Window.getInstance().addResizeEvent(() -> {
|
||||||
var wnd = Window.getInstance();
|
var wnd = Window.getInstance();
|
||||||
var zoomRatio = 1.0;
|
var zoomRatio = Window.getInstance().windowToPixelRatio;
|
||||||
#if js
|
#if js
|
||||||
var zoomRatio = Util.isTouchDevice() ? js.Browser.window.screen.height * js.Browser.window.devicePixelRatio / 600 : js.Browser.window.devicePixelRatio; // 768 / js.Browser.window.innerHeight; // js.Browser.window.innerHeight * js.Browser.window.devicePixelRatio / 768;
|
var zoomRatio = Util.isTouchDevice() ? js.Browser.window.screen.height * js.Browser.window.devicePixelRatio / 600 : js.Browser.window.devicePixelRatio; // 768 / js.Browser.window.innerHeight; // js.Browser.window.innerHeight * js.Browser.window.devicePixelRatio / 768;
|
||||||
Settings.zoomRatio = zoomRatio;
|
Settings.zoomRatio = zoomRatio;
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ class GuiControl {
|
||||||
rect.position = parentRect.position.add(this.position.multiply(uiScaleFactor));
|
rect.position = parentRect.position.add(this.position.multiply(uiScaleFactor));
|
||||||
}
|
}
|
||||||
|
|
||||||
var scaleFactor = 1.0;
|
var scaleFactor = 1.0 / Window.getInstance().windowToPixelRatio;
|
||||||
#if (js || android)
|
#if (js || android)
|
||||||
scaleFactor = 1 / Settings.zoomRatio; // 768 / js.Browser.window.innerHeight * js.Browser.window.devicePixelRatio; // 0.5; // 768 / js.Browser.window.innerHeight; // js.Browser.window.innerHeight * js.Browser.window.devicePixelRatio / 768;
|
scaleFactor = 1 / Settings.zoomRatio; // 768 / js.Browser.window.innerHeight * js.Browser.window.devicePixelRatio; // 0.5; // 768 / js.Browser.window.innerHeight; // js.Browser.window.innerHeight * js.Browser.window.devicePixelRatio / 768;
|
||||||
#end
|
#end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue