Live data from Hacker News

Nuklear – A single-header ANSI C immediate mode cross-platform GUI library

github.com

41–50 of 103 posts

Re: Nuklear – A single-header ANSI C immediate mode cross-platform GUI library

#41

Here's a simple WASM version of the Nuklear standard demo: https://floooh.github.io/sokol-html5/nuklear-sapp.html The big difference to Dear ImGui is that Nuklear has a C API and is also implemented in C - and apparently it has more skinning/themeing options, which I haven't tinkered with yet. TBH, for tools I prefer cimgui (a C wrapper around Dear ImGui), my impression is that Nuklear has a 'purer' immediate-mode de…

Another advantage of Nuklear is that it has a pure software renderer back end that comes with it. If you're developing on a system where you don't have OpenGL or any of the other myriad of software/hardware renderers, nuklear is pretty handy. It makes it easy to write your own driver for custom/embedded systems.

Re: Nuklear – A single-header ANSI C immediate mode cross-platform GUI library

#42

Does anyone know of something similarly lightweight but retained mode?

You can check out LVGL: https://github.com/lvgl/lvgl/

It's geared more for embedded, but you can use an sdl back end for desktop (which might kill your light weight requirement depending on your strictness level). I wrote my own tty/framebuffer driver for it and use it directly on the frame buffer (not Linux) but it's pretty nice to work with. But if you need metal/openGL/Vulcan/directX and hardware acceleration, it's probably not what you're after.

Re: Nuklear – A single-header ANSI C immediate mode cross-platform GUI library

#44
post #42

Does anyone know of something similarly lightweight but retained mode?

You can check out LVGL: https://github.com/lvgl/lvgl/ It's geared more for embedded, but you can use an sdl back end for desktop (which might kill your light weight requirement depending on your strictness level). I wrote my own tty/framebuffer driver for it and use it directly on the frame buffer (not Linux) but it's pretty nice to work with. But if you need metal/openGL/Vulcan/directX and hardware acceleration, it'…

Thank you!

Re: Nuklear – A single-header ANSI C immediate mode cross-platform GUI library

#45

Nuklear is great. I’ve spent countless hours hacking around with it. I’ve also built a customized version for classic Macintosh systems (down to System 2.0 or so) and built some simple Macintosh software for it. I put it on GitHub here: https://github.com/CamHenlin/nuklear-quickdraw

Now that's just awesome - I'll definitely have to play with this! What's the performance like on low-powered CPUs?

Re: Nuklear – A single-header ANSI C immediate mode cross-platform GUI library

#46

This looks cool, but I don’t do a lot of GUI work. Why would one use this as opposed to Qt?

License issues aside the typical use case is that you want to integrate the UI with an existing 3D renderer (e.g. you have a 3D engine, and want an UI overlay for tooling and debugging). 'Bring your own renderer' UI frameworks like Nuklear or Dear ImGui are perfect for this use case. With 'traditional' UI frameworks like Qt, WPF, GTK... this is a massive PITA and even if it's possible would add an incredible amount o…

will immediate mode keep the cpu active thus not power saving friendly?

Re: Nuklear – A single-header ANSI C immediate mode cross-platform GUI library

#47

This looks cool, but I don’t do a lot of GUI work. Why would one use this as opposed to Qt?

In addition to what others have said, they are different types of GUI systems. As an immediate mode UI, the logic behind what gets drawn to the screen in Nuklear runs every frame, and it draws/updates the entire screen every frame. A retained mode UI like QT draws elements once when they need to be updated, and they get left there until an event occurs that requires something change. So immediate mode UIs like Nuklear and Dear ImGUI, tend to be more appropriate for rendering the UI elements of games and other programs that already draw/update the screen each frame. Retained mode tends to be more useful for traditional "desktop" like applications where interacting with the standard toolkit widgets serves the primary purpose of the program. Of course there are many ways of blurring the lines and using either for both, so this isn't a hard and fast rule, just a rule of thumb.

Re: Nuklear – A single-header ANSI C immediate mode cross-platform GUI library

#48

Here's a simple WASM version of the Nuklear standard demo: https://floooh.github.io/sokol-html5/nuklear-sapp.html The big difference to Dear ImGui is that Nuklear has a C API and is also implemented in C - and apparently it has more skinning/themeing options, which I haven't tinkered with yet. TBH, for tools I prefer cimgui (a C wrapper around Dear ImGui), my impression is that Nuklear has a 'purer' immediate-mode de…

Dear ImGui certainly seems more popular wherever skinning isn’t a priority (though I’ve seen games use it even for user facing UI). It’s become a bit of a Wilhelm scream, love spotting it in the wild.

Re: Nuklear – A single-header ANSI C immediate mode cross-platform GUI library

#49

Here's a simple WASM version of the Nuklear standard demo: https://floooh.github.io/sokol-html5/nuklear-sapp.html The big difference to Dear ImGui is that Nuklear has a C API and is also implemented in C - and apparently it has more skinning/themeing options, which I haven't tinkered with yet. TBH, for tools I prefer cimgui (a C wrapper around Dear ImGui), my impression is that Nuklear has a 'purer' immediate-mode de…

Pretty cool that works in a browser on a canvas. Might I consider it to build something like a simplified photopea or powerpoint? However it requires webgl and writing in C translated to wasm? Looks like webgl is well supported, do many folks have it disabled?

Not sure about that, maybe javascript with svg would be easier to write such an app in.

Re: Nuklear – A single-header ANSI C immediate mode cross-platform GUI library

#50
I use Nuklear for a Steam game I made in C. It worked well for my needs but there are a few things I still haven't figured out yet - like rendering centered multi-line text. Localizing my game was very straightforward with Nuklear - I didn't run into any roadblocks with fonts or different alphabets. I was able to get the interfaces to be controller-friendly too. Overall, I had a positive experience and will use it again.
Post reply on HN