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
|
||||
-lib heaps
|
||||
-lib hlsdl
|
||||
-D highDPI
|
||||
-hl native/marblegame.c
|
||||
--main Main
|
||||
|
|
@ -6,5 +6,6 @@
|
|||
--js marblegame.js
|
||||
-D windowSize=1280x720
|
||||
-D js-es=6
|
||||
-D highDPI
|
||||
--dce full
|
||||
--main Main
|
||||
|
|
@ -6,5 +6,6 @@
|
|||
-D windowSize=1280x720
|
||||
-D js-es=6
|
||||
-D keep-inline-positions
|
||||
-D highDPI
|
||||
--main Main
|
||||
-debug
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
-cp src
|
||||
-lib heaps
|
||||
-lib hlsdl
|
||||
-D highDPI
|
||||
-hl native/marblegame.c
|
||||
-D MACOS_BUNDLE
|
||||
--main Main
|
||||
|
|
|
|||
|
|
@ -4,5 +4,6 @@
|
|||
-hl marblegame.hl
|
||||
-D windowSize=1280x720
|
||||
-D keep-inline-positions
|
||||
-D highDPI
|
||||
--main Main
|
||||
-debug
|
||||
|
|
@ -115,7 +115,7 @@ class CameraController extends Object {
|
|||
_ignoreCursor = false;
|
||||
return;
|
||||
}
|
||||
var scaleFactor = 1.0;
|
||||
var scaleFactor = 1.0 / Window.getInstance().windowToPixelRatio;
|
||||
#if js
|
||||
scaleFactor = 1 / js.Browser.window.devicePixelRatio;
|
||||
#end
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ import src.Settings;
|
|||
|
||||
class ResourceLoader {
|
||||
#if (hl && !android)
|
||||
#if MACOS_BUNDLE
|
||||
#if MACOS_BUNDLE
|
||||
public static var fileSystem:FileSystem = new TorqueFileSystem(Path.normalize(Path.join([Path.directory(Sys.programPath()), "..", "..", ".."])), null);
|
||||
#else
|
||||
#else
|
||||
public static var fileSystem:FileSystem = new TorqueFileSystem(".", null);
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
#if (js || android)
|
||||
public static var fileSystem:FileSystem = null;
|
||||
|
|
@ -316,8 +316,7 @@ class ResourceLoader {
|
|||
texObj.flags.set(MipMapped);
|
||||
}
|
||||
var tex = img.toTexture();
|
||||
tex.mipMap = Linear;
|
||||
tex.filter = Linear;
|
||||
tex.mipMap = Nearest;
|
||||
// tex.filter = Nearest;
|
||||
var textureresource = new Resource(tex, path, textureCache, tex -> tex.dispose());
|
||||
textureCache.set(path, textureresource);
|
||||
|
|
|
|||
|
|
@ -157,13 +157,12 @@ class Settings {
|
|||
public static var isTouch:Option<Bool> = Option.None;
|
||||
|
||||
#if hl
|
||||
#if MACOS_BUNDLE
|
||||
#if MACOS_BUNDLE
|
||||
public static var settingsDir = Path.join([Sys.getEnv("HOME"), "Library", "Application Support", "MBHaxe-MBP"]);
|
||||
#else
|
||||
#else
|
||||
public static var settingsDir = ".";
|
||||
#end
|
||||
#end
|
||||
|
||||
#end
|
||||
public static function applySettings() {
|
||||
#if hl
|
||||
Window.getInstance().resize(optionsSettings.screenWidth, optionsSettings.screenHeight);
|
||||
|
|
@ -354,7 +353,7 @@ class Settings {
|
|||
// @:privateAccess Window.getInstance().window.center();
|
||||
Window.getInstance().addResizeEvent(() -> {
|
||||
var wnd = Window.getInstance();
|
||||
var zoomRatio = 1.0;
|
||||
var zoomRatio = Window.getInstance().windowToPixelRatio;
|
||||
#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;
|
||||
Settings.zoomRatio = zoomRatio;
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class GuiControl {
|
|||
rect.position = parentRect.position.add(this.position.multiply(uiScaleFactor));
|
||||
}
|
||||
|
||||
var scaleFactor = 1.0;
|
||||
var scaleFactor = 1.0 / Window.getInstance().windowToPixelRatio;
|
||||
#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;
|
||||
#end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue