scorpioncity.com
scorpioncity.com · This is/was my old 'personal website' (~1997 to 2010-ish); my new 'personal website' is at djoffe.com »
As of Oct 2016 I have decided to add some of the old content back again. Note that some of the info on the site is now outdated.
- David Joffe
Linux / X Window System programming

Menu:

  1. Links
  2. Media/Gaming SDK's
  3. Widget GUI Toolkits
  4. hello: A very simple C application with Makefile example
  5. dlplugin: A simple plugin architecture example (with source)


Links

Technical X Window System and Motif WWW Sites A *lot* of links here, some of them may be useful.

The GUI Toolkit page A list of free GUI development packages (many more than I have listed here.)


Media/gaming SDK's:

Simple DirectMedia Layer: (http://www.libsdl.org/)
Cross-platform (Win32, Linux, BeOS, Mac) low-level games programming API. This is about the closest I've seen to a cross-platform DirectX equivalent. Includes API's for video, audio, input, threads, timers, and has OpenGL support. I recommend this API.

Clanlib SDK: (http://www.clanlib.org/)
This includes API's for 2d graphics, sound and networking, and is platform-independent (Linux and Windows.)

Mesa 3D Graphics Library: (http://www.mesa3d.org/)
Brian Paul's OpenGL compatible 3D (and of course 2D) graphics library.

OpenSound System: (http://www.opensound.com/)
Sound API for Linux and Unix systems.

Advanced Linux Sound Architecture: (http://www.alsa-project.org/)
A sound driver/API project for Linux/Unix systems.


Widget toolkits:

You will notice there are quite a number of widget libraries for X. Choice may sometimes be a good thing, but having ten applications loaded, each using a different widget set, hogs memory, slows your computer down, and results in an inconsistent (and thus harder to learn) user interface for inexperienced users. This is one of Linux's weaknesses. Nonetheless, some of the toolkits do have different purposes. Some are designed to be cross-platform. Some are designed to be small and light. Some are built to have many features and eye-candy (like gtk.) Some are C, some are C++, many have bindings for other languages.

If you want to learn one, and aren't sure which, I would recommend wxWindows.

wxWindows: (http://wxwindows.org/)
A very nice OpenSource C++ cross-platform GUI development kit, with bindings for many other languages. wxWindows is cross-platform (Win32, Linux, MacOS, OS/2, BeOS etc), and features a clean, well-designed API. A major feature of wxWindows is "native look and feel", meaning that your applications will look like Windows applications when compiled on Windows, like Mac applications when compiled on Mac, etc. The API includes many other non-UI classes, such as threads, timers, sockets, regular expression parsing, ZIP file support, OpenGL, databases (ODBC) and more. wxWindows also supports Unicode, and text rendering with Pango on Linux. Many compilers and development environments are supported, and there are many sample programs.

Having now worked with wxWindows, I definitely recommend this API. It is useful not just for people looking to do cross-platform development, but for anyone interested in doing Windows development at all, as the API is MUCH more of a pleasure to work with than either that awful Win32 or that awful MFC. I will be using wxWindows in future for all my own general application development.

Here is a link to an online document to help people get wxWindows set up in MSVC.

GTK: (http://www.gtk.org/)
One of the most popular toolkits currently on Linux. Originally developed for the GIMP (the somewhat stagnant but otherwise very good Photoshop work-alike for Linux.) It is the toolkit of choice for the Gnome project. There is a Win32 port in progress. Supports themes, and has many bindings for other languages, such as Python. The only thing I don't like about it is that although it is object-oriented, the implementation is C, meaning a somewhat "hacky" feel to the OO bits, and lots of ugly typecast macros. Apparently there are C++ bindings though.

Qt: (http://www.trolltech.com/)
TrollTech's Qt is a popular GUI windowing toolkit, with a C++ API. The K Desktop Environment (http://www.kde.org/) uses Qt (so KDE is to Qt as Gnome is to GTK.) Qt doesn't use the GNU license, but has it's own not-quite-as-free, but free-for-non-commercial-use license. Because of this many OpenSource developers don't like it, and this was one of the reasons that the Gnome project was started. The KDE people don't want to change now because Qt is what they know. As a result, Linux software development suffers from fragmentation and wasted, duplicated effort, as KDE developers and Gnome developers very often create different versions of what could be one program. Other drawbacks resulting from this infighting include Linux requiring more memory and being slower (as multiple UI libraries have to be loaded into memory at once if you use programs from both at the same time) as well as an inconsistent (thus harder to learn) user interface for people new to Linux.

FLTK: (http://www.fltk.org/)
The Fast Light Tool Kit, pronounced "fulltick", is an LGPL'd widget library that I have looked at recently and am quite impressed with. It is cross-platform (X and Microsoft Windows) and also works with OpenGL (and Mesa.) The C++ API is pretty clean and easy to use. It is small and light, and includes a user-interface builder, which outputs human-readable and editable C++ source code. It includes an OpenGL/Mesa drawing widget, supports double-buffering, includes a small and fast 2D drawing library, X cut and paste and various other nifty features. It is well-documented and includes a number of decent sample prorams. It is simple to set up and install. I like this toolkit.

The toolkit thats supposed to be the "Unix standard" is Motif. I don't know anything about its licensing terms except I believe its also not completely free, and is a bit dated. There is a free clone of Motif available, called Lesstif. (Need link here.)

FOX: (http://www.fox-toolkit.org/fox.html)
LGPL, C++, cross-platform, OpenGL widgets. Easy to program and extend; fairly good higher-level widgets, splitter windows, file lists, tree lists, notebooks; multiple document interface support. Has a fairly Windows-ish look and feel, which may or may not be a good thing depending on your point of view.


hello: A very simple C application with Makefile example

hello.tar.gz (842 bytes)

A "hello world" sample. This is about as simple as it gets. Contains a Makefile, a .c file and a README.TXT.

To unzip the "tarball", type tar -xvzf hello.tar.gz at the commandline prompt.


dlplugin: A simple plugin architecture example (with source)

dlplugin1.0.tar.gz (170,778 bytes) Version 1.0

This is a Linux C++ example of how to create a plugin architecture for your applications using shared dynamic libraries (.so files), which seems to be the same method used for Netscape Navigator/Mozilla plugins.

This is somewhat experimental and I'm not too experienced with this so any feedback is welcome.

Todo: plugins don't yet have access to any sort of API from the main application.

Follow @d_joffe