Show currently processed node

This commit is contained in:
luboslenco
2023-04-04 16:29:23 +02:00
parent 56c675a613
commit 81340efe3b
8 changed files with 320 additions and 262 deletions
+38 -15
View File
@@ -8,28 +8,51 @@ class Console {
public static var messageColor = 0x00000000;
public static var lastTraces: Array<String> = [""];
static var haxeTrace: Dynamic->haxe.PosInfos->Void = null;
static var progressText: String = null;
public static function toast(s: String, g: kha.graphics2.Graphics = null) {
static function drawToast(s: String, g: kha.graphics2.Graphics) {
g.color = 0x55000000;
g.fillRect(0, 0, kha.System.windowWidth(), kha.System.windowHeight());
var scale = arm.App.getUIs()[0].SCALE();
var x = kha.System.windowWidth() / 2;
var y = kha.System.windowHeight() - 200 * scale;
g.fillRect(x - 200 * scale, y, 400 * scale, 80 * scale);
g.font = App.font;
g.fontSize = Std.int(22 * scale);
g.color = 0xffffffff;
g.drawString(s, x - g.font.width(g.fontSize, s) / 2, y + 40 * scale - g.font.height(g.fontSize) / 2);
}
public static function toast(s: String, g2: kha.graphics2.Graphics = null) {
// Show a popup message
function _render(g: kha.graphics2.Graphics) {
g.color = 0x55000000;
g.fillRect(0, 0, kha.System.windowWidth(), kha.System.windowHeight());
var scale = arm.App.getUIs()[0].SCALE();
var x = kha.System.windowWidth() / 2;
var y = kha.System.windowHeight() - 200 * scale;
g.fillRect(x - 200 * scale, y, 400 * scale, 80 * scale);
g.font = App.font;
g.fontSize = Std.int(22 * scale);
g.color = 0xffffffff;
g.drawString(s, x - g.font.width(g.fontSize, s) / 2, y + 40 * scale - g.font.height(g.fontSize) / 2);
arm.App.notifyOnNextFrame(function() {
iron.App.removeRender2D(_render);
});
drawToast(s, g);
if (g2 == null) {
arm.App.notifyOnNextFrame(function() {
iron.App.removeRender2D(_render);
});
}
}
g != null ? _render(g) : iron.App.notifyOnRender2D(_render);
g2 != null ? _render(g2) : iron.App.notifyOnRender2D(_render);
consoleTrace(s);
}
static function drawProgress(g: kha.graphics2.Graphics) {
drawToast(progressText, g);
}
public static function progress(s: String) {
// Keep popup message displayed until s == null
if (s == null) {
iron.App.removeRender2D(drawProgress);
}
else if (progressText == null) {
iron.App.notifyOnRender2D(drawProgress);
}
if (s != null) consoleTrace(s);
progressText = s;
}
public static function info(s: String) {
messageTimer = 5.0;
message = s;