https://linen.dev logo
Join Discord
Powered by
# haxe-ui
  • a

    ambitious-knife-25690

    01/25/2023, 10:57 PM
    I think you're trying to tackle too much at once
  • b

    bright-gpu-74537

    01/25/2023, 10:57 PM
    so, just keep it simple for now... what i would do, is in your ScreenImpl, keep a ref to the root node... then, override addComponent, and have something like:
  • a

    ambitious-knife-25690

    01/25/2023, 10:57 PM
    First add the ability to draw, even hack it in, then implement
    handleSize
    and
    handlePosition
  • a

    ambitious-knife-25690

    01/25/2023, 10:58 PM
    once you have the boxes going, you kind of get a good idea of how things should go
  • b

    bright-gpu-74537

    01/25/2023, 10:58 PM
    Copy code
    haxe
    override function addComponent(child:Component):Component {
        super.addComponent(child);
        child.ready();
        // stuff here
    }
  • b

    bright-gpu-74537

    01/25/2023, 10:59 PM
    then you can just do:
    Copy code
    haxe
    Screen.instance.node = godotNode;
    Screen.instance.addComponent(mainView)
  • b

    bright-gpu-74537

    01/25/2023, 10:59 PM
    then your godot surface is basically "the screen"
  • b

    bright-gpu-74537

    01/25/2023, 11:02 PM
    i actually misunderstood the original intention too, i thought the idea was to create a godot node for each component instance - so really, yeah, this backend is quite like kha, which means its going to be quite alot of work (fyi) since you will have to setup your own display tree, etc
  • a

    ambitious-knife-25690

    01/25/2023, 11:02 PM
    godot has that stuff baked in from what i heard so it may be easier
  • e

    elegant-twilight-61392

    01/25/2023, 11:03 PM
    > i thought the idea was to create a godot node for each component instance this is what i thought i was doing
  • l

    late-engine-8731

    01/25/2023, 11:03 PM
    nah you can just build a tree of canvasItems
  • a

    ambitious-knife-25690

    01/25/2023, 11:03 PM
    does/can a node track it's own depth in the tree? (and can a node have children)
  • b

    bright-gpu-74537

    01/25/2023, 11:03 PM
    ok, so crossed wires here... which method are you going for Pan?
  • b

    bright-gpu-74537

    01/25/2023, 11:04 PM
    a tree of canvasitem certainly seems like the more correct path
  • e

    elegant-twilight-61392

    01/25/2023, 11:04 PM
    godot nodes can have children
  • b

    bright-gpu-74537

    01/25/2023, 11:04 PM
    since then godot will be handling the tree, and presumably depth etc
  • b

    bright-gpu-74537

    01/25/2023, 11:04 PM
    so a canvasitem can have children, right?
  • e

    elegant-twilight-61392

    01/25/2023, 11:04 PM
    yeah
  • e

    elegant-twilight-61392

    01/25/2023, 11:05 PM
    and those children can be other canvasitems
  • b

    bright-gpu-74537

    01/25/2023, 11:05 PM
    so yeah, defo go that way, its more native to godot and will save you a headache
  • e

    elegant-twilight-61392

    01/25/2023, 11:05 PM
    i think !b brought up the "not" that way
  • e

    elegant-twilight-61392

    01/25/2023, 11:06 PM
    it seems (for now) this will be closer to haxeui-openfl than haxeui-kha
  • b

    bright-gpu-74537

    01/25/2023, 11:06 PM
    yeah, or heaps, or nme, or, well, anything with a display tree built in
  • b

    bright-gpu-74537

    01/25/2023, 11:09 PM
    so, the first thing i would do i, get your canvas item to respond to size, position, and say background color... eg:
    Copy code
    haxe
    var c = new Component();
    c.width = c.height = 100;
    c.backgroundColor = 0xFF0000;
    c.ready(); // call it manually for now, we can fix this later
    GODOTREE.SOMENODE.add(c._myGodotCanvasItem); // <--- i have no idea about any of the calls :)
  • b

    bright-gpu-74537

    01/25/2023, 11:09 PM
    that is the most basic step, once you have that, you can start filling in the blanks
  • e

    elegant-twilight-61392

    01/25/2023, 11:10 PM
    well see the issue is that i cant "statically" get the godot scene tree
  • b

    bright-gpu-74537

    01/25/2023, 11:10 PM
    well, how do you add a node?
  • e

    elegant-twilight-61392

    01/25/2023, 11:13 PM
    ok well first its good to know that most things in godot are nodes. godot has a root node that itll add your "main scene". now normally if your just using gdscript you attach your scripts to nodes that you added to scenes in the editor
  • e

    elegant-twilight-61392

    01/25/2023, 11:14 PM
    so basically your code is usually running inside an object that is a node on the scene tree
  • b

    bright-gpu-74537

    01/25/2023, 11:14 PM
    sure, i get that its all nodes, but how from gdscript, or hxgodot, or c# how do you add a canvasitem dynamically?
1...141114121413...1687Latest