Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Developing a simple windowed app for Linux

Okay, I'd like to write a simple C app for Linux (say Ubuntu with Gnome) that would do the following:

  1. Open a Window
  2. Draw something in that window using a main loop, e.g. the current loop number. I don't want to use controls, but to draw directly on the window surface
  3. Close the window & the app

I can do that in Windows, but I've no idea how I could do that in Linux.

Thanks!

like image 681
Albus Dumbledore Avatar asked Aug 06 '26 23:08

Albus Dumbledore


1 Answers

Unless you want a full-blown GUI (in which case I'd recommend Qt or GTK), then SDL is a very popular and extremely simple free cross-platform library that gives you a drawing surface and some simple IO facilities. It's natively C, but has bindings to a large number of other languages.

like image 74
gspr Avatar answered Aug 08 '26 16:08

gspr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!