2

I'm new to Haxe/HaxeFlixel and I want to use an UI tool to make my game.

After some research I find 3 tools that seems to be good to make UI for Haxe.

  • HaxeUI
  • StablexUI
  • flixel-ui

flixel-ui has a serious lack of documentation, so I'm leaning towards StablexUI. However, it's not integrated with HaxeFlixel.

I test to load it in a FlxState but there are some issues.

  • First, the cursor is behind the UI
  • Second, the UI doesn't catch keyboard input
  • Third, the text is not visible

This is my code:

override public function create():Void
{
    FlxG.cameras.bgColor = 0xff131c1b;
    FlxG.mouse.useSystemCursor = true;
    UIBuilder.init();
    Lib.current.addChild( UIBuilder.buildFn('ui/main.xml')() );
    super.create();
}

And the XML:

<?xml version="1.0" encoding="UTF-8"?>

<HBox padding="10" childPadding="5">
<InputText id="'input'" skin:Paint-border="1" skin:Paint-color="0xFFFFFF" w="150" h="20" text="'type any message here'"/>

<!-- Here we create on-click handler wich shows our alert box with input message -->
<Button h="20" text="'Show me the alert!'" skin:Paint-color="0xbbbbbb" skin:Paint-border="1"/>

Is it possible to use StablexUI with HaxeFlixel, and if yes how?

Gama11
  • 31,714
  • 9
  • 78
  • 100

1 Answers1

3

First of all, Flixel subverts the basic OpenFL display list with its own, so you'll have to layer the entire StablexUI object over the entire Flixel canvas.

This has some noteable downsides to it -- primarily that your entire UI will always have to be over your entire flixel canvas, and will not care about or respond to things like flixel state changes, etc. It also cannot mix with flixel assets like FlxSprites. With the cursor you might be able to get good results by turning off the HaxeFlixel cursor and just using the regular system cursor.

As for flixel-ui's documentation what specifically is lacking? Were you not able to find what you needed here?

https://github.com/haxeflixel/flixel-ui

Another possibility is HaxeUI -- HaxeUI has customizable backends, so it's possible that it could be implemented with native flixel widgets. That's a lot of work, but you could let the maintainer, Ian Harrigan, know that it would be valuable to you, and he might add it in the future.

larsiusprime
  • 935
  • 6
  • 14
  • Thanks a lot for your response. So, if I want to use StablexUI, it's not a good idea to init it in a FlxState ? I may init it in the Main.hx ? Before the init of flixel ? And when I change a State I get the StablexUI instance to load an another layout ? Otherwise, When I deactivate flixel cursor to use system cursor, the mouse it always on top of ui :). But when i compile to neko, the text is never visible ... – Vianney Thurotte Nov 19 '15 at 20:26
  • I see the documentation of FlixelUI, but it is a bit confused for me, and it miss a step by step tutorial to understand all concepts. It gives too much information at once. I prefer the stablexUI documentation that have a step by step tutorial to earn all concepts. The documentation begins with the fundamentals and ends with the advanced use. – Vianney Thurotte Nov 19 '15 at 20:26