SimpleGUI

SimpleGUI is a simple single-file GUI. Its main features are (at this time) sliders and a color palette, but it has a few more options. It is designed for being as nonintrusive as possible with minimal dependencies and needing no external files. This approach is as far as I know unique. It gives some limitations but makes it ideal for course work. It has been tested on Mac and Linux. It had some problems with Apple’s “M” computers but that should be resolved with the recent versions.


Using SimpleGUI is a matter of three things:

- Making three calls from your program in response to updates, mouse clicks and mouse dragging.

- Creating controls connected to selected variables that it should affect (like colors, positions…).

- Include SimpleGUI.h from your program and compile/link with SimpleGUI.c.


The GUI is not super pretty, since all shapes have to be specified as binary pixels. This means that I can have no smooth edges on things. This is due to it being inline, simple and small with no separate image files. Stlll, if you have suggestions to make it look nicer given this limitation, I am listening.


It comes with five demos:

Skärmavbild 2022-03-20 kl. 09.00.15


SimpleGUI mini demo. Just a single slider, two static strings and an output. This is made as a minimal introduction, showing how the control is controlling a variable.


Skärmavbild 2022-02-26 kl. 08.07.15

SimpleGUI Demo: The main demo, showing most controls in SimpleGUI and how they interact.


Skärmavbild 2022-02-07 kl. 10.05.40

Phong bunny and friends, SimpleGUI version. It sports a checkbox, a color selection slider group and sliders for controlling rotation of the lower bunny. You should note how the sliders are connected to variables, so you do not need to access the GUI for values, it sets them where you want them.


Skärmavbild 2022-02-07 kl. 10.07.07

Psychedelic teapot with the physically smallest GUI I have ever seen. The point with this is that mouse when clicks and dragging must be correctly handled with either SimpleGUI or the main program, and this is just a matter of sending events to SimpleGUI and it will return 0 or 1 whether it handled it or not.


Skärmavbild 2022-02-07 kl. 10.07.56

“Put the lid on the teapot” is a variation of a demo I made for LitteOBJLoader, with a teapot split in a number of sub-parts. Here we control the position of the lid with three sliders.


There are also a few “bonus demos” but I don’t plan to make an effort to keep them up to date all the time.


Does SimpleGUI not provide the features you need? Suggestions as well as hacks in my code are welcome!


Version history


Version 0.2 adds color palette, buttons, and the mouse click call should now include mouse up (for button support).


Version 0.2.1 cleans up the code and adds individual colors to sliders.


Version 0.3 adds menus and the mini demo.


Version 0.4 supports multi-line text, steppers plus auto-placement.


Version 0.4.1 modifies the buttons and adds an option for upscaling.


Version 0.4.2 revises dragging so dragging sliders gets easier.


Version 0.4.3 makes a fix get around a problem on M1 Macs.


Version 0.5 adds C++ support.


Downloads


Download version 0.5.1, main file only, a bug fix.


Download version 0.5, now with proper C++ support and main demo in C++ version.


Old versions:


Download Version 0.4.3 as of 2023-03-01


Download Version 0.4.2 as of 2022-11-13


Download Version 0.4.1 as of 2022-05-01


Download Version 0.4 as of 2022-04-27


Download Version 0.3 as of 2022-03-20


Download Version 0.2.1 as of 2022-02-26


Download Version 0.2 as of 2022-02-13


Download First version as of 2022-02-07



SimpleGUI Micro


This is a special, experimental version of SimpleGUI with smaller text and smaller controls.


In this version, everything is made in 8x8 pixel blocks.

Skärmavbild 2022-02-26 kl. 08.00.34

SimpleGUI Micro


For demonstrations on the projector, and most cases with good screen space, the normal version should be more comfortable, but if you really need the GUI to take very little space or you need a lot of controls, you might want this… maybe. I might skip this in the future if interest is low.


Download Micro version 0.4 as of 2022-04-27


Download Micro version 0.3 as of 2022-03-20


Download Micro version 0.2.1 as of 2022-02-26


There will be no upscaling option for the 0.4.1 version since upscaling the downscaled makes no sense.


Please don’t confuse these links with the full version above. The Micro version is a special minimal version for when you want it really small. The standard version, above, is propably what most users will want.


I have not updated SimplGUI Micro after 2022-04-27 since there seems to be no interest for it and keeping it in synch with the normal version takes time.

This page is maintained by Ingemar Ragnemalm.