ImGui LÖVE module

Showcase your libraries, tools and other projects that help your fellow love users.
Trebgarta
Prole
Posts: 33
Joined: Mon May 23, 2016 5:21 pm

Re: ImGui löve module

Post 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) ?
User avatar
Fenrir
Party member
Posts: 222
Joined: Wed Nov 27, 2013 9:44 am
Contact:

Re: ImGui löve module

Post 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.
asmageddon
Prole
Posts: 13
Joined: Mon Apr 09, 2012 1:39 pm

Re: ImGui löve module

Post 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.
Trebgarta
Prole
Posts: 33
Joined: Mon May 23, 2016 5:21 pm

Re: ImGui löve module

Post 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.
User avatar
Fenrir
Party member
Posts: 222
Joined: Wed Nov 27, 2013 9:44 am
Contact:

Re: ImGui löve module

Post 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!
User avatar
Fenrir
Party member
Posts: 222
Joined: Wed Nov 27, 2013 9:44 am
Contact:

Re: ImGui löve module

Post 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.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: ImGui löve module

Post 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)
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
Fenrir
Party member
Posts: 222
Joined: Wed Nov 27, 2013 9:44 am
Contact:

Re: ImGui löve module

Post 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.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: ImGui löve module

Post 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
           ^~~~~~
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
EntranceJew
Prole
Posts: 31
Joined: Fri Apr 03, 2015 10:02 pm
Location: Saint Petersburg, Florida
Contact:

Re: ImGui löve module

Post 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"} );
sandsmas: A LÖVE Editor
My Libraries: Imgur, Palettes, Music Macros, Timer, Hooks
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest