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

    bright-gpu-74537

    01/14/2023, 2:24 PM
    OK, that probably shouldnt crash it... what happens if you do
    Screen.instance.addComponent(v)
    ?
  • r

    refined-greece-48002

    01/14/2023, 2:25 PM
    That works!
  • b

    bright-gpu-74537

    01/14/2023, 2:25 PM
    OK, cool - ill check it out though, i would have expected your code to crash though
  • r

    refined-greece-48002

    01/14/2023, 2:25 PM
    Would have or would not have?
  • b

    bright-gpu-74537

    01/14/2023, 2:25 PM
    (was kinda hoping that it would also crash)
  • b

    bright-gpu-74537

    01/14/2023, 2:25 PM
    sorry, wouldnt
  • b

    bright-gpu-74537

    01/14/2023, 2:26 PM
    i have such an issue with "can/t" "would/nt"... constantly make typos there which changes the whole meaning
  • r

    refined-greece-48002

    01/14/2023, 2:27 PM
    for repro's sake, I'm using the latest git for heaps, haxeui-core, and haxeui-heaps
  • b

    bright-gpu-74537

    01/14/2023, 2:28 PM
    cool - i havent changed anything in haxeui-heaps in a while, so my guess is its always been there - i just never do things that way... Screen.instance is defo the preferred way to go here since then haxeui knows about it, but ill see if there is an event i can listen to or something in heaps
  • r

    refined-greece-48002

    01/14/2023, 2:30 PM
    I will stick with the preferred way either way, then
  • b

    bright-gpu-74537

    01/14/2023, 2:37 PM
    cool - probably safer that way, but ill check it out anyway, might be indicative of a deeper issue / bug
  • r

    refined-greece-48002

    01/14/2023, 2:37 PM
    Thanks very much as always!
  • b

    bright-gpu-74537

    01/14/2023, 4:31 PM
    so the issue is as i thought it was: haxeui doesnt know about the child:
    Copy code
    haxe
            msg.onDialogClosed = function(_) {
                var button = new Button();
                button.text = "Added";
                //Screen.instance.addComponent(button); // <--- this is fine
                Screen.instance.rootComponents.push(button); // <--- without this it crashes
                Screen.instance.root.addChild(button);
            }
  • b

    bright-gpu-74537

    01/14/2023, 4:32 PM
    but i dont think there is an easy way to know if the a child has been added to s2d, so i think for now you are safer with using
    addComponent
  • r

    refined-greece-48002

    01/14/2023, 4:40 PM
    Works for me! I honestly just didn't know about the addComponent way 😄
  • r

    refined-greece-48002

    01/14/2023, 4:41 PM
    But I guess it makes a lot more sense if you ever want to change backends
  • b

    bright-gpu-74537

    01/14/2023, 4:41 PM
    yeah, its what all the components (like dialog, dropdown, menus,etc) use internally since they wouldnt know about "s2d" or "stage" or "whatever"
  • c

    creamy-animal-95850

    01/15/2023, 1:42 AM
    heaps: is it possible to pass an h2d.font into a component's style? I want to use an Sdf font but it seems font-name only resolves bitmap fonts
  • b

    brave-kangaroo-30399

    01/15/2023, 2:08 AM
    It used to be the other way around lol
  • b

    brave-kangaroo-30399

    01/15/2023, 2:09 AM
    https://github.com/haxeui/haxeui-heaps/blob/master/haxe/ui/backend/AssetsImpl.hx#L80
  • b

    brave-kangaroo-30399

    01/15/2023, 2:11 AM
    Not sure how you'd unify them, as haxeui's
    FontData
    is an alias for
    BitmapFont
  • c

    creamy-animal-95850

    01/15/2023, 2:40 AM
    was looking at the way FontCache imports them and it should work, but for some reason I'm getting messed up glyphs
  • b

    brave-kangaroo-30399

    01/15/2023, 3:02 AM
    From experience, that looks like a bitmap font that got treated as an SDF font
  • c

    creamy-animal-95850

    01/15/2023, 3:38 AM
    and it's the other way around
  • c

    creamy-animal-95850

    01/15/2023, 3:39 AM
    just gonna use a regular old bitmap font, thanks for your help though
  • b

    brave-kangaroo-30399

    01/15/2023, 3:58 AM
    I've never intentionally used SDF, so if you have any suggestions or ideas for how to implement we can try that
  • b

    brave-kangaroo-30399

    01/15/2023, 3:59 AM
    Alongside bitmapfont
  • c

    creamy-animal-95850

    01/15/2023, 4:24 AM
    well, not even bitmapfont is working - text is inverted and crashes the program when placed in components that have variable width/heights
  • c

    creamy-animal-95850

    01/15/2023, 4:26 AM
    oh wait
  • c

    creamy-animal-95850

    01/15/2023, 4:27 AM
    because it's anticipating SDF
1...137413751376...1687Latest