ThwUI is platform independed user interface library for games.
It allows to create and display various windows and controls on it in games
interfaces, and also interact with them.
Library is written in C++ and allows rendering user interface using OpenGL or
Direct3D graphic libraries.
* User interface designer (WYSIWYG style).
* Saving and loading user interface to/from XML files.
* Themes support.
* Skins support.
* Windows/Linux/OSX support.
* True type fonts support.
* Rendering using OpenGL, Direct3D or any other pluggable method.
2.1. Required libraries
* FreeType (if building on linux, osx or in windows if not defined
* MsXML (if building on windows)
* libXml2 (if building on linux, osx or in windows if defined
2.2. Required libraries for Examples/UIBuilder
* OpenGL (on linux, osx, windows)
* Direct3D (on windows).
* libpng (if building OpenGL examples and designer)
* zlib (if building OpenGL examples and designer)
* Visual Studio 2005 (on windows)
* Eclipse 3.x (on linux, MacOSX).
Basic usage examples are provided in projects ThwUITestOpenGL,
ThwUITestDirect3D and ThwUITestCommon.
In order to use it is required:
* Add library to include path.
* add #include <UI/UI.h>
* Get the instance of UIEngine (UIEngine::GetInstance()) (it is singleton
* Specify Render interface (UIEngine::GetInstance()->SetRender(pMyRender);)
* Specify working folder (UIEngine::GetInstance()->SetWorkingFolder(L"../data/"));
This is only one interface which has to be implemented by library user.
It's interface is provided in ThW::UI::Utils::IRender class.
Thus in example projects there is 2 implementations of it:
* Using OpenGL and GLUT.
* Using Direct3D.
3.2. Creating Desktop.
All windows in user interface are grouped in Desktops (usually one is
for an application, thus more can be used).
Desktop* pDesktop = UIEngine::GetInstance()->NewDesktop();
Desktop could be created empty or loaded from xml file by passing parameter to
3.3. Adding window to the desktop
New window is created and added to desktop by calling pDeskop->NewWindow()
Window can be created empty or loaded from xml file by passing file name to
3.4. Adding controls to window
Controls can be created by calling windows method CreateControl and passing
controls type as parameter
Button* pButton = static_cast<Button*>(pWindow->CreateControl(L"button",
and after creation control has to be added to required parent:
adding to window pWindow->AddControl(pButton);
adding to panel pPanel->AddControl(pButton);
detailed example is provided in the ThwUITestCommon projects file
3.5. Creating Windows from XML files.
for creating windows using XML, use ThwUIDesignerDirect3D and
Created window can be later loaded using
Window* pWindow = pDesktop->NewWindow(L"mywindow.window.xml");
3.6. Rendering User interface
In order to render user interface developer has to add.
pDesktop->Render(); method call into the application rendering loop.
3.7. Responding to user events.
In order to handle mouse clicks, key presses it is required to call Desktop
methods MousePresse, MouseReleases, KeyPressed, etc..
Detailed examples are provided in ThwUITestOpenGL, ThwUITestDirect3D and
3.8. User interface Internationalization.
User interface supports internalization. Thus text messages can be changed
according required language. In order to use this feature, ILanguage interface
has to be implemented and its instance has to be passed to UIEngine::SetLanguage
Library is provided using BSD license. If other type license is required
feel free to contact library maintainer email@example.com