What is WeaselGui?

WeaselGui is a small, lightweight and flexible, cross-platform drop-in GUI sub-system written in C++. As well as a GUI component, it also contains several other components – namely CONTROL, FONT, GFX, MATHS, STATE and UTILITY. Full source is available and licensed under the Lesser GPL licence.

WeaselGui was born as the source code for the article ‘A Gui Framework and Presentation Layer‘ to appear in ‘Game Engine Gems, Volume I‘, Eric Lyngel, 2010 [Publisher Link]. An initial build of this code is included on the disk. The article describes in detail how it might be used and relates the major design decisions made.

WeaselGui is tested, production-level GUI code. It is designed that a professional programmer might use it as-is instead of spending a few days writing yet another GUI system, or for the student wishing to put a project together using a known framework.

Three samples show basic examples of how the library can be used for the provided components, including menus, sliders, checkboxes, text and graphics. Sample keyboard, mouse and joypad input is provided.

The GUI portion of this code is intended to give the user a set of very basic, reusable component classes that can be extended to create many custom types. Example types for GuiSelectable, GuiSelectableGroups, GuiSelectableText, GuiSliders and an example of several states showing how the input might be handled on the game-side of things.

WeaselGui is more than just a set of GUIĀ  also includes:

  • A sample, simply extendable STATE Machine.
  • A variable-width FONT rendering system (based on the AngelCode BMFont system – who provide a handy Font exporter).
  • CONTROL system – to handle the input of an XBOX controller under a Windows system with a simple
  • Basic Graphics support with GFX – actually this is just the most simple OpenGL renderer we could create to show off the samples.
  • A simple MATHS library – with sample, used, tested classes for 3 component vectors and 4×4 matrices.
  • A set of handy UTILITY classes – Growable arrays, Custom Assert macros (with break, skip this time, skip always options), CRC32 hashing, String classes and more.

The examples also require SDL (Simple Directmedia Layer) headers and binaries to run. A current version of this (1.2.13) is stored in the ‘Code\External’ directory and referenced inside the Example projects. As the .dll file is required for the program to be run, a copy of this is stored in the ‘Code\Examples’ directory, which is where the examples should be run from as their working directory.

There are no known issues at this time. There are a few modifications that may be made. Check the website for more details and updates.

The generated FONT files and corresponding source code are based on data generated from AngelCode’s BMFont v1.12 (http://www.angelcode.com/products/bmfont/).

Future work on WeaselGui will take the form of a simple editor, dependent on usage and demand.
There will be a .DLL implementation of the library available, too that helps comply with the GNU LGPL licence.

Please drop us a line if you find this code useful or can suggest improvements. We’d love to hear from you.

*****************************************************************************************************

Download WeaselGui at SourceForge.net

Download WeaselGui at SourceForge.net

*****************************************************************************************************

Thanks to:
The people at Simple Directmedia Layer for a simple, understandable framework.
The nice people at AngelCode for writing one of the best freely available font exporters out there.
Everyone I’ve worked with. In particular Alan Abram, who contributed to the development of a previous version of this software as well as helping putting this library together.

For more information, see the SourceForge hosted page.

Tutorial screenshot

January - 17 - 2010