From 5bc968b800bae70f7c8b392f806604a4a9f7c79a Mon Sep 17 00:00:00 2001 From: Andreas Date: Sat, 27 Nov 2021 08:34:42 +0100 Subject: [PATCH] Unchecked commits to resume work on linux --- hGameTest/src/Main.hx | 3 -- hGameTest/src/engine/tools/ui/UITool.hx | 37 +++++++++++++++++++++++++ hGameTest/src/engine/ui/UIPane.hx | 1 + 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/hGameTest/src/Main.hx b/hGameTest/src/Main.hx index 20befa04..8a653ded 100644 --- a/hGameTest/src/Main.hx +++ b/hGameTest/src/Main.hx @@ -18,10 +18,8 @@ class Main extends Sprite { private function onInit(e:Event) { //Scanner.scanTextureDir(); - trace("heyy"); stage.frameRate = 1000; var game:Game = new Game(stage); - trace("kokk"); stage.addEventListener(Event.ENTER_FRAME, game.onEnterFrame); stage.addEventListener(KeyboardEvent.KEY_DOWN,Input.onKeyIsDown); stage.addEventListener(KeyboardEvent.KEY_UP,Input.onKeyIsUp); @@ -30,7 +28,6 @@ class Main extends Sprite { //Mode.setVideoMode(1280, 960); } private function onResize (event:Event):Void { - trace("yeet"); //Here we can do shit with window scaling //stage.stageWidth; //stage.stageHeight; diff --git a/hGameTest/src/engine/tools/ui/UITool.hx b/hGameTest/src/engine/tools/ui/UITool.hx index 842a60fe..543f1eb9 100644 --- a/hGameTest/src/engine/tools/ui/UITool.hx +++ b/hGameTest/src/engine/tools/ui/UITool.hx @@ -12,6 +12,13 @@ import engine.ConVar; import game.ui.console.Console; //import Lib.application. + +typedef UINode = { + object:UIPane, + ?children:Array +} + + class UITool{ public static var ccmd_dev_uitool = ConVar.registerCCmd("dev_uitool", (args:Array) -> { open();}); public static var uiEditorWindow:openfl.display.Window; @@ -41,6 +48,36 @@ class UITool{ public static var ccmd_dev_uitool_refresh = ConVar.registerCCmd("dev_uitool_refresh", update); + public static var uiNodes:Map = []; + public static var rootNodes:Array = []; + public static function collect(){ + for(pane in UIPane.panelist){ + var node:UINode = null; + if(uiNodes[pane] == null){ + node = { + object: pane, + children: [] + }; + } + else{ + node = uiNodes[pane]; + } + var parentNode:UINode = null; + if(uiNodes[pane.parent] == null){ + parentNode = { + object:pane.parent, + children: [] + } + } + else{ + parentNode = uiNodes[pane.parent]; + } + parentNode.children.push(node); + if(pane.parent == null){ + rootNodes.push(node); + } + } + } public static function update(args:Array){ diff --git a/hGameTest/src/engine/ui/UIPane.hx b/hGameTest/src/engine/ui/UIPane.hx index a898861a..791bc913 100644 --- a/hGameTest/src/engine/ui/UIPane.hx +++ b/hGameTest/src/engine/ui/UIPane.hx @@ -6,6 +6,7 @@ package engine.ui; // | ____ | | | |_ \ | ____| // | | | | | \__/ | | |____ // |__| |__| \______/ |______| + /* / file: UIPane.hx / author: and.schaafsma@gmail.com