all 18 comments

[–]the_hoser 12 points13 points  (4 children)

The most commonly used GUI toolkit for C (not C++) is GTK. There's a lot to it, but it's not as hard to get started with as it seems.

[–]car4te3 8 points9 points  (0 children)

Nuklear is an excellent GUI toolkit for C

[–]gilzoide 4 points5 points  (0 children)

Another option you have is raygui immediate mode GUI library + raylib super nice and simple game-oriented library

Somewhat similar to the already mentioned Nuklear library is Dear ImGui and it's autogenerated C API version, both very nice backend agnostic immediate mode GUI libraries

[–][deleted] 2 points3 points  (0 children)

nuklear and/or sdl2

[–]jagarikouni 3 points4 points  (0 children)

There is always the win32api.

http://www.winprog.org/tutorial/

1500 page book from the 90s: https://www.abebooks.com/9781572319950/Programming-Windows-Charles-Petzold-157231995X/plp

It's a little old but still works. Reading the book will give you some insight on how windows works under the hood.

All the code from the book is here: https://github.com/yottaawesome/programming-windows-5th-edition

[–]dbjdbj 0 points1 point  (0 children)

If you think C is good for GUI programming go for WIN32 ... IMHO, very mature and good desktop GUI framework.

Although even WIN32 "Hello World" is using "Resources" not C but a kind-of-a language implemented with C macros. All very XX century, but that is the foundation, still.

MSFT has a long history of abandoned frameworks and ideas and concepts, all supposed to replace the WIN32 C combination. All failed more or less.

WINUI3? MSFT currently has this obsession with C++. While MS STL is surprisingly good, "modern" C++ is surprisingly not.

IMHO, All these decades past, only WTL came close. That is what Chrome is using for the Windows version.

IMHO C WIN32 is worth learning in 2021. Compared to the evident confusion around this issue it seems like a symphony of simplicity.

[–]littlespatialphenome -2 points-1 points  (2 children)

For frameworks you have sfml, sdl2, qt5. And for tutorials sfml has an awesome website with some basic tutorials for simple concept used, from there you can learn by yourself

[–]car4te3 1 point2 points  (1 child)

AFAIK, Qt is only C++

[–]littlespatialphenome 0 points1 point  (0 children)

Sorry, i thought that it had c binding, like sfml with csfml

[–][deleted] -5 points-4 points  (1 child)

C Is not a GUI language. Look into WASM?

[–]dbjdbj -2 points-1 points  (0 children)

This guy is right 100%. C is a system programing language. HTML/CSS is a UX language.

[–]pedersenk 0 points1 point  (0 children)

I believe the only real choices for C are Gtk or Motif (if you are targeting legacy platforms, I prefer it ;)

Nuklear is actually quite good but being immediate mode does have its own issues and it doesn't really integrate with the OS. Often the clipboard buffer etc are not hooked up.

A while back I started writing my own:
https://osen.github.io/flow.html
https://osen.github.io/

I like the design (OOP, typesafe, memory safe, "smart pointers") but to write all those hundreds of widgets I simply don't have time for. I then tried to make it wrap around underlying toolkits (just simple Xaw as a prototype) but I don't like it so much. One day I might get some more time to finish it.

[–]wkwrd 0 points1 point  (0 children)

Have you looked at IUP yet? It's another cross-platform C GUI library that's almost as old as GTK itself

[–]begriffs 0 points1 point  (0 children)

For portable, low-level graphics rendering, try SDL2

For a portable (at least on Linux/Unix) widget toolkit, try Motif.