Closed 01010111 closed 6 years ago
Thanks for pointing this out, seems like I forgot to update the haxeflixel demo when I merged the ImVector changes.
I've just pushed a commit which fixes the haxeflixel implementation on my end, hopefully it will work for you as well.
It's working ok now! A few things though:
<haxedef name="HXCPP_FLOAT32" />
results in the application freezingpackage;
import flixel.FlxState;
import imgui.ImGui;
class PlayState extends FlxState
{
var buf:Array<cpp.Char> = [];
override public function create():Void
{
super.create();
FlxImGui.init();
}
override public function update(elapsed:Float):Void
{
super.update(elapsed);
FlxImGui.newFrame();
ImGui.begin('hello');
ImGui.inputText('text input', buf);
ImGui.end();
FlxImGui.render();
}
}
thanks for the help!
Thats strange that the float define would freeze the game. I've tested haxeflixel, luxe, and CLI on windows and linux and never experienced anything like that. If you create a simple haxe program (no haxeflixel or linc_imgui) and just try to do something like add two floats with that define will it work? (anything in linc_imgui involving floats will need that define to work for now)
For the input text not working you can pre-allocate the array size. So doing this.
var buf : Array<cpp.Char> = [ for (i in 0...16) 0x0 ];
Will create an array of 16 UTF8 null characters which will give that input box a max of 16 chars. Internally inputText function will read the length of the array so you can push and pop values to change the max length or add new characters and the textbox will recognize that.
I didn't have any trouble tracing the result of adding two floats with that define. I'll try on my windows machine later and let you know! I'm currently using OSX Sierra.
Thanks for the help! Populating the array worked perfectly :) I'm having a similar issue with ImGui.colorEdit3(), I'm able to pass values from an array with three floats, but it doesn't seem to write to them when I try to change the color, and it snaps back to the original value. This could be tied to the HXCPP_FLOAT32 issue, but I figured I'd ask anyway.
package;
import imgui.ImGui;
import flixel.FlxState;
class PipeGen extends FlxState
{
var col:Array<Float> = [0, 1, 0];
override public function create():Void
{
super.create();
FlxImGui.init();
}
override public function update(elapsed:Float):Void
{
super.update(elapsed);
FlxImGui.newFrame();
ImGui.begin('PipeGen');
ImGui.colorEdit3('color', col);
ImGui.end();
FlxImGui.render();
}
}
Yeah, that's probably tied to the float issue. I just tried it on windows and it worked fine. I also booted up my high-sierra VM to check if OSX is working and everything seemed to work fine for me. The basic demo and stuff involving float worked fine.
I think I've found a way around needing the float define without having to make loads of double -> float wrapper functions so I'll have to give that a go when I get back home this evening.
I've just pushed a commit which should remove the need for the FLAOT32 define. When passing floats into ImGui functions which directly modifies the value of the variable you pass that variable needs to be explicitly defined as a cpp.Float32. So your colour edit sample would need to be changed to.
var col:Array<cpp.Float32> = [0, 1, 0];
When creating objects such as Vec2, Vec4, etc you can pass default haxe floats as they do not permanently modify the float variables passed.
awesome! I haven't had a chance to test anything out since yesterday, but I was able to make a nice little tool that I've been meaning on making in about an hour - this is already super awesome :) thanks!
Just tested out colorEdit3() and it's working well!
Thanks again!
No problem, I'm glad the issue was solved and that people other than myself are finding a use for the bindings!
Since things seem to be working I'll close the issue.
Hello! First off, thanks for your work on this! I'm super excited to play with imgui in haxe :D
I tried to get the haxeflixel demo to work, and it came back with a couple of errors:
I went with those suggestions and now I'm getting:
I tried to dive into the framework and figure it out, but I can't find those
get_____()
functions anywhere.