Page 3 of 17

Re: ImGui löve module

Posted: Wed Jul 13, 2016 10:17 am
by Trebgarta
Can you do like string matching?

For example, no GL enum values are in Löve, instead there are stuff like "dynamic" for GL_DYNAMIC_DRAW etc.

something like löve.imgui.setTitleBar(false) or löve.imgui.setProperty("title_bar", false) ?

Re: ImGui löve module

Posted: Wed Jul 13, 2016 10:50 am
by Fenrir
It would be possible but it removes the ability to combine flags, or we would need to send a table of flags and it will be quite more tricky to handle. It would be best to keep using numbers if possible.

Re: ImGui löve module

Posted: Thu Jul 14, 2016 1:58 am
by asmageddon
I agree with Trebgarta. Handling flags as numbers, with OR, is a practice I absolutely abhor. There is very little reason to have it here, the added complexity isn't a big deal at all.

Re: ImGui löve module

Posted: Thu Jul 14, 2016 7:40 am
by Trebgarta
OR, put them into a table in love.imgui or whatever. Then to combine one can use bitwise like in c/cpp. Though that isnt very idiomatic in Lua.

The Lua way would be strings. To combine flags one can pass in a table of strings. Bad and complicated but at least the API will be idiomatic and easier to use.

Re: ImGui löve module

Posted: Thu Jul 14, 2016 8:01 am
by Fenrir
Yep after thinking about it going for strings is probably the best option, with the ability to pass only one string if we're interested by only one flag or an array of strings if we want to set multiple flags.

I'll have a look into implementing it!

Re: ImGui löve module

Posted: Thu Jul 14, 2016 12:08 pm
by Fenrir
OK guys I've created a github project:
https://github.com/slages/love-imgui

Now I need to catch up on other tasks but I'll try to come back to it next week for the improvements to the enums management.

Re: ImGui löve module

Posted: Fri Jul 15, 2016 10:50 am
by Nixola
I tried building in Linux, I get this error:

Code: Select all

libraries/imgui/imgui_iterator.cpp:10:15: error: expected constructor, destructor, or type conversion before ‘(’ token
 IMGUI_FUNCTION(Render)

Re: ImGui löve module

Posted: Fri Jul 15, 2016 11:56 am
by Fenrir
Hmm can you try converting the imgui_iterator file to a .h instead of a .cpp, and in warp_imgui_impl.cpp, make the switch to include the .h instead of a .cpp (lines 424 and 537).

It seems that the file is being built before being included where it needs to, and actually it's quite weird that this file is a .cpp and not a .h, I kept this behavior because it's how it was done in the project I used as base but it seems there's no real reason for it.

Re: ImGui löve module

Posted: Fri Jul 15, 2016 3:54 pm
by Nixola
I'm now getting this error (which I got before the one above, but somehow I didn't get it afterwards until now):

Code: Select all

libraries/imgui/imgui_impl.cpp: In function ‘bool Init()’:
libraries/imgui/imgui_impl.cpp:214:8: error: ‘window’ was not declared in this scope
  (void)window;
        ^~~~~~
libraries/imgui/imgui_impl.cpp:214:8: note: suggested alternative:
In file included from libraries/imgui/imgui_impl.cpp:11:0:
./modules/window/Window.h:35:11: note:   ‘love::window’
 namespace window
           ^~~~~~

Re: ImGui löve module

Posted: Fri Jul 15, 2016 5:26 pm
by EntranceJew
In my opinion, the way to handle the generous amounts of globals and enums would be to simply pass a table of strings in their place. Instead of:

Code: Select all

imgui.Begin("Another Window", true, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMenu);
It would make sense to:

Code: Select all

imgui.Begin("Another Window", true, { "AlwaysAutoResize", "NoMenu"} );