Skip to content
/ lux Public

lux-gui: the Lightweight User eXperience (a windowing library using SDL)

License

Notifications You must be signed in to change notification settings

MurphyMc/lux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lux

Lux, or lux-gui, is a Lightweight User eXperience. It's a small windowing toolkit for making desktop-like user interfaces. It's written hastily in C. Patches are welcome.

Here's what Lux looks like as part of the the SDL multiplexer SDLuxer (Lux is used to draw the windows, handle keyboard and mouse input, manage the cursor, etc.):

SDLuxer screenshot

Lux is currently tied to SDL for getting events and displaying output, and it uses some SDL structures as part of its interface. It should be possible to port it to non-SDL systems (i.e., framebuffers plus some input), but the easiest way to do that is probably to port at least parts of SDL to the system (which is potentially useful in itself).

It's my belief that the included font comes from X and is in the public domain. Thanks go to Lars C. Hassing for making it available in an easy-to-consume form. More information on the font file can be found with the Lilt terminal emulator.

The Demo

Lux comes with a little demo program. Press F1 to create a new window. There is a keyboard-based window switcher which is bound to Alt-~ and Alt-Shift-~ by default.

Compiling the demo is just a matter of compiling the two C files and linking with SDL. There's a cmake file which will do it for you:

cmake .
cmake --build .
./lux-demo

Using Lux

Please feel free to write better documentation. At present, the best way to learn to use Lux is to read the demo program (it's short!), and then look through the header file. There are various other routines in the C file which aren't exposed, but some of them are useful and maybe they should be. Submit a pull request or file an issue if you think something vital is missing or should be exposed instead of hidden.

A very short crash course:

  • There are functions for dealing with rectangles, which start with rect_.
  • There are general functions starting with lux_.
  • There are functions for dealing with windows, starting with window_.
  • Windows are represented by the structure Window.
  • Windows have a number of event-handling functions starting with on_, which you use to override window behavior.
  • The F-keys can be used as global hotkeys.
  • You can either let Lux run an event loop (lux_loop), or you can run your own SDL event loop, passing events to Lux (lux_do_event).

About

lux-gui: the Lightweight User eXperience (a windowing library using SDL)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published