3 ms·
Widgets are bloat. Is there a similar library but without widgets? Something really, really simple. I just want a canvas to draw, and a handler to receive mo
by enriquto 6y ago
Widgets are bloat.
Is there a similar library but without widgets? Something really, really simple. I just want a canvas to draw, and a handler to receive mouse and keyboard events. No windows, no text, just a framebuffer.
Back in the day I was really happy with glut and opengl. You just took the three-line hello world and started drawing stuff without fuss. ImGui seems too unnecessarily complicated for me.
- flohofwoe 6y agoShameless plug, but check out the Sokol libraries (there's also a header with a Dear ImGui rendering backend sitting on top of sokol_app.h and sokol_gfx.h): https://github.com/floooh/sokol https://github.com/floooh/sokol ...and here's a minimal standalone starter project for writing Dear ImGui apps in C I just created a couple of days ago: https://github.com/floooh/cimgui-sokol-starterkit https://github.com/floooh/cimgui-sokol-starterkit
- enriquto 6y agoI love this! I'm currently using my own shit headers, but this stuff is really appropriate. Thanks!
- prime31 6y ago...and here is a slightly more rich starter project that happens to use Sokol + Dear ImGui. It was made to create game tools fast in Zig. https://github.com/prime31/zig-upaya https://github.com/prime31/zig-upaya
- pkphilip 6y agoYou can already directly draw using framebuffers etc. However, you will likely end up re-implementing widgets in any case, if your app gets more sophisticated. About UI, it is not necessary that it should be heavy and bloated. Lazarus IDE, for instance, produces very small binaries even for fairly sophisticated UIs and it is quite fast.
- enriquto 6y ago> You can already directly draw using framebuffers etc. Can I, really? How does one framebuffer in a couple of lines of C? Show me a simple program that draws a black 800x600 window. > you will likely end up re-implementing widgets in any case, if your app gets more sophisticated. Don't worry about that. My "app" won't get more sophisticated. I will never ever need any widgets nor drawing directives. Just give me a framebuffer and key/pointer events.
- 10000truths 6y agoIf you really want to go barebones, just mmap /dev/fb0 and do a memset 0 on the region of screen that you want black. Key/pointer events are a matter of reading files from /dev/input.
- DonHopkins 6y agoYeahhhh!!! That's what FORTH is for! https://donhopkins.com/home/archive/forth/cg/cg.f https://donhopkins.com/home/archive/forth/cg/cg.f
- enriquto 6y agoHa! But I want to open a window, if possible portably between linux and windows (just like glut was). It seems to me that we are adding a lot of complexity and going backwards feature-wise.
- sitic 6y agoGLUT (in the form of freeglut [1]) still exists (last commit is from February) and works on all major (desktop) operating systems. GLFW [2] is however much more wildly used these days and pretty much the spiritual successor of GLUT. ImGUI can run on top off all of them and doesn't provide the features (window/context creation, event handling) they do. [1] http://freeglut.sourceforge.net/ http://freeglut.sourceforge.net/ [2] https://www.glfw.org/ https://www.glfw.org/