ImGui FFI bindings! (Super early alpha)

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Posts: 12
Joined: Mon Mar 19, 2018 9:52 am

ImGui FFI bindings! (Super early alpha)

Post by nikki93 » Thu Mar 22, 2018 12:55 am

Hi all! :ultrahappy:

I've begun working on ImGui bindings for LÖVE that use LuaJIT's FFI system. Here's a screenshot of it working:
Screenshot 2018-03-21 17.40.31.png
Screenshot 2018-03-21 17.40.31.png (488.42 KiB) Viewed 1876 times
It also works on iOS (I had to change '' in the LÖVE source a bit to get arrow keys + modifier keys working, will post that separately at some point):
IMG_3761.JPG (2.34 MiB) Viewed 1876 times
Due to EXIF shenanigans the above image is upside down on the forums... But you get the idea. ^^

I'll make a repository for the code this weekend, but here's a gist for now. The gist also has a diff showing how to integrate it with usual LÖVE application code.

Right now the main Lua stuff added over the direct C FFI is the I/O event forwarding and drawing. Both use LÖVE APIs, no direct OpenGL or C tricks. This way it's more extensible in Lua.

This is definitely super early and I'll start working on actual ergonomic wrappers over the bare FFI but thought I'd post this already to gauge interest. One thing that could be nice is all the wrapping will be written in Lua and thus more manageable / extensible than writing it in C and dealing with the Lua stack to pass arguments and return types. There are tradeoffs across both approaches, but hey, now you have a choice between the two!

(Thanks to love-imgui, BTW, for 'imgui_impl.cpp' which was really helpful in figuring out Love <-> ImGui event and draw binding)

Party member
Posts: 118
Joined: Mon Sep 12, 2016 7:52 am
Location: Germany

Re: ImGui FFI bindings! (Super early alpha)

Post by Nelvin » Thu Mar 22, 2018 6:02 am

Looks very interesting.
I plan to add some editor features to my game soon and your imgui binding might be a decent choice.

User avatar
Party member
Posts: 222
Joined: Wed Nov 27, 2013 9:44 am

Re: ImGui FFI bindings! (Super early alpha)

Post by Fenrir » Thu Mar 22, 2018 8:43 am

Wow really nice and glad my work helped you a bit! :)

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests