mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix ui scaling
This commit is contained in:
parent
41677fccc3
commit
5cb0abcd80
3 changed files with 17 additions and 12 deletions
|
|
@ -163,13 +163,13 @@ class GuiControl {
|
||||||
}
|
}
|
||||||
if (this.horizSizing == HorizSizing.Left) {
|
if (this.horizSizing == HorizSizing.Left) {
|
||||||
if (this.parent != null) {
|
if (this.parent != null) {
|
||||||
rect.position.x = parentRect.position.x + parentRect.extent.x - (parent.extent.x - this.position.x * uiScaleFactor);
|
rect.position.x = parentRect.position.x + parentRect.extent.x - (parent.extent.x - this.position.x) * uiScaleFactor;
|
||||||
rect.extent.x *= uiScaleFactor;
|
rect.extent.x *= uiScaleFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.vertSizing == VertSizing.Top) {
|
if (this.vertSizing == VertSizing.Top) {
|
||||||
if (this.parent != null) {
|
if (this.parent != null) {
|
||||||
rect.position.y = parentRect.position.y + parentRect.extent.y - (parent.extent.y - this.position.y * uiScaleFactor);
|
rect.position.y = parentRect.position.y + parentRect.extent.y - (parent.extent.y - this.position.y) * uiScaleFactor;
|
||||||
rect.extent.y *= uiScaleFactor;
|
rect.extent.y *= uiScaleFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import hxd.res.Sound;
|
||||||
import hxd.Key;
|
import hxd.Key;
|
||||||
import gui.GuiControl.MouseState;
|
import gui.GuiControl.MouseState;
|
||||||
import src.Util;
|
import src.Util;
|
||||||
|
import src.Settings;
|
||||||
|
|
||||||
class GuiSlider extends GuiImage {
|
class GuiSlider extends GuiImage {
|
||||||
public var sliderValue:Float = 0;
|
public var sliderValue:Float = 0;
|
||||||
|
|
@ -29,6 +30,7 @@ class GuiSlider extends GuiImage {
|
||||||
super.update(dt, mouseState);
|
super.update(dt, mouseState);
|
||||||
this.bmp.x = renderRect.position.x + renderRect.extent.x * sliderValue;
|
this.bmp.x = renderRect.position.x + renderRect.extent.x * sliderValue;
|
||||||
this.bmp.x = Util.clamp(this.bmp.x, renderRect.position.x, renderRect.position.x + renderRect.extent.x - bmp.width / 2);
|
this.bmp.x = Util.clamp(this.bmp.x, renderRect.position.x, renderRect.position.x + renderRect.extent.x - bmp.width / 2);
|
||||||
this.bmp.width = this.bmp.tile.width;
|
this.bmp.width = this.bmp.tile.width * Settings.uiScale;
|
||||||
|
super.update(dt, mouseState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -195,8 +195,9 @@ class PlayGui {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initCenterText() {
|
public function initCenterText() {
|
||||||
RSGOCenterText.x = scene2d.width / 2 - RSGOCenterText.frames[0].width / 2;
|
RSGOCenterText.x = scene2d.width / 2 - RSGOCenterText.frames[0].width * Settings.uiScale / 2;
|
||||||
RSGOCenterText.y = scene2d.height * 0.3; // - RSGOCenterText.frames[0].height / 2;
|
RSGOCenterText.y = scene2d.height * 0.3; // - RSGOCenterText.frames[0].height / 2;
|
||||||
|
RSGOCenterText.setScale(Settings.uiScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCenterText(identifier:String) {
|
public function setCenterText(identifier:String) {
|
||||||
|
|
@ -205,19 +206,19 @@ class PlayGui {
|
||||||
} else if (identifier == 'ready') {
|
} else if (identifier == 'ready') {
|
||||||
this.RSGOCenterText.visible = true;
|
this.RSGOCenterText.visible = true;
|
||||||
this.RSGOCenterText.currentFrame = 0;
|
this.RSGOCenterText.currentFrame = 0;
|
||||||
RSGOCenterText.x = scene2d.width / 2 - RSGOCenterText.frames[0].width / 2;
|
RSGOCenterText.x = scene2d.width / 2 - RSGOCenterText.frames[0].width * Settings.uiScale / 2;
|
||||||
} else if (identifier == 'set') {
|
} else if (identifier == 'set') {
|
||||||
this.RSGOCenterText.visible = true;
|
this.RSGOCenterText.visible = true;
|
||||||
this.RSGOCenterText.currentFrame = 1;
|
this.RSGOCenterText.currentFrame = 1;
|
||||||
RSGOCenterText.x = scene2d.width / 2 - RSGOCenterText.frames[1].width / 2;
|
RSGOCenterText.x = scene2d.width / 2 - RSGOCenterText.frames[1].width * Settings.uiScale / 2;
|
||||||
} else if (identifier == 'go') {
|
} else if (identifier == 'go') {
|
||||||
this.RSGOCenterText.visible = true;
|
this.RSGOCenterText.visible = true;
|
||||||
this.RSGOCenterText.currentFrame = 2;
|
this.RSGOCenterText.currentFrame = 2;
|
||||||
RSGOCenterText.x = scene2d.width / 2 - RSGOCenterText.frames[2].width / 2;
|
RSGOCenterText.x = scene2d.width / 2 - RSGOCenterText.frames[2].width * Settings.uiScale / 2;
|
||||||
} else if (identifier == 'outofbounds') {
|
} else if (identifier == 'outofbounds') {
|
||||||
this.RSGOCenterText.visible = true;
|
this.RSGOCenterText.visible = true;
|
||||||
this.RSGOCenterText.currentFrame = 3;
|
this.RSGOCenterText.currentFrame = 3;
|
||||||
RSGOCenterText.x = scene2d.width / 2 - RSGOCenterText.frames[3].width / 2;
|
RSGOCenterText.x = scene2d.width / 2 - RSGOCenterText.frames[3].width * Settings.uiScale / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -252,8 +253,9 @@ class PlayGui {
|
||||||
gemImageSceneTarget.depthBuffer = new DepthBuffer(60, 60);
|
gemImageSceneTarget.depthBuffer = new DepthBuffer(60, 60);
|
||||||
|
|
||||||
gemImageSceneTargetBitmap = new Bitmap(Tile.fromTexture(gemImageSceneTarget), scene2d);
|
gemImageSceneTargetBitmap = new Bitmap(Tile.fromTexture(gemImageSceneTarget), scene2d);
|
||||||
gemImageSceneTargetBitmap.x = -8;
|
gemImageSceneTargetBitmap.x = -8 * Settings.uiScale;
|
||||||
gemImageSceneTargetBitmap.y = -8;
|
gemImageSceneTargetBitmap.y = -8 * Settings.uiScale;
|
||||||
|
gemImageSceneTargetBitmap.setScale(Settings.uiScale);
|
||||||
// gemImageSceneTargetBitmap.blendMode = None;
|
// gemImageSceneTargetBitmap.blendMode = None;
|
||||||
// gemImageSceneTargetBitmap.addShader(new ColorKey());
|
// gemImageSceneTargetBitmap.addShader(new ColorKey());
|
||||||
|
|
||||||
|
|
@ -297,8 +299,9 @@ class PlayGui {
|
||||||
powerupImageSceneTarget.depthBuffer = new DepthBuffer(68, 67);
|
powerupImageSceneTarget.depthBuffer = new DepthBuffer(68, 67);
|
||||||
|
|
||||||
powerupImageSceneTargetBitmap = new Bitmap(Tile.fromTexture(powerupImageSceneTarget), scene2d);
|
powerupImageSceneTargetBitmap = new Bitmap(Tile.fromTexture(powerupImageSceneTarget), scene2d);
|
||||||
powerupImageSceneTargetBitmap.x = scene2d.width - 88;
|
powerupImageSceneTargetBitmap.x = scene2d.width - 88 * Settings.uiScale;
|
||||||
powerupImageSceneTargetBitmap.y = 18;
|
powerupImageSceneTargetBitmap.y = 18 * Settings.uiScale;
|
||||||
|
powerupImageSceneTargetBitmap.setScale(Settings.uiScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initTexts() {
|
function initTexts() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue