diff --git a/data/font/Arial Bold.fnt b/data/font/Arial Bold.fnt
index 27bc6b3d..7044fbd4 100644
--- a/data/font/Arial Bold.fnt
+++ b/data/font/Arial Bold.fnt
@@ -3,7 +3,7 @@
-
+
diff --git a/data/font/Arial Bold.ttf b/data/font/Arial Bold.ttf
new file mode 100644
index 00000000..a6037e68
Binary files /dev/null and b/data/font/Arial Bold.ttf differ
diff --git a/data/font/ArialBold.png b/data/font/ArialBold.png
new file mode 100644
index 00000000..4b2dfc9a
Binary files /dev/null and b/data/font/ArialBold.png differ
diff --git a/data/font/ArialBoldSDF.png b/data/font/ArialBoldSDF.png
deleted file mode 100644
index f67c8306..00000000
Binary files a/data/font/ArialBoldSDF.png and /dev/null differ
diff --git a/data/font/charset.txt b/data/font/charset.txt
new file mode 100644
index 00000000..e7c1ad9f
--- /dev/null
+++ b/data/font/charset.txt
@@ -0,0 +1 @@
+QWERTYUIOPASDFGHJKLZXCVBNM1234567890-=!@#$%^&*()_+`~[]\{}|;':",./<>? Âqwertyuiopasdfghjklzxcvbnm
\ No newline at end of file
diff --git a/data/tmp/cache.dat b/data/tmp/cache.dat
index 55f76b83..972b9c2f 100644
--- a/data/tmp/cache.dat
+++ b/data/tmp/cache.dat
@@ -1 +1 @@
-by30:data%2Ffont%2FArial%20Bold.fntaoy3:outy44:data%2Ftmp%2Fdata%2Ffont%2FArial%20Bold.bfnty3:veri1y4:hashy40:dce4a5edf92262f9ea5540d55271f8423683d064y4:timei1659272757ghy21:font%2FDomCasualD.fntaoR1y28:tmp%2Ffont%2FDomCasualD.bfntR3i1R4y40:ea40ffbf969a51d3e653a3d09b450143a814c7eeR6i1659272757ghy16:font%2FEXPON.fntaoR1y23:tmp%2Ffont%2FEXPON.bfntR3i1R4y40:ba8ecd55d9475ee0f9d20c9a5189fe6a9c9ff727R6i1659272757ghy27:font%2FLucida%20Console.fntaoR1y34:tmp%2Ffont%2FLucida%20Console.bfntR3i1R4y40:b56483df1b8f3d8472856b51459d5ce8f3cdfa09R6i1685983312ghy28:data%2Ffont%2FColiseumRR.fntaoR4y40:fbeaa449cc1d1c48a6a9cc0eae47fabe1a2aad69R1y42:data%2Ftmp%2Fdata%2Ffont%2FColiseumRR.bfntR6i1687283656R3i1ghy23:font%2FArial%20Bold.fntaoR1y30:tmp%2Ffont%2FArial%20Bold.bfntR3i1R4R5R6i1659272757ghy28:data%2Ffont%2FMarkerFelt.fntaoR1y42:data%2Ftmp%2Fdata%2Ffont%2FMarkerFelt.bfntR3i1R4y40:eb239790210478413cc111da54400b3d38aba041R6i1685983312ghy16:font%2Farial.fntaoR1y23:tmp%2Ffont%2Farial.bfntR3i1R4y40:dc7f069d72e0d1b6b7edfd5b9e6af9c22f9c641cR6i1659272757ghy28:data%2Ffont%2FDomCasualD.fntaoR1y42:data%2Ftmp%2Fdata%2Ffont%2FDomCasualD.bfntR3i1R4R9R6i1659272757ghy34:data%2Ffont%2FLucida%20Console.fntaoR1y48:data%2Ftmp%2Fdata%2Ffont%2FLucida%20Console.bfntR3i1R4R15R6i1685983312ghy21:font%2FMarkerFelt.fntaoR1y28:tmp%2Ffont%2FMarkerFelt.bfntR3i1R4R23R6i1685983312ghy23:data%2Ffont%2FEXPON.fntaoR1y37:data%2Ftmp%2Fdata%2Ffont%2FEXPON.bfntR3i1R4R12R6i1659272757ghy23:data%2Ffont%2Farial.fntaoR1y37:data%2Ftmp%2Fdata%2Ffont%2Farial.bfntR3i1R4R26R6i1659272757ghh
\ No newline at end of file
+by27:font%2FLucida%20Console.fntaoy3:outy34:tmp%2Ffont%2FLucida%20Console.bfnty3:veri1y4:hashy40:b56483df1b8f3d8472856b51459d5ce8f3cdfa09y4:timei1685983312ghy16:font%2FEXPON.fntaoR1y23:tmp%2Ffont%2FEXPON.bfntR3i1R4y40:ba8ecd55d9475ee0f9d20c9a5189fe6a9c9ff727R6i1659272757ghy21:font%2FDomCasualD.fntaoR1y28:tmp%2Ffont%2FDomCasualD.bfntR3i1R4y40:ea40ffbf969a51d3e653a3d09b450143a814c7eeR6i1659272757ghy30:data%2Ffont%2FArial%20Bold.fntaoR1y44:data%2Ftmp%2Fdata%2Ffont%2FArial%20Bold.bfntR3i1R4y40:b6ce44ca1a3f30e3054e3de6daccf1144e31ee94R6i1687370373ghy28:data%2Ffont%2FColiseumRR.fntaoR1y42:data%2Ftmp%2Fdata%2Ffont%2FColiseumRR.bfntR3i1R4y40:fbeaa449cc1d1c48a6a9cc0eae47fabe1a2aad69R6i1687283656ghy23:font%2FArial%20Bold.fntaoR1y30:tmp%2Ffont%2FArial%20Bold.bfntR3i1R4y40:dce4a5edf92262f9ea5540d55271f8423683d064R6i1659272757ghy28:data%2Ffont%2FMarkerFelt.fntaoR1y42:data%2Ftmp%2Fdata%2Ffont%2FMarkerFelt.bfntR3i1R4y40:eb239790210478413cc111da54400b3d38aba041R6i1685983312ghy16:font%2Farial.fntaoR1y23:tmp%2Ffont%2Farial.bfntR3i1R4y40:dc7f069d72e0d1b6b7edfd5b9e6af9c22f9c641cR6i1659272757ghy21:font%2FMarkerFelt.fntaoR1y28:tmp%2Ffont%2FMarkerFelt.bfntR3i1R4R24R6i1685983312ghy34:data%2Ffont%2FLucida%20Console.fntaoR1y48:data%2Ftmp%2Fdata%2Ffont%2FLucida%20Console.bfntR3i1R4R5R6i1685983312ghy28:data%2Ffont%2FDomCasualD.fntaoR1y42:data%2Ftmp%2Fdata%2Ffont%2FDomCasualD.bfntR3i1R4R12R6i1659272757ghy23:data%2Ffont%2Farial.fntaoR1y37:data%2Ftmp%2Fdata%2Ffont%2Farial.bfntR3i1R4R27R6i1659272757ghy23:data%2Ffont%2FEXPON.fntaoR1y37:data%2Ftmp%2Fdata%2Ffont%2FEXPON.bfntR3i1R4R9R6i1659272757ghh
\ No newline at end of file
diff --git a/data/tmp/data/font/Arial Bold.bfnt b/data/tmp/data/font/Arial Bold.bfnt
index 105b3fb4..58c20280 100644
Binary files a/data/tmp/data/font/Arial Bold.bfnt and b/data/tmp/data/font/Arial Bold.bfnt differ
diff --git a/src/MarbleGame.hx b/src/MarbleGame.hx
index 444f65f6..785f64f8 100644
--- a/src/MarbleGame.hx
+++ b/src/MarbleGame.hx
@@ -213,7 +213,8 @@ class MarbleGame {
var mouseState:MouseState = {
position: new Vector(canvas.scene2d.mouseX, canvas.scene2d.mouseY),
- wheel: _mouseWheelDelta
+ wheel: _mouseWheelDelta,
+ handled: false
}
ProfilerUI.measure("canvasUpdate");
canvas.update(dt, mouseState);
diff --git a/src/gui/ExitGameDlg.hx b/src/gui/ExitGameDlg.hx
index dea0af32..6adb94f1 100644
--- a/src/gui/ExitGameDlg.hx
+++ b/src/gui/ExitGameDlg.hx
@@ -26,16 +26,19 @@ class ExitGameDlg extends GuiImage {
return [normal, hover, pressed];
}
- var innerCtrl = new GuiControl();
- innerCtrl.position = new Vector(320, 180);
- innerCtrl.extent = new Vector(1280, 720);
-
var scene2d = MarbleGame.canvas.scene2d;
- // var subX = 640 - (scene2d.width - 145 * 2) * 640 g/ scene2d.width;
- // var subY = 480 - (scene2d.height - 82 * 2) * 480 / scene2d.height;
+ var offsetX = (scene2d.width - 1280) / 2;
+ var offsetY = (scene2d.height - 720) / 2;
- // innerCtrl.extent = new Vector(640 - subX, 480 - subY);
+ var innerCtrl = new GuiControl();
+ innerCtrl.position = new Vector(offsetX, offsetY);
+ // innerCtrl.extent = new Vector(640, 480);
+
+ var subX = 640 - (scene2d.width - offsetX * 2) * 640 / scene2d.width;
+ var subY = 480 - (scene2d.height - offsetY * 2) * 480 / scene2d.height;
+
+ innerCtrl.extent = new Vector(640 - subX, 480 - subY);
innerCtrl.horizSizing = Width;
innerCtrl.vertSizing = Height;
this.addChild(innerCtrl);
@@ -61,50 +64,18 @@ class ExitGameDlg extends GuiImage {
levelTitle.text.text = 'Level ${MarbleGame.instance.world.mission.index + 1}';
innerCtrl.addChild(levelTitle);
- var dialogImg = new GuiImage(ResourceLoader.getResource("data/ui/common/dialog.png", ResourceLoader.getImage, this.imageResources).toTile());
- dialogImg.horizSizing = Center;
- dialogImg.vertSizing = Center;
- dialogImg.position = new Vector(162, 160);
+ var btnList = new GuiXboxList();
+ btnList.position = new Vector(70, 95);
+ btnList.horizSizing = Left;
+ btnList.extent = new Vector(502, 500);
+ innerCtrl.addChild(btnList);
- dialogImg.extent = new Vector(315, 160);
-
- var overlay = new GuiImage(ResourceLoader.getResource("data/ui/common/quitfromthislvl_overlay.png", ResourceLoader.getImage, this.imageResources)
- .toTile());
- overlay.horizSizing = Right;
- overlay.vertSizing = Bottom;
- overlay.position = new Vector(36, 22);
- overlay.extent = new Vector(235, 42);
-
- var yesButton = new GuiButton(loadButtonImages("data/ui/common/yes"));
- yesButton.position = new Vector(19, 103);
- yesButton.extent = new Vector(86, 40);
- yesButton.vertSizing = Top;
- yesButton.horizSizing = Right;
- yesButton.accelerator = hxd.Key.ENTER;
- yesButton.gamepadAccelerator = ["A"];
- yesButton.pressedAction = (sender) -> yesFunc(yesButton);
-
- var noButton = new GuiButton(loadButtonImages("data/ui/common/no"));
- noButton.position = new Vector(105, 102);
- noButton.extent = new Vector(86, 40);
- noButton.vertSizing = Top;
- noButton.horizSizing = Right;
- noButton.gamepadAccelerator = ["B"];
- noButton.pressedAction = (sender) -> noFunc(noButton);
-
- var restartButton = new GuiButton(loadButtonImages("data/ui/common/restart"));
- restartButton.position = new Vector(214, 104);
- restartButton.extent = new Vector(86, 40);
- restartButton.vertSizing = Top;
- restartButton.horizSizing = Right;
- restartButton.gamepadAccelerator = ["X"];
- restartButton.pressedAction = (sender) -> restartFunc(restartButton);
-
- dialogImg.addChild(overlay);
- dialogImg.addChild(yesButton);
- dialogImg.addChild(noButton);
- dialogImg.addChild(restartButton);
-
- this.addChild(dialogImg);
+ btnList.addButton(0, "Resume", (evt) -> noFunc(btnList));
+ btnList.addButton(0, "Restart", (evt) -> restartFunc(btnList));
+ btnList.addButton(4, "Exit Level", (evt) -> yesFunc(btnList));
+ btnList.addButton(3, "Help & Options", (evt) -> {}, 20);
+ btnList.addButton(2, "Leaderboards", (evt) -> {});
+ btnList.addButton(2, "Achievements", (evt) -> {});
+ btnList.addButton(4, "Main Menu", (evt) -> yesFunc(btnList));
}
}
diff --git a/src/gui/GuiControl.hx b/src/gui/GuiControl.hx
index b96ce262..2a05fc62 100644
--- a/src/gui/GuiControl.hx
+++ b/src/gui/GuiControl.hx
@@ -36,6 +36,7 @@ typedef MouseState = {
var position:Vector;
var ?button:Int;
var ?wheel:Float;
+ var handled:Bool;
}
@:publicFields
@@ -120,47 +121,67 @@ class GuiControl {
if (Key.isPressed(Key.MOUSE_LEFT)) {
mouseState.button = Key.MOUSE_LEFT;
this.onMousePress(mouseState);
+ if (mouseState.handled)
+ return;
}
if (Key.isPressed(Key.MOUSE_RIGHT)) {
mouseState.button = Key.MOUSE_RIGHT;
this.onMousePress(mouseState);
+ if (mouseState.handled)
+ return;
}
if (Key.isReleased(Key.MOUSE_LEFT)) {
mouseState.button = Key.MOUSE_LEFT;
this.onMouseRelease(mouseState);
+ if (mouseState.handled)
+ return;
}
if (Key.isReleased(Key.MOUSE_RIGHT)) {
mouseState.button = Key.MOUSE_RIGHT;
this.onMouseRelease(mouseState);
+ if (mouseState.handled)
+ return;
}
if (Key.isDown(Key.MOUSE_LEFT)) {
mouseState.button = Key.MOUSE_LEFT;
this.onMouseDown(mouseState);
+ if (mouseState.handled)
+ return;
}
if (Key.isDown(Key.MOUSE_RIGHT)) {
mouseState.button = Key.MOUSE_RIGHT;
this.onMouseDown(mouseState);
+ if (mouseState.handled)
+ return;
}
if (!_entered) {
_entered = true;
this.onMouseEnter(mouseState);
+ if (mouseState.handled)
+ return;
}
if (_entered) {
if (this._mousePos != null) {
if (!this._mousePos.equals(mouseState.position)) {
this.onMouseMove(mouseState);
this._mousePos = mouseState.position.clone();
+ if (mouseState.handled)
+ return;
}
} else {
this._mousePos = mouseState.position.clone();
this.onMouseMove(mouseState);
+ if (mouseState.handled)
+ return;
}
}
} else {
if (_entered) {
_entered = false;
this.onMouseLeave(mouseState);
+ if (mouseState.handled)
+ return;
}
}
} else {
diff --git a/src/gui/GuiXboxList.hx b/src/gui/GuiXboxList.hx
new file mode 100644
index 00000000..fa173b3c
--- /dev/null
+++ b/src/gui/GuiXboxList.hx
@@ -0,0 +1,20 @@
+package gui;
+
+import h3d.Vector;
+
+class GuiXboxList extends GuiControl {
+ var currentOffset:Float = 0;
+
+ public function new() {
+ super();
+ }
+
+ public function addButton(icon:Int, name:String, func:GuiEvent->Void, addOffset:Float = 0) {
+ var btn = new GuiXboxListButton(icon, name);
+ btn.position = new Vector(0, currentOffset + addOffset);
+ btn.extent = new Vector(502, 94);
+ btn.pressedAction = func;
+ this.addChild(btn);
+ currentOffset += 60 + addOffset;
+ }
+}
diff --git a/src/gui/GuiXboxListButton.hx b/src/gui/GuiXboxListButton.hx
new file mode 100644
index 00000000..56d260e5
--- /dev/null
+++ b/src/gui/GuiXboxListButton.hx
@@ -0,0 +1,132 @@
+package gui;
+
+import h3d.Matrix;
+import hxd.Key;
+import gui.GuiControl.MouseState;
+import hxd.res.BitmapFont;
+import h3d.Vector;
+import src.ResourceLoader;
+import src.Settings;
+import src.Gamepad;
+import src.AudioManager;
+
+class GuiXboxListButton extends GuiControl {
+ var button:GuiAnim;
+ var buttonIcon:GuiAnim;
+ var buttonText:GuiText;
+
+ public var pressedAction:GuiEvent->Void = null;
+
+ public var disabled:Bool = false;
+
+ public var pressed:Bool = false;
+
+ public var buttonSounds:Bool = true;
+
+ public var accelerator:Int = 0;
+ public var gamepadAccelerator:Array = [];
+ public var acceleratorWasPressed = false;
+
+ public function new(icon:Int, text:String) {
+ super();
+
+ var buttonImage = ResourceLoader.getResource("data/ui/xbox/cursorArray.png", ResourceLoader.getImage, this.imageResources).toTile();
+ var buttonDefault = buttonImage.sub(0, 2, 502, 94);
+ var buttonHover = buttonImage.sub(0, 98, 502, 94);
+ var buttonIconImg = buttonImage.sub(74 * icon, 219, 36, 36);
+ var buttonIconPressed = buttonImage.sub(74 * icon + 37, 219, 36, 36);
+
+ var cmat = Matrix.I();
+ cmat.colorGain(0x7F7F7F, 1);
+ // cmat._44 = 1;
+ var shadeFilter = new h2d.filter.ColorMatrix(cmat);
+ shadeFilter.enable = false;
+
+ button = new GuiAnim([buttonDefault, buttonHover]);
+ button.position = new Vector(0, 0);
+ button.extent = new Vector(502, 94);
+ button.anim.filter = shadeFilter;
+ this.addChild(button);
+
+ buttonIcon = new GuiAnim([buttonIconImg, buttonIconPressed]);
+ buttonIcon.position = new Vector(42, 30);
+ buttonIcon.extent = new Vector(36, 36);
+ this.addChild(buttonIcon);
+
+ var arial14fontdata = ResourceLoader.getFileEntry("data/font/Arial Bold.fnt");
+ var arial14b = new BitmapFont(arial14fontdata.entry);
+ @:privateAccess arial14b.loader = ResourceLoader.loader;
+ var arial14 = arial14b.toSdfFont(cast 26 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel);
+
+ buttonText = new GuiText(arial14);
+ buttonText.position = new Vector(92, 36);
+ buttonText.extent = new Vector(92, 35);
+ buttonText.vertSizing = Top;
+ buttonText.text.text = text;
+ buttonText.text.textColor = 0x787878;
+ this.addChild(buttonText);
+ }
+
+ public override function update(dt:Float, mouseState:MouseState) {
+ var renderRect = getHitTestRect();
+ renderRect.position = renderRect.position.add(new Vector(24, 20)); // Offset
+ renderRect.extent.set(439, 53);
+ if (renderRect.inRect(mouseState.position) && !disabled) {
+ if (buttonSounds && Key.isPressed(Key.MOUSE_LEFT)) {
+ AudioManager.playSound(ResourceLoader.getResource("data/sound/buttonpress.wav", ResourceLoader.getAudio, this.soundResources));
+ }
+ }
+ if (renderRect.inRect(mouseState.position) && !disabled) {
+ if (Key.isDown(Key.MOUSE_LEFT)) {
+ this.button.anim.currentFrame = 1;
+ this.buttonIcon.anim.currentFrame = 1;
+ buttonText.text.textColor = 0x101010;
+ button.anim.filter.enable = true;
+ pressed = true;
+ } else {
+ this.button.anim.currentFrame = 1;
+ this.buttonIcon.anim.currentFrame = 1;
+ buttonText.text.textColor = 0x101010;
+ button.anim.filter.enable = false;
+ pressed = false;
+ }
+ } else {
+ this.button.anim.currentFrame = disabled ? 3 : 0;
+ this.buttonIcon.anim.currentFrame = 0;
+ this.buttonText.text.textColor = 0x787878;
+ button.anim.filter.enable = false;
+ pressed = false;
+ }
+ if (!disabled) {
+ if (acceleratorWasPressed && (accelerator != 0 && hxd.Key.isReleased(accelerator)) || Gamepad.isReleased(gamepadAccelerator)) {
+ if (this.pressedAction != null) {
+ this.pressedAction(new GuiEvent(this));
+ }
+ } else if ((accelerator != 0 && hxd.Key.isPressed(accelerator)) || Gamepad.isPressed(gamepadAccelerator)) {
+ acceleratorWasPressed = true;
+ }
+ }
+ if (acceleratorWasPressed) {
+ if ((accelerator != 0 && hxd.Key.isReleased(accelerator)) || Gamepad.isReleased(gamepadAccelerator))
+ acceleratorWasPressed = false;
+ }
+ super.update(dt, mouseState);
+ }
+
+ public override function onMouseRelease(mouseState:MouseState) {
+ mouseState.handled = true;
+ super.onMouseRelease(mouseState);
+ if (this.pressedAction != null && !disabled) {
+ this.pressedAction(new GuiEvent(this));
+ }
+ }
+
+ public override function onMouseEnter(mouseState:MouseState) {
+ mouseState.handled = true;
+ super.onMouseEnter(mouseState);
+
+ if (buttonSounds && !disabled) {
+ AudioManager.playSound(ResourceLoader.getResource("data/sound/buttonover.wav", ResourceLoader.getAudio, this.soundResources));
+ }
+ }
+}
diff --git a/src/gui/PlayGui.hx b/src/gui/PlayGui.hx
index 77e73477..998c6184 100644
--- a/src/gui/PlayGui.hx
+++ b/src/gui/PlayGui.hx
@@ -109,11 +109,14 @@ class PlayGui {
playGuiCtrlOuter.horizSizing = Width;
playGuiCtrlOuter.vertSizing = Height;
- playGuiCtrl = new GuiControl();
- playGuiCtrl.position = new Vector(145, 82);
+ var safeVerMargin = 1 + (scene2d.height * 0.15) / 2;
+ var safeHorMargin = 1 + (scene2d.width * 0.15) / 2;
- var subX = 640 - (scene2d.width - 145 * 2) * 640 / scene2d.width;
- var subY = 480 - (scene2d.height - 82 * 2) * 480 / scene2d.height;
+ playGuiCtrl = new GuiControl();
+ playGuiCtrl.position = new Vector(safeHorMargin, safeVerMargin);
+
+ var subX = 640 - (scene2d.width - safeHorMargin * 2) * 640 / scene2d.width;
+ var subY = 480 - (scene2d.height - safeVerMargin * 2) * 480 / scene2d.height;
playGuiCtrl.extent = new Vector(640 - subX, 480 - subY);
playGuiCtrl.horizSizing = Width;
@@ -160,65 +163,67 @@ class PlayGui {
}
public function initTimer() {
+ var safeVerMargin = 1 + (scene2d.height * 0.15) / 2;
+
var timerCtrl = new GuiImage(ResourceLoader.getResource('data/ui/game/timebackdrop0.png', ResourceLoader.getImage, this.imageResources).toTile());
timerCtrl.position = new Vector(215, 0);
timerCtrl.extent = new Vector(256, 64);
timerCtrl.horizSizing = Center;
- timerCtrl.xScale = (scene2d.height - 82 * 2) / 480;
- timerCtrl.yScale = (scene2d.height - 82 * 2) / 480;
+ timerCtrl.xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ timerCtrl.yScale = (scene2d.height - safeVerMargin * 2) / 480;
var innerCtrl = new GuiControl();
innerCtrl.position = new Vector(26, 0);
innerCtrl.extent = new Vector(256, 64);
- innerCtrl.xScale = (scene2d.height - 82 * 2) / 480;
- innerCtrl.yScale = (scene2d.height - 82 * 2) / 480;
+ innerCtrl.xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ innerCtrl.yScale = (scene2d.height - safeVerMargin * 2) / 480;
timerCtrl.addChild(innerCtrl);
timerNumbers[0].position = new Vector(20, 4);
timerNumbers[0].extent = new Vector(43, 55);
- timerNumbers[0].xScale = (scene2d.height - 82 * 2) / 480;
- timerNumbers[0].yScale = (scene2d.height - 82 * 2) / 480;
+ timerNumbers[0].xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ timerNumbers[0].yScale = (scene2d.height - safeVerMargin * 2) / 480;
timerNumbers[1].position = new Vector(40, 4);
timerNumbers[1].extent = new Vector(43, 55);
- timerNumbers[1].xScale = (scene2d.height - 82 * 2) / 480;
- timerNumbers[1].yScale = (scene2d.height - 82 * 2) / 480;
+ timerNumbers[1].xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ timerNumbers[1].yScale = (scene2d.height - safeVerMargin * 2) / 480;
var colonCols = ResourceLoader.getResource('data/ui/game/numbers/colon.png', ResourceLoader.getImage, this.imageResources).toTile();
timerColon = new GuiImage(colonCols);
timerColon.position = new Vector(55, 4);
timerColon.extent = new Vector(43, 55);
- timerColon.xScale = (scene2d.height - 82 * 2) / 480;
- timerColon.yScale = (scene2d.height - 82 * 2) / 480;
+ timerColon.xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ timerColon.yScale = (scene2d.height - safeVerMargin * 2) / 480;
timerNumbers[2].position = new Vector(70, 4);
timerNumbers[2].extent = new Vector(43, 55);
- timerNumbers[2].xScale = (scene2d.height - 82 * 2) / 480;
- timerNumbers[2].yScale = (scene2d.height - 82 * 2) / 480;
+ timerNumbers[2].xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ timerNumbers[2].yScale = (scene2d.height - safeVerMargin * 2) / 480;
timerNumbers[3].position = new Vector(90, 4);
timerNumbers[3].extent = new Vector(43, 55);
- timerNumbers[3].xScale = (scene2d.height - 82 * 2) / 480;
- timerNumbers[3].yScale = (scene2d.height - 82 * 2) / 480;
+ timerNumbers[3].xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ timerNumbers[3].yScale = (scene2d.height - safeVerMargin * 2) / 480;
var pointCols = ResourceLoader.getResource('data/ui/game/numbers/point.png', ResourceLoader.getImage, this.imageResources).toTile();
timerPoint = new GuiImage(pointCols);
timerPoint.position = new Vector(105, 4);
timerPoint.extent = new Vector(43, 55);
- timerPoint.xScale = (scene2d.height - 82 * 2) / 480;
- timerPoint.yScale = (scene2d.height - 82 * 2) / 480;
+ timerPoint.xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ timerPoint.yScale = (scene2d.height - safeVerMargin * 2) / 480;
timerNumbers[4].position = new Vector(120, 4);
timerNumbers[4].extent = new Vector(43, 55);
- timerNumbers[4].xScale = (scene2d.height - 82 * 2) / 480;
- timerNumbers[4].yScale = (scene2d.height - 82 * 2) / 480;
+ timerNumbers[4].xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ timerNumbers[4].yScale = (scene2d.height - safeVerMargin * 2) / 480;
timerNumbers[5].position = new Vector(140, 4);
timerNumbers[5].extent = new Vector(43, 55);
- timerNumbers[5].xScale = (scene2d.height - 82 * 2) / 480;
- timerNumbers[5].yScale = (scene2d.height - 82 * 2) / 480;
+ timerNumbers[5].xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ timerNumbers[5].yScale = (scene2d.height - safeVerMargin * 2) / 480;
timerNumbers[6].position = new Vector(191, 0);
timerNumbers[6].extent = new Vector(43, 55);
@@ -248,60 +253,62 @@ class PlayGui {
}
public function initGemCounter() {
+ var safeVerMargin = 1 + (scene2d.height * 0.15) / 2;
+
var gemBox = new GuiControl();
gemBox.position = new Vector(0, 0);
gemBox.extent = new Vector(300, 200);
- gemBox.xScale = (scene2d.height - 82 * 2) / 480;
- gemBox.yScale = (scene2d.height - 82 * 2) / 480;
+ gemBox.xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ gemBox.yScale = (scene2d.height - safeVerMargin * 2) / 480;
var innerCtrl = new GuiControl();
innerCtrl.position = new Vector(26, 0);
innerCtrl.extent = new Vector(256, 64);
- innerCtrl.xScale = (scene2d.height - 82 * 2) / 480;
- innerCtrl.yScale = (scene2d.height - 82 * 2) / 480;
+ innerCtrl.xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ innerCtrl.yScale = (scene2d.height - safeVerMargin * 2) / 480;
gemBox.addChild(innerCtrl);
gemCountNumbers[0].position = new Vector(20, 4);
gemCountNumbers[0].extent = new Vector(43, 55);
- gemCountNumbers[0].xScale = (scene2d.height - 82 * 2) / 480;
- gemCountNumbers[0].yScale = (scene2d.height - 82 * 2) / 480;
+ gemCountNumbers[0].xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ gemCountNumbers[0].yScale = (scene2d.height - safeVerMargin * 2) / 480;
gemCountNumbers[1].position = new Vector(38, 4);
gemCountNumbers[1].extent = new Vector(43, 55);
- gemCountNumbers[1].xScale = (scene2d.height - 82 * 2) / 480;
- gemCountNumbers[1].yScale = (scene2d.height - 82 * 2) / 480;
+ gemCountNumbers[1].xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ gemCountNumbers[1].yScale = (scene2d.height - safeVerMargin * 2) / 480;
gemCountNumbers[2].position = new Vector(56, 4);
gemCountNumbers[2].extent = new Vector(43, 55);
- gemCountNumbers[2].xScale = (scene2d.height - 82 * 2) / 480;
- gemCountNumbers[2].yScale = (scene2d.height - 82 * 2) / 480;
+ gemCountNumbers[2].xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ gemCountNumbers[2].yScale = (scene2d.height - safeVerMargin * 2) / 480;
gemCountSlash = new GuiImage(ResourceLoader.getResource('data/ui/game/numbers/slash.png', ResourceLoader.getImage, this.imageResources).toTile());
gemCountSlash.position = new Vector(73, 4);
gemCountSlash.extent = new Vector(43, 55);
- gemCountSlash.xScale = (scene2d.height - 82 * 2) / 480;
- gemCountSlash.yScale = (scene2d.height - 82 * 2) / 480;
+ gemCountSlash.xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ gemCountSlash.yScale = (scene2d.height - safeVerMargin * 2) / 480;
gemCountNumbers[3].position = new Vector(89, 4);
gemCountNumbers[3].extent = new Vector(43, 55);
- gemCountNumbers[3].xScale = (scene2d.height - 82 * 2) / 480;
- gemCountNumbers[3].yScale = (scene2d.height - 82 * 2) / 480;
+ gemCountNumbers[3].xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ gemCountNumbers[3].yScale = (scene2d.height - safeVerMargin * 2) / 480;
gemCountNumbers[4].position = new Vector(107, 4);
gemCountNumbers[4].extent = new Vector(43, 55);
- gemCountNumbers[4].xScale = (scene2d.height - 82 * 2) / 480;
- gemCountNumbers[4].yScale = (scene2d.height - 82 * 2) / 480;
+ gemCountNumbers[4].xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ gemCountNumbers[4].yScale = (scene2d.height - safeVerMargin * 2) / 480;
gemCountNumbers[5].position = new Vector(125, 4);
gemCountNumbers[5].extent = new Vector(43, 55);
- gemCountNumbers[5].xScale = (scene2d.height - 82 * 2) / 480;
- gemCountNumbers[5].yScale = (scene2d.height - 82 * 2) / 480;
+ gemCountNumbers[5].xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ gemCountNumbers[5].yScale = (scene2d.height - safeVerMargin * 2) / 480;
gemHUD = new GuiImage(ResourceLoader.getResource('data/ui/game/gem.png', ResourceLoader.getImage, this.imageResources).toTile());
gemHUD.position = new Vector(144, 2);
gemHUD.extent = new Vector(64, 64);
- gemHUD.xScale = (scene2d.height - 82 * 2) / 480;
- gemHUD.yScale = (scene2d.height - 82 * 2) / 480;
+ gemHUD.xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ gemHUD.yScale = (scene2d.height - safeVerMargin * 2) / 480;
innerCtrl.addChild(gemCountNumbers[0]);
innerCtrl.addChild(gemCountNumbers[1]);
@@ -318,6 +325,8 @@ class PlayGui {
}
function initPowerupBox() {
+ var safeVerMargin = 1 + (scene2d.height * 0.15) / 2;
+
var powerupImgs = [
ResourceLoader.getResource('data/ui/game/pc/powerup.png', ResourceLoader.getImage, this.imageResources).toTile(),
ResourceLoader.getResource('data/ui/game/pc/powerup_copter.png', ResourceLoader.getImage, this.imageResources).toTile(),
@@ -332,8 +341,8 @@ class PlayGui {
powerupBox.extent = new Vector(170, 170);
powerupBox.horizSizing = Left;
powerupBox.vertSizing = Bottom;
- powerupBox.xScale = (scene2d.height - 82 * 2) / 480;
- powerupBox.yScale = (scene2d.height - 82 * 2) / 480;
+ powerupBox.xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ powerupBox.yScale = (scene2d.height - safeVerMargin * 2) / 480;
playGuiCtrl.addChild(powerupBox);
}
@@ -455,19 +464,21 @@ class PlayGui {
}
function initBlastBar() {
+ var safeVerMargin = 1 + (scene2d.height * 0.15) / 2;
+
blastBar = new GuiControl();
blastBar.position = new Vector(0, 400);
blastBar.extent = new Vector(170, 83);
blastBar.vertSizing = Bottom;
- blastBar.xScale = (scene2d.height - 82 * 2) / 480;
- blastBar.yScale = (scene2d.height - 82 * 2) / 480;
+ blastBar.xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ blastBar.yScale = (scene2d.height - safeVerMargin * 2) / 480;
this.playGuiCtrl.addChild(blastBar);
blastFill = new GuiImage(ResourceLoader.getResource("data/ui/game/powerbarMask.png", ResourceLoader.getImage, this.imageResources).toTile());
blastFill.position = new Vector(36, 38);
blastFill.extent = new Vector(100, 27);
- blastFill.xScale = (scene2d.height - 82 * 2) / 480;
- blastFill.yScale = (scene2d.height - 82 * 2) / 480;
+ blastFill.xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ blastFill.yScale = (scene2d.height - safeVerMargin * 2) / 480;
var colorMat = Matrix.I();
colorMat.colorSet(0x0080FF);
blastFill.bmp.filter = new h2d.filter.ColorMatrix(colorMat);
@@ -477,8 +488,8 @@ class PlayGui {
blastFillUltra = new GuiImage(ResourceLoader.getResource("data/ui/game/powerbarMask.png", ResourceLoader.getImage, this.imageResources).toTile());
blastFillUltra.position = new Vector(36, 38);
blastFillUltra.extent = new Vector(100, 27);
- blastFillUltra.xScale = (scene2d.height - 82 * 2) / 480;
- blastFillUltra.yScale = (scene2d.height - 82 * 2) / 480;
+ blastFillUltra.xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ blastFillUltra.yScale = (scene2d.height - safeVerMargin * 2) / 480;
var colorMat = Matrix.I();
colorMat.colorSet(0xC4FF00);
blastFillUltra.bmp.filter = new h2d.filter.ColorMatrix(colorMat);
@@ -488,8 +499,8 @@ class PlayGui {
blastFrame = new GuiImage(ResourceLoader.getResource("data/ui/game/pc/powerbar.png", ResourceLoader.getImage, this.imageResources).toTile());
blastFrame.position = new Vector(0, 0);
blastFrame.extent = new Vector(170, 83);
- blastFrame.xScale = (scene2d.height - 82 * 2) / 480;
- blastFrame.yScale = (scene2d.height - 82 * 2) / 480;
+ blastFrame.xScale = (scene2d.height - safeVerMargin * 2) / 480;
+ blastFrame.yScale = (scene2d.height - safeVerMargin * 2) / 480;
blastBar.addChild(blastFrame);
}