mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-02-17 11:45:54 +00:00
some gui scaling shit
This commit is contained in:
parent
a7865c2eb3
commit
255658f456
14 changed files with 36 additions and 27 deletions
|
|
@ -205,8 +205,14 @@ class Settings {
|
|||
#if js
|
||||
zoomRatio = js.Browser.window.devicePixelRatio;
|
||||
#end
|
||||
#if hl
|
||||
Settings.optionsSettings.screenWidth = cast wnd.width / zoomRatio;
|
||||
Settings.optionsSettings.screenHeight = cast wnd.height / zoomRatio;
|
||||
#end
|
||||
#if js
|
||||
Settings.optionsSettings.screenWidth = cast js.Browser.window.innerWidth;
|
||||
Settings.optionsSettings.screenHeight = cast js.Browser.window.innerHeight;
|
||||
#end
|
||||
|
||||
MarbleGame.canvas.scene2d.scaleMode = Zoom(zoomRatio);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,18 +54,18 @@ class EndGameGui extends GuiControl {
|
|||
var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt");
|
||||
var arial14b = new BitmapFont(arial14fontdata.entry);
|
||||
@:privateAccess arial14b.loader = ResourceLoader.loader;
|
||||
var arial14 = arial14b.toSdfFont(12, MultiChannel);
|
||||
var arial14 = arial14b.toSdfFont(cast 12 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
|
||||
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
|
||||
var domcasual32 = domcasual32b.toSdfFont(26, MultiChannel);
|
||||
var domcasual32 = domcasual32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var expo50fontdata = ResourceLoader.getFileEntry("data/font/EXPON.fnt");
|
||||
var expo50b = new BitmapFont(expo50fontdata.entry);
|
||||
@:privateAccess expo50b.loader = ResourceLoader.loader;
|
||||
var expo50 = expo50b.toSdfFont(35, MultiChannel);
|
||||
var expo32 = expo50b.toSdfFont(24, MultiChannel);
|
||||
var expo50 = expo50b.toSdfFont(cast 35 * Settings.uiScale, MultiChannel);
|
||||
var expo32 = expo50b.toSdfFont(cast 24 * Settings.uiScale, MultiChannel);
|
||||
|
||||
function mlFontLoader(text:String) {
|
||||
switch (text) {
|
||||
|
|
|
|||
|
|
@ -24,18 +24,18 @@ class EnterNameDlg extends GuiControl {
|
|||
var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt");
|
||||
var arial14b = new BitmapFont(arial14fontdata.entry);
|
||||
@:privateAccess arial14b.loader = ResourceLoader.loader;
|
||||
var arial14 = arial14b.toSdfFont(12, MultiChannel);
|
||||
var arial14 = arial14b.toSdfFont(cast 12 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
|
||||
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
|
||||
var domcasual32 = domcasual32b.toSdfFont(26, MultiChannel);
|
||||
var domcasual32 = domcasual32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var expo50fontdata = ResourceLoader.getFileEntry("data/font/EXPON.fnt");
|
||||
var expo50b = new BitmapFont(expo50fontdata.entry);
|
||||
@:privateAccess expo50b.loader = ResourceLoader.loader;
|
||||
var expo50 = expo50b.toSdfFont(35, MultiChannel);
|
||||
var expo32 = expo50b.toSdfFont(24, MultiChannel);
|
||||
var expo50 = expo50b.toSdfFont(cast 35 * Settings.uiScale, MultiChannel);
|
||||
var expo32 = expo50b.toSdfFont(cast 24 * Settings.uiScale, MultiChannel);
|
||||
|
||||
function mlFontLoader(text:String) {
|
||||
switch (text) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package gui;
|
|||
import hxd.res.BitmapFont;
|
||||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.Settings;
|
||||
|
||||
class ExitGameDlg extends GuiControl {
|
||||
public function new(yesFunc:GuiControl->Void, noFunc:GuiControl->Void, restartFunc:GuiControl->Void) {
|
||||
|
|
@ -29,7 +30,7 @@ class ExitGameDlg extends GuiControl {
|
|||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
|
||||
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
|
||||
var domcasual32 = domcasual32b.toSdfFont(26, MultiChannel);
|
||||
var domcasual32 = domcasual32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var exitGameText = new GuiText(domcasual32);
|
||||
exitGameText.text.textColor = 0x000000;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ class GuiMLText extends GuiControl {
|
|||
super();
|
||||
this.text = new HtmlText(font);
|
||||
this.text.loadFont = loadFontFunc;
|
||||
var uiScaleFactor = Settings.uiScale;
|
||||
this.text.scale(uiScaleFactor);
|
||||
}
|
||||
|
||||
public override function render(scene2d:Scene) {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ class GuiText extends GuiControl {
|
|||
public function new(font:Font) {
|
||||
super();
|
||||
this.text = new Text(font);
|
||||
var uiScaleFactor = Settings.uiScale;
|
||||
this.text.scale(uiScaleFactor);
|
||||
}
|
||||
|
||||
public override function render(scene2d:Scene) {
|
||||
|
|
|
|||
|
|
@ -83,18 +83,18 @@ class HelpCreditsGui extends GuiImage {
|
|||
var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt");
|
||||
var arial14b = new BitmapFont(arial14fontdata.entry);
|
||||
@:privateAccess arial14b.loader = ResourceLoader.loader;
|
||||
var arial14 = arial14b.toSdfFont(12, MultiChannel);
|
||||
var arial14 = arial14b.toSdfFont(cast 12 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
|
||||
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
|
||||
var domcasual32 = domcasual32b.toSdfFont(26, MultiChannel);
|
||||
var domcasual32 = domcasual32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var expo50fontdata = ResourceLoader.getFileEntry("data/font/EXPON.fnt");
|
||||
var expo50b = new BitmapFont(expo50fontdata.entry);
|
||||
@:privateAccess expo50b.loader = ResourceLoader.loader;
|
||||
var expo50 = expo50b.toSdfFont(35, MultiChannel);
|
||||
var expo32 = expo50b.toSdfFont(24, MultiChannel);
|
||||
var expo50 = expo50b.toSdfFont(cast 35 * Settings.uiScale, MultiChannel);
|
||||
var expo32 = expo50b.toSdfFont(cast 24 * Settings.uiScale, MultiChannel);
|
||||
|
||||
function mlFontLoader(text:String) {
|
||||
switch (text) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import hxd.res.BitmapFont;
|
|||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.MarbleGame;
|
||||
import src.Settings;
|
||||
|
||||
class LoadingGui extends GuiImage {
|
||||
public var setProgress:Float->Void;
|
||||
|
|
@ -32,7 +33,7 @@ class LoadingGui extends GuiImage {
|
|||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
|
||||
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
|
||||
var domcasual32 = domcasual32b.toSdfFont(26, MultiChannel);
|
||||
var domcasual32 = domcasual32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var mapName = new GuiText(domcasual32);
|
||||
mapName.position = new Vector(134, 78);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import gui.GuiControl.MouseState;
|
|||
import hxd.res.BitmapFont;
|
||||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.Settings;
|
||||
|
||||
class MainMenuGui extends GuiImage {
|
||||
public function new() {
|
||||
|
|
@ -13,7 +14,7 @@ class MainMenuGui extends GuiImage {
|
|||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
|
||||
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
|
||||
var domcasual32 = domcasual32b.toSdfFont(26, MultiChannel);
|
||||
var domcasual32 = domcasual32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
||||
|
||||
this.horizSizing = Width;
|
||||
this.vertSizing = Height;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import src.MarbleGame;
|
|||
import hxd.res.BitmapFont;
|
||||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.Settings;
|
||||
|
||||
class MessageBoxYesNoDlg extends GuiControl {
|
||||
public function new(text:String, yesFunc:Void->Void, noFunc:Void->Void) {
|
||||
|
|
@ -16,7 +17,7 @@ class MessageBoxYesNoDlg extends GuiControl {
|
|||
var domcasual24fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
var domcasual24b = new BitmapFont(domcasual24fontdata.entry);
|
||||
@:privateAccess domcasual24b.loader = ResourceLoader.loader;
|
||||
var domcasual24 = domcasual24b.toSdfFont(20, MultiChannel);
|
||||
var domcasual24 = domcasual24b.toSdfFont(cast 20 * Settings.uiScale, MultiChannel);
|
||||
|
||||
function loadButtonImages(path:String) {
|
||||
var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import src.MarbleGame;
|
|||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.Util;
|
||||
import src.Settings;
|
||||
|
||||
class OptionsDlg extends GuiImage {
|
||||
var musicSliderFunc:(dt:Float, mouseState:MouseState) -> Void;
|
||||
|
|
@ -26,7 +27,7 @@ class OptionsDlg extends GuiImage {
|
|||
var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt");
|
||||
var arial14b = new BitmapFont(arial14fontdata.entry);
|
||||
@:privateAccess arial14b.loader = ResourceLoader.loader;
|
||||
var arial14 = arial14b.toSdfFont(12, MultiChannel);
|
||||
var arial14 = arial14b.toSdfFont(cast 12 * Settings.uiScale, MultiChannel);
|
||||
|
||||
function loadButtonImages(path:String) {
|
||||
var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import src.MarbleGame;
|
|||
import src.Resource;
|
||||
import hxd.res.Sound;
|
||||
import h3d.mat.Texture;
|
||||
import src.Settings;
|
||||
|
||||
class PlayGui {
|
||||
var scene2d:h2d.Scene;
|
||||
|
|
@ -298,7 +299,7 @@ class PlayGui {
|
|||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
|
||||
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
|
||||
var bfont = domcasual32b.toSdfFont(26, MultiChannel);
|
||||
var bfont = domcasual32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var helpTextCtrl = new GuiControl();
|
||||
helpTextCtrl.position = new Vector(0, 210);
|
||||
|
|
|
|||
|
|
@ -128,19 +128,19 @@ class PlayMissionGui extends GuiImage {
|
|||
var domcasual24fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
var domcasual24b = new BitmapFont(domcasual24fontdata.entry);
|
||||
@:privateAccess domcasual24b.loader = ResourceLoader.loader;
|
||||
var domcasual24 = domcasual24b.toSdfFont(20, MultiChannel);
|
||||
var domcasual24 = domcasual24b.toSdfFont(cast 20 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var domcasual32 = domcasual24b.toSdfFont(26, MultiChannel);
|
||||
var domcasual32 = domcasual24b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt");
|
||||
var arial14b = new BitmapFont(arial14fontdata.entry);
|
||||
@:privateAccess arial14b.loader = ResourceLoader.loader;
|
||||
var arial14 = arial14b.toSdfFont(12, MultiChannel);
|
||||
var arial14 = arial14b.toSdfFont(cast 12 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var arialb14fontdata = ResourceLoader.getFileEntry("data/font/Arial Bold.fnt");
|
||||
var arialb14b = new BitmapFont(arialb14fontdata.entry);
|
||||
@:privateAccess arialb14b.loader = ResourceLoader.loader;
|
||||
var arialBold14 = arialb14b.toSdfFont(12, MultiChannel);
|
||||
var arialBold14 = arialb14b.toSdfFont(cast 12 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var levelBkgnd = new GuiText(domcasual24);
|
||||
levelBkgnd.position = new Vector(5, 156);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import gui.GuiControl.MouseState;
|
|||
import hxd.res.BitmapFont;
|
||||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.Settings;
|
||||
|
||||
class RemapDlg extends GuiControl {
|
||||
var remapCallback:Int->Void;
|
||||
|
|
@ -27,7 +28,7 @@ class RemapDlg extends GuiControl {
|
|||
var domcasual24b = new BitmapFont(domcasual24fontdata.entry);
|
||||
@:privateAccess domcasual24b.loader = ResourceLoader.loader;
|
||||
|
||||
var domcasual24 = domcasual24b.toSdfFont(20, MultiChannel);
|
||||
var domcasual24 = domcasual24b.toSdfFont(cast 20 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var remapText = new GuiMLText(domcasual24, null);
|
||||
remapText.horizSizing = Center;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue