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

    early-butcher-76809

    02/08/2023, 1:53 PM
    Thanks
  • r

    refined-greece-48002

    02/08/2023, 1:53 PM
    https://www.haxeui.org/builder/?eebac0f2 works on js too
  • b

    bright-gpu-74537

    02/08/2023, 1:53 PM
    zip and send a test project here if you can...
  • e

    early-butcher-76809

    02/08/2023, 2:06 PM
    Ok, found it. I added my Component to an interactive h2d.Flow and this step doesn't work anymore :/
  • e

    early-butcher-76809

    02/08/2023, 2:07 PM
    The interactive part of the Flow seems to be on top of my buttons, now, preventing me from clicking them :(
  • b

    bright-gpu-74537

    02/08/2023, 2:57 PM
    can you disable the interactivity? Im not really familiar with Flow
    e
    • 2
    • 7
  • b

    bright-gpu-74537

    02/08/2023, 2:57 PM
    seems that its for layout though... any reason not to use haxeui for layout?
  • e

    early-butcher-76809

    02/08/2023, 2:57 PM
    I can but I use it to block interaction with the 3D stuff underneath
  • b

    bright-gpu-74537

    02/08/2023, 2:58 PM
    hmmm
  • b

    billowy-easter-22196

    02/08/2023, 2:59 PM
    I know zoom is always pain, but how do i do properly zoom in heaps? or how can i do haxeui-components "static"? I have a scene and interactive camera and im scalling my camera with like this.
    Copy code
    haxe
    camera.scaleX += (isScrollingIn ? 1 : -1) * 0.01;
    camera.scaleY += (isScrollingIn ? 1 : -1) * 0.01;
    after zoom, haxeui components seems to be screwed. text is gone but interactive elements from in in a static absolute positions
  • b

    billowy-easter-22196

    02/08/2023, 3:01 PM
    the one opportunity is to make extra camera somewhere on side and render ui here. but is there way to render it properly on main view, main camera which can be zoomed and changed position?
  • b

    billowy-easter-22196

    02/08/2023, 3:02 PM
    i tried something like this
    Copy code
    Toolkit.scaleX = s2d.interactiveCamera.scaleX;
    Toolkit.scaleY = s2d.interactiveCamera.scaleY;
    this zooms components but they like still broken after this
  • b

    billowy-easter-22196

    02/08/2023, 3:06 PM
    for scaling this works in simmilar way, the window (and other elements) just staying small but interactive elements at the static absolute position
  • a

    ambitious-knife-25690

    02/08/2023, 3:08 PM
    I don't know much about heaps, but, the way to handle this may be to separate the root object you pass to haxeui from the game camera
  • b

    billowy-easter-22196

    02/08/2023, 3:09 PM
    i think i know what you mean, this can be usefull... i will look 🙂 thanks
  • f

    full-journalist-82607

    02/08/2023, 3:39 PM
    Lol, you're using some French in your example. I thought that with your name, you wouldn't know French, so you've chosen your handle on purpose ?
  • e

    early-butcher-76809

    02/08/2023, 3:39 PM
    I have, quite some time ago ^^'
  • f

    full-journalist-82607

    02/08/2023, 3:40 PM
    Nice ! quite some self confidence here 😉
  • b

    bumpy-engineer-49082

    02/08/2023, 3:44 PM
    it finally works, but i had to make a few replacements. ComponentBuilder and Screen are moved to render function. It wasn't obvious.
  • b

    bright-gpu-74537

    02/08/2023, 3:47 PM
    you 100% dont want to be doing that... you are creating a new UI every frame and adding it to the screen...
  • a

    ambitious-knife-25690

    02/08/2023, 3:49 PM
    what's the issue?
  • a

    ambitious-knife-25690

    02/08/2023, 3:49 PM
    I didn't have any obvious issues with color on kha
  • b

    bright-gpu-74537

    02/08/2023, 3:50 PM
    Copy code
    class Main {
        static function update():Void {}
    
        static function render(framebuffers:Array<Framebuffer>):Void {
            var g = framebuffers[0].g2;
            g.begin(true, 0xFFFFFFFF);
            Screen.instance.renderTo(g);
            g.end();
        }
    
        public static function main() {
            kha.System.start({}, function(_) {
                kha.Assets.loadEverything(function() {
                    haxe.ui.Toolkit.init();
    
                    final ui = haxe.ui.ComponentBuilder.fromFile("main-view.xml");
                    haxe.ui.core.Screen.instance.addComponent(ui);
    
                    System.start({title: "Project", width: 1024, height: 768}, function(_) {
                        // Just loading everything is ok for small projects
                        Assets.loadEverything(function() {
                            // Avoid passing update/render directly,
                            // so replacing them via code injection works
                            Scheduler.addTimeTask(function() {
                                update();
                            }, 0, 1 / 60);
                            System.notifyOnFrames(render);
                        });
                    });
                });
            });
        }
    }
  • b

    bright-gpu-74537

    02/08/2023, 3:55 PM
    maybe the UI creation has to be after the System.start? Not sure... ie, this:
  • b

    bright-gpu-74537

    02/08/2023, 3:55 PM
    Copy code
    class Main {
        static function update():Void {}
    
        static function render(framebuffers:Array<Framebuffer>):Void {
            var g = framebuffers[0].g2;
            g.begin(true, 0xFFFFFFFF);
            Screen.instance.renderTo(g);
            g.end();
        }
    
        public static function main() {
            kha.System.start({}, function(_) {
                kha.Assets.loadEverything(function() {
                    haxe.ui.Toolkit.init();
    
                    System.start({title: "Project", width: 1024, height: 768}, function(_) {
                        // Just loading everything is ok for small projects
                        final ui = haxe.ui.ComponentBuilder.fromFile("main-view.xml");
                        haxe.ui.core.Screen.instance.addComponent(ui);
    
                        Assets.loadEverything(function() {
                            // Avoid passing update/render directly,
                            // so replacing them via code injection works
                            Scheduler.addTimeTask(function() {
                                update();
                            }, 0, 1 / 60);
                            System.notifyOnFrames(render);
                        });
                    });
                });
            });
        }
    }
  • b

    bumpy-engineer-49082

    02/08/2023, 4:27 PM
    thanks, that's way better.
  • i

    icy-zebra-52882

    02/09/2023, 1:04 PM
    should changing a dropdown's
    selectedIndex
    via code update the UI and call any
    onChange
    callbacks?
  • i

    icy-zebra-52882

    02/09/2023, 1:04 PM
    I'm trying to do just that, to pick the first option in a dropdown if none has been picked already, but the UI doesn't update:
    Copy code
    haxe
    // Pick first option for reaction dropdown if none has been selected
    reactionDropdown.selectedIndex = (reactionDropdown.value == -1) ? 0 : reactionDropdown.selectedIndex;
    var selectedReaction = reactionDropdown.value;
  • i

    icy-zebra-52882

    02/09/2023, 1:07 PM
    the use case being here, where when I pick an NPC from the top dropdown, the second dropdown's data is populated but an option doesn't get picked as a default
  • i

    icy-zebra-52882

    02/09/2023, 1:07 PM
    in fact it seems that changing the
    selectedIndex
    isn't actually changing the value at all
1...148214831484...1687Latest