News
 
About
 
UI Library
 
Current Status
 
ScreenShots
 
Downloads
 
Team
 
Sourceforge
Project

 
Releases
 
1

1. About
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.

Library provides:
* 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. Building
2.1. Required libraries
* FreeType (if building on linux, osx or in windows if not defined THW_UI_NO_FREETYPE)
* MsXML (if building on windows)
* libXml2 (if building on linux, osx or in windows if defined THW_UI_USE_LIBXML2)
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)
2.3. Tools
* Visual Studio 2005 (on windows)
* Eclipse 3.x (on linux, MacOSX).

3. Usage
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 object)
* Specify Render interface (UIEngine::GetInstance()->SetRender(pMyRender);)
* Specify working folder (UIEngine::GetInstance()->SetWorkingFolder(L"../data/"));

3.1. Render
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 sufficient
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
NewDesktop method.

3.3. Adding window to the desktop
New window is created and added to desktop by calling pDeskop->NewWindow() method.
Window can be created empty or loaded from xml file by passing file name to
NewWindow method.

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", FlagsNone);

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 ConsoleWindow.h.

3.5. Creating Windows from XML files.
for creating windows using XML, use ThwUIDesignerDirect3D and
ThwUIDesignerOpenGL tools.
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
ThwUITestCommon projects.

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
method.

4. Licensing
Library is provided using BSD license. If other type license is required
feel free to contact library maintainer sarunas@ieee.org