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

    brave-kangaroo-30399

    05/22/2019, 5:46 PM
    Might be related to a dumb flash rule with loading things
  • b

    bright-gpu-74537

    05/22/2019, 5:58 PM
    there defo does seem to be some "weirdness" with haxeui-flixel
  • b

    bright-gpu-74537

    05/22/2019, 5:59 PM
    not sure if it might just be me though... checking some stuff
  • b

    bright-gpu-74537

    05/22/2019, 6:20 PM
    im not event getting mouse events
  • b

    bright-gpu-74537

    05/22/2019, 6:20 PM
    Copy code
    haxe
    class PlayState extends FlxState {
        public var uiGroup:FlxGroup = new FlxGroup();
        
        override public function create():Void {
            FlxG.mouse.useSystemCursor = true;
            
            super.create();
            
            this.bgColor = 0xFFFFFFFF;
            Toolkit.init({ container : uiGroup });
            this.add(this.uiGroup);
            
            var button = new Button();
            button.text = "Open Substate";
            uiGroup.add(button);
        }
    
        override public function update(elapsed:Float):Void {
            super.update(elapsed);
        }
    }
  • b

    bright-gpu-74537

    05/22/2019, 6:21 PM
    @brave-kangaroo-30399 - any idea what im doing completly wrong here??
  • b

    bright-gpu-74537

    05/22/2019, 6:29 PM
    ok, so there is defo something up with the haxeui-flixel... if you dont load with the buildComponent macro then you dont get events
  • b

    bright-gpu-74537

    05/22/2019, 6:30 PM
    and all that does it build "addComponent" type code... but probably in some type of order that haxeui-flixel is ok with
  • b

    bright-gpu-74537

    05/22/2019, 6:31 PM
    actually, that might not be right
  • b

    bright-gpu-74537

    05/22/2019, 6:34 PM
    Copy code
    haxe
            var button = new Button();
            button.text = "Open Substate";
            
            var box = new Box(); // <------- have to add button into a box to get mouse events??
            box.addComponent(button);
            
            add(box);
  • b

    bright-gpu-74537

    05/22/2019, 6:35 PM
    (doesnt have to be a box, any component will work, but doesnt seem right)
  • b

    brave-kangaroo-30399

    05/22/2019, 6:47 PM
    Oh yeah I’m not sure how to get around that
  • b

    brave-kangaroo-30399

    05/22/2019, 6:48 PM
    Has to be added to the “stage” which is the main container
  • b

    brave-kangaroo-30399

    05/22/2019, 6:48 PM
    I can look into it tonight
  • b

    bright-gpu-74537

    05/22/2019, 6:48 PM
    fair enough... not a huge deal, but certainly a gotcha when you just want a button
  • b

    bright-gpu-74537

    05/22/2019, 6:49 PM
    im just trying to get it to integrate with a flixel collision demo... i mean, ideally it should work
  • b

    brave-kangaroo-30399

    05/22/2019, 6:49 PM
    I honestly didn’t think of that use case haha
  • b

    bright-gpu-74537

    05/22/2019, 6:50 PM
    so the first issue is it seems haxeui needs to know when flixel has updated coords
  • b

    bright-gpu-74537

    05/22/2019, 6:50 PM
    (i think thats the issue anyway)
  • b

    bright-gpu-74537

    05/22/2019, 6:53 PM
    Copy code
    haxe
            var button = createButton("Bob");
            button.x = 100; // this doesnt work
            button.y = 100; // this doesnt work
    //        button.left = 100; // this works
    //        button.top = 100; // this works
            add(button);
  • b

    bright-gpu-74537

    05/22/2019, 7:00 PM
    Copy code
    haxe
        public override function set_x(value:Float):Float {
            var v = super.set_x(value);
            this.left = value;
            return v;
        }
        
        public override function set_y(value:Float):Float {
            var v = super.set_y(value);
            this.top = value;
            return v;
        }
  • b

    bright-gpu-74537

    05/22/2019, 7:00 PM
    ... that worked... ... better but screws a load of other things up
  • b

    bitter-family-72722

    05/22/2019, 7:01 PM
    I don't think you want to make accessors public
  • b

    bright-gpu-74537

    05/22/2019, 7:01 PM
    ok, well, im just playing about, its not the cause of the further issues after that
  • b

    bitter-family-72722

    05/22/2019, 7:02 PM
    sure, just pointing that out since it's a fairly common mistake / misconception
  • b

    bright-gpu-74537

    05/22/2019, 7:02 PM
    sure... just brain on auto... i do do that sometimes and usually realise when "set_x" shows up in auto completion
  • b

    bitter-family-72722

    05/22/2019, 7:02 PM
    making the accessors public doesn't have any effect on the property, and you basically never want to call the accesors directly / appear publicly in code completion
  • b

    bitter-family-72722

    05/22/2019, 7:02 PM
    right 😃
  • b

    bright-gpu-74537

    05/22/2019, 7:07 PM
    am i right in thinking, in flixel, there isnt any child co-ords?
  • b

    bright-gpu-74537

    05/22/2019, 7:07 PM
    i mean, everything is relative to screen co-ords?
1...343536...1687Latest