mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
basically rewrite the whole UI to allow better scrolling support
This commit is contained in:
parent
7fa0da4a9b
commit
1f7b117753
24 changed files with 355 additions and 144 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
-lib heaps
|
-lib heaps
|
||||||
-lib hlsdl
|
-lib hlsdl
|
||||||
-D highDPI
|
-D highDPI
|
||||||
|
-D flow_border
|
||||||
-D hlgen.makefile=vs2019
|
-D hlgen.makefile=vs2019
|
||||||
-hl native/marblegame.c
|
-hl native/marblegame.c
|
||||||
--main Main
|
--main Main
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
--js marblegame.js
|
--js marblegame.js
|
||||||
-D windowSize=1280x720
|
-D windowSize=1280x720
|
||||||
-D js-es=6
|
-D js-es=6
|
||||||
|
-D flow_border
|
||||||
-D highDPI
|
-D highDPI
|
||||||
--dce full
|
--dce full
|
||||||
--main Main
|
--main Main
|
||||||
|
|
@ -7,5 +7,6 @@
|
||||||
-D js-es=6
|
-D js-es=6
|
||||||
-D keep-inline-positions
|
-D keep-inline-positions
|
||||||
-D highDPI
|
-D highDPI
|
||||||
|
-D flow_border
|
||||||
--main Main
|
--main Main
|
||||||
-debug
|
-debug
|
||||||
|
|
@ -2,5 +2,6 @@
|
||||||
-lib heaps
|
-lib heaps
|
||||||
-lib hlsdl
|
-lib hlsdl
|
||||||
-D highDPI
|
-D highDPI
|
||||||
|
-D flow_border
|
||||||
-hl native/marblegame.c
|
-hl native/marblegame.c
|
||||||
--main Main
|
--main Main
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
-lib heaps
|
-lib heaps
|
||||||
-lib hlsdl
|
-lib hlsdl
|
||||||
-D highDPI
|
-D highDPI
|
||||||
|
-D flow_border
|
||||||
-hl native/marblegame.c
|
-hl native/marblegame.c
|
||||||
-D MACOS_BUNDLE
|
-D MACOS_BUNDLE
|
||||||
--main Main
|
--main Main
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@
|
||||||
-D windowSize=1280x720
|
-D windowSize=1280x720
|
||||||
-D keep-inline-positions
|
-D keep-inline-positions
|
||||||
-D highDPI
|
-D highDPI
|
||||||
|
-D flow_border
|
||||||
--main Main
|
--main Main
|
||||||
-debug
|
-debug
|
||||||
|
|
@ -114,8 +114,8 @@ class ConsoleDlg extends GuiControl {
|
||||||
Console.removeConsumer(onConsoleEntry);
|
Console.removeConsumer(onConsoleEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
super.render(scene2d);
|
super.render(scene2d, parent);
|
||||||
|
|
||||||
scroll.setScrollMax(consoleContent.text.textHeight);
|
scroll.setScrollMax(consoleContent.text.textHeight);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,16 +15,27 @@ class GuiAnim extends GuiControl {
|
||||||
this.anim = new Anim(textures, 0);
|
this.anim = new Anim(textures, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
|
if (parent != null) {
|
||||||
|
if (parent.contains(this.anim)) {
|
||||||
|
parent.removeChild(this.anim);
|
||||||
|
}
|
||||||
|
parent.addChild(this.anim);
|
||||||
|
var off = this.getOffsetFromParent();
|
||||||
|
var props = parent.getProperties(this.anim);
|
||||||
|
props.isAbsolute = true;
|
||||||
|
this.anim.setPosition(off.x, off.y);
|
||||||
|
}
|
||||||
|
|
||||||
var renderRect = this.getRenderRectangle();
|
var renderRect = this.getRenderRectangle();
|
||||||
anim.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
|
// anim.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
|
||||||
anim.scaleX = renderRect.extent.x / anim.getFrame().width;
|
anim.scaleX = renderRect.extent.x / anim.getFrame().width;
|
||||||
anim.scaleY = renderRect.extent.y / anim.getFrame().height;
|
anim.scaleY = renderRect.extent.y / anim.getFrame().height;
|
||||||
if (scene2d.contains(anim)) {
|
// if (scene2d.contains(anim)) {
|
||||||
scene2d.removeChild(anim); // Refresh "layer"
|
// scene2d.removeChild(anim); // Refresh "layer"
|
||||||
}
|
// }
|
||||||
scene2d.addChild(anim);
|
// scene2d.addChild(anim);
|
||||||
super.render(scene2d);
|
super.render(scene2d, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function dispose() {
|
public override function dispose() {
|
||||||
|
|
@ -37,5 +48,6 @@ class GuiAnim extends GuiControl {
|
||||||
if (MarbleGame.canvas.scene2d.contains(anim)) {
|
if (MarbleGame.canvas.scene2d.contains(anim)) {
|
||||||
MarbleGame.canvas.scene2d.removeChild(anim); // Refresh "layer"
|
MarbleGame.canvas.scene2d.removeChild(anim); // Refresh "layer"
|
||||||
}
|
}
|
||||||
|
this.anim.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ class GuiConsoleScrollCtrl extends GuiControl {
|
||||||
return rrec;
|
return rrec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
this.dirty = true;
|
this.dirty = true;
|
||||||
|
|
||||||
scrollUpButton.position = new Vector(this.extent.x - 18, 0);
|
scrollUpButton.position = new Vector(this.extent.x - 18, 0);
|
||||||
|
|
@ -157,7 +157,7 @@ class GuiConsoleScrollCtrl extends GuiControl {
|
||||||
|
|
||||||
updateScrollVisual();
|
updateScrollVisual();
|
||||||
|
|
||||||
super.render(scene2d);
|
super.render(scene2d, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateScrollVisual() {
|
public function updateScrollVisual() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package gui;
|
package gui;
|
||||||
|
|
||||||
|
import h2d.Flow;
|
||||||
import hxd.res.Image;
|
import hxd.res.Image;
|
||||||
import h2d.Graphics;
|
import h2d.Graphics;
|
||||||
import hxd.Key;
|
import hxd.Key;
|
||||||
|
|
@ -55,11 +56,42 @@ class GuiControl {
|
||||||
|
|
||||||
var _disposed = false;
|
var _disposed = false;
|
||||||
|
|
||||||
|
var _flow:Flow;
|
||||||
|
|
||||||
public function new() {}
|
public function new() {}
|
||||||
|
|
||||||
public function render(scene2d:Scene) {
|
public function render(scene2d:Scene, ?parent:Flow) {
|
||||||
|
if (this._flow == null) {
|
||||||
|
this._flow = new Flow(parent != null ? parent : scene2d);
|
||||||
|
}
|
||||||
|
if (parent == null) {
|
||||||
|
if (scene2d.contains(this._flow)) {
|
||||||
|
scene2d.removeChild(this._flow);
|
||||||
|
}
|
||||||
|
scene2d.addChild(this._flow);
|
||||||
|
} else {
|
||||||
|
if (parent.contains(this._flow)) {
|
||||||
|
parent.removeChild(this._flow);
|
||||||
|
}
|
||||||
|
parent.addChild(this._flow);
|
||||||
|
}
|
||||||
|
var rrect = getRenderRectangle();
|
||||||
|
this._flow.maxWidth = cast rrect.extent.x;
|
||||||
|
this._flow.maxHeight = cast rrect.extent.y;
|
||||||
|
this._flow.borderWidth = cast rrect.extent.x;
|
||||||
|
this._flow.borderHeight = cast rrect.extent.y;
|
||||||
|
this._flow.borderRight = cast rrect.extent.x;
|
||||||
|
this._flow.borderBottom = cast rrect.extent.y;
|
||||||
|
this._flow.overflow = Hidden;
|
||||||
|
this._flow.multiline = true;
|
||||||
|
if (parent != null) {
|
||||||
|
var props = parent.getProperties(this._flow);
|
||||||
|
props.isAbsolute = true;
|
||||||
|
var off = this.getOffsetFromParent();
|
||||||
|
this._flow.setPosition(off.x, off.y);
|
||||||
|
}
|
||||||
for (c in children) {
|
for (c in children) {
|
||||||
c.render(scene2d);
|
c.render(scene2d, this._flow);
|
||||||
}
|
}
|
||||||
this._skipNextEvent = true;
|
this._skipNextEvent = true;
|
||||||
}
|
}
|
||||||
|
|
@ -203,6 +235,59 @@ class GuiControl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getOffsetFromParent() {
|
||||||
|
var rect = new Rect(this.position, this.extent);
|
||||||
|
var parentRect:Rect = null;
|
||||||
|
|
||||||
|
var uiScaleFactor = Settings.uiScale;
|
||||||
|
|
||||||
|
var offset = this.position.clone();
|
||||||
|
|
||||||
|
if (this.parent != null) {
|
||||||
|
parentRect = this.parent.getRenderRectangle();
|
||||||
|
offset = this.position.multiply(uiScaleFactor);
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
if (this.horizSizing == HorizSizing.Center) {
|
||||||
|
if (this.parent != null) {
|
||||||
|
offset.x = parentRect.extent.x / 2 - (rect.extent.x * uiScaleFactor) / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.vertSizing == VertSizing.Center) {
|
||||||
|
if (this.parent != null) {
|
||||||
|
offset.y = parentRect.extent.y / 2 - (rect.extent.y * uiScaleFactor) / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.horizSizing == HorizSizing.Right) {
|
||||||
|
if (this.parent != null) {
|
||||||
|
offset.x = this.position.x * uiScaleFactor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.vertSizing == VertSizing.Bottom) {
|
||||||
|
if (this.parent != null) {
|
||||||
|
offset.y = this.position.y * uiScaleFactor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.horizSizing == HorizSizing.Left) {
|
||||||
|
if (this.parent != null) {
|
||||||
|
offset.x = parentRect.extent.x - (parent.extent.x - this.position.x) * uiScaleFactor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.vertSizing == VertSizing.Top) {
|
||||||
|
if (this.parent != null) {
|
||||||
|
offset.y = parentRect.extent.y - (parent.extent.y - this.position.y) * uiScaleFactor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
offset.x = Math.floor(offset.x);
|
||||||
|
offset.y = Math.floor(offset.y);
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
public function guiToScreen(point:Vector) {
|
public function guiToScreen(point:Vector) {
|
||||||
var rect = this.getRenderRectangle();
|
var rect = this.getRenderRectangle();
|
||||||
return rect.position.add(point);
|
return rect.position.add(point);
|
||||||
|
|
@ -261,6 +346,7 @@ class GuiControl {
|
||||||
public function onScroll(scrollX:Float, scrollY:Float) {}
|
public function onScroll(scrollX:Float, scrollY:Float) {}
|
||||||
|
|
||||||
public function onRemove() {
|
public function onRemove() {
|
||||||
|
this._flow.remove();
|
||||||
for (c in this.children) {
|
for (c in this.children) {
|
||||||
c.onRemove();
|
c.onRemove();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class GuiGraphics extends GuiControl {
|
||||||
this.graphics = graphics;
|
this.graphics = graphics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
var renderRect = this.getRenderRectangle();
|
var renderRect = this.getRenderRectangle();
|
||||||
graphics.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
|
graphics.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
|
||||||
// bmp.scaleX = renderRect.extent.x / bmp.tile.width;
|
// bmp.scaleX = renderRect.extent.x / bmp.tile.width;
|
||||||
|
|
|
||||||
|
|
@ -23,38 +23,48 @@ class GuiImage extends GuiControl {
|
||||||
this.bmp = new Bitmap(texture);
|
this.bmp = new Bitmap(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
|
if (parent != null) {
|
||||||
|
if (parent.contains(this.bmp)) {
|
||||||
|
parent.removeChild(this.bmp);
|
||||||
|
}
|
||||||
|
parent.addChild(this.bmp);
|
||||||
|
var off = this.getOffsetFromParent();
|
||||||
|
var props = parent.getProperties(this.bmp);
|
||||||
|
props.isAbsolute = true;
|
||||||
|
this.bmp.setPosition(off.x, off.y);
|
||||||
|
}
|
||||||
|
super.render(scene2d, parent);
|
||||||
var renderRect = this.getRenderRectangle();
|
var renderRect = this.getRenderRectangle();
|
||||||
var hittestRect = this.getHitTestRect();
|
// var hittestRect = this.getHitTestRect();
|
||||||
|
|
||||||
var obj:h2d.Object = bmp;
|
// var obj:h2d.Object = bmp;
|
||||||
if (doClipping) {
|
// if (doClipping) {
|
||||||
bmpFlow = new Flow();
|
// bmpFlow = new Flow();
|
||||||
bmpFlow.addChild(bmp);
|
// bmpFlow.addChild(bmp);
|
||||||
bmpFlow.overflow = FlowOverflow.Hidden;
|
// bmpFlow.overflow = FlowOverflow.Hidden;
|
||||||
bmpFlow.multiline = true;
|
// bmpFlow.multiline = true;
|
||||||
bmpFlow.setPosition(hittestRect.position.x, hittestRect.position.y);
|
// bmpFlow.setPosition(hittestRect.position.x, hittestRect.position.y);
|
||||||
obj = bmpFlow;
|
// obj = bmpFlow;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (doClipping) {
|
// if (doClipping) {
|
||||||
var fp = bmpFlow.getProperties(bmp);
|
// var fp = bmpFlow.getProperties(bmp);
|
||||||
fp.offsetX = -Std.int(hittestRect.position.x - renderRect.position.x);
|
// fp.offsetX = -Std.int(hittestRect.position.x - renderRect.position.x);
|
||||||
fp.offsetY = -Std.int(hittestRect.position.y - renderRect.position.y);
|
// fp.offsetY = -Std.int(hittestRect.position.y - renderRect.position.y);
|
||||||
} else {
|
// } else {
|
||||||
bmp.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
|
// bmp.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
|
||||||
}
|
// }
|
||||||
bmp.width = renderRect.extent.x;
|
bmp.width = renderRect.extent.x;
|
||||||
bmp.height = renderRect.extent.y;
|
bmp.height = renderRect.extent.y;
|
||||||
if (doClipping) {
|
// if (doClipping) {
|
||||||
bmpFlow.maxWidth = Std.int(hittestRect.extent.x);
|
// bmpFlow.maxWidth = Std.int(hittestRect.extent.x);
|
||||||
bmpFlow.maxHeight = Std.int(hittestRect.extent.y);
|
// bmpFlow.maxHeight = Std.int(hittestRect.extent.y);
|
||||||
}
|
// }
|
||||||
if (scene2d.contains(obj)) {
|
// if (scene2d.contains(obj)) {
|
||||||
scene2d.removeChild(obj); // Refresh "layer"
|
// scene2d.removeChild(obj); // Refresh "layer"
|
||||||
}
|
// }
|
||||||
scene2d.addChild(obj);
|
// scene2d.addChild(obj);
|
||||||
super.render(scene2d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function dispose() {
|
public override function dispose() {
|
||||||
|
|
@ -80,5 +90,6 @@ class GuiImage extends GuiControl {
|
||||||
if (MarbleGame.canvas.scene2d.contains(bmp)) {
|
if (MarbleGame.canvas.scene2d.contains(bmp)) {
|
||||||
MarbleGame.canvas.scene2d.removeChild(bmp); // Refresh "layer"
|
MarbleGame.canvas.scene2d.removeChild(bmp); // Refresh "layer"
|
||||||
}
|
}
|
||||||
|
this.bmp.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,43 +30,66 @@ class GuiMLText extends GuiControl {
|
||||||
this.text.loadFont = loadFontFunc;
|
this.text.loadFont = loadFontFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
var renderRect = this.getRenderRectangle();
|
var renderRect = this.getRenderRectangle();
|
||||||
text.maxWidth = renderRect.extent.x;
|
text.maxWidth = renderRect.extent.x;
|
||||||
|
|
||||||
if (this.scrollable) {
|
if (parent != null) {
|
||||||
this.flow = new Flow();
|
if (parent.contains(this.text)) {
|
||||||
this.flow.addChild(this.text);
|
parent.removeChild(this.text);
|
||||||
|
}
|
||||||
|
parent.addChild(this.text);
|
||||||
|
var off = this.getOffsetFromParent();
|
||||||
|
var props = parent.getProperties(this.text);
|
||||||
|
props.isAbsolute = true;
|
||||||
|
|
||||||
this.flow.maxWidth = cast renderRect.extent.x;
|
if (justify == Left) {
|
||||||
this.flow.maxHeight = cast renderRect.extent.y;
|
text.setPosition(Math.floor(off.x), Math.floor(off.y));
|
||||||
this.flow.multiline = true;
|
text.textAlign = Left;
|
||||||
this.flow.overflow = FlowOverflow.Hidden;
|
}
|
||||||
|
if (justify == Right) {
|
||||||
|
text.setPosition(Math.floor(off.x + renderRect.extent.x), Math.floor(off.y));
|
||||||
|
text.textAlign = Right;
|
||||||
|
}
|
||||||
|
if (justify == Center) {
|
||||||
|
text.setPosition(Math.floor(off.x + renderRect.extent.x / 2), Math.floor(off.y));
|
||||||
|
text.textAlign = Center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj:h2d.Object = this.scrollable ? flow : text;
|
// if (this.scrollable) {
|
||||||
|
// this.flow = new Flow();
|
||||||
|
// this.flow.addChild(this.text);
|
||||||
|
|
||||||
if (justify == Left) {
|
// this.flow.maxWidth = cast renderRect.extent.x;
|
||||||
obj.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
|
// this.flow.maxHeight = cast renderRect.extent.y;
|
||||||
text.textAlign = Left;
|
// this.flow.multiline = true;
|
||||||
}
|
// this.flow.overflow = FlowOverflow.Hidden;
|
||||||
if (justify == Right) {
|
// }
|
||||||
obj.setPosition(Math.floor(renderRect.position.x + renderRect.extent.x), Math.floor(renderRect.position.y));
|
super.render(scene2d, parent);
|
||||||
text.textAlign = Right;
|
|
||||||
}
|
|
||||||
if (justify == Center) {
|
|
||||||
obj.setPosition(Math.floor(renderRect.position.x + renderRect.extent.x / 2), Math.floor(renderRect.position.y));
|
|
||||||
text.textAlign = Center;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scrollable)
|
// var obj:h2d.Object = this.scrollable ? flow : text;
|
||||||
text.setPosition(0, -_scroll);
|
|
||||||
|
|
||||||
if (scene2d.contains(obj))
|
// if (justify == Left) {
|
||||||
scene2d.removeChild(obj);
|
// obj.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
|
||||||
|
// text.textAlign = Left;
|
||||||
|
// }
|
||||||
|
// if (justify == Right) {
|
||||||
|
// obj.setPosition(Math.floor(renderRect.position.x + renderRect.extent.x), Math.floor(renderRect.position.y));
|
||||||
|
// text.textAlign = Right;
|
||||||
|
// }
|
||||||
|
// if (justify == Center) {
|
||||||
|
// obj.setPosition(Math.floor(renderRect.position.x + renderRect.extent.x / 2), Math.floor(renderRect.position.y));
|
||||||
|
// text.textAlign = Center;
|
||||||
|
// }
|
||||||
|
|
||||||
scene2d.addChild(obj);
|
// if (scrollable)
|
||||||
super.render(scene2d);
|
// text.setPosition(0, -_scroll);
|
||||||
|
|
||||||
|
// if (scene2d.contains(obj))
|
||||||
|
// scene2d.removeChild(obj);
|
||||||
|
|
||||||
|
// scene2d.addChild(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function dispose() {
|
public override function dispose() {
|
||||||
|
|
@ -76,6 +99,7 @@ class GuiMLText extends GuiControl {
|
||||||
} else {
|
} else {
|
||||||
this.flow.remove();
|
this.flow.remove();
|
||||||
}
|
}
|
||||||
|
this.text.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function onRemove() {
|
public override function onRemove() {
|
||||||
|
|
@ -86,11 +110,12 @@ class GuiMLText extends GuiControl {
|
||||||
if (MarbleGame.canvas.scene2d.contains(text)) {
|
if (MarbleGame.canvas.scene2d.contains(text)) {
|
||||||
MarbleGame.canvas.scene2d.removeChild(text); // Refresh "layer"
|
MarbleGame.canvas.scene2d.removeChild(text); // Refresh "layer"
|
||||||
}
|
}
|
||||||
|
this.text.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function onScroll(scrollX:Float, scrollY:Float) {
|
public override function onScroll(scrollX:Float, scrollY:Float) {
|
||||||
_scroll = scrollY;
|
_scroll = scrollY;
|
||||||
text.setPosition(0, -scrollY);
|
text.setPosition(text.x, -scrollY);
|
||||||
if (flow != null)
|
if (flow != null)
|
||||||
flow.getProperties(text).offsetY = cast - scrollY;
|
flow.getProperties(text).offsetY = cast - scrollY;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,18 +34,32 @@ class GuiObjectShow extends GuiControl {
|
||||||
timeState.timeSinceLoad = 0;
|
timeState.timeSinceLoad = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
var renderRect = getRenderRectangle();
|
var renderRect = getRenderRectangle();
|
||||||
|
|
||||||
init(renderRect);
|
init(renderRect);
|
||||||
if (scene2d.contains(sceneBitmap))
|
|
||||||
scene2d.removeChild(sceneBitmap);
|
if (parent != null) {
|
||||||
if (visible)
|
if (parent.contains(this.sceneBitmap)) {
|
||||||
scene2d.addChild(sceneBitmap);
|
parent.removeChild(this.sceneBitmap);
|
||||||
sceneBitmap.x = renderRect.position.x;
|
}
|
||||||
sceneBitmap.y = renderRect.position.y;
|
parent.addChild(this.sceneBitmap);
|
||||||
|
var off = this.getOffsetFromParent();
|
||||||
|
var props = parent.getProperties(this.sceneBitmap);
|
||||||
|
props.isAbsolute = true;
|
||||||
|
this.sceneBitmap.setPosition(off.x, off.y);
|
||||||
|
}
|
||||||
|
super.render(scene2d, parent);
|
||||||
|
var renderRect = this.getRenderRectangle();
|
||||||
|
|
||||||
|
// if (scene2d.contains(sceneBitmap))
|
||||||
|
// scene2d.removeChild(sceneBitmap);
|
||||||
|
// if (visible)
|
||||||
|
// scene2d.addChild(sceneBitmap);
|
||||||
|
// sceneBitmap.x = renderRect.position.x;
|
||||||
|
// sceneBitmap.y = renderRect.position.y;
|
||||||
sceneBitmap.width = renderRect.extent.x;
|
sceneBitmap.width = renderRect.extent.x;
|
||||||
sceneBitmap.height = renderRect.extent.y;
|
sceneBitmap.height = renderRect.extent.y;
|
||||||
super.render(scene2d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function update(dt:Float, mouseState:MouseState) {
|
public override function update(dt:Float, mouseState:MouseState) {
|
||||||
|
|
|
||||||
|
|
@ -17,23 +17,31 @@ class GuiProgress extends GuiControl {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
var renderRect = getRenderRectangle();
|
var renderRect = getRenderRectangle();
|
||||||
if (this.progressRect == null) {
|
if (this.progressRect == null) {
|
||||||
this.progressRect = new Graphics();
|
this.progressRect = new Graphics();
|
||||||
}
|
}
|
||||||
if (scene2d.contains(progressRect))
|
if (parent != null) {
|
||||||
progressRect.remove();
|
if (parent.contains(this.progressRect)) {
|
||||||
scene2d.addChild(progressRect);
|
parent.removeChild(this.progressRect);
|
||||||
|
}
|
||||||
|
parent.addChild(this.progressRect);
|
||||||
|
var off = this.getOffsetFromParent();
|
||||||
|
var props = parent.getProperties(this.progressRect);
|
||||||
|
props.isAbsolute = true;
|
||||||
|
this.progressRect.setPosition(off.x, off.y);
|
||||||
|
}
|
||||||
|
// if (scene2d.contains(progressRect))
|
||||||
|
// progressRect.remove();
|
||||||
|
// scene2d.addChild(progressRect);
|
||||||
var rgb = progressColor >> 2;
|
var rgb = progressColor >> 2;
|
||||||
var a = progressColor & 0xFF;
|
var a = progressColor & 0xFF;
|
||||||
this.progressRect.clear();
|
this.progressRect.clear();
|
||||||
this.progressRect.beginFill(rgb, a / 0xFF);
|
this.progressRect.beginFill(rgb, a / 0xFF);
|
||||||
this.progressRect.drawRect(0, 0, renderRect.extent.x * progress, renderRect.extent.y);
|
this.progressRect.drawRect(0, 0, renderRect.extent.x * progress, renderRect.extent.y);
|
||||||
this.progressRect.endFill();
|
this.progressRect.endFill();
|
||||||
this.progressRect.x = renderRect.position.x;
|
super.render(scene2d, parent);
|
||||||
this.progressRect.y = renderRect.position.y;
|
|
||||||
super.render(scene2d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function dispose() {
|
public override function dispose() {
|
||||||
|
|
@ -47,6 +55,7 @@ class GuiProgress extends GuiControl {
|
||||||
if (MarbleGame.canvas.scene2d.contains(progressRect)) {
|
if (MarbleGame.canvas.scene2d.contains(progressRect)) {
|
||||||
MarbleGame.canvas.scene2d.removeChild(progressRect); // Refresh "layer"
|
MarbleGame.canvas.scene2d.removeChild(progressRect); // Refresh "layer"
|
||||||
}
|
}
|
||||||
|
this.progressRect.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_progress() {
|
function get_progress() {
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ class GuiScrollCtrl extends GuiControl {
|
||||||
return rrec;
|
return rrec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
this.dirty = true;
|
this.dirty = true;
|
||||||
|
|
||||||
if (scene2d.contains(scrollBarY))
|
if (scene2d.contains(scrollBarY))
|
||||||
|
|
@ -111,7 +111,7 @@ class GuiScrollCtrl extends GuiControl {
|
||||||
|
|
||||||
updateScrollVisual();
|
updateScrollVisual();
|
||||||
|
|
||||||
super.render(scene2d);
|
super.render(scene2d, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateScrollVisual() {
|
public function updateScrollVisual() {
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,9 @@ class GuiSlider extends GuiImage {
|
||||||
}
|
}
|
||||||
} else if (slidingSound != null)
|
} else if (slidingSound != null)
|
||||||
slidingSound.pause = true;
|
slidingSound.pause = true;
|
||||||
this.bmp.x = renderRect.position.x + renderRect.extent.x * sliderValue;
|
var off = getOffsetFromParent();
|
||||||
this.bmp.x = Util.clamp(this.bmp.x, renderRect.position.x, renderRect.position.x + renderRect.extent.x - bmp.width / 2);
|
this.bmp.x = off.x + renderRect.extent.x * sliderValue;
|
||||||
|
this.bmp.x = Util.clamp(this.bmp.x, off.x, off.x + renderRect.extent.x - bmp.width / 2);
|
||||||
this.bmp.width = this.bmp.tile.width * Settings.uiScale;
|
this.bmp.width = this.bmp.tile.width * Settings.uiScale;
|
||||||
super.update(dt, mouseState);
|
super.update(dt, mouseState);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,24 +23,46 @@ class GuiText extends GuiControl {
|
||||||
this.text = new Text(font);
|
this.text = new Text(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
var renderRect = this.getRenderRectangle();
|
var renderRect = this.getRenderRectangle();
|
||||||
if (justify == Left) {
|
if (parent != null) {
|
||||||
text.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
|
if (parent.contains(this.text)) {
|
||||||
text.textAlign = Left;
|
parent.removeChild(this.text);
|
||||||
|
}
|
||||||
|
parent.addChild(this.text);
|
||||||
|
var off = this.getOffsetFromParent();
|
||||||
|
var props = parent.getProperties(this.text);
|
||||||
|
props.isAbsolute = true;
|
||||||
|
|
||||||
|
if (justify == Left) {
|
||||||
|
text.setPosition(Math.floor(off.x), Math.floor(off.y));
|
||||||
|
text.textAlign = Left;
|
||||||
|
}
|
||||||
|
if (justify == Right) {
|
||||||
|
text.setPosition(Math.floor(off.x + renderRect.extent.x), Math.floor(off.y));
|
||||||
|
text.textAlign = Right;
|
||||||
|
}
|
||||||
|
if (justify == Center) {
|
||||||
|
text.setPosition(Math.floor(off.x + renderRect.extent.x / 2), Math.floor(off.y));
|
||||||
|
text.textAlign = Center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (justify == Right) {
|
// if (justify == Left) {
|
||||||
text.setPosition(Math.floor(renderRect.position.x + renderRect.extent.x), Math.floor(renderRect.position.y));
|
// text.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
|
||||||
text.textAlign = Right;
|
// text.textAlign = Left;
|
||||||
}
|
// }
|
||||||
if (justify == Center) {
|
// if (justify == Right) {
|
||||||
text.setPosition(Math.floor(renderRect.position.x + renderRect.extent.x / 2), Math.floor(renderRect.position.y));
|
// text.setPosition(Math.floor(renderRect.position.x + renderRect.extent.x), Math.floor(renderRect.position.y));
|
||||||
text.textAlign = Center;
|
// text.textAlign = Right;
|
||||||
}
|
// }
|
||||||
if (scene2d.contains(text))
|
// if (justify == Center) {
|
||||||
scene2d.removeChild(text);
|
// text.setPosition(Math.floor(renderRect.position.x + renderRect.extent.x / 2), Math.floor(renderRect.position.y));
|
||||||
scene2d.addChild(text);
|
// text.textAlign = Center;
|
||||||
super.render(scene2d);
|
// }
|
||||||
|
// if (scene2d.contains(text))
|
||||||
|
// scene2d.removeChild(text);
|
||||||
|
// scene2d.addChild(text);
|
||||||
|
super.render(scene2d, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function dispose() {
|
public override function dispose() {
|
||||||
|
|
@ -53,5 +75,6 @@ class GuiText extends GuiControl {
|
||||||
if (MarbleGame.canvas.scene2d.contains(text)) {
|
if (MarbleGame.canvas.scene2d.contains(text)) {
|
||||||
MarbleGame.canvas.scene2d.removeChild(text); // Refresh "layer"
|
MarbleGame.canvas.scene2d.removeChild(text); // Refresh "layer"
|
||||||
}
|
}
|
||||||
|
this.text.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,25 +28,32 @@ class GuiTextInput extends GuiControl {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
var renderRect = this.getRenderRectangle();
|
var renderRect = this.getRenderRectangle();
|
||||||
if (justify == Left) {
|
if (parent != null) {
|
||||||
text.setPosition(renderRect.position.x, renderRect.position.y);
|
if (parent.contains(this.text)) {
|
||||||
text.textAlign = Left;
|
parent.removeChild(this.text);
|
||||||
|
}
|
||||||
|
parent.addChild(this.text);
|
||||||
|
var off = this.getOffsetFromParent();
|
||||||
|
var props = parent.getProperties(this.text);
|
||||||
|
props.isAbsolute = true;
|
||||||
|
|
||||||
|
if (justify == Left) {
|
||||||
|
text.setPosition(Math.floor(off.x), Math.floor(off.y));
|
||||||
|
text.textAlign = Left;
|
||||||
|
}
|
||||||
|
if (justify == Right) {
|
||||||
|
text.setPosition(Math.floor(off.x + renderRect.extent.x), Math.floor(off.y));
|
||||||
|
text.textAlign = Right;
|
||||||
|
}
|
||||||
|
if (justify == Center) {
|
||||||
|
text.setPosition(Math.floor(off.x + renderRect.extent.x / 2), Math.floor(off.y));
|
||||||
|
text.textAlign = Center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (justify == Right) {
|
|
||||||
text.setPosition(renderRect.position.x + renderRect.extent.x, renderRect.position.y);
|
|
||||||
text.textAlign = Right;
|
|
||||||
}
|
|
||||||
if (justify == Center) {
|
|
||||||
text.setPosition(renderRect.position.x + renderRect.extent.x / 2, renderRect.position.y);
|
|
||||||
text.textAlign = Center;
|
|
||||||
}
|
|
||||||
if (scene2d.contains(text))
|
|
||||||
scene2d.removeChild(text);
|
|
||||||
scene2d.addChild(text);
|
|
||||||
this.text.inputWidth = cast renderRect.extent.x;
|
this.text.inputWidth = cast renderRect.extent.x;
|
||||||
super.render(scene2d);
|
super.render(scene2d, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function dispose() {
|
public override function dispose() {
|
||||||
|
|
@ -59,6 +66,7 @@ class GuiTextInput extends GuiControl {
|
||||||
if (MarbleGame.canvas.scene2d.contains(text)) {
|
if (MarbleGame.canvas.scene2d.contains(text)) {
|
||||||
MarbleGame.canvas.scene2d.removeChild(text); // Refresh "layer"
|
MarbleGame.canvas.scene2d.removeChild(text); // Refresh "layer"
|
||||||
}
|
}
|
||||||
|
text.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function onMousePress(mouseState:MouseState) {
|
public override function onMousePress(mouseState:MouseState) {
|
||||||
|
|
|
||||||
|
|
@ -87,14 +87,20 @@ class GuiTextListCtrl extends GuiControl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
var renderRect = this.getRenderRectangle();
|
var renderRect = this.getRenderRectangle();
|
||||||
var htr = this.getHitTestRect();
|
var htr = this.getHitTestRect();
|
||||||
|
|
||||||
if (scene2d.contains(g))
|
if (parent != null) {
|
||||||
scene2d.removeChild(g);
|
if (parent.contains(g))
|
||||||
scene2d.addChild(g);
|
parent.removeChild(g);
|
||||||
g.setPosition(renderRect.position.x, renderRect.position.y - this.scroll);
|
parent.addChild(g);
|
||||||
|
|
||||||
|
var off = this.getOffsetFromParent();
|
||||||
|
parent.getProperties(g).isAbsolute = true;
|
||||||
|
|
||||||
|
g.setPosition(off.x, off.y - this.scroll);
|
||||||
|
}
|
||||||
|
|
||||||
if (scrollable) {
|
if (scrollable) {
|
||||||
this.flow = new Flow();
|
this.flow = new Flow();
|
||||||
|
|
@ -104,12 +110,18 @@ class GuiTextListCtrl extends GuiControl {
|
||||||
this.flow.multiline = true;
|
this.flow.multiline = true;
|
||||||
this.flow.layout = Stack;
|
this.flow.layout = Stack;
|
||||||
this.flow.overflow = FlowOverflow.Hidden;
|
this.flow.overflow = FlowOverflow.Hidden;
|
||||||
if (scene2d.contains(this.flow))
|
|
||||||
scene2d.removeChild(this.flow);
|
|
||||||
|
|
||||||
scene2d.addChild(this.flow);
|
if (parent != null) {
|
||||||
|
if (parent.contains(this.flow)) {
|
||||||
|
parent.removeChild(this.flow);
|
||||||
|
}
|
||||||
|
parent.addChild(this.flow);
|
||||||
|
var off = this.getOffsetFromParent();
|
||||||
|
var props = parent.getProperties(this.flow);
|
||||||
|
props.isAbsolute = true;
|
||||||
|
|
||||||
this.flow.setPosition(htr.position.x, htr.position.y);
|
this.flow.setPosition(off.x, off.y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i in 0...textObjs.length) {
|
for (i in 0...textObjs.length) {
|
||||||
|
|
@ -135,7 +147,7 @@ class GuiTextListCtrl extends GuiControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
redrawSelectionRect(htr);
|
redrawSelectionRect(htr);
|
||||||
super.render(scene2d);
|
super.render(scene2d, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function calculateFullHeight() {
|
public function calculateFullHeight() {
|
||||||
|
|
@ -159,9 +171,11 @@ class GuiTextListCtrl extends GuiControl {
|
||||||
if (MarbleGame.canvas.scene2d.contains(text)) {
|
if (MarbleGame.canvas.scene2d.contains(text)) {
|
||||||
MarbleGame.canvas.scene2d.removeChild(text); // Refresh "layer"
|
MarbleGame.canvas.scene2d.removeChild(text); // Refresh "layer"
|
||||||
}
|
}
|
||||||
|
text.remove();
|
||||||
}
|
}
|
||||||
if (MarbleGame.canvas.scene2d.contains(g))
|
if (MarbleGame.canvas.scene2d.contains(g))
|
||||||
MarbleGame.canvas.scene2d.removeChild(g);
|
MarbleGame.canvas.scene2d.removeChild(g);
|
||||||
|
g.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function onMouseMove(mouseState:MouseState) {
|
public override function onMouseMove(mouseState:MouseState) {
|
||||||
|
|
@ -221,17 +235,18 @@ class GuiTextListCtrl extends GuiControl {
|
||||||
g.clear();
|
g.clear();
|
||||||
g.beginFill(selectedFillColor);
|
g.beginFill(selectedFillColor);
|
||||||
|
|
||||||
|
var off = this.getOffsetFromParent();
|
||||||
// Check if we are between the top and bottom, render normally in that case
|
// Check if we are between the top and bottom, render normally in that case
|
||||||
var topY = 2 + (_prevSelected * (font.size + 4)) + g.y;
|
var topY = 2 + (_prevSelected * (font.size + 4)) + g.y;
|
||||||
var bottomY = 2 + (_prevSelected * (font.size + 4)) + g.y + font.size + 4;
|
var bottomY = 2 + (_prevSelected * (font.size + 4)) + g.y + font.size + 4;
|
||||||
var topRectY = renderRect.position.y;
|
var topRectY = off.y;
|
||||||
var bottomRectY = renderRect.position.y + renderRect.extent.y;
|
var bottomRectY = off.y + renderRect.extent.y;
|
||||||
|
|
||||||
if (topY >= topRectY && bottomY <= bottomRectY)
|
if (topY >= topRectY && bottomY <= bottomRectY)
|
||||||
g.drawRect(0, 5 + (_prevSelected * (font.size + 4)) - 3, renderRect.extent.x, font.size + 4);
|
g.drawRect(0, 5 + (_prevSelected * (font.size + 4)) - 3, renderRect.extent.x, font.size + 4);
|
||||||
// We need to do math the draw the partially visible top selected
|
// We need to do math the draw the partially visible top selected
|
||||||
if (topY <= topRectY && bottomY >= topRectY) {
|
if (topY <= topRectY && bottomY >= topRectY) {
|
||||||
g.drawRect(0, this.scroll, renderRect.extent.x, topY + font.size + 4 - renderRect.position.y);
|
g.drawRect(0, this.scroll, renderRect.extent.x, topY + font.size + 4 - off.y);
|
||||||
}
|
}
|
||||||
// Same for the bottom
|
// Same for the bottom
|
||||||
if (topY <= bottomRectY && bottomY >= bottomRectY) {
|
if (topY <= bottomRectY && bottomY >= bottomRectY) {
|
||||||
|
|
@ -240,7 +255,7 @@ class GuiTextListCtrl extends GuiControl {
|
||||||
- font.size
|
- font.size
|
||||||
- 4
|
- 4
|
||||||
+ (topY + font.size + 4 - bottomRectY), renderRect.extent.x,
|
+ (topY + font.size + 4 - bottomRectY), renderRect.extent.x,
|
||||||
renderRect.position.y
|
off.y
|
||||||
+ renderRect.extent.y
|
+ renderRect.extent.y
|
||||||
- (topY));
|
- (topY));
|
||||||
}
|
}
|
||||||
|
|
@ -259,7 +274,7 @@ class GuiTextListCtrl extends GuiControl {
|
||||||
for (i in 0...textObjs.length) {
|
for (i in 0...textObjs.length) {
|
||||||
var text = textObjs[i];
|
var text = textObjs[i];
|
||||||
text.y = Math.floor((i * (text.font.size + 4) + 5 + textYOffset * Settings.uiScale - scrollY));
|
text.y = Math.floor((i * (text.font.size + 4) + 5 + textYOffset * Settings.uiScale - scrollY));
|
||||||
g.y = renderRect.position.y - scrollY;
|
g.y = -scrollY;
|
||||||
}
|
}
|
||||||
redrawSelectionRect(hittestrect);
|
redrawSelectionRect(hittestrect);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,8 @@ class HelpCreditsGui extends GuiImage {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
super.render(scene2d);
|
super.render(scene2d, parent);
|
||||||
|
|
||||||
manualPageList.onSelectedFunc(0);
|
manualPageList.onSelectedFunc(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ class JukeboxDlg extends GuiImage {
|
||||||
stopBtn.pressedAction = (e) -> {
|
stopBtn.pressedAction = (e) -> {
|
||||||
this.removeChild(stopBtn);
|
this.removeChild(stopBtn);
|
||||||
this.addChild(playBtn);
|
this.addChild(playBtn);
|
||||||
playBtn.render(MarbleGame.canvas.scene2d);
|
playBtn.render(MarbleGame.canvas.scene2d, @:privateAccess playBtn.parent._flow);
|
||||||
playing = false;
|
playing = false;
|
||||||
songStatus.text.text = '<p align="center">${playing ? "Playing" : "Stopped"}</p>';
|
songStatus.text.text = '<p align="center">${playing ? "Playing" : "Stopped"}</p>';
|
||||||
AudioManager.pauseMusic(true);
|
AudioManager.pauseMusic(true);
|
||||||
|
|
@ -117,7 +117,7 @@ class JukeboxDlg extends GuiImage {
|
||||||
playBtn.pressedAction = (e) -> {
|
playBtn.pressedAction = (e) -> {
|
||||||
this.removeChild(playBtn);
|
this.removeChild(playBtn);
|
||||||
this.addChild(stopBtn);
|
this.addChild(stopBtn);
|
||||||
stopBtn.render(MarbleGame.canvas.scene2d);
|
stopBtn.render(MarbleGame.canvas.scene2d, @:privateAccess stopBtn.parent._flow);
|
||||||
playing = true;
|
playing = true;
|
||||||
songStatus.text.text = '<p align="center">${playing ? "Playing" : "Stopped"}</p>';
|
songStatus.text.text = '<p align="center">${playing ? "Playing" : "Stopped"}</p>';
|
||||||
if (AudioManager.currentMusicName != songList[selectedIdx]) {
|
if (AudioManager.currentMusicName != songList[selectedIdx]) {
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ class OptionsDlg extends GuiImage {
|
||||||
optDropdown.pressedAction = (sender) -> {
|
optDropdown.pressedAction = (sender) -> {
|
||||||
if (currentDropDown == null) {
|
if (currentDropDown == null) {
|
||||||
parent.addChild(optDropdownImg);
|
parent.addChild(optDropdownImg);
|
||||||
optDropdownImg.render(MarbleGame.canvas.scene2d);
|
optDropdownImg.render(MarbleGame.canvas.scene2d, @:privateAccess parent._flow);
|
||||||
currentDropDown = optDropdownImg;
|
currentDropDown = optDropdownImg;
|
||||||
setAllBtnState(false);
|
setAllBtnState(false);
|
||||||
return;
|
return;
|
||||||
|
|
@ -187,6 +187,7 @@ class OptionsDlg extends GuiImage {
|
||||||
case 'xlarge': 97;
|
case 'xlarge': 97;
|
||||||
default: 0;
|
default: 0;
|
||||||
});
|
});
|
||||||
|
// optDropdownList.scrollable = true;
|
||||||
optDropdownList.textYOffset = -5;
|
optDropdownList.textYOffset = -5;
|
||||||
optDropdownList.onSelectedFunc = (idx) -> {
|
optDropdownList.onSelectedFunc = (idx) -> {
|
||||||
onSelect(idx);
|
onSelect(idx);
|
||||||
|
|
|
||||||
|
|
@ -821,8 +821,8 @@ class PlayMissionGui extends GuiImage {
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelectedFunc(currentList.length - 1);
|
setSelectedFunc(currentList.length - 1);
|
||||||
if (doRender)
|
// if (doRender)
|
||||||
this.render(cast(this.parent, Canvas).scene2d);
|
// this.render(cast(this.parent, Canvas).scene2d);
|
||||||
}
|
}
|
||||||
|
|
||||||
setScoreHover = (isHover) -> {
|
setScoreHover = (isHover) -> {
|
||||||
|
|
@ -1040,8 +1040,8 @@ class PlayMissionGui extends GuiImage {
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene, ?parent:h2d.Flow) {
|
||||||
super.render(scene2d);
|
super.render(scene2d, parent);
|
||||||
setSelectedFunc(currentSelectionStatic);
|
setSelectedFunc(currentSelectionStatic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue