<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://cegui.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lindquist</id>
		<title>CEGUI Wiki - Crazy Eddie's GUI System (Open Source) - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://cegui.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lindquist"/>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/Special:Contributions/Lindquist"/>
		<updated>2026-06-10T05:02:41Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Template:CEGUIDownloadsRC&amp;diff=2397</id>
		<title>Template:CEGUIDownloadsRC</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Template:CEGUIDownloadsRC&amp;diff=2397"/>
				<updated>2006-08-22T15:32:10Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;text-align:center; color:#884400; border:1px dashed #888888; margin:0.9em&amp;quot;&amp;gt;&lt;br /&gt;
'''Note that the downloads on this page are the official file releases from the CEGUI Team. The downloads on this page corresponds to Release Candidate version of CEGUI. Please test this version and report all bugs on the Mantis bug tracker. For additional, community provided downloads, please visit the [[Community Downloads|Community Downloads page]]'''&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{| cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot; width=&amp;quot;100%&amp;quot; background-color=&amp;quot;transparent&amp;quot; &lt;br /&gt;
| style=&amp;quot;width:50%; border:none; margin:none; padding:none;&amp;quot; valign=&amp;quot;top&amp;quot; | &amp;lt;!-- This is the left panel --&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#2f1fef; padding:0px; border:1px solid #888888; margin-right:5px; margin-bottom:10px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center; line-height:100%; padding:0.2em; background-color:#eeeeee; border-bottom:1px dashed #888888;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#339933; font-size:100%&amp;quot;&amp;gt;'''Core Library Source Downloads'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;!-- Core library download (Source) --&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0.5em&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0px; border:1px dashed #888888; margin-bottom:10px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center; line-height:100%; padding:0.1em; background-color:#eeeeee; border-bottom:1px dashed #888888;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#3349dd; font-size:100%&amp;quot;&amp;gt;'''Crazy Eddie's GUI System Mk-2 Source Code (tar.gz archive)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0.5em&amp;quot;&amp;gt;&lt;br /&gt;
* Version {{{cegui}}} of the source code for Crazy Eddie's GUI System Mk-2, supplied as a bz2 compressed tarball.&lt;br /&gt;
* This package is intended for linux and Apple Mac users.&lt;br /&gt;
* [http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-{{{cegui}}}.tar.gz?download Download Now!]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0px; border:1px dashed #888888; margin-bottom:10px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center; line-height:100%; padding:0.1em; background-color:#eeeeee; border-bottom:1px dashed #888888;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#3349dd; font-size:100%&amp;quot;&amp;gt;'''Crazy Eddie's GUI System Mk-2 Source Code (zip archive)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0.5em&amp;quot;&amp;gt;&lt;br /&gt;
* Version {{{cegui}}} of the source code for Crazy Eddie's GUI System Mk-2, supplied as a compressed zip archive.&lt;br /&gt;
* This package is intended for Microsoft Windows users.&lt;br /&gt;
* [http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-{{{cegui}}}.zip?download Download Now!]&lt;br /&gt;
* Read this thread for details: http://www.cegui.org.uk/phpBB2/viewtopic.php?t=1665&amp;amp;start=0&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;highlight=&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#2f1fef; padding:0px; border:1px solid #888888; margin-left:5px; margin-bottom:10px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center; line-height:100%; padding:0.2em; background-color:#eeeeee; border-bottom:1px dashed #888888;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#339933; font-size:100%&amp;quot;&amp;gt;'''Crazy Eddie's GUI Simple Image Loading Library (SILLY)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0.5em&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0px; border:1px dashed #888888; margin-bottom:10px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center; line-height:100%; padding:0.1em; background-color:#eeeeee; border-bottom:1px dashed #888888;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#3349dd; font-size:100%&amp;quot;&amp;gt;'''Source Code (tarball)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0.5em&amp;quot;&amp;gt;&lt;br /&gt;
* Version {{{silly}}} of the source code for Crazy Eddie's GUI Simple Image Loading Library, supplied as a tar.gz compressed tarball.&lt;br /&gt;
* This package is intended for linux and Apple Mac users.&lt;br /&gt;
* [http://prdownloads.sourceforge.net/crayzedsgui/SILLY-{{{silly}}}.tar.gz?download Download Now!]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center; line-height:100%; padding:0.1em; background-color:#eeeeee; border-bottom:1px dashed #888888;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#3349dd; font-size:100%&amp;quot;&amp;gt;'''Source Code (zip archive)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0.5em&amp;quot;&amp;gt;&lt;br /&gt;
* Version {{{silly}}} of the source code for Crazy Eddie's GUI Simple Image Loading Library, supplied as a zip compressed archive.&lt;br /&gt;
* This package is intended for Win32 users.&lt;br /&gt;
* [http://prdownloads.sourceforge.net/crayzedsgui/SILLY-{{{silly}}}.zip?download Download Now!]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#2f1fef; padding:0px; border:1px solid #888888; margin-right:5px; margin-bottom:10px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center; line-height:100%; padding:0.2em; background-color:#eeeeee; border-bottom:1px dashed #888888;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#339933; font-size:100%&amp;quot;&amp;gt;'''Core Library Win32 Dependency Downloads'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0.5em&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0px; border:1px dashed #888888; margin-bottom:10px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center; line-height:100%; padding:0.1em; background-color:#eeeeee; border-bottom:1px dashed #888888;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#3349dd; font-size:100%&amp;quot;&amp;gt;'''MSVC++ 8 dependency package for CEGUI Mk-2 {{{cegui}}}'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0.5em&amp;quot;&amp;gt;&lt;br /&gt;
* This package contains all library for use by MSVC++ 8 (MSVC++ 2005) users.&lt;br /&gt;
* This package is for use with CEGUI {{{cegui}}} series of releases.&lt;br /&gt;
* [http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-{{{dependency}}}-deps-vc8.zip?download Download Now!]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0px; border:1px dashed #888888; margin-bottom:10px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center; line-height:100%; padding:0.1em; background-color:#eeeeee; border-bottom:1px dashed #888888;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#3349dd; font-size:100%&amp;quot;&amp;gt;'''MSVC++ 7.1 dependency package for CEGUI Mk-2 {{{cegui}}}'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0.5em&amp;quot;&amp;gt;&lt;br /&gt;
* This package contains the all library for use by MSVC++ 7.1 (MSVC++&amp;gt;Net 2003) users.&lt;br /&gt;
* This package is for use with CEGUI {{{dependency}}} series of releases.&lt;br /&gt;
* [http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-{{{dependency}}}-deps-vc71.zip?download Download Now!]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border:none; margin:none; padding:none;&amp;quot; valign=&amp;quot;top&amp;quot; | &amp;lt;!-- This is the right panel --&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#2f1fef; padding:0px; border:1px solid #888888; margin-left:5px; margin-bottom:10px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center; line-height:100%; padding:0.2em; background-color:#eeeeee; border-bottom:1px dashed #888888;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#339933; font-size:100%&amp;quot;&amp;gt;'''Crazy Eddie's GUI System Layout Editor'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0.5em&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0px; border:1px dashed #888888; margin-bottom:10px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center; line-height:100%; padding:0.1em; background-color:#eeeeee; border-bottom:1px dashed #888888;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#3349dd; font-size:100%&amp;quot;&amp;gt;'''CELayoutEditor Windows Installer'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0.5em&amp;quot;&amp;gt;&lt;br /&gt;
* Out-of-the-box installer, which is built against the stable CEGUI {{{cegui}}} release. Includes sample layout(s).&lt;br /&gt;
* Version {{{editor}}} (version renamed to match the corresponding cegui library)&lt;br /&gt;
* [http://prdownloads.sourceforge.net/crayzedsgui/CELayoutEditorSetup_0.5-RC2.exe Download Now!]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0px; border:1px dashed #888888; margin-bottom:10px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center; line-height:100%; padding:0.1em; background-color:#eeeeee; border-bottom:1px dashed #888888;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#3349dd; font-size:100%&amp;quot;&amp;gt;'''CELayoutEditor Source Distributions'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#ffffff; padding:0.5em&amp;quot;&amp;gt;&lt;br /&gt;
* These zip- and gz packages contain the exact sources from which the installer is build. It's for Linux users and for those who don't have access to Subversion or are not familiar with the hussle.&lt;br /&gt;
* It at least compiles to the CEGUI {{{cegui}}} source release with gcc, VC7.1, VC8.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The installer is above this download link, so make sure you pick the one you feel most comfortable with.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://prdownloads.sourceforge.net/crayzedsgui/CELayoutEditor_0.5-RC2.zip?download Download zip version!]&lt;br /&gt;
* [http://prdownloads.sourceforge.net/crayzedsgui/CELayoutEditor-0.5.0-RC2.tar.gz?download Download gz version!]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Scheme_files&amp;diff=2396</id>
		<title>Scheme files</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Scheme_files&amp;diff=2396"/>
				<updated>2006-08-16T22:52:36Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: /* Document structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
CEGUI is pretty modular in many aspects. Resource loading, rendering, scripting and window-factories, can all be controlled by client modules.&lt;br /&gt;
The scheme file concerns resource loading.&lt;br /&gt;
&lt;br /&gt;
The first thing most users do when initialising CEGUI, is to load a scheme. This could for example be &amp;quot;../datafiles/schemes/TaharezLookSkin.scheme&amp;quot;. This scheme file is probably the most used currently, and will load the Falagard version of classic TaharezLook into the library.&lt;br /&gt;
&lt;br /&gt;
If one takes a closer look at this file, they'll see that it is a XML document, ready to be edited... The nice thing here is that it's no longer necessary to recompile, to change the resources to be loaded. Furthermore a scheme acts like a &amp;quot;resource package&amp;quot; as we can unload all resources that is loaded by a scheme given we know it's name. From a coding perspective this is nice as it simplifies the resource management. All you have to create/destroy is the scheme it self. CEGUI worries about all the individual resources specified in the XML file for you...&lt;br /&gt;
&lt;br /&gt;
This document is largely based on the 'Readme.txt' file in the 'XMLRefSchema' directory of the source distribution by Paul himself.&lt;br /&gt;
&lt;br /&gt;
== Document structure ==&lt;br /&gt;
A CEGUI sheme follows a &amp;quot;strict&amp;quot; order dependent structure that looks like this:&lt;br /&gt;
&lt;br /&gt;
* '''GUIScheme'''&lt;br /&gt;
** '''Imageset'''&lt;br /&gt;
** '''ImagesetFromImage'''&lt;br /&gt;
** '''Font'''&lt;br /&gt;
** '''LookNFeel'''&lt;br /&gt;
** '''WindowSet'''&lt;br /&gt;
*** '''WindowFactory'''&lt;br /&gt;
** '''WindowRendererSet''' (CEGUI 0.5.X only)&lt;br /&gt;
*** '''WindowRendererFactory'''&lt;br /&gt;
** '''WindowAlias'''&lt;br /&gt;
** '''FalagardMapping'''&lt;br /&gt;
&lt;br /&gt;
All elements are optional and can be repeated. Two imagesets - for example - are after all a fairly common ;-)&lt;br /&gt;
&lt;br /&gt;
Each element will be described individually below.&lt;br /&gt;
&lt;br /&gt;
== GUIScheme ==&lt;br /&gt;
Root element. Has a name attribute, and a collection of sub-elements which can be Imageset, ImagesetFromFile, Font, LookNFeel, WindowSet, FalagardMapping and WindowAlias elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - Specifies the name that the scheme will use within the system. ''Required''.&lt;br /&gt;
&lt;br /&gt;
''GUIScheme'' is the root element and is the only &amp;quot;global&amp;quot; tag.&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
     ... resources ...&lt;br /&gt;
     ...&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All schemes will have this XML as all the &amp;quot;magic&amp;quot; goes inside it :-)&lt;br /&gt;
&lt;br /&gt;
=== Imageset ===&lt;br /&gt;
Specifies an Imageset to be loaded as part of this scheme.  Has attributes but no sub-elements.&lt;br /&gt;
If an imageset with the requested name already exists, the file specified is not loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - The name of the Imageset. ''Required''.&lt;br /&gt;
* '''Filename''' - Filename of the Imageset file.  If the imageset created by this file does not = Name above, an exception is thrown. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     '''&amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example the file &amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; must define the imageset named &amp;quot;MyImages&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== ImagesetFromFile ===&lt;br /&gt;
Specifies an Imageset to be loaded as part of this scheme.  Has attributes but no sub-elements.&lt;br /&gt;
If an imageset with the requested name already exists, the file specified is not loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - The name of the Imageset. ''Required''.&lt;br /&gt;
* '''Filename''' - Filename of the image file to load in order to create this Imageset. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the image file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     '''&amp;lt;ImagesetFromFile Name=&amp;quot;MyBackground&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyBackground.tga&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example the file &amp;quot;../datafiles/imagesets/MyBackground&amp;quot; is a Targa (.TGA) image file. By default an Imageset loaded like this defines a single image named '''full_image''' that covers the entire texture (the content of the image file).&lt;br /&gt;
&lt;br /&gt;
=== Font ===&lt;br /&gt;
Specifies a Font to be loaded as part of the scheme. Has attributes but no sub-elements.&lt;br /&gt;
If a font with the requested name already exists, the file specified is not loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - The name of the Font ''Required''.&lt;br /&gt;
* '''Filename''' - Filename of the Font file.  If the font created by this file does not = Name above, an exception is thrown. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     '''&amp;lt;Font Name=&amp;quot;MyFont&amp;quot; Filename=&amp;quot;../datafiles/fonts/MyFont.font&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Font element always loads font XML files. These are not covered here.&lt;br /&gt;
&lt;br /&gt;
=== LookNFeel ===&lt;br /&gt;
Specifies a LookNFeel to be loaded as part of the scheme. Has attributes but no sub-elements.&lt;br /&gt;
The XML file loaded by this element may contain many widget looks which will all become available.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Filename''' - Filename of the LookNFeel file to parse. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     '''&amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Loading a look'n'feel specification is not enough. We must create a FalagardMapping as well. More on this soon. Just know that now the widget looks specified in MySkin.looknfeel are available to falagard mappings. At least the imageset we use in MySkin is available ;-)&lt;br /&gt;
&lt;br /&gt;
=== WindowSet ===&lt;br /&gt;
Specifies a module containing concrete GUI elements and their factories. Has attributes and zero or more WindowFactory sub-elements. That is you can optionally specify WindowFactory sub-elements. If they are omitted all available factories in the module are loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Filename''' - Specifies the name of the loadable module (dll / .so / etc). ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     '''&amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardBase&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CEGUI 0.4.X provides 3 windowsets. Falagard, WindowsLook and TaharezLook. The above sample code is only valid for CEGUI 0.4.X.&lt;br /&gt;
&lt;br /&gt;
CEGUI 0.5.X provides no widget sets. All the core widgets are part of the CEGUIBase library. It's still there though as it allows user widget modules to be loaded dynamically.&lt;br /&gt;
&lt;br /&gt;
=== WindowRendererSet (CEGUI 0.5.X only) ===&lt;br /&gt;
Specifies a module containing WindowRenderer classes and their factories. Has attributes and zero or more WindowRendererFactory sub-elements. That is you can optionally specify WindowRendererFactory sub-elements. If they are omitted all available factories in the module are loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Filename''' - Specifies the name of the loadable module (dll / .so / etc). ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     '''&amp;lt;WindowRendererSet Filename=&amp;quot;CEGUIFalagardWRBase&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CEGUI 0.5.0 only provides one WindowRendererSet. Falagard. It's perfectly possible to write your own WindowRendererSet in C++. Take a look at the CEGUIFalagardWRBase module if you're curious :)&lt;br /&gt;
&lt;br /&gt;
=== WindowFactory ===&lt;br /&gt;
Specifies the factory name (GUI window type name) from the loadable module that is to be added to the list of available factories. Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - Name of the factory / window type which is to be added.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardBase&amp;quot;&amp;gt;&lt;br /&gt;
         '''&amp;lt;WindowFactory Name=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;'''&lt;br /&gt;
     &amp;lt;/WindowSet&amp;gt;&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example we only load the &amp;quot;Falagard/Button&amp;quot; factory. If you only need a few widgets and not the whole set, this could save you some memory.&lt;br /&gt;
&lt;br /&gt;
=== FalagardMapping in CEGUI 0.4.X ===&lt;br /&gt;
Maps a look'n'feel to a window factory and assigns the result to a new window type, in effect creating a new window factory for a specific look'n'feel.&lt;br /&gt;
Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''WindowType''' - The name for the new &amp;quot;factory&amp;quot;. ''Required''.&lt;br /&gt;
* '''TargetType''' - The name of the target window factory which will have the look'n'feel assigned. ''Required''.&lt;br /&gt;
* '''LookNFeel''' - The name of the look'n'feel to use. That's the WidgetLook name from the Falagard XML. ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardBase&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;WindowFactory Name=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/WindowSet&amp;gt;&lt;br /&gt;
     '''&amp;lt;FalagardMapping WindowType=&amp;quot;My/Button&amp;quot; TargetType=&amp;quot;Falagard/Button&amp;quot; LookNFeel=&amp;quot;MyButton&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would be a proper scheme to use the look'n'feel created in  [[The Beginners Guide to Falagard skinning - Part I]]. The new type of button window would in this case be available from code or XML layouts by the type name &amp;quot;My/Button&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== FalagardMapping in CEGUI 0.5.X ===&lt;br /&gt;
Maps a look'n'feel to a window factory and assigns the result to a new window type, in effect creating a new window factory for a specific look'n'feel.&lt;br /&gt;
Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''WindowType''' - The name for the new &amp;quot;factory&amp;quot;. ''Required''.&lt;br /&gt;
* '''TargetType''' - The name of the target window factory which will have the look'n'feel assigned. ''Required''.&lt;br /&gt;
* '''LookNFeel''' - The name of the look'n'feel to use. That's the WidgetLook name from the Falagard XML. ''Required''.&lt;br /&gt;
* '''Renderer''' - Then name of the window renderer factory to use. This module implements the widget rendering code. ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardWRBase&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;WindowFactory Name=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/WindowSet&amp;gt;&lt;br /&gt;
     '''&amp;lt;FalagardMapping WindowType=&amp;quot;My/Button&amp;quot; TargetType=&amp;quot;CEGUI/PushButton&amp;quot; LookNFeel=&amp;quot;MyButton&amp;quot; Renderer=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would be a proper scheme to use the look'n'feel created in  [[The Beginners Guide to Falagard skinning - Part I]]. The new type of button window would in this case be available from code or XML layouts by the type name &amp;quot;My/Button&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== WindowAlias ===&lt;br /&gt;
Specifies an alias for a given window factory type or falagard mapping.  Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Alias''' - Name of the alias. This is the alternative name that 'Target' will be known by. ''Required''.&lt;br /&gt;
* '''Target''' - Name of the window factory type, falagard mapping or existing alias that is to (also) be known as 'Alias'. ''Required''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Discussion ==&lt;br /&gt;
The scheme is obviously a bit more than just loading resources. It also ties the resources together. All of it can be done in code, but using a scheme file is flexible, and avoids recompiling often.&lt;br /&gt;
&lt;br /&gt;
Schemes are especially useful for artists not familiar with C++ programming, as everything you &amp;quot;set up&amp;quot; in the scheme can be used from XML layouts.&lt;br /&gt;
With Falagard this means that you can totally customize the user interface if the program is properly configured to do so without ever talking to the developers ;)&lt;br /&gt;
&lt;br /&gt;
--[[User:lindquist|lindquist]] 03:49, 14 Dec 2005 (CET)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Scheme_files&amp;diff=2395</id>
		<title>Scheme files</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Scheme_files&amp;diff=2395"/>
				<updated>2006-08-16T22:52:13Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: /* Document structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
CEGUI is pretty modular in many aspects. Resource loading, rendering, scripting and window-factories, can all be controlled by client modules.&lt;br /&gt;
The scheme file concerns resource loading.&lt;br /&gt;
&lt;br /&gt;
The first thing most users do when initialising CEGUI, is to load a scheme. This could for example be &amp;quot;../datafiles/schemes/TaharezLookSkin.scheme&amp;quot;. This scheme file is probably the most used currently, and will load the Falagard version of classic TaharezLook into the library.&lt;br /&gt;
&lt;br /&gt;
If one takes a closer look at this file, they'll see that it is a XML document, ready to be edited... The nice thing here is that it's no longer necessary to recompile, to change the resources to be loaded. Furthermore a scheme acts like a &amp;quot;resource package&amp;quot; as we can unload all resources that is loaded by a scheme given we know it's name. From a coding perspective this is nice as it simplifies the resource management. All you have to create/destroy is the scheme it self. CEGUI worries about all the individual resources specified in the XML file for you...&lt;br /&gt;
&lt;br /&gt;
This document is largely based on the 'Readme.txt' file in the 'XMLRefSchema' directory of the source distribution by Paul himself.&lt;br /&gt;
&lt;br /&gt;
== Document structure ==&lt;br /&gt;
A CEGUI sheme follows a &amp;quot;strict&amp;quot; order dependent structure that looks like this:&lt;br /&gt;
&lt;br /&gt;
* '''GUIScheme'''&lt;br /&gt;
** '''Imageset'''&lt;br /&gt;
** '''ImagesetFromImage'''&lt;br /&gt;
** '''Font'''&lt;br /&gt;
** '''LookNFeel'''&lt;br /&gt;
** '''WindowSet'''&lt;br /&gt;
*** '''WindowFactory'''&lt;br /&gt;
** '''WindowRendererSet''' (CEGUI 0.5.X only)&lt;br /&gt;
*** '''WindowRendererFactory'''&lt;br /&gt;
** '''WindowAlias'''&lt;br /&gt;
** '''FalagardMapping'''&lt;br /&gt;
&lt;br /&gt;
All elements can be repeated. Two imagesets - for example - are after all a fairly common ;-)&lt;br /&gt;
&lt;br /&gt;
Each element will be described individually below.&lt;br /&gt;
&lt;br /&gt;
== GUIScheme ==&lt;br /&gt;
Root element. Has a name attribute, and a collection of sub-elements which can be Imageset, ImagesetFromFile, Font, LookNFeel, WindowSet, FalagardMapping and WindowAlias elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - Specifies the name that the scheme will use within the system. ''Required''.&lt;br /&gt;
&lt;br /&gt;
''GUIScheme'' is the root element and is the only &amp;quot;global&amp;quot; tag.&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
     ... resources ...&lt;br /&gt;
     ...&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All schemes will have this XML as all the &amp;quot;magic&amp;quot; goes inside it :-)&lt;br /&gt;
&lt;br /&gt;
=== Imageset ===&lt;br /&gt;
Specifies an Imageset to be loaded as part of this scheme.  Has attributes but no sub-elements.&lt;br /&gt;
If an imageset with the requested name already exists, the file specified is not loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - The name of the Imageset. ''Required''.&lt;br /&gt;
* '''Filename''' - Filename of the Imageset file.  If the imageset created by this file does not = Name above, an exception is thrown. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     '''&amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example the file &amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; must define the imageset named &amp;quot;MyImages&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== ImagesetFromFile ===&lt;br /&gt;
Specifies an Imageset to be loaded as part of this scheme.  Has attributes but no sub-elements.&lt;br /&gt;
If an imageset with the requested name already exists, the file specified is not loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - The name of the Imageset. ''Required''.&lt;br /&gt;
* '''Filename''' - Filename of the image file to load in order to create this Imageset. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the image file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     '''&amp;lt;ImagesetFromFile Name=&amp;quot;MyBackground&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyBackground.tga&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example the file &amp;quot;../datafiles/imagesets/MyBackground&amp;quot; is a Targa (.TGA) image file. By default an Imageset loaded like this defines a single image named '''full_image''' that covers the entire texture (the content of the image file).&lt;br /&gt;
&lt;br /&gt;
=== Font ===&lt;br /&gt;
Specifies a Font to be loaded as part of the scheme. Has attributes but no sub-elements.&lt;br /&gt;
If a font with the requested name already exists, the file specified is not loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - The name of the Font ''Required''.&lt;br /&gt;
* '''Filename''' - Filename of the Font file.  If the font created by this file does not = Name above, an exception is thrown. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     '''&amp;lt;Font Name=&amp;quot;MyFont&amp;quot; Filename=&amp;quot;../datafiles/fonts/MyFont.font&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Font element always loads font XML files. These are not covered here.&lt;br /&gt;
&lt;br /&gt;
=== LookNFeel ===&lt;br /&gt;
Specifies a LookNFeel to be loaded as part of the scheme. Has attributes but no sub-elements.&lt;br /&gt;
The XML file loaded by this element may contain many widget looks which will all become available.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Filename''' - Filename of the LookNFeel file to parse. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     '''&amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Loading a look'n'feel specification is not enough. We must create a FalagardMapping as well. More on this soon. Just know that now the widget looks specified in MySkin.looknfeel are available to falagard mappings. At least the imageset we use in MySkin is available ;-)&lt;br /&gt;
&lt;br /&gt;
=== WindowSet ===&lt;br /&gt;
Specifies a module containing concrete GUI elements and their factories. Has attributes and zero or more WindowFactory sub-elements. That is you can optionally specify WindowFactory sub-elements. If they are omitted all available factories in the module are loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Filename''' - Specifies the name of the loadable module (dll / .so / etc). ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     '''&amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardBase&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CEGUI 0.4.X provides 3 windowsets. Falagard, WindowsLook and TaharezLook. The above sample code is only valid for CEGUI 0.4.X.&lt;br /&gt;
&lt;br /&gt;
CEGUI 0.5.X provides no widget sets. All the core widgets are part of the CEGUIBase library. It's still there though as it allows user widget modules to be loaded dynamically.&lt;br /&gt;
&lt;br /&gt;
=== WindowRendererSet (CEGUI 0.5.X only) ===&lt;br /&gt;
Specifies a module containing WindowRenderer classes and their factories. Has attributes and zero or more WindowRendererFactory sub-elements. That is you can optionally specify WindowRendererFactory sub-elements. If they are omitted all available factories in the module are loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Filename''' - Specifies the name of the loadable module (dll / .so / etc). ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     '''&amp;lt;WindowRendererSet Filename=&amp;quot;CEGUIFalagardWRBase&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CEGUI 0.5.0 only provides one WindowRendererSet. Falagard. It's perfectly possible to write your own WindowRendererSet in C++. Take a look at the CEGUIFalagardWRBase module if you're curious :)&lt;br /&gt;
&lt;br /&gt;
=== WindowFactory ===&lt;br /&gt;
Specifies the factory name (GUI window type name) from the loadable module that is to be added to the list of available factories. Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - Name of the factory / window type which is to be added.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardBase&amp;quot;&amp;gt;&lt;br /&gt;
         '''&amp;lt;WindowFactory Name=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;'''&lt;br /&gt;
     &amp;lt;/WindowSet&amp;gt;&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example we only load the &amp;quot;Falagard/Button&amp;quot; factory. If you only need a few widgets and not the whole set, this could save you some memory.&lt;br /&gt;
&lt;br /&gt;
=== FalagardMapping in CEGUI 0.4.X ===&lt;br /&gt;
Maps a look'n'feel to a window factory and assigns the result to a new window type, in effect creating a new window factory for a specific look'n'feel.&lt;br /&gt;
Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''WindowType''' - The name for the new &amp;quot;factory&amp;quot;. ''Required''.&lt;br /&gt;
* '''TargetType''' - The name of the target window factory which will have the look'n'feel assigned. ''Required''.&lt;br /&gt;
* '''LookNFeel''' - The name of the look'n'feel to use. That's the WidgetLook name from the Falagard XML. ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardBase&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;WindowFactory Name=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/WindowSet&amp;gt;&lt;br /&gt;
     '''&amp;lt;FalagardMapping WindowType=&amp;quot;My/Button&amp;quot; TargetType=&amp;quot;Falagard/Button&amp;quot; LookNFeel=&amp;quot;MyButton&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would be a proper scheme to use the look'n'feel created in  [[The Beginners Guide to Falagard skinning - Part I]]. The new type of button window would in this case be available from code or XML layouts by the type name &amp;quot;My/Button&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== FalagardMapping in CEGUI 0.5.X ===&lt;br /&gt;
Maps a look'n'feel to a window factory and assigns the result to a new window type, in effect creating a new window factory for a specific look'n'feel.&lt;br /&gt;
Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''WindowType''' - The name for the new &amp;quot;factory&amp;quot;. ''Required''.&lt;br /&gt;
* '''TargetType''' - The name of the target window factory which will have the look'n'feel assigned. ''Required''.&lt;br /&gt;
* '''LookNFeel''' - The name of the look'n'feel to use. That's the WidgetLook name from the Falagard XML. ''Required''.&lt;br /&gt;
* '''Renderer''' - Then name of the window renderer factory to use. This module implements the widget rendering code. ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardWRBase&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;WindowFactory Name=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/WindowSet&amp;gt;&lt;br /&gt;
     '''&amp;lt;FalagardMapping WindowType=&amp;quot;My/Button&amp;quot; TargetType=&amp;quot;CEGUI/PushButton&amp;quot; LookNFeel=&amp;quot;MyButton&amp;quot; Renderer=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would be a proper scheme to use the look'n'feel created in  [[The Beginners Guide to Falagard skinning - Part I]]. The new type of button window would in this case be available from code or XML layouts by the type name &amp;quot;My/Button&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== WindowAlias ===&lt;br /&gt;
Specifies an alias for a given window factory type or falagard mapping.  Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Alias''' - Name of the alias. This is the alternative name that 'Target' will be known by. ''Required''.&lt;br /&gt;
* '''Target''' - Name of the window factory type, falagard mapping or existing alias that is to (also) be known as 'Alias'. ''Required''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Discussion ==&lt;br /&gt;
The scheme is obviously a bit more than just loading resources. It also ties the resources together. All of it can be done in code, but using a scheme file is flexible, and avoids recompiling often.&lt;br /&gt;
&lt;br /&gt;
Schemes are especially useful for artists not familiar with C++ programming, as everything you &amp;quot;set up&amp;quot; in the scheme can be used from XML layouts.&lt;br /&gt;
With Falagard this means that you can totally customize the user interface if the program is properly configured to do so without ever talking to the developers ;)&lt;br /&gt;
&lt;br /&gt;
--[[User:lindquist|lindquist]] 03:49, 14 Dec 2005 (CET)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Scheme_files&amp;diff=2394</id>
		<title>Scheme files</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Scheme_files&amp;diff=2394"/>
				<updated>2006-08-16T22:50:53Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: Scheme XML spec update for 0.5&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
CEGUI is pretty modular in many aspects. Resource loading, rendering, scripting and window-factories, can all be controlled by client modules.&lt;br /&gt;
The scheme file concerns resource loading.&lt;br /&gt;
&lt;br /&gt;
The first thing most users do when initialising CEGUI, is to load a scheme. This could for example be &amp;quot;../datafiles/schemes/TaharezLookSkin.scheme&amp;quot;. This scheme file is probably the most used currently, and will load the Falagard version of classic TaharezLook into the library.&lt;br /&gt;
&lt;br /&gt;
If one takes a closer look at this file, they'll see that it is a XML document, ready to be edited... The nice thing here is that it's no longer necessary to recompile, to change the resources to be loaded. Furthermore a scheme acts like a &amp;quot;resource package&amp;quot; as we can unload all resources that is loaded by a scheme given we know it's name. From a coding perspective this is nice as it simplifies the resource management. All you have to create/destroy is the scheme it self. CEGUI worries about all the individual resources specified in the XML file for you...&lt;br /&gt;
&lt;br /&gt;
This document is largely based on the 'Readme.txt' file in the 'XMLRefSchema' directory of the source distribution by Paul himself.&lt;br /&gt;
&lt;br /&gt;
== Document structure ==&lt;br /&gt;
A CEGUI sheme follows a &amp;quot;strict&amp;quot; order dependent structure that looks like this:&lt;br /&gt;
&lt;br /&gt;
* '''GUIScheme'''&lt;br /&gt;
** '''Imageset'''&lt;br /&gt;
** '''ImagesetFromImage'''&lt;br /&gt;
** '''Font'''&lt;br /&gt;
** '''LookNFeel'''&lt;br /&gt;
** '''WindowSet'''&lt;br /&gt;
*** '''WindowFactory''' &lt;br /&gt;
** '''WindowAlias'''&lt;br /&gt;
** '''FalagardMapping'''&lt;br /&gt;
&lt;br /&gt;
All elements can be repeated. Two imagesets - for example - are after all a fairly common ;-)&lt;br /&gt;
&lt;br /&gt;
Each element will be described individually below.&lt;br /&gt;
&lt;br /&gt;
== GUIScheme ==&lt;br /&gt;
Root element. Has a name attribute, and a collection of sub-elements which can be Imageset, ImagesetFromFile, Font, LookNFeel, WindowSet, FalagardMapping and WindowAlias elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - Specifies the name that the scheme will use within the system. ''Required''.&lt;br /&gt;
&lt;br /&gt;
''GUIScheme'' is the root element and is the only &amp;quot;global&amp;quot; tag.&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
     ... resources ...&lt;br /&gt;
     ...&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All schemes will have this XML as all the &amp;quot;magic&amp;quot; goes inside it :-)&lt;br /&gt;
&lt;br /&gt;
=== Imageset ===&lt;br /&gt;
Specifies an Imageset to be loaded as part of this scheme.  Has attributes but no sub-elements.&lt;br /&gt;
If an imageset with the requested name already exists, the file specified is not loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - The name of the Imageset. ''Required''.&lt;br /&gt;
* '''Filename''' - Filename of the Imageset file.  If the imageset created by this file does not = Name above, an exception is thrown. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     '''&amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example the file &amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; must define the imageset named &amp;quot;MyImages&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== ImagesetFromFile ===&lt;br /&gt;
Specifies an Imageset to be loaded as part of this scheme.  Has attributes but no sub-elements.&lt;br /&gt;
If an imageset with the requested name already exists, the file specified is not loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - The name of the Imageset. ''Required''.&lt;br /&gt;
* '''Filename''' - Filename of the image file to load in order to create this Imageset. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the image file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     '''&amp;lt;ImagesetFromFile Name=&amp;quot;MyBackground&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyBackground.tga&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example the file &amp;quot;../datafiles/imagesets/MyBackground&amp;quot; is a Targa (.TGA) image file. By default an Imageset loaded like this defines a single image named '''full_image''' that covers the entire texture (the content of the image file).&lt;br /&gt;
&lt;br /&gt;
=== Font ===&lt;br /&gt;
Specifies a Font to be loaded as part of the scheme. Has attributes but no sub-elements.&lt;br /&gt;
If a font with the requested name already exists, the file specified is not loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - The name of the Font ''Required''.&lt;br /&gt;
* '''Filename''' - Filename of the Font file.  If the font created by this file does not = Name above, an exception is thrown. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     '''&amp;lt;Font Name=&amp;quot;MyFont&amp;quot; Filename=&amp;quot;../datafiles/fonts/MyFont.font&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Font element always loads font XML files. These are not covered here.&lt;br /&gt;
&lt;br /&gt;
=== LookNFeel ===&lt;br /&gt;
Specifies a LookNFeel to be loaded as part of the scheme. Has attributes but no sub-elements.&lt;br /&gt;
The XML file loaded by this element may contain many widget looks which will all become available.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Filename''' - Filename of the LookNFeel file to parse. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     '''&amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Loading a look'n'feel specification is not enough. We must create a FalagardMapping as well. More on this soon. Just know that now the widget looks specified in MySkin.looknfeel are available to falagard mappings. At least the imageset we use in MySkin is available ;-)&lt;br /&gt;
&lt;br /&gt;
=== WindowSet ===&lt;br /&gt;
Specifies a module containing concrete GUI elements and their factories. Has attributes and zero or more WindowFactory sub-elements. That is you can optionally specify WindowFactory sub-elements. If they are omitted all available factories in the module are loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Filename''' - Specifies the name of the loadable module (dll / .so / etc). ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     '''&amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardBase&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CEGUI 0.4.X provides 3 windowsets. Falagard, WindowsLook and TaharezLook. The above sample code is only valid for CEGUI 0.4.X.&lt;br /&gt;
&lt;br /&gt;
CEGUI 0.5.X provides no widget sets. All the core widgets are part of the CEGUIBase library. It's still there though as it allows user widget modules to be loaded dynamically.&lt;br /&gt;
&lt;br /&gt;
=== WindowRendererSet (CEGUI 0.5.X only) ===&lt;br /&gt;
Specifies a module containing WindowRenderer classes and their factories. Has attributes and zero or more WindowRendererFactory sub-elements. That is you can optionally specify WindowRendererFactory sub-elements. If they are omitted all available factories in the module are loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Filename''' - Specifies the name of the loadable module (dll / .so / etc). ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     '''&amp;lt;WindowRendererSet Filename=&amp;quot;CEGUIFalagardWRBase&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CEGUI 0.5.0 only provides one WindowRendererSet. Falagard. It's perfectly possible to write your own WindowRendererSet in C++. Take a look at the CEGUIFalagardWRBase module if you're curious :)&lt;br /&gt;
&lt;br /&gt;
=== WindowFactory ===&lt;br /&gt;
Specifies the factory name (GUI window type name) from the loadable module that is to be added to the list of available factories. Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - Name of the factory / window type which is to be added.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardBase&amp;quot;&amp;gt;&lt;br /&gt;
         '''&amp;lt;WindowFactory Name=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;'''&lt;br /&gt;
     &amp;lt;/WindowSet&amp;gt;&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example we only load the &amp;quot;Falagard/Button&amp;quot; factory. If you only need a few widgets and not the whole set, this could save you some memory.&lt;br /&gt;
&lt;br /&gt;
=== FalagardMapping in CEGUI 0.4.X ===&lt;br /&gt;
Maps a look'n'feel to a window factory and assigns the result to a new window type, in effect creating a new window factory for a specific look'n'feel.&lt;br /&gt;
Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''WindowType''' - The name for the new &amp;quot;factory&amp;quot;. ''Required''.&lt;br /&gt;
* '''TargetType''' - The name of the target window factory which will have the look'n'feel assigned. ''Required''.&lt;br /&gt;
* '''LookNFeel''' - The name of the look'n'feel to use. That's the WidgetLook name from the Falagard XML. ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardBase&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;WindowFactory Name=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/WindowSet&amp;gt;&lt;br /&gt;
     '''&amp;lt;FalagardMapping WindowType=&amp;quot;My/Button&amp;quot; TargetType=&amp;quot;Falagard/Button&amp;quot; LookNFeel=&amp;quot;MyButton&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would be a proper scheme to use the look'n'feel created in  [[The Beginners Guide to Falagard skinning - Part I]]. The new type of button window would in this case be available from code or XML layouts by the type name &amp;quot;My/Button&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== FalagardMapping in CEGUI 0.5.X ===&lt;br /&gt;
Maps a look'n'feel to a window factory and assigns the result to a new window type, in effect creating a new window factory for a specific look'n'feel.&lt;br /&gt;
Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''WindowType''' - The name for the new &amp;quot;factory&amp;quot;. ''Required''.&lt;br /&gt;
* '''TargetType''' - The name of the target window factory which will have the look'n'feel assigned. ''Required''.&lt;br /&gt;
* '''LookNFeel''' - The name of the look'n'feel to use. That's the WidgetLook name from the Falagard XML. ''Required''.&lt;br /&gt;
* '''Renderer''' - Then name of the window renderer factory to use. This module implements the widget rendering code. ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardWRBase&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;WindowFactory Name=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/WindowSet&amp;gt;&lt;br /&gt;
     '''&amp;lt;FalagardMapping WindowType=&amp;quot;My/Button&amp;quot; TargetType=&amp;quot;CEGUI/PushButton&amp;quot; LookNFeel=&amp;quot;MyButton&amp;quot; Renderer=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would be a proper scheme to use the look'n'feel created in  [[The Beginners Guide to Falagard skinning - Part I]]. The new type of button window would in this case be available from code or XML layouts by the type name &amp;quot;My/Button&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== WindowAlias ===&lt;br /&gt;
Specifies an alias for a given window factory type or falagard mapping.  Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Alias''' - Name of the alias. This is the alternative name that 'Target' will be known by. ''Required''.&lt;br /&gt;
* '''Target''' - Name of the window factory type, falagard mapping or existing alias that is to (also) be known as 'Alias'. ''Required''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Discussion ==&lt;br /&gt;
The scheme is obviously a bit more than just loading resources. It also ties the resources together. All of it can be done in code, but using a scheme file is flexible, and avoids recompiling often.&lt;br /&gt;
&lt;br /&gt;
Schemes are especially useful for artists not familiar with C++ programming, as everything you &amp;quot;set up&amp;quot; in the scheme can be used from XML layouts.&lt;br /&gt;
With Falagard this means that you can totally customize the user interface if the program is properly configured to do so without ever talking to the developers ;)&lt;br /&gt;
&lt;br /&gt;
--[[User:lindquist|lindquist]] 03:49, 14 Dec 2005 (CET)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Scheme_files&amp;diff=2393</id>
		<title>Scheme files</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Scheme_files&amp;diff=2393"/>
				<updated>2006-08-16T22:40:25Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: Scheme XML spec update for 0.5&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
CEGUI is pretty modular in many aspects. Resource loading, rendering, scripting and window-factories, can all be controlled by client modules.&lt;br /&gt;
The scheme file concerns resource loading.&lt;br /&gt;
&lt;br /&gt;
The first thing most users do when initialising CEGUI, is to load a scheme. This could for example be &amp;quot;../datafiles/schemes/TaharezLookSkin.scheme&amp;quot;. This scheme file is probably the most used currently, and will load the Falagard version of classic TaharezLook into the library.&lt;br /&gt;
&lt;br /&gt;
If one takes a closer look at this file, they'll see that it is a XML document, ready to be edited... The nice thing here is that it's no longer necessary to recompile, to change the resources to be loaded. Furthermore a scheme acts like a &amp;quot;resource package&amp;quot; as we can unload all resources that is loaded by a scheme given we know it's name. From a coding perspective this is nice as it simplifies the resource management. All you have to create/destroy is the scheme it self. CEGUI worries about all the individual resources specified in the XML file for you...&lt;br /&gt;
&lt;br /&gt;
This document is largely based on the 'Readme.txt' file in the 'XMLRefSchema' directory of the source distribution by Paul himself.&lt;br /&gt;
&lt;br /&gt;
== Document structure ==&lt;br /&gt;
A CEGUI sheme follows a &amp;quot;strict&amp;quot; order dependent structure that looks like this:&lt;br /&gt;
&lt;br /&gt;
* '''GUIScheme'''&lt;br /&gt;
** '''Imageset'''&lt;br /&gt;
** '''ImagesetFromImage'''&lt;br /&gt;
** '''Font'''&lt;br /&gt;
** '''LookNFeel'''&lt;br /&gt;
** '''WindowSet'''&lt;br /&gt;
*** '''WindowFactory''' &lt;br /&gt;
** '''WindowAlias'''&lt;br /&gt;
** '''FalagardMapping'''&lt;br /&gt;
&lt;br /&gt;
All elements can be repeated. Two imagesets - for example - are after all a fairly common ;-)&lt;br /&gt;
&lt;br /&gt;
Each element will be described individually below.&lt;br /&gt;
&lt;br /&gt;
== GUIScheme ==&lt;br /&gt;
Root element. Has a name attribute, and a collection of sub-elements which can be Imageset, ImagesetFromFile, Font, LookNFeel, WindowSet, FalagardMapping and WindowAlias elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - Specifies the name that the scheme will use within the system. ''Required''.&lt;br /&gt;
&lt;br /&gt;
''GUIScheme'' is the root element and is the only &amp;quot;global&amp;quot; tag.&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
     ... resources ...&lt;br /&gt;
     ...&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All schemes will have this XML as all the &amp;quot;magic&amp;quot; goes inside it :-)&lt;br /&gt;
&lt;br /&gt;
=== Imageset ===&lt;br /&gt;
Specifies an Imageset to be loaded as part of this scheme.  Has attributes but no sub-elements.&lt;br /&gt;
If an imageset with the requested name already exists, the file specified is not loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - The name of the Imageset. ''Required''.&lt;br /&gt;
* '''Filename''' - Filename of the Imageset file.  If the imageset created by this file does not = Name above, an exception is thrown. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     '''&amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example the file &amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; must define the imageset named &amp;quot;MyImages&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== ImagesetFromFile ===&lt;br /&gt;
Specifies an Imageset to be loaded as part of this scheme.  Has attributes but no sub-elements.&lt;br /&gt;
If an imageset with the requested name already exists, the file specified is not loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - The name of the Imageset. ''Required''.&lt;br /&gt;
* '''Filename''' - Filename of the image file to load in order to create this Imageset. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the image file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     '''&amp;lt;ImagesetFromFile Name=&amp;quot;MyBackground&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyBackground.tga&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example the file &amp;quot;../datafiles/imagesets/MyBackground&amp;quot; is a Targa (.TGA) image file. By default an Imageset loaded like this defines a single image named '''full_image''' that covers the entire texture (the content of the image file).&lt;br /&gt;
&lt;br /&gt;
=== Font ===&lt;br /&gt;
Specifies a Font to be loaded as part of the scheme. Has attributes but no sub-elements.&lt;br /&gt;
If a font with the requested name already exists, the file specified is not loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - The name of the Font ''Required''.&lt;br /&gt;
* '''Filename''' - Filename of the Font file.  If the font created by this file does not = Name above, an exception is thrown. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     '''&amp;lt;Font Name=&amp;quot;MyFont&amp;quot; Filename=&amp;quot;../datafiles/fonts/MyFont.font&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Font element always loads font XML files. These are not covered here.&lt;br /&gt;
&lt;br /&gt;
=== LookNFeel ===&lt;br /&gt;
Specifies a LookNFeel to be loaded as part of the scheme. Has attributes but no sub-elements.&lt;br /&gt;
The XML file loaded by this element may contain many widget looks which will all become available.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Filename''' - Filename of the LookNFeel file to parse. ''Required''.&lt;br /&gt;
* '''ResourceGroup''' - The resource group identifier to pass to the resource provider when loading the file. ''Optional''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     '''&amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Loading a look'n'feel specification is not enough. We must create a FalagardMapping as well. More on this soon. Just know that now the widget looks specified in MySkin.looknfeel are available to falagard mappings. At least the imageset we use in MySkin is available ;-)&lt;br /&gt;
&lt;br /&gt;
=== WindowSet ===&lt;br /&gt;
Specifies a module containing concrete GUI elements and their factories. Has attributes and zero or more WindowFactory sub-elements. That is you can optionally specify WindowFactory sub-elements. If they are omitted all available factories in the module are loaded.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Filename''' - Specifies the name of the loadable module (dll / .so / etc). ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     '''&amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardBase&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CEGUI 0.4.0 provides 3 windowsets. Falagard, WindowsLook and TaharezLook. Using Falagard is recommended though and the two others will be removed from future versions of the library as the can be implemented in Falagard itself. It's perfectly possible to write your own WindowSet in C++.&lt;br /&gt;
&lt;br /&gt;
=== WindowFactory ===&lt;br /&gt;
Specifies the factory name (GUI window type name) from the loadable module that is to be added to the list of available factories. Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Name''' - Name of the factory / window type which is to be added.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardBase&amp;quot;&amp;gt;&lt;br /&gt;
         '''&amp;lt;WindowFactory Name=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;'''&lt;br /&gt;
     &amp;lt;/WindowSet&amp;gt;&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example we only load the &amp;quot;Falagard/Button&amp;quot; factory. If you only need a few widgets and not the whole set, this could save you some memory.&lt;br /&gt;
&lt;br /&gt;
=== FalagardMapping in CEGUI 0.4.X ===&lt;br /&gt;
Maps a look'n'feel to a window factory and assigns the result to a new window type, in effect creating a new window factory for a specific look'n'feel.&lt;br /&gt;
Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''WindowType''' - The name for the new &amp;quot;factory&amp;quot;. ''Required''.&lt;br /&gt;
* '''TargetType''' - The name of the target window factory which will have the look'n'feel assigned. ''Required''.&lt;br /&gt;
* '''LookNFeel''' - The name of the look'n'feel to use. That's the WidgetLook name from the Falagard XML. ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardBase&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;WindowFactory Name=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/WindowSet&amp;gt;&lt;br /&gt;
     '''&amp;lt;FalagardMapping WindowType=&amp;quot;My/Button&amp;quot; TargetType=&amp;quot;Falagard/Button&amp;quot; LookNFeel=&amp;quot;MyButton&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would be a proper scheme to use the look'n'feel created in  [[The Beginners Guide to Falagard skinning - Part I]]. The new type of button window would in this case be available from code or XML layouts by the type name &amp;quot;My/Button&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== FalagardMapping in CEGUI 0.5.X ===&lt;br /&gt;
Maps a look'n'feel to a window factory and assigns the result to a new window type, in effect creating a new window factory for a specific look'n'feel.&lt;br /&gt;
Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''WindowType''' - The name for the new &amp;quot;factory&amp;quot;. ''Required''.&lt;br /&gt;
* '''TargetType''' - The name of the target window factory which will have the look'n'feel assigned. ''Required''.&lt;br /&gt;
* '''LookNFeel''' - The name of the look'n'feel to use. That's the WidgetLook name from the Falagard XML. ''Required''.&lt;br /&gt;
* '''Renderer''' - Then name of the window renderer factory to use. This module implements the widget rendering code. ''Required''.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUIScheme Name=&amp;quot;MyScheme&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Imageset Name=&amp;quot;MyImages&amp;quot; Filename=&amp;quot;../datafiles/imagesets/MyImages.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;LookNFeel Filename=&amp;quot;../datafiles/looknfeel/MySkin.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;WindowSet Filename=&amp;quot;CEGUIFalagardWRBase&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;WindowFactory Name=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/WindowSet&amp;gt;&lt;br /&gt;
     '''&amp;lt;FalagardMapping WindowType=&amp;quot;My/Button&amp;quot; TargetType=&amp;quot;CEGUI/PushButton&amp;quot; LookNFeel=&amp;quot;MyButton&amp;quot; Renderer=&amp;quot;Falagard/Button&amp;quot; /&amp;gt;'''&lt;br /&gt;
 &amp;lt;/GUIScheme&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would be a proper scheme to use the look'n'feel created in  [[The Beginners Guide to Falagard skinning - Part I]]. The new type of button window would in this case be available from code or XML layouts by the type name &amp;quot;My/Button&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== WindowAlias ===&lt;br /&gt;
Specifies an alias for a given window factory type or falagard mapping.  Has attributes but no sub-elements.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* '''Alias''' - Name of the alias. This is the alternative name that 'Target' will be known by. ''Required''.&lt;br /&gt;
* '''Target''' - Name of the window factory type, falagard mapping or existing alias that is to (also) be known as 'Alias'. ''Required''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Discussion ==&lt;br /&gt;
The scheme is obviously a bit more than just loading resources. It also ties the resources together. All of it can be done in code, but using a scheme file is flexible, and avoids recompiling often.&lt;br /&gt;
&lt;br /&gt;
Schemes are especially useful for artists not familiar with C++ programming, as everything you &amp;quot;set up&amp;quot; in the scheme can be used from XML layouts.&lt;br /&gt;
With Falagard this means that you can totally customize the user interface if the program is properly configured to do so without ever talking to the developers ;)&lt;br /&gt;
&lt;br /&gt;
--[[User:lindquist|lindquist]] 03:49, 14 Dec 2005 (CET)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=FAQ&amp;diff=2361</id>
		<title>FAQ</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=FAQ&amp;diff=2361"/>
				<updated>2006-08-05T06:45:33Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: fixed bad code in &amp;quot;how to subscribe...&amp;quot; (reported on forum)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== General Questions ==&lt;br /&gt;
=== What is CEGUI? ===&lt;br /&gt;
CEGUI stands for ''Crazy Eddie's Gui System''; a free library providing windowing and widgets for graphics APIs / engines where such functionality is not natively available, or severely lacking. The library is object orientated, written in C++, and targeted at games developers who should be spending their time creating great games, not building GUI sub-systems!&lt;br /&gt;
&lt;br /&gt;
CEGUI is used as the GUI of choice in the [http://www.ogre3d.org Ogre3D project] but supports Microsoft® DirectX® 8.1 and 9, OpenGL, and the Irrlicht engine natively.&lt;br /&gt;
&lt;br /&gt;
CEGUI was started by Paul Turner (&amp;quot;[[User:CrazyEddie|CrazyEddie]]&amp;quot;) about two years ago and is currently in it's second major revision, &amp;quot;Mk2&amp;quot;. The project supports windows, linux and MacOS.&lt;br /&gt;
&lt;br /&gt;
=== How is CEGUI licensed? ===&lt;br /&gt;
Up and until version 0.4.1, CEGUI '''is''' licenced under [http://www.gnu.org/licenses/lgpl.html LGPL], which basically means you can dynamically link to it (ie. use it as a library) in a non-GPL project, as long as you fulfil the other requirements of the LGPL.&lt;br /&gt;
&lt;br /&gt;
However, as from 0.5 (not officially released yet), the library will be released under the [http://www.opensource.org/licenses/mit-license.php MIT] licence, which is less restrictive then LGPL. You may for example statically link to libraries. The main reason for this switch is the fact that the Ogre3D project has started to provide dual licensing to allow console development. And in order to keep CEGUI as their preferred GUI system, we have switched as well.&lt;br /&gt;
&lt;br /&gt;
=== What is the situation with the Falagard components and the Creative Commons license? ===&lt;br /&gt;
There is no situation!  The Creative Commons license only applies to the documentation where that notice appears; the source code, libraries, and all other materials relating to the Falagard skinning system are licensed under LGPL or MIT (depending upon the version; see above).&lt;br /&gt;
&lt;br /&gt;
=== Why is the Falagard documentation licensed seperately?  Why is it not LGPL/MIT like the rest of the library? ===&lt;br /&gt;
Originally that documentation was only to be available as a PDF file intended for self-printing into a mini-book, and the &amp;quot;this work&amp;quot; portion of the license notification applies to the text of that book; the documentation is considered a seperate work from the code / library itself, and so it licensed seperately.&lt;br /&gt;
&lt;br /&gt;
=== How much does CEGUI cost? ===&lt;br /&gt;
Nothing. The use of CEGUI is totally free within the bounds of the license as described above.&lt;br /&gt;
&lt;br /&gt;
=== I am developing a commercial, closed-source product. Should i use the 0.4 or 0.5 version of the library? ===&lt;br /&gt;
When you are creating a product for PC, where it is possible for users to update any of your used third-party DLL's (a requirement for LGPL), you can choose both versions. However if you are shipping a product on a read-only device, such as a console DVD, you must use 0.5 or higher, because the MIT license does not require that users can update anything.&lt;br /&gt;
&lt;br /&gt;
However before deciding, do always carefully check the mentioned licenses to make sure that your project doesn't do something uncommon.&lt;br /&gt;
&lt;br /&gt;
=== I am not happy with the LGPL / MIT license, do you offer alternative licensing? ===&lt;br /&gt;
No. Alternative licensing is not available, nor is it planned. But you won't find anything much less restrictive then the MIT license.&lt;br /&gt;
&lt;br /&gt;
=== Does CEGUI rely upon any third party libraries? If so what are they? ===&lt;br /&gt;
CEGUI currently depends upon the following external libraries:&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; &lt;br /&gt;
|| '''Library''' || '''Required''' || '''Url''' || '''License''' &lt;br /&gt;
|- &lt;br /&gt;
|| FreeType2 || yes || [http://www.freetype.org/freetype2/index.html http://www.freetype.org/freetype2/index.html] || BSD-like [http://www.freetype.org/FTL.TXT FreeType License] ou [http://www.freetype.org/GPL.TXT GPL] &lt;br /&gt;
|-&lt;br /&gt;
|| Perl C Regular Expression || yes || [http://www.pcre.org/ http://www.pcre.org/] || [http://www.pcre.org/license.txt BSD]&lt;br /&gt;
|-&lt;br /&gt;
|| Xerces-C++ || no || [http://xerces.apache.org/ http://xerces.apache.org/] || [http://www.apache.org/licenses/LICENSE-2.0.html  Apache Software License, Version 2.0]&lt;br /&gt;
|-&lt;br /&gt;
|| Expat || no || [http://expat.sourceforge.net/ http://expat.sourceforge.net/] || [http://www.opensource.org/licenses/mit-license.html MIT]&lt;br /&gt;
|-&lt;br /&gt;
|| Libxml || no ||  [http://www.xmlsoft.org/ http://www.xmlsoft.org/] || [http://www.opensource.org/licenses/mit-license.html MIT]&lt;br /&gt;
|-&lt;br /&gt;
|| DevIL || no ||  [http://openil.sourceforge.net/ http://openil.sourceforge.net/] || [http://openil.sourceforge.net/license.php  LGPL License Version 2.1] &lt;br /&gt;
|}&lt;br /&gt;
You will also require a supported rendering system, and some form of input library.&lt;br /&gt;
&lt;br /&gt;
=== Do I have to compile the third part libraries myself? ===&lt;br /&gt;
It depends. Under Linux and similar systems, you will need to perform your own compilation. For Microsoft® Windows® users, we have supplied packages containing binary versions of the libraries for a selection of popular compiler configurations. See the &amp;quot;Current Releases&amp;quot; on the home page.&lt;br /&gt;
&lt;br /&gt;
=== You mentioned something about &amp;quot;supported rendering systems&amp;quot;, what's that all about and which systems are supported? ===&lt;br /&gt;
CEGUI can be used with various rendering systems. There are currently CEGUI renderer modules for Microsoft® DirectX® 8.1 and 9, OpenGL, the Ogre engine, and the Irrlicht engine.&lt;br /&gt;
&lt;br /&gt;
=== There is no renderer module for my rendering engine or API of choice, will other rendering system be supported? ===&lt;br /&gt;
It is likely that, over time, CEGUI will add support for other APIs and engines. Having said this, it is fairly simple to write your own renderer module for CEGUI, so you might consider taking that option if you do not want to wait.&lt;br /&gt;
&lt;br /&gt;
=== And what about input libraries? ===&lt;br /&gt;
CEGUI requires you to ''inject'' inputs into it, these inputs can come from any source that you choose. All you need to do is pass mouse movements, mouse button up and down events, and keyboard inputs to CEGUI.&lt;br /&gt;
&lt;br /&gt;
=== Why doesn't CEGUI collect its own inputs? Why do I need to inject the inputs myself? ===&lt;br /&gt;
CEGUI does not collect its own input so that the system can remain as flexible as possible. We didn't want to tie people down to one system or input library.&lt;br /&gt;
&lt;br /&gt;
=== I have seen mention of a Lua scripting module, how can I get this? ===&lt;br /&gt;
The Lua scripting module is provided with CEGUI and resides in the same source repository. Downloading CEGUI binary/source/svn will get you everything you need.&lt;br /&gt;
&lt;br /&gt;
=== I can't find many of the things you talk about in my crayzedsgui code, what's wrong? ===&lt;br /&gt;
You probably have one of the older Mk-1 alpha releases. Get the newer Mk-2 releases instead, the archive files for these generally have names with cegui_mk2 in them.&lt;br /&gt;
&lt;br /&gt;
=== Why are there two versions of the system? ===&lt;br /&gt;
The Mk-1 version was a Windows®/DirectX® only library and was really a dry run for what became the Mk-2 system. There was only ever 'alpha' versions of the Mk-1 code, so it was never anywhere near finished.&lt;br /&gt;
&lt;br /&gt;
=== Are the Mk-1 and Mk-2 systems interface compatible? ===&lt;br /&gt;
No. The interfaces of the two systems are totally different, although many of the general concepts have remained the same.&lt;br /&gt;
&lt;br /&gt;
=== The Mk-1 system is so much more lightweight than the Mk-2 system. Can I still use the Mk-1 code? Is the Mk-1 code still being developed and supported? ===&lt;br /&gt;
Short Answer: Not really.&lt;br /&gt;
&lt;br /&gt;
Long Answer: There were too many weak areas within the Mk-1 system and development on this version has ceased completely. There is no longer any support for the Mk-1 version; in general it would be better for everyone if they migrated to the Mk-2 version of the system.&lt;br /&gt;
&lt;br /&gt;
=== I am having major troubles integrating CEGUI with my project, will you do it for me? ===&lt;br /&gt;
No. The CEGUI developers have enough to do without writing users projects for them. Follow the Howto's and Tutorials from the home page.&lt;br /&gt;
&lt;br /&gt;
=== I have (or think I have) found a bug. How should I proceed? ===&lt;br /&gt;
If you are certain that it's a bug and not, for example, a misunderstanding of what is happening, then the bug should be reported via the [http://www.cegui.org.uk/mantis/index.php | Mantis Tracker] However, before submitting a bug to the tracker, it is asked that you first do a quick search to see if the bug has already been reported. If you are unsure whether something is a bug or not, then it may be discussed on the web site forums prior to submitting a bug report to the project bug tracker.&lt;br /&gt;
&lt;br /&gt;
=== I notice that feature/widget 'X' is missing. Will this be added to CEGUI? ===&lt;br /&gt;
Requests for new features and/or widgets are welcomed in this forum: http://www.cegui.org.uk/phpBB2/viewforum.php?f=3&amp;amp;sid=587eedf3463c00490686f8cddc61a257&lt;br /&gt;
This is the best way because most people will read it, including the team. This helps others to give input as well, which migth result in clearly defined requests.&lt;br /&gt;
&lt;br /&gt;
Note that no promises are made with regards to which features will and will not be added, or how long such things will take, but all requests will be seriously considered.&lt;br /&gt;
&lt;br /&gt;
=== How can I get involved with CEGUI development? ===&lt;br /&gt;
Each new member gets added by invitation by the current team. Most probably because that person has contributed some valuable patches, or is of great help in the forums. It will of course depend on the current state of the project to know which positions are required.&lt;br /&gt;
&lt;br /&gt;
So the best way to become involved is to show your face at the web site forums, the irc channel, and state what your intentions are (to help in avoiding duplicated effort), thereby becoming a constructive individual for CEGUI and its community. And some patches are a huge pro!&lt;br /&gt;
&lt;br /&gt;
=== Is there managed code / Microsoft .Net support for the CEGUI library? ===&lt;br /&gt;
Yes, there is ''ceguisharp'' at http://ceguisharp.sourceforge.net/ This is a C# port of the library which will support Managed Direct 3D, OpenGL, as well as higher-level engines such as the excellent Axiom rendering engine.&lt;br /&gt;
&lt;br /&gt;
=== This FAQ doesn't answer my question, what should I do now? ===&lt;br /&gt;
Feel free to post your question on the web site forums, somebody will gladly answer your question and/or offer further advice.&lt;br /&gt;
&lt;br /&gt;
== Building CEGUI ==&lt;br /&gt;
&lt;br /&gt;
This section has moved to [http://www.cegui.org.uk/wiki/index.php/HOWTO:_Obtain_the_library_source_from_subversion New location]&lt;br /&gt;
&lt;br /&gt;
== Usage Questions ==&lt;br /&gt;
''(This whole section should be moved to a Tutorial or a Howto).''&lt;br /&gt;
=== What is the correct way to subscribe for an event? ===&lt;br /&gt;
Event notification is a vital aspect of GUI programming. CEGUI handles those using subscribers.&lt;br /&gt;
In order to subscribe a window for an event, you have to call the method 'Window::subscribeEvent', passing the function&lt;br /&gt;
to be called when the specified event occurs, and the instance on which the method is called.&lt;br /&gt;
&lt;br /&gt;
 class MyButtonHandler&lt;br /&gt;
 {&lt;br /&gt;
 private:&lt;br /&gt;
     PushButton* mButton;&lt;br /&gt;
 &lt;br /&gt;
 public:&lt;br /&gt;
     MyButtonHandler::MyButtonHandler(PushButton* btn) : mButton(btn)&lt;br /&gt;
     {&lt;br /&gt;
         btn-&amp;gt;subscribeEvent(PushButton::EventClicked, Event::Subscriber(&amp;amp;MyButtonHandler::ButtonClicked,this));&lt;br /&gt;
     }&lt;br /&gt;
     &lt;br /&gt;
     bool MyButtonHandler::ButtonClicked(const EventArgs&amp;amp;)&lt;br /&gt;
     {&lt;br /&gt;
         //This function gets called when the button is clicked&lt;br /&gt;
         std::cout &amp;lt;&amp;lt; &amp;quot;Button clicked&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
The 'subscribeEvent' method returns an Event::Connection, which can be used later to unsubscribe for a registered event with&lt;br /&gt;
the 'disconnect' method.&lt;br /&gt;
&lt;br /&gt;
 Event::Connection myCon = btn-&amp;gt;subscribeEvent(...);&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 &lt;br /&gt;
 myCon-&amp;gt;disconnect();&lt;br /&gt;
&lt;br /&gt;
In order to totally remove the event itself, you have to call the 'removeEvent' function:&lt;br /&gt;
all the connections to the specified event will be disconnected. &lt;br /&gt;
There's also an Event::ScopedConnection, which can be used to auto-unsubscribe when the event goes out of scope.&lt;br /&gt;
&lt;br /&gt;
Similar way for the scripted events, which can be subscribed with the 'subscribeScriptedEvent' method.&lt;br /&gt;
In addition, you can do it in XML, using this syntax:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Event Name=&amp;quot;Clicked&amp;quot; Function=&amp;quot;luabtn_clicked&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== How can I make the ListBox highlight the selected item? ===&lt;br /&gt;
In order to highlight selected items you need to set selection brush image and the selection colours of that item. The selection image is modulated by the colours you set. Note, that the alpha component needs to be smaller than 1.0, for the content of the selected item to be seen.&lt;br /&gt;
 // set selection highlight to a half transparent blue to red gradient.&lt;br /&gt;
 colour blue(0.0, 0.0, 1.0, 0.5);&lt;br /&gt;
 colour red(1.0, 0.0, 0.0, 0.5);&lt;br /&gt;
 myListBoxItem-&amp;gt;setSelectionColours(blue, blue, red, red);&lt;br /&gt;
 // this default image is a simple white rectangle&lt;br /&gt;
 myListBoxItem-&amp;gt;setSelectionBrushImage(&amp;quot;TaharezLook&amp;quot;, &amp;quot;ListboxSelectionBrush&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
=== How can I remove the border of a StaticImage? ===&lt;br /&gt;
Either put the following property into the window definition:&lt;br /&gt;
 &amp;lt;Property Name=&amp;quot;FrameEnabled&amp;quot; Value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
Or set it by code:&lt;br /&gt;
 myStaticImage-&amp;gt;setFrameEnabled(false);&lt;br /&gt;
&lt;br /&gt;
=== How can I set the background of a StaticImage? ===&lt;br /&gt;
The first thing you need in order to do this is an Imageset that defines the Image that you wish to use. When wanting to use an image file for this as you suggest, you basically have an imageset defined like this:&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;Imageset Name=&amp;quot;BackdropImageset&amp;quot; Imagefile=&amp;quot;backdrop.tga&amp;quot; NativeHorzRes=&amp;quot;1024&amp;quot; NativeVertRes=&amp;quot;768&amp;quot; AutoScaled=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
 	&amp;lt;Image Name=&amp;quot;Backdrop&amp;quot; XPos=&amp;quot;0&amp;quot; YPos=&amp;quot;0&amp;quot; Width=&amp;quot;1024&amp;quot; Height=&amp;quot;768&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;/Imageset&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What this does is define an Imageset using the backdrop.tga. A single image &amp;quot;Backdrop&amp;quot; is defined that starts at location (0,0) and is 1024 x 768 in size. You should be careful in that the source image file should have dimensions that are powers of two - this is because the image is loaded as a texture, and may be stretched if the powers-of-two requirement is not observed.&amp;lt;br&amp;gt;&lt;br /&gt;
Once you have your imageset defined, you can load it either by adding a reference to it in whichever scheme you are loading, or manually using the ImagesetManager:&lt;br /&gt;
 CEGUI::ImagesetManager::getSingleton().createImageset(&amp;quot;myImageset.imagset&amp;quot;);&lt;br /&gt;
Once the thing is loaded, you set the image into the StaticImage like so:&lt;br /&gt;
 myStaticImage-&amp;gt;setImage(&amp;quot;BackdropImageset&amp;quot;, &amp;quot;Backdrop&amp;quot;);&lt;br /&gt;
Notice that the names we specify here are the ones that were originally specified in the imageset XML file.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== I can't see the items I've added to my Combobox, how do I get the list to show when I press the button? ===&lt;br /&gt;
The height you specify for the combobox widget includes the height of the drop down list; it's not just for the 'Editbox' portion of the widget (the height of which  is usually automatically determined based upon the font).  Ensure that when specifying the height for your combobox, you have provided sufficient space for the list to appear.&lt;br /&gt;
&lt;br /&gt;
=== What properties are available for use in XML layouts, and what format do I use for the value strings? ===&lt;br /&gt;
If you start at the documentation for the base Property class ([http://www.cegui.org.uk/api_reference/classCEGUI_1_1Property.html Property base]), you will get an inheritance diagram showing all properties in the system. When you click one, you'll get its page. Each page has a description of the format in which you should provide its value.&lt;br /&gt;
&lt;br /&gt;
Besides, as an overview, each widget has its properties placed within an appropriately named C++ namespace within the [http://www.cegui.org.uk/api_reference/namespaces.html namespaces section of the API reference].&lt;br /&gt;
&lt;br /&gt;
Also, remember that properties are inherited.  So for example, when looking up properties for a PushButton, also check the properties for ButtonBase and Window too - since these properties are also available to you.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Developer_Team&amp;diff=2318</id>
		<title>Developer Team</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Developer_Team&amp;diff=2318"/>
				<updated>2006-07-23T00:21:42Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Something about the team should go here&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=SDL_to_CEGUI_keytable&amp;diff=2312</id>
		<title>SDL to CEGUI keytable</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=SDL_to_CEGUI_keytable&amp;diff=2312"/>
				<updated>2006-07-17T21:23:26Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: adding syntax highlighting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;As this was a very boring thing to do, I'll share it with the rest of you ;)&lt;br /&gt;
&lt;br /&gt;
With this function injecting KeyDown and KeyUp events to CEGUI works like you'd expect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
 /************************************************************************&lt;br /&gt;
     Translate a SDLKey to the proper CEGUI::Key&lt;br /&gt;
 *************************************************************************/&lt;br /&gt;
 CEGUI::uint SDLKeyToCEGUIKey(SDLKey key)&lt;br /&gt;
 {&lt;br /&gt;
     using namespace CEGUI;&lt;br /&gt;
     switch (key)&lt;br /&gt;
     {&lt;br /&gt;
     case SDLK_BACKSPACE:    return Key::Backspace;&lt;br /&gt;
     case SDLK_TAB:          return Key::Tab;&lt;br /&gt;
     case SDLK_RETURN:       return Key::Return;&lt;br /&gt;
     case SDLK_PAUSE:        return Key::Pause;&lt;br /&gt;
     case SDLK_ESCAPE:       return Key::Escape;&lt;br /&gt;
     case SDLK_SPACE:        return Key::Space;&lt;br /&gt;
     case SDLK_COMMA:        return Key::Comma;&lt;br /&gt;
     case SDLK_MINUS:        return Key::Minus;&lt;br /&gt;
     case SDLK_PERIOD:       return Key::Period;&lt;br /&gt;
     case SDLK_SLASH:        return Key::Slash;&lt;br /&gt;
     case SDLK_0:            return Key::Zero;&lt;br /&gt;
     case SDLK_1:            return Key::One;&lt;br /&gt;
     case SDLK_2:            return Key::Two;&lt;br /&gt;
     case SDLK_3:            return Key::Three;&lt;br /&gt;
     case SDLK_4:            return Key::Four;&lt;br /&gt;
     case SDLK_5:            return Key::Five;&lt;br /&gt;
     case SDLK_6:            return Key::Six;&lt;br /&gt;
     case SDLK_7:            return Key::Seven;&lt;br /&gt;
     case SDLK_8:            return Key::Eight;&lt;br /&gt;
     case SDLK_9:            return Key::Nine;&lt;br /&gt;
     case SDLK_COLON:        return Key::Colon;&lt;br /&gt;
     case SDLK_SEMICOLON:    return Key::Semicolon;&lt;br /&gt;
     case SDLK_EQUALS:       return Key::Equals;&lt;br /&gt;
     case SDLK_LEFTBRACKET:  return Key::LeftBracket;&lt;br /&gt;
     case SDLK_BACKSLASH:    return Key::Backslash;&lt;br /&gt;
     case SDLK_RIGHTBRACKET: return Key::RightBracket;&lt;br /&gt;
     case SDLK_a:            return Key::A;&lt;br /&gt;
     case SDLK_b:            return Key::B;&lt;br /&gt;
     case SDLK_c:            return Key::C;&lt;br /&gt;
     case SDLK_d:            return Key::D;&lt;br /&gt;
     case SDLK_e:            return Key::E;&lt;br /&gt;
     case SDLK_f:            return Key::F;&lt;br /&gt;
     case SDLK_g:            return Key::G;&lt;br /&gt;
     case SDLK_h:            return Key::H;&lt;br /&gt;
     case SDLK_i:            return Key::I;&lt;br /&gt;
     case SDLK_j:            return Key::J;&lt;br /&gt;
     case SDLK_k:            return Key::K;&lt;br /&gt;
     case SDLK_l:            return Key::L;&lt;br /&gt;
     case SDLK_m:            return Key::M;&lt;br /&gt;
     case SDLK_n:            return Key::N;&lt;br /&gt;
     case SDLK_o:            return Key::O;&lt;br /&gt;
     case SDLK_p:            return Key::P;&lt;br /&gt;
     case SDLK_q:            return Key::Q;&lt;br /&gt;
     case SDLK_r:            return Key::R;&lt;br /&gt;
     case SDLK_s:            return Key::S;&lt;br /&gt;
     case SDLK_t:            return Key::T;&lt;br /&gt;
     case SDLK_u:            return Key::U;&lt;br /&gt;
     case SDLK_v:            return Key::V;&lt;br /&gt;
     case SDLK_w:            return Key::W;&lt;br /&gt;
     case SDLK_x:            return Key::X;&lt;br /&gt;
     case SDLK_y:            return Key::Y;&lt;br /&gt;
     case SDLK_z:            return Key::Z;&lt;br /&gt;
     case SDLK_DELETE:       return Key::Delete;&lt;br /&gt;
     case SDLK_KP0:          return Key::Numpad0;&lt;br /&gt;
     case SDLK_KP1:          return Key::Numpad1;&lt;br /&gt;
     case SDLK_KP2:          return Key::Numpad2;&lt;br /&gt;
     case SDLK_KP3:          return Key::Numpad3;&lt;br /&gt;
     case SDLK_KP4:          return Key::Numpad4;&lt;br /&gt;
     case SDLK_KP5:          return Key::Numpad5;&lt;br /&gt;
     case SDLK_KP6:          return Key::Numpad6;&lt;br /&gt;
     case SDLK_KP7:          return Key::Numpad7;&lt;br /&gt;
     case SDLK_KP8:          return Key::Numpad8;&lt;br /&gt;
     case SDLK_KP9:          return Key::Numpad9;&lt;br /&gt;
     case SDLK_KP_PERIOD:    return Key::Decimal;&lt;br /&gt;
     case SDLK_KP_DIVIDE:    return Key::Divide;&lt;br /&gt;
     case SDLK_KP_MULTIPLY:  return Key::Multiply;&lt;br /&gt;
     case SDLK_KP_MINUS:     return Key::Subtract;&lt;br /&gt;
     case SDLK_KP_PLUS:      return Key::Add;&lt;br /&gt;
     case SDLK_KP_ENTER:     return Key::NumpadEnter;&lt;br /&gt;
     case SDLK_KP_EQUALS:    return Key::NumpadEquals;&lt;br /&gt;
     case SDLK_UP:           return Key::ArrowUp;&lt;br /&gt;
     case SDLK_DOWN:         return Key::ArrowDown;&lt;br /&gt;
     case SDLK_RIGHT:        return Key::ArrowRight;&lt;br /&gt;
     case SDLK_LEFT:         return Key::ArrowLeft;&lt;br /&gt;
     case SDLK_INSERT:       return Key::Insert;&lt;br /&gt;
     case SDLK_HOME:         return Key::Home;&lt;br /&gt;
     case SDLK_END:          return Key::End;&lt;br /&gt;
     case SDLK_PAGEUP:       return Key::PageUp;&lt;br /&gt;
     case SDLK_PAGEDOWN:     return Key::PageDown;&lt;br /&gt;
     case SDLK_F1:           return Key::F1;&lt;br /&gt;
     case SDLK_F2:           return Key::F2;&lt;br /&gt;
     case SDLK_F3:           return Key::F3;&lt;br /&gt;
     case SDLK_F4:           return Key::F4;&lt;br /&gt;
     case SDLK_F5:           return Key::F5;&lt;br /&gt;
     case SDLK_F6:           return Key::F6;&lt;br /&gt;
     case SDLK_F7:           return Key::F7;&lt;br /&gt;
     case SDLK_F8:           return Key::F8;&lt;br /&gt;
     case SDLK_F9:           return Key::F9;&lt;br /&gt;
     case SDLK_F10:          return Key::F10;&lt;br /&gt;
     case SDLK_F11:          return Key::F11;&lt;br /&gt;
     case SDLK_F12:          return Key::F12;&lt;br /&gt;
     case SDLK_F13:          return Key::F13;&lt;br /&gt;
     case SDLK_F14:          return Key::F14;&lt;br /&gt;
     case SDLK_F15:          return Key::F15;&lt;br /&gt;
     case SDLK_NUMLOCK:      return Key::NumLock;&lt;br /&gt;
     case SDLK_SCROLLOCK:    return Key::ScrollLock;&lt;br /&gt;
     case SDLK_RSHIFT:       return Key::RightShift;&lt;br /&gt;
     case SDLK_LSHIFT:       return Key::LeftShift;&lt;br /&gt;
     case SDLK_RCTRL:        return Key::RightControl;&lt;br /&gt;
     case SDLK_LCTRL:        return Key::LeftControl;&lt;br /&gt;
     case SDLK_RALT:         return Key::RightAlt;&lt;br /&gt;
     case SDLK_LALT:         return Key::LeftAlt;&lt;br /&gt;
     case SDLK_LSUPER:       return Key::LeftWindows;&lt;br /&gt;
     case SDLK_RSUPER:       return Key::RightWindows;&lt;br /&gt;
     case SDLK_SYSREQ:       return Key::SysRq;&lt;br /&gt;
     case SDLK_MENU:         return Key::AppMenu;&lt;br /&gt;
     case SDLK_POWER:        return Key::Power;&lt;br /&gt;
     default:                return 0;&lt;br /&gt;
     }&lt;br /&gt;
     return 0;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Usage is like so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
 SDL_Event e;&lt;br /&gt;
 while (SDL_PollEvent(&amp;amp;e))&lt;br /&gt;
 {&lt;br /&gt;
     if (e.type == SDL_KEYDOWN)&lt;br /&gt;
     {&lt;br /&gt;
         CEGUI::uint kc = SDLKeyToCEGUIKey(e.key.keysym.sym);&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyDown(kc);&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
--[[User:lindquist|lindquist]] 19:24, 8 Nov 2005 (CET)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=2311</id>
		<title>Using CEGUI with SDL and OpenGL</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=2311"/>
				<updated>2006-07-17T21:15:20Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: adding syntax highlighting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.libsdl.org SDL (Simple DirectMedia Layer)] is an excellent library for writing portable games and other multimedia applications, but as it is a low-level library, it has no native support for GUI interfaces.&lt;br /&gt;
&lt;br /&gt;
When using [http://www.opengl.org OpenGL] for rendering, using CEGUI with SDL is not hard.&lt;br /&gt;
&lt;br /&gt;
I'll assume that you've read the imbiciles tutorials, and have used SDL with OpenGL.&lt;br /&gt;
And know C / C++ ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Initialisation ===&lt;br /&gt;
Before we can do anything, we need to initialise our libraries.&lt;br /&gt;
First SDL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
if (SDL_Init(SDL_INIT_VIDEO)&amp;lt;0)&lt;br /&gt;
{&lt;br /&gt;
  fprintf(stderr, &amp;quot;Unable to initialise SDL: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
  exit(0);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we initialise SDL with video support. We need this for CEGUI.&lt;br /&gt;
O.K. now SDL is ready to go. So let's fire up OpenGL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
if (SDL_SetVideoMode(800,600,0,SDL_OPENGL)==NULL)&lt;br /&gt;
{&lt;br /&gt;
  fprintf(stderr, &amp;quot;Unable to set OpenGL videomode: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
  SDL_Quit();&lt;br /&gt;
  exit(0);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now OpenGL is ready. But we still need to set a decent configuration:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
glEnable(GL_CULL_FACE);&lt;br /&gt;
glDisable(GL_FOG);&lt;br /&gt;
glClearColor(0.0f,0.0f,0.0f,1.0f);&lt;br /&gt;
glViewport(0,0, 800,600);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The OpenGL renderer that comes with CEGUI sets the matrices itself, so if you're using CEGUI for all your rendering needs this would be fine. Normally you would want the normal perspective projection setup though:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
glMatrixMode(GL_PROJECTION);&lt;br /&gt;
glLoadIdentity();&lt;br /&gt;
gluPerspective(45.0, 800.0/600.0, 0.1,100.0);&lt;br /&gt;
glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
glLoadIdentity();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SDL and OpenGL are now both ready for action. So it's time to initialise CEGUI.&lt;br /&gt;
First we need the renderer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
#include &amp;quot;renderers/OpenGLGUIRenderer/openglrenderer.h&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It must be created before starting CEGUI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
CEGUI::OpenGLRenderer* renderer = new CEGUI::OpenGLRenderer(0,800,600);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the CEGUI::System must be initialised:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
new CEGUI::System(renderer);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember that you have to load a widget set, set the mouse cursor and a default font before CEGUI is completely ready. This is described in the other tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the SDL cursor is displayed, so we'll remove that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
SDL_ShowCursor(SDL_DISABLE);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As keypress characters needs to be injected into CEGUI, we activate unicode translation for SDL key events:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
SDL_EnableUNICODE(1);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This makes it alot easier as we don't have to worry about modifier keys and keyboard layouts ourselves. More about this later on...&lt;br /&gt;
&lt;br /&gt;
Key repeat is a nice feature for the text input widgets in CEGUI, so we use SDL to generate them:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Everything is ready now, and we can start the main loop :)&lt;br /&gt;
&lt;br /&gt;
=== The Main Loop ===&lt;br /&gt;
To make it all happen, we use a simple main loop that just keeps pushing on those frames:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
void main_loop()&lt;br /&gt;
{&lt;br /&gt;
  bool must_quit = false;&lt;br /&gt;
  &lt;br /&gt;
  // get &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
  double last_time_pulse = 0.001*static_cast&amp;lt;double&amp;gt;(SDL_GetTicks());&lt;br /&gt;
  &lt;br /&gt;
  while (!must_quit)&lt;br /&gt;
  {&lt;br /&gt;
    inject_input(must_quit);&lt;br /&gt;
    inject_time_pulse(last_time_pulse);&lt;br /&gt;
    render_gui();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function will run the main loop until the ''bool'' value ''must_quit'' becomes ''true''. In this tutorial this will happen when the user clicks the close button provided by the window manager.&lt;br /&gt;
&lt;br /&gt;
The ''double'' value ''last_time_pulse'' holds the time of the latest time pulse injection. More about this later.&lt;br /&gt;
&lt;br /&gt;
Each function in the ''while'' loop will be described below.&lt;br /&gt;
&lt;br /&gt;
There are endless ways of making your main loop. I took a simple approach to ease writing this tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Injecting Input ===&lt;br /&gt;
When the user press or release keyboard or mouse buttons, we need to tell CEGUI about it, for this we use the injection functions of ''CEGUI::System''.&lt;br /&gt;
&lt;br /&gt;
Here is what our inject_input function looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
void inject_input(bool&amp;amp; must_quit)&lt;br /&gt;
{&lt;br /&gt;
  SDL_Event e;&lt;br /&gt;
  &lt;br /&gt;
  // go through all available events&lt;br /&gt;
  while (SDL_PollEvent(&amp;amp;e))&lt;br /&gt;
  {&lt;br /&gt;
    // we use a switch to determine the event type&lt;br /&gt;
    switch (e.type)&lt;br /&gt;
    {&lt;br /&gt;
      // mouse motion handler&lt;br /&gt;
      case SDL_MOUSEMOTION:&lt;br /&gt;
        // we inject the mouse position directly.&lt;br /&gt;
        CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
          static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
          static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
        );&lt;br /&gt;
        break;&lt;br /&gt;
    &lt;br /&gt;
      // mouse down handler&lt;br /&gt;
      case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
        // let a special function handle the mouse button down event&lt;br /&gt;
        handle_mouse_down(e.button.button);&lt;br /&gt;
        break;&lt;br /&gt;
    &lt;br /&gt;
      // mouse up handler&lt;br /&gt;
      case SDL_MOUSEBUTTONUP:&lt;br /&gt;
        // let a special function handle the mouse button up event&lt;br /&gt;
        handle_mouse_up(e.button.button);&lt;br /&gt;
        break;&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
      // key down&lt;br /&gt;
      case SDL_KEYDOWN:&lt;br /&gt;
        // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
        CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
        &lt;br /&gt;
        // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
        // this is described in more detail below.&lt;br /&gt;
        if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
        {&lt;br /&gt;
          CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
        }&lt;br /&gt;
        break;&lt;br /&gt;
    &lt;br /&gt;
      // key up&lt;br /&gt;
      case SDL_KEYUP:&lt;br /&gt;
        // like before we inject the scancode directly.&lt;br /&gt;
        CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
        break;&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
      // WM quit event occured&lt;br /&gt;
      case SDL_QUIT:&lt;br /&gt;
        must_quit = true;&lt;br /&gt;
        break;&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First I'll explain the events that get handled directly in the ''inject_input'' function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Motion''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
// we inject the mouse position directly.&lt;br /&gt;
CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
  static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
  static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is nothing special here. Like stated in the comment the mouse position is just injected directly.&lt;br /&gt;
&lt;br /&gt;
There are two ways of injecting mouse motion. One where you inject how much the cursor moved, and one where you inject the mouse cursor position. The last one is failsafe.&lt;br /&gt;
Then first one only works correctly in fullscreen mode, or with input grabbed. The reason for this is that in regular windowed mode, the mouse can be moved outside the application window, and during this time no mouse motion event are generated. So if we enter the window at another position, the real mousecursor and CEGUI's mouse cursor will be offset, which will break mouse usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Down'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This event takes a little more work. CEGUI requires that key characters (the printable character the key represents) are injected alongside key codes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
// to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Luckily the key code is just the SDL scancode, so we inject that directly. (This only seems to be true on windows. On other platforms you will need to use a translation function. One can be found here [[SDL to CEGUI keytable]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
// as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
// this is described in more detail below.&lt;br /&gt;
if (e.key.keysym.unicode != 0)&lt;br /&gt;
{&lt;br /&gt;
  CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of formatting the keypress ourselves, we let SDL do it for us. We could check if we actually got a valid ASCII code, but we want support for local characters as well, so we won't do that. For more information, take a look at the SDL documentation for this feature. [http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fkeysym SDL_keysym].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This one is simple. Only the keycode need to injected. So we just use the scancode directly (As with KeyDown you will need to use a translation function for non Windows platforms. Check KeyDown above for more info):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
// like before we inject the scancode directly.&lt;br /&gt;
CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Down and Mouse Wheel'''&amp;lt;br /&amp;gt;&lt;br /&gt;
CEGUI and SDL are a little different when it comes to mouse button and mouse wheel events. So a little conversion is necessary. Here's the ''handle_mouse_down'' function that gets called when a mouse button down event occurs in SDL. It takes one parameter, a ''Uint8'' describing the mouse button that was pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
void handle_mouse_down(Uint8 button)&lt;br /&gt;
	{&lt;br /&gt;
	switch ( button )&lt;br /&gt;
		{&lt;br /&gt;
		// handle real mouse buttons&lt;br /&gt;
		case SDL_BUTTON_LEFT:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case SDL_BUTTON_RIGHT:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);&lt;br /&gt;
			break;&lt;br /&gt;
		&lt;br /&gt;
		// handle the mouse wheel&lt;br /&gt;
		case SDL_BUTTON_WHEELDOWN:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseWheelChange( -1 );&lt;br /&gt;
			break;&lt;br /&gt;
		case SDL_BUTTON_WHEELUP:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseWheelChange( +1 );&lt;br /&gt;
			break;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I chose a very &amp;quot;manual&amp;quot; conversion, but it works fine. Everything should be pretty self-explainatory.&lt;br /&gt;
As you can see mouse wheel events are emitted as mouse button down events in SDL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
The mouse button up event is handled very much like the mouse button down event, except there are no mousewheel release events.&lt;br /&gt;
Like ''handle_mouse_down'' it takes one parameter, a ''Uint8'' describing the mouse button that was released:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
void handle_mouse_up(Uint8 button)&lt;br /&gt;
	{&lt;br /&gt;
	switch ( button )&lt;br /&gt;
		{&lt;br /&gt;
		case SDL_BUTTON_LEFT:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case SDL_BUTTON_RIGHT:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);&lt;br /&gt;
			break;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Time Pulses ===&lt;br /&gt;
SDL has a built-in millisecond counter which we will use for this example. There are other ways to use timers with SDL, but I chose this approach as it is simple to use, and provides decent precision.&lt;br /&gt;
&lt;br /&gt;
Remember in the main loop where we stored the current &amp;quot;run-time&amp;quot; in seconds ? This value will be passed as a reference to ''inject_time_pulse'' function which in turn will set a new value to it.&lt;br /&gt;
&lt;br /&gt;
CEGUI's interface for injecting time pulses requires that you pass the time in seconds that has passed since the last time pulse injection. Let's take a look at the function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
void inject_time_pulse(double&amp;amp; last_time_pulse)&lt;br /&gt;
{&lt;br /&gt;
	// get current &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
	double t = 0.001*SDL_GetTicks();&lt;br /&gt;
&lt;br /&gt;
	// inject the time that passed since the last call &lt;br /&gt;
	CEGUI::System::getSingleton().injectTimePulse( float(t-last_time_pulse) );&lt;br /&gt;
&lt;br /&gt;
	// store the new time as the last time&lt;br /&gt;
	last_time_pulse = t;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The first line gets the actual &amp;quot;run-time&amp;quot; when called.&lt;br /&gt;
* The second line injects the time pulse as the difference between the current time and the last time.&lt;br /&gt;
* The third line stores the current time as the last time a time pulse was injected.&lt;br /&gt;
&lt;br /&gt;
This will work for about 47 days... After that the counter wraps to zero and it breaks (a single insanely invalid timepulse will be injected).&lt;br /&gt;
I'll leave it up to you to fix that if it's a problem.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Rendering ===&lt;br /&gt;
Now all that's left is renderingthe GUI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
void render_gui()&lt;br /&gt;
{&lt;br /&gt;
	// clear the colour buffer&lt;br /&gt;
	glClear( GL_COLOR_BUFFER_BIT );&lt;br /&gt;
&lt;br /&gt;
	// render the GUI :)&lt;br /&gt;
	CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
&lt;br /&gt;
	// Update the screen&lt;br /&gt;
	SDL_GL_SwapBuffers();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
does all the CEGUI magic and sets OpenGL state itself. As long as the viewport is setup, it will render the GUI.&lt;br /&gt;
&lt;br /&gt;
=== Error Handling ===&lt;br /&gt;
The neat C++ architecture of CEGUI suggests that C++ exceptions are used for error handling. This is completely true.&lt;br /&gt;
Whenever an error occurs, a sub-class of ''CEGUI::Exception'' is thrown.&lt;br /&gt;
&lt;br /&gt;
There are many scenarios where an exception can be thrown. And whether or not these should be considered fatal depends on the application. To make sure you catch the CEGUI exceptions a regular ''try'' block is used. Like so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
try&lt;br /&gt;
{&lt;br /&gt;
	// do some cegui code&lt;br /&gt;
}&lt;br /&gt;
catch (CEGUI::Exception&amp;amp; e)&lt;br /&gt;
{&lt;br /&gt;
	fprintf(stderr,&amp;quot;CEGUI Exception occured: %s&amp;quot;, e.getMessage().c_str());&lt;br /&gt;
	// you could quit here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should provide you with the basic steps needed to get interactive with CEGUI in your SDL application.&lt;br /&gt;
Have fun.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 16:21, 8 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=2310</id>
		<title>Using CEGUI with SDL and OpenGL</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=2310"/>
				<updated>2006-07-17T21:11:39Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: adding syntax highlighting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.libsdl.org SDL (Simple DirectMedia Layer)] is an excellent library for writing portable games and other multimedia applications, but as it is a low-level library, it has no native support for GUI interfaces.&lt;br /&gt;
&lt;br /&gt;
When using [http://www.opengl.org OpenGL] for rendering, using CEGUI with SDL is not hard.&lt;br /&gt;
&lt;br /&gt;
I'll assume that you've read the imbiciles tutorials, and have used SDL with OpenGL.&lt;br /&gt;
And know C / C++ ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Initialisation ===&lt;br /&gt;
Before we can do anything, we need to initialise our libraries.&lt;br /&gt;
First SDL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
if (SDL_Init(SDL_INIT_VIDEO)&amp;lt;0)&lt;br /&gt;
{&lt;br /&gt;
  fprintf(stderr, &amp;quot;Unable to initialise SDL: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
  exit(0);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we initialise SDL with video support. We need this for CEGUI.&lt;br /&gt;
O.K. now SDL is ready to go. So let's fire up OpenGL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
if (SDL_SetVideoMode(800,600,0,SDL_OPENGL)==NULL)&lt;br /&gt;
{&lt;br /&gt;
  fprintf(stderr, &amp;quot;Unable to set OpenGL videomode: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
  SDL_Quit();&lt;br /&gt;
  exit(0);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now OpenGL is ready. But we still need to set a decent configuration:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
glEnable(GL_CULL_FACE);&lt;br /&gt;
glDisable(GL_FOG);&lt;br /&gt;
glClearColor(0.0f,0.0f,0.0f,1.0f);&lt;br /&gt;
glViewport(0,0, 800,600);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The OpenGL renderer that comes with CEGUI sets the matrices itself, so if you're using CEGUI for all your rendering needs this would be fine. Normally you would want the normal perspective projection setup though:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
glMatrixMode(GL_PROJECTION);&lt;br /&gt;
glLoadIdentity();&lt;br /&gt;
gluPerspective(45.0, 800.0/600.0, 0.1,100.0);&lt;br /&gt;
glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
glLoadIdentity();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SDL and OpenGL are now both ready for action. So it's time to initialise CEGUI.&lt;br /&gt;
First we need the renderer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
#include &amp;quot;renderers/OpenGLGUIRenderer/openglrenderer.h&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It must be created before starting CEGUI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
CEGUI::OpenGLRenderer* renderer = new CEGUI::OpenGLRenderer(0,800,600);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the CEGUI::System must be initialised:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
new CEGUI::System(renderer);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember that you have to load a widget set, set the mouse cursor and a default font before CEGUI is completely ready. This is described in the other tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the SDL cursor is displayed, so we'll remove that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
SDL_ShowCursor(SDL_DISABLE);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As keypress characters needs to be injected into CEGUI, we activate unicode translation for SDL key events:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
SDL_EnableUNICODE(1);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This makes it alot easier as we don't have to worry about modifier keys and keyboard layouts ourselves. More about this later on...&lt;br /&gt;
&lt;br /&gt;
Key repeat is a nice feature for the text input widgets in CEGUI, so we use SDL to generate them:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Everything is ready now, and we can start the main loop :)&lt;br /&gt;
&lt;br /&gt;
=== The Main Loop ===&lt;br /&gt;
To make it all happen, we use a simple main loop that just keeps pushing on those frames:&lt;br /&gt;
&lt;br /&gt;
 void main_loop()&lt;br /&gt;
 {&lt;br /&gt;
   bool must_quit = false;&lt;br /&gt;
   &lt;br /&gt;
   // get &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
   double last_time_pulse = 0.001*static_cast&amp;lt;double&amp;gt;(SDL_GetTicks());&lt;br /&gt;
   &lt;br /&gt;
   while (!must_quit)&lt;br /&gt;
   {&lt;br /&gt;
     inject_input(must_quit);&lt;br /&gt;
     inject_time_pulse(last_time_pulse);&lt;br /&gt;
     render_gui();&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This function will run the main loop until the ''bool'' value ''must_quit'' becomes ''true''. In this tutorial this will happen when the user clicks the close button provided by the window manager.&lt;br /&gt;
&lt;br /&gt;
The ''double'' value ''last_time_pulse'' holds the time of the latest time pulse injection. More about this later.&lt;br /&gt;
&lt;br /&gt;
Each function in the ''while'' loop will be described below.&lt;br /&gt;
&lt;br /&gt;
There are endless ways of making your main loop. I took a simple approach to ease writing this tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Injecting Input ===&lt;br /&gt;
When the user press or release keyboard or mouse buttons, we need to tell CEGUI about it, for this we use the injection functions of ''CEGUI::System''.&lt;br /&gt;
&lt;br /&gt;
Here is what our inject_input function looks like:&lt;br /&gt;
&lt;br /&gt;
 void inject_input(bool&amp;amp; must_quit)&lt;br /&gt;
 {&lt;br /&gt;
   SDL_Event e;&lt;br /&gt;
   &lt;br /&gt;
   // go through all available events&lt;br /&gt;
   while (SDL_PollEvent(&amp;amp;e))&lt;br /&gt;
   {&lt;br /&gt;
     // we use a switch to determine the event type&lt;br /&gt;
     switch (e.type)&lt;br /&gt;
     {&lt;br /&gt;
       // mouse motion handler&lt;br /&gt;
       case SDL_MOUSEMOTION:&lt;br /&gt;
         // we inject the mouse position directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
         );&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     // mouse down handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button down event&lt;br /&gt;
         handle_mouse_down(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // mouse up handler&lt;br /&gt;
       case SDL_MOUSEBUTTONUP:&lt;br /&gt;
         // let a special function handle the mouse button up event&lt;br /&gt;
         handle_mouse_up(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // key down&lt;br /&gt;
       case SDL_KEYDOWN:&lt;br /&gt;
         // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
         &lt;br /&gt;
         // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
         // this is described in more detail below.&lt;br /&gt;
         if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
         {&lt;br /&gt;
           CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
         }&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // key up&lt;br /&gt;
       case SDL_KEYUP:&lt;br /&gt;
         // like before we inject the scancode directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // WM quit event occured&lt;br /&gt;
       case SDL_QUIT:&lt;br /&gt;
         must_quit = true;&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
First I'll explain the events that get handled directly in the ''inject_input'' function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Motion''':&lt;br /&gt;
&lt;br /&gt;
 // we inject the mouse position directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
There is nothing special here. Like stated in the comment the mouse position is just injected directly.&lt;br /&gt;
&lt;br /&gt;
There are two ways of injecting mouse motion. One where you inject how much the cursor moved, and one where you inject the mouse cursor position. The last one is failsafe.&lt;br /&gt;
Then first one only works correctly in fullscreen mode, or with input grabbed. The reason for this is that in regular windowed mode, the mouse can be moved outside the application window, and during this time no mouse motion event are generated. So if we enter the window at another position, the real mousecursor and CEGUI's mouse cursor will be offset, which will break mouse usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Down'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This event takes a little more work. CEGUI requires that key characters (the printable character the key represents) are injected alongside key codes.&lt;br /&gt;
&lt;br /&gt;
 // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
Luckily the key code is just the SDL scancode, so we inject that directly. (This only seems to be true on windows. On other platforms you will need to use a translation function. One can be found here [[SDL to CEGUI keytable]])&lt;br /&gt;
&lt;br /&gt;
 // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
 // this is described in more detail below.&lt;br /&gt;
 if (e.key.keysym.unicode != 0)&lt;br /&gt;
 {&lt;br /&gt;
   CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Instead of formatting the keypress ourselves, we let SDL do it for us. We could check if we actually got a valid ASCII code, but we want support for local characters as well, so we won't do that. For more information, take a look at the SDL documentation for this feature. [http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fkeysym SDL_keysym].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This one is simple. Only the keycode need to injected. So we just use the scancode directly (As with KeyDown you will need to use a translation function for non Windows platforms. Check KeyDown above for more info):&lt;br /&gt;
&lt;br /&gt;
 // like before we inject the scancode directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Down and Mouse Wheel'''&amp;lt;br /&amp;gt;&lt;br /&gt;
CEGUI and SDL are a little different when it comes to mouse button and mouse wheel events. So a little conversion is necessary. Here's the ''handle_mouse_down'' function that gets called when a mouse button down event occurs in SDL. It takes one parameter, a ''Uint8'' describing the mouse button that was pressed.&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_down(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		// handle real mouse buttons&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		&lt;br /&gt;
 		// handle the mouse wheel&lt;br /&gt;
 		case SDL_BUTTON_WHEELDOWN:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( -1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_WHEELUP:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( +1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
I chose a very &amp;quot;manual&amp;quot; conversion, but it works fine. Everything should be pretty self-explainatory.&lt;br /&gt;
As you can see mouse wheel events are emitted as mouse button down events in SDL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
The mouse button up event is handled very much like the mouse button down event, except there are no mousewheel release events.&lt;br /&gt;
Like ''handle_mouse_down'' it takes one parameter, a ''Uint8'' describing the mouse button that was released:&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_up(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Time Pulses ===&lt;br /&gt;
SDL has a built-in millisecond counter which we will use for this example. There are other ways to use timers with SDL, but I chose this approach as it is simple to use, and provides decent precision.&lt;br /&gt;
&lt;br /&gt;
Remember in the main loop where we stored the current &amp;quot;run-time&amp;quot; in seconds ? This value will be passed as a reference to ''inject_time_pulse'' function which in turn will set a new value to it.&lt;br /&gt;
&lt;br /&gt;
CEGUI's interface for injecting time pulses requires that you pass the time in seconds that has passed since the last time pulse injection. Let's take a look at the function:&lt;br /&gt;
&lt;br /&gt;
 void inject_time_pulse(double&amp;amp; last_time_pulse)&lt;br /&gt;
 {&lt;br /&gt;
 	// get current &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
 	double t = 0.001*SDL_GetTicks();&lt;br /&gt;
 &lt;br /&gt;
 	// inject the time that passed since the last call &lt;br /&gt;
 	CEGUI::System::getSingleton().injectTimePulse( float(t-last_time_pulse) );&lt;br /&gt;
 &lt;br /&gt;
 	// store the new time as the last time&lt;br /&gt;
 	last_time_pulse = t;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The first line gets the actual &amp;quot;run-time&amp;quot; when called.&lt;br /&gt;
* The second line injects the time pulse as the difference between the current time and the last time.&lt;br /&gt;
* The third line stores the current time as the last time a time pulse was injected.&lt;br /&gt;
&lt;br /&gt;
This will work for about 47 days... After that the counter wraps to zero and it breaks (a single insanely invalid timepulse will be injected).&lt;br /&gt;
I'll leave it up to you to fix that if it's a problem.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Rendering ===&lt;br /&gt;
Now all that's left is renderingthe GUI.&lt;br /&gt;
&lt;br /&gt;
 void render_gui()&lt;br /&gt;
 {&lt;br /&gt;
 	// clear the colour buffer&lt;br /&gt;
 	glClear( GL_COLOR_BUFFER_BIT );&lt;br /&gt;
 &lt;br /&gt;
 	// render the GUI :)&lt;br /&gt;
 	CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
 &lt;br /&gt;
 	// Update the screen&lt;br /&gt;
 	SDL_GL_SwapBuffers();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The line:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
&lt;br /&gt;
does all the CEGUI magic and sets OpenGL state itself. As long as the viewport is setup, it will render the GUI.&lt;br /&gt;
&lt;br /&gt;
=== Error Handling ===&lt;br /&gt;
The neat C++ architecture of CEGUI suggests that C++ exceptions are used for error handling. This is completely true.&lt;br /&gt;
Whenever an error occurs, a sub-class of ''CEGUI::Exception'' is thrown.&lt;br /&gt;
&lt;br /&gt;
There are many scenarios where an exception can be thrown. And whether or not these should be considered fatal depends on the application. To make sure you catch the CEGUI exceptions a regular ''try'' block is used. Like so:&lt;br /&gt;
&lt;br /&gt;
 try&lt;br /&gt;
 {&lt;br /&gt;
 	// do some cegui code&lt;br /&gt;
 }&lt;br /&gt;
 catch (CEGUI::Exception&amp;amp; e)&lt;br /&gt;
 {&lt;br /&gt;
 	fprintf(stderr,&amp;quot;CEGUI Exception occured: %s&amp;quot;, e.getMessage().c_str());&lt;br /&gt;
 	// you could quit here&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This should provide you with the basic steps needed to get interactive with CEGUI in your SDL application.&lt;br /&gt;
Have fun.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 16:21, 8 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Changes_and_Porting_Tips_for_0.5.0&amp;diff=2146</id>
		<title>Changes and Porting Tips for 0.5.0</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Changes_and_Porting_Tips_for_0.5.0&amp;diff=2146"/>
				<updated>2006-05-20T23:28:19Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note that this is incomplete, work in progress, documentation.&lt;br /&gt;
==Introduction==&lt;br /&gt;
The 0.5.0 release of Crazy Eddie's GUI System is the first of what will likely be a series of releases containing breaking changes for client code and data files.  We feel these breaking changes are required as we move closer to the 1.0 release of CEGUI, and also as the design and usage patterns for CEGUI change; the results are a generally more streamlined system as we move from one idiom to another, as opposed to becoming more and more bloated due to retaining vast amounts of code and kludges for backward compatibility reasons.&lt;br /&gt;
&lt;br /&gt;
This document is a general overview and guide to the breaking changes between the 0.4.x series of releases and the 0.5.0 release.  As and when other breaking releases are made, additional documentation will be provided as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Changes and Porting==&lt;br /&gt;
This section is intended as a general overview of the breaking changes made.  Blah, blah, blah.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Code Changes===&lt;br /&gt;
This sub-section details changes made to the CEGUI system code and API which will affect client code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====The new WindowRenderer system====&lt;br /&gt;
One of the main issues with the previous widget module approach, was that it became exceptionally difficult to sub-class a widget type where some custom behavioural changes or additions were required.  &lt;br /&gt;
 *** TODO ***&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====CEGUI::System Constructor====&lt;br /&gt;
The overloaded constructors for the main CEGUI::System object have been removed and replaced with a single, unified, constructor.  Using the new constructor it is still possible to do all the things that used to be possible, while making the whole system construction process a little more uniform.&lt;br /&gt;
&lt;br /&gt;
The new constructor has the form:&lt;br /&gt;
 System(Renderer* renderer,&lt;br /&gt;
       ResourceProvider* resourceProvider = 0,&lt;br /&gt;
       XMLParser* xmlParser = 0,&lt;br /&gt;
       ScriptModule* scriptModule = 0,&lt;br /&gt;
       const String&amp;amp; configFile = &amp;quot;&amp;quot;,&lt;br /&gt;
       const String&amp;amp; logFile = &amp;quot;CEGUI.log&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
As can be seen, the Renderer module is, of course, still mandatory, though you are free to provide all or none of the other optional arguments and passing in 0 where no object, or no custom object, is required.&lt;br /&gt;
&lt;br /&gt;
For the most basic uses of the system, where only the Renderer is passed in, no changes will be required. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====System::setTooltip changed to System::setDefaultTooltip====&lt;br /&gt;
The member function&lt;br /&gt;
 System::setTooltip&lt;br /&gt;
has been renamed as&lt;br /&gt;
 System::setDefaultTooltip&lt;br /&gt;
this was a change for API consistency.  Update your code to use the new name for this member.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Window MetricsMode removed====&lt;br /&gt;
The concept of a singular 'MetricsMode' for a window is now obsolete and is replaced with the 'Unified' metrics system (which comprises of both a relative 'scale' value and an absolute 'offset' value).&lt;br /&gt;
&lt;br /&gt;
The class members, properties and all associated items affecting MetricsMode have been removed from the system and the use of the Unified metrics system is now mandatory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Window Metrics and other conversion members removed====&lt;br /&gt;
Member functions in the Window class that were concerned with converting values between the various metric modes have all been removed.&lt;br /&gt;
There may still be the need to perform some conversions of co-ordinates, so this functionality is now provided by the external utility class CEGUI::CoordConverter.&lt;br /&gt;
Window Size and Positioning&lt;br /&gt;
&lt;br /&gt;
Due to the removal of the MetricsMode concept, and the now mandatory use of 'Unified' co-ordinate values, the means by which you specify size and position is now by using the unified type members.  &lt;br /&gt;
&lt;br /&gt;
*getXPosition, getRelativeXPosition and getAbsoluteXPosition members are replaced with getWindowXPosition.&lt;br /&gt;
*getYPosition, getRelativeYPosition and getAbsoluteYPosition members are replaced with getWindowYPosition.&lt;br /&gt;
*getPosition, getRelativePosition and getAbsolutePosition members are replaced with getWindowPosition.&lt;br /&gt;
*getWidth, getRelativeWidth and getAbsoluteWidth members are replaced with getWindowWidth&lt;br /&gt;
*getHeight, getRelativeHeight and getAbsoluteHeight members are replaced with getWindowHeight&lt;br /&gt;
*getSize, getRelativeSize and getAbsoluteSize members are replaced with getWindowSize&lt;br /&gt;
*getRect, getRelativeRect and getAbsoluteRect members are replaced with getWindowArea&lt;br /&gt;
*getMaximumSize member is replaced with getWindowMaxSize&lt;br /&gt;
*getMinimumSize member is replaced with getWindowMinSize&lt;br /&gt;
*setWidth members are replaced with setWindowWidth&lt;br /&gt;
*setHeight members are replaced with setWindowHeight&lt;br /&gt;
*setSize members are replaced with setWindowSize&lt;br /&gt;
*setXPosition members are replaced with setWindowXPosition.&lt;br /&gt;
*setYPosition members are replaced with setWindowYPosition.&lt;br /&gt;
*setPosition members are replaced with setWindowPosition.&lt;br /&gt;
*setAreaRect and setRect members are replaced with setWindowArea&lt;br /&gt;
*setMaximumSize member is replaced with setWindowMaxSize&lt;br /&gt;
*setMinimumSize member is replaced with setWindowMinSize&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Component Widget creation abstract members====&lt;br /&gt;
If you have sub-classed any Window types in order to create a new “Widget Module”, part of your responsibility was to provide implementations for various abstract member functions whose job it was to create the various component widgets required by the container window.  These members were typically named createXXX (for example, Combobox::createEditbox).&lt;br /&gt;
&lt;br /&gt;
These abstract member functions and the internal calls to them have all been removed from the system.  The component widgets are now specified within the looknfeel xml files are are automatically created by the Falagard looknfeel system as and when required.&lt;br /&gt;
You should remove any code that creates these component widgets and add appropriate &amp;lt;Child&amp;gt; tags to your looknfeel xml files instead.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Component Widget member fields====&lt;br /&gt;
If you had sub-classed any of the Window types, either to provide some modified behaviour or perhaps for a “Widget Module” as part of creating a custom look, you would previously have had access to some member variables that held pointers to component widgets of the more complicated widget types (for example, the Scrollbar widget would have held pointers to the two PushButton widgets and the Thumb widget that it was composed of).  These members have now been removed and replaced with 'getter' member functions; this is important because in the future the actual Window objects used for these component parts may not be valid for the entire life of the containing Window.  That is, the component Windows may get destroyed and re-created, thus invalidating any cached pointers.&lt;br /&gt;
&lt;br /&gt;
The old member variables and the getter function that replaces them are listed here:&lt;br /&gt;
 *** TODO ***&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====RenderableElement, RenderableImage and RenderableFrame classes====&lt;br /&gt;
These classes have all been removed from the system entirely.  Everything that these classes achieved with regards to rendering for window and widget types can now be done via the Falagard looknfeel system.&lt;br /&gt;
&lt;br /&gt;
For window based rendering, you should remove your use of Renderable* classes in favour of ImageryComponent and FrameComponent elements in your looknfeel xml files.&lt;br /&gt;
If you were using the Renderable* classes to perform rendering outside of the window rendering systems, you will now need to find alternative, custom, means to do this.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Static, StaticImage and StaticText classes====&lt;br /&gt;
These classes are now removed from the base system and have been implemented as WindowRenderer classes.  Generally, your interface to these widget types should now use a simple default window and the properties system.&lt;br /&gt;
&lt;br /&gt;
The look'n'feel spec for these two widgets have changed as well.&lt;br /&gt;
&lt;br /&gt;
StaticImage:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        The LookNFeel should provide the following:&lt;br /&gt;
&lt;br /&gt;
        States:&lt;br /&gt;
            - Enabled                     - basic rendering for enabled state.&lt;br /&gt;
            - Disabled                    - basic rendering for disabled state.&lt;br /&gt;
            - EnabledFrame                - frame rendering for enabled state&lt;br /&gt;
            - DisabledFrame               - frame rendering for disabled state.&lt;br /&gt;
            - WithFrameEnabledBackground  - backdrop rendering for enabled state with frame enabled.&lt;br /&gt;
            - WithFrameDisabledBackground - backdrop rendering for disabled state with frame enabled.&lt;br /&gt;
            - NoFrameEnabledBackground    - backdrop rendering for enabled state with frame disabled.&lt;br /&gt;
            - NoFrameDisabledBackground   - backdrop rendering for disabled state with frame disabled.&lt;br /&gt;
            - WithFrameImage              - image rendering when frame is enabled&lt;br /&gt;
            - NoFrameImage                - image rendering when frame is disabled (defaults to WithFrameImage if not present)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
StaticText:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        The LookNFeel should provide the following:&lt;br /&gt;
&lt;br /&gt;
        States:&lt;br /&gt;
            - Enabled                     - basic rendering for enabled state.&lt;br /&gt;
            - Disabled                    - basic rendering for disabled state.&lt;br /&gt;
            - EnabledFrame                - frame rendering for enabled state&lt;br /&gt;
            - DisabledFrame               - frame rendering for disabled state.&lt;br /&gt;
            - WithFrameEnabledBackground  - backdrop rendering for enabled state with frame enabled.&lt;br /&gt;
            - WithFrameDisabledBackground - backdrop rendering for disabled state with frame enabled.&lt;br /&gt;
            - NoFrameEnabledBackground    - backdrop rendering for enabled state with frame disabled.&lt;br /&gt;
            - NoFrameDisabledBackground   - backdrop rendering for disabled state with frame disabled.&lt;br /&gt;
&lt;br /&gt;
        Named Areas (missing areas will default to 'WithFrameTextRenderArea'):&lt;br /&gt;
            WithFrameTextRenderArea&lt;br /&gt;
            WithFrameTextRenderAreaHScroll&lt;br /&gt;
            WithFrameTextRenderAreaVScroll&lt;br /&gt;
            WithFrameTextRenderAreaHVScroll&lt;br /&gt;
            NoFrameTextRenderArea&lt;br /&gt;
            NoFrameTextRenderAreaHScroll&lt;br /&gt;
            NoFrameTextRenderAreaVScroll&lt;br /&gt;
            NoFrameTextRenderAreaHVScroll&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Dynamic addition of Events to Windows and other EventSet based objects====&lt;br /&gt;
It used to be that all available Event objects would be pre-added to an EventSet when it was constructed.  When an Event was accessed which had not been added to the EventSet an appropriate exception was thrown.&lt;br /&gt;
&lt;br /&gt;
This behaviour has now changed.  Events are only added to an EventSet when a handler for that event is first subscribed.  A side effect of this is that EventSet does now not throw exceptions, either when firing a non-existing Event (now reclassified as simply an event which has no subscribers), or when subscribing to an Event that does not yet exist, since the Event is now automatically created and added to the EventSet.&lt;br /&gt;
&lt;br /&gt;
If your code currently relies on exceptions being thrown by the events system, you will need to change this to a more pro-active approach (by manually checking if an event exists yet), instead of reactive (catching exceptions).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====TinyXML moved to CEGUITinyXML namespace====&lt;br /&gt;
If you were for some reason using our integrated copy of TinyXML directly in your application, we have moved this module into the namespace 'CEGUITinyXML'.  This was done to avoid clashes and conflicts where the client contained it's own copy of TinyXML.&lt;br /&gt;
&lt;br /&gt;
To continue to directly use the integrated TinyXML, just add the namespace qualifier where appropriate.&lt;br /&gt;
&lt;br /&gt;
If you are just using the TinyXML based implementation of CEGUI::XMLParser, you do not need to change anything.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Data File Changes===&lt;br /&gt;
This sub-section details changes that will affect the xml data files used with CEGUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Updated XSD files for Xerces====&lt;br /&gt;
Even the most rudimentary changes to the xml formats we use mean that if you're using the Xerces-C, or other, validating XML parser, then you will need to update you projects to use the new .xsd files.  These are collected together for convenience in the XMLRefSchema subdirectory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Falagard Additions ===&lt;br /&gt;
From lack of a better place to put this I'll list the additions that have been made to Falagard here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''PropertyLinkDefinition'''&lt;br /&gt;
New element that will create a property that is a link to another property of a child window.&lt;br /&gt;
&lt;br /&gt;
Attributes:&lt;br /&gt;
* type (type, optional and not currently used for anything)&lt;br /&gt;
* name (name of the property link)&lt;br /&gt;
* widget (name suffix of the child widget to link to)&lt;br /&gt;
* targetProperty (the target property to link to. Optional, will default to ''name'' if not given)&lt;br /&gt;
* initialValue (starting value for the property. Optional, will default to empty)&lt;br /&gt;
* layoutOnWrite (will make the widget redo the child layout when the property is written. Optional, defaults to ''false'')&lt;br /&gt;
* redrawOnWrite (will make the widget redraw when the property is written. Optional, default to ''false'')&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''controlProperty'''&lt;br /&gt;
&lt;br /&gt;
New attribute added to ''Section''. Value is the name of a property, and if specified the Section will only render when the property has a value of ''True''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''TextComponent'''&lt;br /&gt;
&lt;br /&gt;
Two new sub-elements are now valid for ''TextComponent''.&lt;br /&gt;
&lt;br /&gt;
''TextProperty'', and ''FontProperty''. Must be specified in that order after the (optional) ''Text'' element.&lt;br /&gt;
Both have one required attribute ''name'' which takes the name of a property which will contain the text to draw, or the name of the font to use for rendering.&lt;br /&gt;
&lt;br /&gt;
In case these new elements are used along with the ''Text'' element, the string and font specified in the ''Text'' element will be used as defaults if the ''TextProperty'' or ''FontProperty'' evaluates to empty strings.&lt;br /&gt;
&lt;br /&gt;
To be continued...&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=FAQ&amp;diff=2145</id>
		<title>FAQ</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=FAQ&amp;diff=2145"/>
				<updated>2006-05-20T17:27:01Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== General Questions ==&lt;br /&gt;
=== What is CEGUI? ===&lt;br /&gt;
CEGUI is ''Crazy Eddie's Gui System''; a cross platform Gui/widget library for use in games and other multi-media projects where use of standard operating system Gui libraries is either not possible, or is very difficult.&lt;br /&gt;
&lt;br /&gt;
=== How is CEGUI licensed? ===&lt;br /&gt;
CEGUI is licensed under the LGPL (Lesser/Library General Public License). For details of this license, please visit the following web-site: http://www.gnu.org/copyleft/lesser.html.&lt;br /&gt;
&lt;br /&gt;
Starting from the 0.5 release CEGUI will be licensed under the [http://www.opensource.org/licenses/mit-license.php MIT license]&lt;br /&gt;
&lt;br /&gt;
=== How much does CEGUI cost? ===&lt;br /&gt;
Nothing. The use of CEGUI is totally free within the bounds of the license as described above.&lt;br /&gt;
&lt;br /&gt;
=== I am developing a commercial, closed-source product. Since CEGUI 0.4 is licensed under LGPL, this means that can't I use the library, right? ===&lt;br /&gt;
No, that's not right. So long as you link dynamically to CEGUI and associated libraries, then you do not have to release any of your own source or .o/.obj files, though do carefully check the LGPL, and the licenses for the third party libraries for full details of what is and is not permissible.&lt;br /&gt;
&lt;br /&gt;
=== I am not happy with the LGPL / MIT license, do you offer alternative licensing? ===&lt;br /&gt;
No. Alternative licensing is not available, nor is it planned.&lt;br /&gt;
&lt;br /&gt;
=== And what if I need to develop to a plataform wich doesn´t support dynamic linking? ===&lt;br /&gt;
Use the 0.5 release as the MIT license allows static linking.&lt;br /&gt;
&lt;br /&gt;
=== Does CEGUI rely upon any third party libraries? If so what are they? ===&lt;br /&gt;
CEGUI currently depends upon the following external libraries:&lt;br /&gt;
&lt;br /&gt;
    * FreeType2&lt;br /&gt;
    * Xerces-C++ (optional, built-in TinyXML parser is provided)&lt;br /&gt;
&lt;br /&gt;
You will also require a supported rendering system, and some form of input library.&lt;br /&gt;
&lt;br /&gt;
=== Where can I get these third party libraries? ===&lt;br /&gt;
&lt;br /&gt;
    * FreeType2: http://www.freetype.org/&lt;br /&gt;
    * Xerces-C++: http://xml.apache.org/xerces-c/&lt;br /&gt;
&lt;br /&gt;
=== Do I have to compile the third part libraries myself? ===&lt;br /&gt;
It depends. Under Linux and similar systems, you will need to perform your own compilation. For Microsoft® Windows® users, we have supplied packages containing binary versions of the libraries for a selection of popular compiler configurations.&lt;br /&gt;
&lt;br /&gt;
=== You mentioned something about &amp;quot;supported rendering systems&amp;quot;, what's that all about and which systems are supported? ===&lt;br /&gt;
CEGUI can be used with various rendering systems. There are currently CEGUI renderer modules for Microsoft® DirectX® 8.1 and 9, OpenGL, the Ogre engine, and the Irrlicht engine.&lt;br /&gt;
&lt;br /&gt;
=== There is no renderer module for my rendering engine or API of choice, will other rendering system be supported? ===&lt;br /&gt;
It is likely that, over time, CEGUI will add support for other APIs and engines. Having said this, it is fairly simple to write your own renderer module for CEGUI, so you might consider taking that option if you do not want to wait.&lt;br /&gt;
&lt;br /&gt;
=== And what about input libraries? ===&lt;br /&gt;
CEGUI requires you to ''inject'' inputs into it, these inputs can come from any source that you choose. All you need to do is pass mouse movements, mouse button up and down events, and keyboard inputs to CEGUI.&lt;br /&gt;
&lt;br /&gt;
=== Why doesn't CEGUI collect its own inputs? Why do I need to inject the inputs myself? ===&lt;br /&gt;
CEGUI does not collect its own input so that the system can remain as flexible as possible. We didn't want to tie people down to one system or input library.&lt;br /&gt;
&lt;br /&gt;
=== I have seen mention of a Lua scripting module, how can I get this? ===&lt;br /&gt;
The Lua scripting module is provided with CEGUI and resides in the same source repository. Downloading CEGUI binary/source/svn will get you everything you need.&lt;br /&gt;
&lt;br /&gt;
=== I can't find many of the things you talk about in my crayzedsgui code, what's wrong? ===&lt;br /&gt;
You probably have one of the older Mk-1 alpha releases. Get the newer Mk-2 releases instead, the archive files for these generally have names with cegui_mk2 in them.&lt;br /&gt;
&lt;br /&gt;
=== Why are there two versions of the system? ===&lt;br /&gt;
The Mk-1 version was a Windows®/DirectX® only library and was really a dry run for what became the Mk-2 system. There was only ever 'alpha' versions of the Mk-1 code, so it was never anywhere near finished.&lt;br /&gt;
&lt;br /&gt;
=== Are the Mk-1 and Mk-2 systems interface compatible? ===&lt;br /&gt;
No. The interfaces of the two systems are totally different, although many of the general concepts have remained the same.&lt;br /&gt;
&lt;br /&gt;
=== The Mk-1 system is so much more lightweight than the Mk-2 system. Can I still use the Mk-1 code? Is the Mk-1 code still being developed and supported? ===&lt;br /&gt;
Short Answer: Not really.&lt;br /&gt;
&lt;br /&gt;
Long Answer: There were too many weak areas within the Mk-1 system and development on this version has ceased completely. There is no longer any support for the Mk-1 version; in general it would be better for everyone if they migrated to the Mk-2 version of the system.&lt;br /&gt;
&lt;br /&gt;
=== I am having major troubles integrating CEGUI with my project, will you do it for me? ===&lt;br /&gt;
No. The CEGUI developers have enough to do without writing users projects for them.&lt;br /&gt;
&lt;br /&gt;
=== I have (or think I have) found a bug. How should I proceed? ===&lt;br /&gt;
If you are certain that it's a bug and not, for example, a misunderstanding of what is happening, then the bug should be reported via the project bug tracking system. However, before submitting a bug to the tracker, it is asked that you first do a quick search to see if the bug has already been reported. If you are unsure whether something is a bug or not, then it may be discussed on the web site forums prior to submitting a bug report to the project bug tracker.&lt;br /&gt;
&lt;br /&gt;
=== I notice that feature/widget 'X' is missing. Will this be added to CEGUI? ===&lt;br /&gt;
Requests for new features and/or widgets are welcomed. You can discuss such things on the web site forums and then submit a feature request to the project feature request tracking system. Although it is asked that you first search to ensure that the feature has not already been requested; if the feature has already been requested feel free to add a note to the tracker item stating your support for the feature request. Note that no promises are made with regards to which features will and will not be added, or how long such things will take, but all requests will be seriously considered.&lt;br /&gt;
&lt;br /&gt;
=== How can I get involved with CEGUI development? ===&lt;br /&gt;
The best way to become involved is to visit the web site forums, state what your intentions are (to help in avoiding duplicated effort), and then start submitting some patches to the project patch tracking system.&lt;br /&gt;
&lt;br /&gt;
=== Is there managed code / Microsoft .Net support for the CEGUI library? ===&lt;br /&gt;
Yes, there is ''ceguisharp'' at http://realmforgewiki.castlegobs.nl/index.php/CEGUI This is a C# port of the library which uses the excellent Axiom rendering engine.&lt;br /&gt;
&lt;br /&gt;
=== This FAQ doesn't answer my question, what should I do now? ===&lt;br /&gt;
Feel free to post your question on the web site forums, somebody will gladly answer your question and/or offer further advice.&lt;br /&gt;
&lt;br /&gt;
== Build Questions ==&lt;br /&gt;
&lt;br /&gt;
(A work in Progress)&lt;br /&gt;
&lt;br /&gt;
=== Building CEGUI ===&lt;br /&gt;
# General Requirements&lt;br /&gt;
# Dependency installs&lt;br /&gt;
&lt;br /&gt;
=== Building from CVS ===&lt;br /&gt;
''(The following instructions are for unix systems)''&lt;br /&gt;
&lt;br /&gt;
==== Configuring CEGUI ====&lt;br /&gt;
First, we need to generate the configure script, as well as a few other files.&lt;br /&gt;
In the cegui_mk2 directory, run:&lt;br /&gt;
    $ sh ./bootstrap&lt;br /&gt;
Now, it's time to actually run configure:&lt;br /&gt;
    $ ./configure&lt;br /&gt;
&lt;br /&gt;
==== Building CEGUI ====&lt;br /&gt;
With all this one, we can now build CEGUI.&lt;br /&gt;
Type:&lt;br /&gt;
    $ make&lt;br /&gt;
Once that's finished, we can install it!&lt;br /&gt;
Type:&lt;br /&gt;
    $ make install&lt;br /&gt;
&lt;br /&gt;
Tada!&lt;br /&gt;
&lt;br /&gt;
=== CEGUI Layout Editor Build ===&lt;br /&gt;
For full details, please refer to this seperate wiki page: http://www.cegui.org.uk/wiki/index.php/The_%22official%22_layout_editor&lt;br /&gt;
# Dependency installs (for versions &amp;gt; 0.4.0)&lt;br /&gt;
Install wxWidgets&lt;br /&gt;
# Building&lt;br /&gt;
&lt;br /&gt;
== Usage Questions ==&lt;br /&gt;
=== What is the correct way to subscribe for an event? ===&lt;br /&gt;
Event notification is a vital aspect of GUI programming. CEGUI handles those using subscribers.&lt;br /&gt;
In order to subscribe a window for an event, you have to call the method 'Window::subscribeEvent', passing the function&lt;br /&gt;
to be called when the specified event occurs, and the instance on which the method is called.&lt;br /&gt;
&lt;br /&gt;
 class MyButtonHandler&lt;br /&gt;
 {&lt;br /&gt;
 private:&lt;br /&gt;
     PushButton* mButton;&lt;br /&gt;
 &lt;br /&gt;
 public:&lt;br /&gt;
     MyButtonHandler::MyButtonHandler(PushButton* btn) : mButton(btn)&lt;br /&gt;
     {&lt;br /&gt;
         btn-&amp;gt;subscribeEvent(PushButton::EventClicked, Event::Subscriber(MyButtonHandler::ButtonClicked,this));&lt;br /&gt;
     }&lt;br /&gt;
     &lt;br /&gt;
     MyButtonHandler::ButtonClicked()&lt;br /&gt;
     {&lt;br /&gt;
         //This function gets called when the button is clicked&lt;br /&gt;
         std::cout &amp;lt;&amp;lt; &amp;quot;Button clicked&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
The 'subscribeEvent' method returns an Event::Connection, which can be used later to unsubscribe for a registered event with&lt;br /&gt;
the 'disconnect' method.&lt;br /&gt;
&lt;br /&gt;
 Event::Connection myCon = btn-&amp;gt;subscribeEvent(...);&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 &lt;br /&gt;
 myCon-&amp;gt;disconnect();&lt;br /&gt;
&lt;br /&gt;
In order to totally remove the event itself, you have to call the 'removeEvent' function:&lt;br /&gt;
all the connections to the specified event will be disconnected. &lt;br /&gt;
There's also an Event::ScopedConnection, which can be used to auto-unsubscribe when the event goes out of scope.&lt;br /&gt;
&lt;br /&gt;
Similar way for the scripted events, which can be subscribed with the 'subscribeScriptedEvent' method.&lt;br /&gt;
In addition, you can do it in XML, using this syntax:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Event Name=&amp;quot;Clicked&amp;quot; Function=&amp;quot;luabtn_clicked&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== How can I make the ListBox highlight the selected item? ===&lt;br /&gt;
In order to highlight selected items you need to set selection brush image and the selection colours of that item. The selection image is modulated by the colours you set. Note, that the alpha component needs to be smaller than 1.0, for the content of the selected item to be seen.&lt;br /&gt;
 // set selection highlight to a half transparent blue to red gradient.&lt;br /&gt;
 colour blue(0.0, 0.0, 1.0, 0.5);&lt;br /&gt;
 colour red(1.0, 0.0, 0.0, 0.5);&lt;br /&gt;
 myListBoxItem-&amp;gt;setSelectionColours(blue, blue, red, red);&lt;br /&gt;
 // this default image is a simple white rectangle&lt;br /&gt;
 myListBoxItem-&amp;gt;setSelectionBrushImage(&amp;quot;TaharezLook&amp;quot;, &amp;quot;ListboxSelectionBrush&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
=== How can I remove the border of a StaticImage? ===&lt;br /&gt;
Either put the following property into the window definition:&lt;br /&gt;
 &amp;lt;Property Name=&amp;quot;FrameEnabled&amp;quot; Value=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
Or set it by code:&lt;br /&gt;
 myStaticImage-&amp;gt;setFrameEnabled(false);&lt;br /&gt;
&lt;br /&gt;
=== How can I set the background of a StaticImage? ===&lt;br /&gt;
The first thing you need in order to do this is an Imageset that defines the Image that you wish to use. When wanting to use an image file for this as you suggest, you basically have an imageset defined like this:&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;Imageset Name=&amp;quot;BackdropImageset&amp;quot; Imagefile=&amp;quot;backdrop.tga&amp;quot; NativeHorzRes=&amp;quot;1024&amp;quot; NativeVertRes=&amp;quot;768&amp;quot; AutoScaled=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
 	&amp;lt;Image Name=&amp;quot;Backdrop&amp;quot; XPos=&amp;quot;0&amp;quot; YPos=&amp;quot;0&amp;quot; Width=&amp;quot;1024&amp;quot; Height=&amp;quot;768&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;/Imageset&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What this does is define an Imageset using the backdrop.tga. A single image &amp;quot;Backdrop&amp;quot; is defined that starts at location (0,0) and is 1024 x 768 in size. You should be careful in that the source image file should have dimensions that are powers of two - this is because the image is loaded as a texture, and may be stretched if the powers-of-two requirement is not observed.&amp;lt;br&amp;gt;&lt;br /&gt;
Once you have your imageset defined, you can load it either by adding a reference to it in whichever scheme you are loading, or manually using the ImagesetManager:&lt;br /&gt;
 CEGUI::ImagesetManager::getSingleton().createImageset(&amp;quot;myImageset.imagset&amp;quot;);&lt;br /&gt;
Once the thing is loaded, you set the image into the StaticImage like so:&lt;br /&gt;
 myStaticImage-&amp;gt;setImage(&amp;quot;BackdropImageset&amp;quot;, &amp;quot;Backdrop&amp;quot;);&lt;br /&gt;
Notice that the names we specify here are the ones that were originally specified in the imageset XML file.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== What properties are available for use in XML layouts, and what format do I use for the value strings? ===&lt;br /&gt;
Each widget has its properties placed within an appropriately named C++ namespace, so all you need to do is look up the appropriate namespace within the [http://www.cegui.org.uk/api_reference/namespaces.html namespaces section of the API reference].&lt;br /&gt;
&lt;br /&gt;
Also, remember that properties are inherited.  So for example, when looking up properties for a PushButton, also check the properties for ButtonBase and Window too - since these properties are also available to you.&lt;br /&gt;
&lt;br /&gt;
=== I can't see the items I've added to my Combobox, how do I get the list to show when I press the button? ===&lt;br /&gt;
&lt;br /&gt;
The height you specify for the combobox widget includes the height of the drop down list; it's not just for the 'Editbox' portion of the widget (the height of which  is usually automatically determined based upon the font).  Ensure that when specifying the height for your combobox, you have provided sufficient space for the list to appear.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Template:CEGUIWikiGettingStarted&amp;diff=2122</id>
		<title>Template:CEGUIWikiGettingStarted</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Template:CEGUIWikiGettingStarted&amp;diff=2122"/>
				<updated>2006-05-18T21:06:18Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[What is CEGUI]]?&lt;br /&gt;
* [[FAQ|Frequently Asked Questions]]&lt;br /&gt;
* [[Tutorials]]&lt;br /&gt;
* [[CodeSnippets]]&lt;br /&gt;
* [[HOW-TO series]]&lt;br /&gt;
* [[&amp;quot;Falagard&amp;quot; Skinning System Documentation]]&lt;br /&gt;
* [[The &amp;quot;official&amp;quot; layout editor]]&lt;br /&gt;
* [[XML File formats]]&lt;br /&gt;
* [[X-Files: CEGUI Case]]&lt;br /&gt;
* [[User Contributed Material]]&lt;br /&gt;
* [[Assembling a Toolset]]&lt;br /&gt;
* [[Porting to the 0.5.0 Release]]&lt;br /&gt;
* [[CEGUI Developer Corner]]&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Changes_and_Porting_Tips_for_0.5.0&amp;diff=2121</id>
		<title>Changes and Porting Tips for 0.5.0</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Changes_and_Porting_Tips_for_0.5.0&amp;diff=2121"/>
				<updated>2006-05-18T20:59:20Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: /* Static, StaticImage and StaticText classes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note that this is incomplete, work in progress, documentation.&lt;br /&gt;
==Introduction==&lt;br /&gt;
The 0.5.0 release of Crazy Eddie's GUI System is the first of what will likely be a series of releases containing breaking changes for client code and data files.  We feel these breaking changes are required as we move closer to the 1.0 release of CEGUI, and also as the design and usage patterns for CEGUI change; the results are a generally more streamlined system as we move from one idiom to another, as opposed to becoming more and more bloated due to retaining vast amounts of code and kludges for backward compatibility reasons.&lt;br /&gt;
&lt;br /&gt;
This document is a general overview and guide to the breaking changes between the 0.4.x series of releases and the 0.5.0 release.  As and when other breaking releases are made, additional documentation will be provided as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Changes and Porting==&lt;br /&gt;
This section is intended as a general overview of the breaking changes made.  Blah, blah, blah.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Code Changes===&lt;br /&gt;
This sub-section details changes made to the CEGUI system code and API which will affect client code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====The new WindowRenderer system====&lt;br /&gt;
One of the main issues with the previous widget module approach, was that it became exceptionally difficult to sub-class a widget type where some custom behavioural changes or additions were required.  &lt;br /&gt;
 *** TODO ***&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====CEGUI::System Constructor====&lt;br /&gt;
The overloaded constructors for the main CEGUI::System object have been removed and replaced with a single, unified, constructor.  Using the new constructor it is still possible to do all the things that used to be possible, while making the whole system construction process a little more uniform.&lt;br /&gt;
&lt;br /&gt;
The new constructor has the form:&lt;br /&gt;
 System(Renderer* renderer,&lt;br /&gt;
       ResourceProvider* resourceProvider = 0,&lt;br /&gt;
       XMLParser* xmlParser = 0,&lt;br /&gt;
       ScriptModule* scriptModule = 0,&lt;br /&gt;
       const String&amp;amp; configFile = &amp;quot;&amp;quot;,&lt;br /&gt;
       const String&amp;amp; logFile = &amp;quot;CEGUI.log&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
As can be seen, the Renderer module is, of course, still mandatory, though you are free to provide all or none of the other optional arguments and passing in 0 where no object, or no custom object, is required.&lt;br /&gt;
&lt;br /&gt;
For the most basic uses of the system, where only the Renderer is passed in, no changes will be required. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====System::setTooltip changed to System::setDefaultTooltip====&lt;br /&gt;
The member function&lt;br /&gt;
 System::setTooltip&lt;br /&gt;
has been renamed as&lt;br /&gt;
 System::setDefaultTooltip&lt;br /&gt;
this was a change for API consistency.  Update your code to use the new name for this member.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Window MetricsMode removed====&lt;br /&gt;
The concept of a singular 'MetricsMode' for a window is now obsolete and is replaced with the 'Unified' metrics system (which comprises of both a relative 'scale' value and an absolute 'offset' value).&lt;br /&gt;
&lt;br /&gt;
The class members, properties and all associated items affecting MetricsMode have been removed from the system and the use of the Unified metrics system is now mandatory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Window Metrics and other conversion members removed====&lt;br /&gt;
Member functions in the Window class that were concerned with converting values between the various metric modes have all been removed.&lt;br /&gt;
There may still be the need to perform some conversions of co-ordinates, so this functionality is now provided by the external utility class CEGUI::CoordConverter.&lt;br /&gt;
Window Size and Positioning&lt;br /&gt;
&lt;br /&gt;
Due to the removal of the MetricsMode concept, and the now mandatory use of 'Unified' co-ordinate values, the means by which you specify size and position is now by using the unified type members.  &lt;br /&gt;
&lt;br /&gt;
*getXPosition, getRelativeXPosition and getAbsoluteXPosition members are replaced with getWindowXPosition.&lt;br /&gt;
*getYPosition, getRelativeYPosition and getAbsoluteYPosition members are replaced with getWindowYPosition.&lt;br /&gt;
*getPosition, getRelativePosition and getAbsolutePosition members are replaced with getWindowPosition.&lt;br /&gt;
*getWidth, getRelativeWidth and getAbsoluteWidth members are replaced with getWindowWidth&lt;br /&gt;
*getHeight, getRelativeHeight and getAbsoluteHeight members are replaced with getWindowHeight&lt;br /&gt;
*getSize, getRelativeSize and getAbsoluteSize members are replaced with getWindowSize&lt;br /&gt;
*getRect, getRelativeRect and getAbsoluteRect members are replaced with getWindowArea&lt;br /&gt;
*getMaximumSize member is replaced with getWindowMaxSize&lt;br /&gt;
*getMinimumSize member is replaced with getWindowMinSize&lt;br /&gt;
*setWidth members are replaced with setWindowWidth&lt;br /&gt;
*setHeight members are replaced with setWindowHeight&lt;br /&gt;
*setSize members are replaced with setWindowSize&lt;br /&gt;
*setXPosition members are replaced with setWindowXPosition.&lt;br /&gt;
*setYPosition members are replaced with setWindowYPosition.&lt;br /&gt;
*setPosition members are replaced with setWindowPosition.&lt;br /&gt;
*setAreaRect and setRect members are replaced with setWindowArea&lt;br /&gt;
*setMaximumSize member is replaced with setWindowMaxSize&lt;br /&gt;
*setMinimumSize member is replaced with setWindowMinSize&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Component Widget creation abstract members====&lt;br /&gt;
If you have sub-classed any Window types in order to create a new “Widget Module”, part of your responsibility was to provide implementations for various abstract member functions whose job it was to create the various component widgets required by the container window.  These members were typically named createXXX (for example, Combobox::createEditbox).&lt;br /&gt;
&lt;br /&gt;
These abstract member functions and the internal calls to them have all been removed from the system.  The component widgets are now specified within the looknfeel xml files are are automatically created by the Falagard looknfeel system as and when required.&lt;br /&gt;
You should remove any code that creates these component widgets and add appropriate &amp;lt;Child&amp;gt; tags to your looknfeel xml files instead.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Component Widget member fields====&lt;br /&gt;
If you had sub-classed any of the Window types, either to provide some modified behaviour or perhaps for a “Widget Module” as part of creating a custom look, you would previously have had access to some member variables that held pointers to component widgets of the more complicated widget types (for example, the Scrollbar widget would have held pointers to the two PushButton widgets and the Thumb widget that it was composed of).  These members have now been removed and replaced with 'getter' member functions; this is important because in the future the actual Window objects used for these component parts may not be valid for the entire life of the containing Window.  That is, the component Windows may get destroyed and re-created, thus invalidating any cached pointers.&lt;br /&gt;
&lt;br /&gt;
The old member variables and the getter function that replaces them are listed here:&lt;br /&gt;
 *** TODO ***&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====RenderableElement, RenderableImage and RenderableFrame classes====&lt;br /&gt;
These classes have all been removed from the system entirely.  Everything that these classes achieved with regards to rendering for window and widget types can now be done via the Falagard looknfeel system.&lt;br /&gt;
&lt;br /&gt;
For window based rendering, you should remove your use of Renderable* classes in favour of ImageryComponent and FrameComponent elements in your looknfeel xml files.&lt;br /&gt;
If you were using the Renderable* classes to perform rendering outside of the window rendering systems, you will now need to find alternative, custom, means to do this.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Static, StaticImage and StaticText classes====&lt;br /&gt;
These classes are now removed from the base system and have been implemented as WindowRenderer classes.  Generally, your interface to these widget types should now use a simple default window and the properties system.&lt;br /&gt;
&lt;br /&gt;
The look'n'feel spec for these two widgets have changed as well.&lt;br /&gt;
&lt;br /&gt;
StaticImage:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        The LookNFeel should provide the following:&lt;br /&gt;
&lt;br /&gt;
        States:&lt;br /&gt;
            - Enabled                     - basic rendering for enabled state.&lt;br /&gt;
            - Disabled                    - basic rendering for disabled state.&lt;br /&gt;
            - EnabledFrame                - frame rendering for enabled state&lt;br /&gt;
            - DisabledFrame               - frame rendering for disabled state.&lt;br /&gt;
            - WithFrameEnabledBackground  - backdrop rendering for enabled state with frame enabled.&lt;br /&gt;
            - WithFrameDisabledBackground - backdrop rendering for disabled state with frame enabled.&lt;br /&gt;
            - NoFrameEnabledBackground    - backdrop rendering for enabled state with frame disabled.&lt;br /&gt;
            - NoFrameDisabledBackground   - backdrop rendering for disabled state with frame disabled.&lt;br /&gt;
            - WithFrameImage              - image rendering when frame is enabled&lt;br /&gt;
            - NoFrameImage                - image rendering when frame is disabled (defaults to WithFrameImage if not present)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
StaticText:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        The LookNFeel should provide the following:&lt;br /&gt;
&lt;br /&gt;
        States:&lt;br /&gt;
            - Enabled                     - basic rendering for enabled state.&lt;br /&gt;
            - Disabled                    - basic rendering for disabled state.&lt;br /&gt;
            - EnabledFrame                - frame rendering for enabled state&lt;br /&gt;
            - DisabledFrame               - frame rendering for disabled state.&lt;br /&gt;
            - WithFrameEnabledBackground  - backdrop rendering for enabled state with frame enabled.&lt;br /&gt;
            - WithFrameDisabledBackground - backdrop rendering for disabled state with frame enabled.&lt;br /&gt;
            - NoFrameEnabledBackground    - backdrop rendering for enabled state with frame disabled.&lt;br /&gt;
            - NoFrameDisabledBackground   - backdrop rendering for disabled state with frame disabled.&lt;br /&gt;
&lt;br /&gt;
        Named Areas (missing areas will default to 'WithFrameTextRenderArea'):&lt;br /&gt;
            WithFrameTextRenderArea&lt;br /&gt;
            WithFrameTextRenderAreaHScroll&lt;br /&gt;
            WithFrameTextRenderAreaVScroll&lt;br /&gt;
            WithFrameTextRenderAreaHVScroll&lt;br /&gt;
            NoFrameTextRenderArea&lt;br /&gt;
            NoFrameTextRenderAreaHScroll&lt;br /&gt;
            NoFrameTextRenderAreaVScroll&lt;br /&gt;
            NoFrameTextRenderAreaHVScroll&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Dynamic addition of Events to Windows and other EventSet based objects====&lt;br /&gt;
It used to be that all available Event objects would be pre-added to an EventSet when it was constructed.  When an Event was accessed which had not been added to the EventSet an appropriate exception was thrown.&lt;br /&gt;
&lt;br /&gt;
This behaviour has now changed.  Events are only added to an EventSet when a handler for that event is first subscribed.  A side effect of this is that EventSet does now not throw exceptions, either when firing a non-existing Event (now reclassified as simply an event which has no subscribers), or when subscribing to an Event that does not yet exist, since the Event is now automatically created and added to the EventSet.&lt;br /&gt;
&lt;br /&gt;
If your code currently relies on exceptions being thrown by the events system, you will need to change this to a more pro-active approach (by manually checking if an event exists yet), instead of reactive (catching exceptions).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====TinyXML moved to CEGUITinyXML namespace====&lt;br /&gt;
If you were for some reason using our integrated copy of TinyXML directly in your application, we have moved this module into the namespace 'CEGUITinyXML'.  This was done to avoid clashes and conflicts where the client contained it's own copy of TinyXML.&lt;br /&gt;
&lt;br /&gt;
To continue to directly use the integrated TinyXML, just add the namespace qualifier where appropriate.&lt;br /&gt;
&lt;br /&gt;
If you are just using the TinyXML based implementation of CEGUI::XMLParser, you do not need to change anything.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Data File Changes===&lt;br /&gt;
This sub-section details changes that will affect the xml data files used with CEGUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Updated XSD files for Xerces====&lt;br /&gt;
Even the most rudimentary changes to the xml formats we use mean that if you're using the Xerces-C, or other, validating XML parser, then you will need to update you projects to use the new .xsd files.  These are collected together for convenience in the XMLRefSchema subdirectory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To be continued...&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Tooltips&amp;diff=2045</id>
		<title>Tooltips</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Tooltips&amp;diff=2045"/>
				<updated>2006-04-17T13:13:57Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I am not an expert but I would like to share what I have learned and gleaned about the ''Tooltip'' widget.&lt;br /&gt;
&lt;br /&gt;
API References:&lt;br /&gt;
[http://www.cegui.org.uk/api_reference/classCEGUI_1_1Tooltip.html Tooltip]&lt;br /&gt;
[http://www.cegui.org.uk/api_reference/classCEGUI_1_1System.html System]&lt;br /&gt;
&lt;br /&gt;
As you would expect, the ''Tooltip'' works very similar to most tooltip systems. Basically the user hovers the mouse over a CEGUI widget and when a specified time has elapsed the tooltip is displayed for a specified amount of time. As with most of the CEGUI widgets the ''Tooltip'' widget is based upon the CEGUI ''Window'' class widget.&lt;br /&gt;
&lt;br /&gt;
''Please note that the following example source code was gleaned and edited from project specific code so there may be some syntax errors.''&lt;br /&gt;
&lt;br /&gt;
== Creating the Default System ''Tootip'' widget ==&lt;br /&gt;
&lt;br /&gt;
CEGUI will manage a single default, system wide ''Tooltip'' widget for you that will take care of displaying your tooltip text. You have to initialize it by calling '''CEGUI::System::setTooltip()'' one time, somehwere in your code. I would recommend calling this right after initializing the CEGUI system. Here's a sample call:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // Create default ToolTip item&lt;br /&gt;
  CEGUI::System::getSingleton().setTooltip( (CEGUI::utf8*)&amp;quot;TaharezLook/Tooltip&amp;quot; );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Yep, that's all there is too it.&lt;br /&gt;
In newer versions of CEGUI the method has been renamed to setDefaultTooltip for consistency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Setting the ''Tootip'' text to display ==&lt;br /&gt;
&lt;br /&gt;
There are two methods for setting your tooltip text: In your code or in your layout file.&lt;br /&gt;
&lt;br /&gt;
'''Setting the ''Tooltip'' text in your code'''&lt;br /&gt;
&lt;br /&gt;
You can hardcode toolip text in your code by using the ''WindowObject::setTooltipText()'' function like so:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CEGUI::PushButton *mPushButton = (CEGUI::PushButton *)mWinMgr-&amp;gt;createWindow(&lt;br /&gt;
(CEGUI::utf8*)&amp;quot;TaharezLook/PushButton&amp;quot;, (CEGUI::utf8*)&amp;quot;PushButton&amp;quot;);&lt;br /&gt;
// Set other properties like size, position, etc.&lt;br /&gt;
mPushButton-&amp;gt;setTooltipText(&amp;quot;This is a tooltip.&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Setting the ''Tooltip'' text in your layout (xml) file'''&lt;br /&gt;
&lt;br /&gt;
The prefered method is to set the tooltip text in your layout file and you can do it like so:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Window Type=&amp;quot;TaharezLook/Editbox&amp;quot; Name=&amp;quot;Login/EditBox/Password&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Property Name=&amp;quot;AbsoluteRect&amp;quot; Value=&amp;quot;l:128.000000 t:0.000000 r:486.000000 b:46.000000&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;Property Name=&amp;quot;AlwaysOnTop&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;Property Name=&amp;quot;RelativeRect&amp;quot; Value=&amp;quot;l:0.250000 t:0.000000 r:0.950000 b:1.000000&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;{Enter Password Here}&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;Property Name=&amp;quot;Tooltip&amp;quot; Value=&amp;quot;Enter your password here.&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/Window&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Ensure that the Tooltip is registered in your .Scheme file'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;WindowSet Filename=&amp;quot;CEGUITaharezLook&amp;quot;&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;WindowFactory Name=&amp;quot;TaharezLook/Tooltip&amp;quot; /&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;/WindowSet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Ensure that imageset contains graphics for the Tooltip'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Imageset Name=&amp;quot;TaharezLook&amp;quot; Imagefile=&amp;quot;TaharezLook.png&amp;quot; NativeHorzRes=&amp;quot;800&amp;quot; NativeVertRes=&amp;quot;600&amp;quot; AutoScaled=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;Image Name=&amp;quot;TooltipLeftEdge&amp;quot; XPos=&amp;quot;217&amp;quot; YPos=&amp;quot;225&amp;quot; Width=&amp;quot;7&amp;quot; Height=&amp;quot;7&amp;quot; XOffset=&amp;quot;0&amp;quot; YOffset=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;Image Name=&amp;quot;TooltipRightEdge&amp;quot; XPos=&amp;quot;246&amp;quot; YPos=&amp;quot;225&amp;quot; Width=&amp;quot;7&amp;quot; Height=&amp;quot;7&amp;quot; XOffset=&amp;quot;0&amp;quot; YOffset=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;Image Name=&amp;quot;TooltipTopEdge&amp;quot; XPos=&amp;quot;224&amp;quot; YPos=&amp;quot;218&amp;quot; Width=&amp;quot;7&amp;quot; Height=&amp;quot;7&amp;quot; XOffset=&amp;quot;0&amp;quot; YOffset=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;Image Name=&amp;quot;TooltipBottomEdge&amp;quot; XPos=&amp;quot;224&amp;quot; YPos=&amp;quot;248&amp;quot; Width=&amp;quot;7&amp;quot; Height=&amp;quot;7&amp;quot; XOffset=&amp;quot;0&amp;quot; YOffset=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;Image Name=&amp;quot;TooltipTopLeft&amp;quot; XPos=&amp;quot;217&amp;quot; YPos=&amp;quot;218&amp;quot; Width=&amp;quot;7&amp;quot; Height=&amp;quot;7&amp;quot; XOffset=&amp;quot;0&amp;quot; YOffset=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;Image Name=&amp;quot;TooltipTopRight&amp;quot; XPos=&amp;quot;246&amp;quot; YPos=&amp;quot;218&amp;quot; Width=&amp;quot;7&amp;quot; Height=&amp;quot;7&amp;quot; XOffset=&amp;quot;0&amp;quot; YOffset=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;Image Name=&amp;quot;TooltipBottomLeft&amp;quot; XPos=&amp;quot;217&amp;quot; YPos=&amp;quot;248&amp;quot; Width=&amp;quot;7&amp;quot; Height=&amp;quot;7&amp;quot; XOffset=&amp;quot;0&amp;quot; YOffset=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;Image Name=&amp;quot;TooltipBottomRight&amp;quot; XPos=&amp;quot;246&amp;quot; YPos=&amp;quot;248&amp;quot; Width=&amp;quot;7&amp;quot; Height=&amp;quot;7&amp;quot; XOffset=&amp;quot;0&amp;quot; YOffset=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;Image Name=&amp;quot;TooltipMiddle&amp;quot; XPos=&amp;quot;2&amp;quot; YPos=&amp;quot;2&amp;quot; Width=&amp;quot;64&amp;quot; Height=&amp;quot;64&amp;quot; XOffset=&amp;quot;0&amp;quot; YOffset=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/Imageset&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How to display the ''Tooltip'' ==&lt;br /&gt;
&lt;br /&gt;
'''Inject Time Pulse'''&lt;br /&gt;
&lt;br /&gt;
''CEGUI::System::injectTimePulse(float timeElapsed)''&lt;br /&gt;
&lt;br /&gt;
This is a very important piece of information that is not well documented in the current CEGUI system: ''Time Pulse Injection''. The CEGUI system, to my knowledge, does not keep track of time for you by itself - it needs help. You must inject into the CEGUI System elapsed time. If you don't do this, then your ''Tooltip'' and other time sensitive window events (like fades, etc) will not work or will not work properly. What is the ''value'' you inject? The ''value'' should be the amount of time that has elapsed since the previous injection call. Refer to the ''CEGUI::System::injectTimePulse()''. The best place to inject a time pulse into the CEGUI system is in a main loop. Here are a couple of examples of how to implement this:&lt;br /&gt;
&lt;br /&gt;
'''Inject Time Pulse: via a MAIN Loop'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;time.h&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
clock_t mLastTimeInjection=clock();&lt;br /&gt;
...&lt;br /&gt;
// Your main loop&lt;br /&gt;
while ( true )&lt;br /&gt;
{&lt;br /&gt;
  ...&lt;br /&gt;
  // Make sure the CEGUI System is initialized and running&lt;br /&gt;
  // and if it is, inject a time pulse&lt;br /&gt;
  if ( CEGUI::System::getSingletonPtr() )&lt;br /&gt;
  {&lt;br /&gt;
    CEGUI::System::getSingleton().injectTimePulse( ( clock() - mLastTimeInjection ) * 0.001f );&lt;br /&gt;
    mLastTimeInjection = clock();&lt;br /&gt;
  } // CEGUI Time pulse&lt;br /&gt;
  ...&lt;br /&gt;
} // while&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Inject Time Pulse: via an Ogre::FrameListenter'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
bool clsMyFrameListener::frameStarted(const Ogre::FrameEvent&amp;amp; evt)&lt;br /&gt;
{ &lt;br /&gt;
  ...&lt;br /&gt;
  // Make sure the CEGUI System is initialized and running&lt;br /&gt;
  // and if it is, inject a time pulse&lt;br /&gt;
  if ( CEGUI::System::getSingletonPtr() )&lt;br /&gt;
    CEGUI::System::getSingleton().injectTimePulse( evt.timeSinceLastFrame );&lt;br /&gt;
  ...&lt;br /&gt;
  return true;&lt;br /&gt;
} //frameStarted&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The finer the resolution of the injection, the better your fades will look. Injecting time every one second or greater will make your ''fades'' just popup instead of ''fading'' in.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
That's really all there is to it. My biggest ''gotcha'' was the not knowing about the ''CEGUI::System::injectTimePulse()'' and how important it was. Once I stumbled upon that everything else fell into place.&lt;br /&gt;
&lt;br /&gt;
Some advanced notes. You can have more than one ''Tooltip'' widget. There maybe some scenerios where just one ''Tooltip'' widget won't work (like for a different look and feel from that of the default one, etc.). You can create another ''Tooltip'' widget using the standard CEGUI method for creating all the window widgets then use the ''CEGUI::Window::setToolTip()'' function to set the widget to use the desired ''Tooltip''.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=XML_File_formats&amp;diff=2028</id>
		<title>XML File formats</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=XML_File_formats&amp;diff=2028"/>
				<updated>2006-03-27T22:03:13Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[Scheme files]] - Reference manual for the scheme XML format.&lt;br /&gt;
*[[Layout files]] - Reference manual for the layout XML format.&lt;br /&gt;
*[[Imageset files]] - Reference manual for the layout XML format.&lt;br /&gt;
*[[Font files]] - Reference manual for the font XML format.&lt;br /&gt;
* Looknfeel files - Check the [[&amp;quot;Falagard&amp;quot; Skinning System Documentation]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Related Documents===&lt;br /&gt;
* [[Overview of GUI files]] - an brief overview of what role each these xml files plays.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=XML_File_formats&amp;diff=2027</id>
		<title>XML File formats</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=XML_File_formats&amp;diff=2027"/>
				<updated>2006-03-27T22:02:44Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[Scheme files]] - Reference manual for the scheme XML format.&lt;br /&gt;
*[[Layout files]] - Reference manual for the layout XML format.&lt;br /&gt;
*[[Imageset files]] - Reference manual for the layout XML format.&lt;br /&gt;
*[[Font files]] - Reference manual for the font XML format.&lt;br /&gt;
* Looknfeel files - Check the [[&amp;quot;Falagard&amp;quot; Skinning System Documentation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Related Documents===&lt;br /&gt;
* [[Overview of GUI files]] - an brief overview of what role each these xml files plays.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=309</id>
		<title>Using CEGUI with SDL and OpenGL</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=309"/>
				<updated>2005-09-13T11:24:16Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: Updated link to documentation for SDL_keysym&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.libsdl.org SDL (Simple DirectMedia Layer)] is an excellent library for writing portable games and other multimedia applications, but as it is a low-level library, it has no native support for GUI interfaces.&lt;br /&gt;
&lt;br /&gt;
When using [http://www.opengl.org OpenGL] for rendering, using CEGUI with SDL is not hard.&lt;br /&gt;
&lt;br /&gt;
I'll assume that you've read the imbiciles tutorials, and have used SDL with OpenGL.&lt;br /&gt;
And know C / C++ ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Initialisation ===&lt;br /&gt;
Before we can do anything, we need to initialise our libraries.&lt;br /&gt;
First SDL:&lt;br /&gt;
&lt;br /&gt;
 if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER)&amp;lt;0)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to initialise SDL: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we initialise SDL with video and timer support. We need this for CEGUI.&lt;br /&gt;
O.K. now SDL is ready to go. So let's fire up OpenGL:&lt;br /&gt;
&lt;br /&gt;
 if (SDL_SetVideoMode(800,600,0,SDL_OPENGL)==NULL)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to set OpenGL videomode: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   SDL_Quit();&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now OpenGL is ready. But we still need to set a decent configuration:&lt;br /&gt;
&lt;br /&gt;
 glEnable(GL_CULL_FACE);&lt;br /&gt;
 glClearColor(0.0f,0.0f,0.0f,1.0f);&lt;br /&gt;
 glViewport(0,0, 800,600);&lt;br /&gt;
&lt;br /&gt;
The OpenGL renderer that comes with CEGUI sets the matrices itself, so if you're using CEGUI for all your rendering needs this would be fine. Normally you would want the normal perspective projection setup though:&lt;br /&gt;
&lt;br /&gt;
 glMatrixMode(GL_PROJECTION);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
 gluPerspective(45.0, 800.0/600.0, 0.1,100.0);&lt;br /&gt;
 glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
&lt;br /&gt;
SDL and OpenGL are now both ready for action. So it's time to initialise CEGUI.&lt;br /&gt;
First we need the renderer.&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;renderers/OpenGLGUIRenderer/openglrenderer.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It must be created before starting CEGUI.&lt;br /&gt;
&lt;br /&gt;
 CEGUI::OpenGLRenderer* renderer = new CEGUI::OpenGLRenderer(0,800,600);&lt;br /&gt;
&lt;br /&gt;
Then the CEGUI::System must be initialised:&lt;br /&gt;
&lt;br /&gt;
 new CEGUI::System(renderer);&lt;br /&gt;
&lt;br /&gt;
Remember that you have to load a widget set, set the mouse cursor and a default font before CEGUI is completely ready. This is described in the other tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the SDL cursor is displayed, so we'll remove that:&lt;br /&gt;
&lt;br /&gt;
 SDL_ShowCursor(SDL_DISABLE);&lt;br /&gt;
&lt;br /&gt;
As keypress characters needs to be injected into CEGUI, we activate unicode translation for SDL key events:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableUNICODE(1);&lt;br /&gt;
&lt;br /&gt;
This makes it alot easier as we don't have to worry about modifier keys and keyboard layouts ourselves. More about this later on...&lt;br /&gt;
&lt;br /&gt;
Key repeat is a nice feature for the text input widgets in CEGUI, so we use SDL to generate them:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);&lt;br /&gt;
&lt;br /&gt;
Everything is ready now, and we can start the main loop :)&lt;br /&gt;
&lt;br /&gt;
=== The Main Loop ===&lt;br /&gt;
To make it all happen, we use a simple main loop that just keeps pushing on those frames:&lt;br /&gt;
&lt;br /&gt;
 void main_loop()&lt;br /&gt;
 {&lt;br /&gt;
   bool must_quit = false;&lt;br /&gt;
   &lt;br /&gt;
   // get &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
   double last_time_pulse = 0.001*static_cast&amp;lt;double&amp;gt;(SDL_GetTicks());&lt;br /&gt;
   &lt;br /&gt;
   while (!must_quit)&lt;br /&gt;
   {&lt;br /&gt;
     inject_input(must_quit);&lt;br /&gt;
     inject_time_pulse(last_time_pulse);&lt;br /&gt;
     render_gui();&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This function will run the main loop until the ''bool'' value ''must_quit'' becomes ''true''. In this tutorial this will happen when the user clicks the close button provided by the window manager (fx. [http://www.microsoft.com Microsoft] Windows).&lt;br /&gt;
&lt;br /&gt;
The ''double'' value ''last_time_pulse'' holds the time of the latest time pulse injection. More about this later.&lt;br /&gt;
&lt;br /&gt;
Each function in the ''while'' loop will be described below.&lt;br /&gt;
&lt;br /&gt;
There are endless ways of making your main loop. I took a simple approach to ease writing this tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Injecting Input ===&lt;br /&gt;
When the user press or release keyboard or mouse buttons, we need to tell CEGUI about it, for this we use the injection functions of ''CEGUI::System''.&lt;br /&gt;
&lt;br /&gt;
Here is what our inject_input function looks like:&lt;br /&gt;
&lt;br /&gt;
 void inject_input(bool&amp;amp; must_quit)&lt;br /&gt;
 {&lt;br /&gt;
   SDL_Event e;&lt;br /&gt;
   &lt;br /&gt;
   // go through all available events&lt;br /&gt;
   while (SDL_PollEvent(&amp;amp;e))&lt;br /&gt;
   {&lt;br /&gt;
     // we use a switch to determine the event type&lt;br /&gt;
     switch (e.type)&lt;br /&gt;
     {&lt;br /&gt;
       // mouse motion handler&lt;br /&gt;
       case SDL_MOUSEMOTION:&lt;br /&gt;
         // we inject the mouse position directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
         );&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     // mouse down handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button down event&lt;br /&gt;
         handle_mouse_down(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // mouse up handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button up event&lt;br /&gt;
         handle_mouse_up(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // key down&lt;br /&gt;
       case SDL_KEYDOWN:&lt;br /&gt;
         // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
         &lt;br /&gt;
         // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
         // this is described in more detail below.&lt;br /&gt;
         if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
         {&lt;br /&gt;
           CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
         }&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // key up&lt;br /&gt;
       case SDL_KEYUP:&lt;br /&gt;
         // like before we inject the scancode directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // WM quit event occured&lt;br /&gt;
       case SDL_QUIT:&lt;br /&gt;
         must_quit = true;&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
First I'll explain the events that get handled directly in the ''inject_input'' function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Motion''':&lt;br /&gt;
&lt;br /&gt;
 // we inject the mouse position directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
There is nothing special here. Like stated in the comment the mouse position is just injected directly.&lt;br /&gt;
&lt;br /&gt;
There are two ways of injecting mouse motion. One where you inject how much the cursor moved, and one where you inject the mouse cursor position. The last one is failsafe.&lt;br /&gt;
Then first one only works correctly in fullscreen mode, or with input grabbed. The reason for this is that in regular windowed mode, the mouse can be moved outside the application window, and during this time no mouse motion event are generated. So if we enter the window at another position, the real mousecursor and CEGUI's mouse cursor will be offset, which will break mouse usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Down'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This event takes a little more work. CEGUI requires that key characters (the printable character the key represents) are injected alongside key codes.&lt;br /&gt;
&lt;br /&gt;
 // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
Luckily the key code is just the SDL scancode, so we inject that directly.&lt;br /&gt;
&lt;br /&gt;
 // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
 // this is described in more detail below.&lt;br /&gt;
 if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
 {&lt;br /&gt;
   CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Instead of formatting the keypress ourselves, we let SDL do it for us. For more information, take a look at the SDL documentation for this feature. [http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fkeysym SDL_keysym].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This one is simple. Only the keycode need to injected. So we just use the scancode directly:&lt;br /&gt;
&lt;br /&gt;
 // like before we inject the scancode directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Down and Mouse Wheel'''&amp;lt;br /&amp;gt;&lt;br /&gt;
CEGUI and SDL are a little different when it comes to mouse button and mouse wheel events. So a little conversion is necessary. Here's the ''handle_mouse_down'' function that gets called when a mouse button down event occurs in SDL. It takes one parameter, a ''Uint8'' describing the mouse button that was pressed.&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_down(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		// handle real mouse buttons&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		&lt;br /&gt;
 		// handle the mouse wheel&lt;br /&gt;
 		case SDL_BUTTON_WHEELDOWN:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( -1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_WHEELUP:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( +1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
I chose a very &amp;quot;manual&amp;quot; conversion, but it works fine. Everything should be pretty self-explainatory.&lt;br /&gt;
As you can see mouse wheel events are emitted as mouse button down events in SDL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
The mouse button up event is handled very much like the mouse button down event, except there are no mousewheel release events.&lt;br /&gt;
Like ''handle_mouse_down'' it takes one parameter, a ''Uint8'' describing the mouse button that was released:&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_up(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Time Pulses ===&lt;br /&gt;
SDL has a built-in millisecond counter which we will use for this example. There are other ways to use timers with SDL, but I chose this approach as it is simple to use, and provides decent precision.&lt;br /&gt;
&lt;br /&gt;
Remember in the main loop where we stored the current &amp;quot;run-time&amp;quot; in seconds ? This value will be passed as a reference to ''inject_time_pulse'' function which in turn will set a new value to it.&lt;br /&gt;
&lt;br /&gt;
CEGUI's interface for injecting time pulses requires that you pass the time in seconds that has passed since the last time pulse injection. Let's take a look at the function:&lt;br /&gt;
&lt;br /&gt;
 void inject_time_pulse(double&amp;amp; last_time_pulse)&lt;br /&gt;
 {&lt;br /&gt;
 	// get current &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
 	double t = 0.001*SDL_GetTicks();&lt;br /&gt;
 &lt;br /&gt;
 	// inject the time that passed since the last call &lt;br /&gt;
 	CEGUI::System::getSingleton().injectTimePulse( float(t-last_time_pulse) );&lt;br /&gt;
 &lt;br /&gt;
 	// store the new time as the last time&lt;br /&gt;
 	last_time_pulse = t;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The first line gets the actual &amp;quot;run-time&amp;quot; when called.&lt;br /&gt;
* The second line injects the time pulse as the difference between the current time and the last time.&lt;br /&gt;
* The third line stores the current time as the last time a time pulse was injected.&lt;br /&gt;
&lt;br /&gt;
This will work for about 47 days... After that the counter wraps to zero and it breaks...&lt;br /&gt;
I'll leave it up to you to fix that if it's a problem.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Rendering ===&lt;br /&gt;
Now all that's left is renderingthe GUI.&lt;br /&gt;
&lt;br /&gt;
 void render_gui()&lt;br /&gt;
 {&lt;br /&gt;
 	// clear the colour buffer&lt;br /&gt;
 	glClear( GL_COLOR_BUFFER_BIT );&lt;br /&gt;
 &lt;br /&gt;
 	// render the GUI :)&lt;br /&gt;
 	CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
 &lt;br /&gt;
 	// Update the screen&lt;br /&gt;
 	SDL_GL_SwapBuffers();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The line:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
&lt;br /&gt;
does all the CEGUI magic and sets OpenGL state itself. As long as the viewport is setup, it will render the GUI.&lt;br /&gt;
&lt;br /&gt;
=== Error Handling ===&lt;br /&gt;
The neat C++ architecture of CEGUI suggests that C++ exceptions are used for error handling. This is completely true.&lt;br /&gt;
Whenever an error occurs, a sub-class of ''CEGUI::Exception'' is thrown.&lt;br /&gt;
&lt;br /&gt;
There are many scenarios where an exception can be thrown. And whether or not these should be considered fatal depends on the application. To make sure you catch the CEGUI exceptions a regular ''try'' block is used. Like so:&lt;br /&gt;
&lt;br /&gt;
 try&lt;br /&gt;
 {&lt;br /&gt;
 	// do some cegui code&lt;br /&gt;
 }&lt;br /&gt;
 catch (CEGUI::Exception&amp;amp; e)&lt;br /&gt;
 {&lt;br /&gt;
 	fprintf(stderr,&amp;quot;CEGUI Exception occured: %s&amp;quot;, e.getMessage().c_str());&lt;br /&gt;
 	// you could quit here&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That's it. Now you know how to use SDL, OpenGL and CEGUI together. Have fun.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 16:21, 8 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Writing_CEGUI_scripts&amp;diff=325</id>
		<title>Writing CEGUI scripts</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Writing_CEGUI_scripts&amp;diff=325"/>
				<updated>2005-07-05T20:03:22Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The code on this page is Lua script using the CEGUILua bindings available in CEGUI 0.3.&lt;br /&gt;
The code snippets might not be specifically useful, but they should show off some of the posibilities with CEGUI and Lua used together. And give an idea of how to write these scripts.&lt;br /&gt;
&lt;br /&gt;
Off we go :)&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 20:56, 9 Jun 2005 (BST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Change logging level ==&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()	-- get the logger&lt;br /&gt;
 local lvl = logger:getLoggingLevel()		-- get logging level&lt;br /&gt;
 &lt;br /&gt;
 if lvl &amp;lt; CEGUI.Insane then			-- if logging level is less than insane&lt;br /&gt;
 	logger:setLoggingLevel(lvl+1)		-- then increase it&lt;br /&gt;
 end&lt;br /&gt;
Bumps up the logging level a notch unless we're already at Insane.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Load a scheme ==&lt;br /&gt;
 CEGUI.SchemeManager:getSingleton():loadScheme(&amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot;)&lt;br /&gt;
Loads the TaharezLook scheme.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Simple Interface ==&lt;br /&gt;
 -- create the GUI sheet&lt;br /&gt;
 local sheet = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;DefaultGUISheet&amp;quot;,&amp;quot;root&amp;quot;);&lt;br /&gt;
 CEGUI.System:getSingleton():setGUISheet(sheet) -- and attach it to the system&lt;br /&gt;
 &lt;br /&gt;
 -- create a FrameWindow&lt;br /&gt;
 local fw = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;TaharezLook/FrameWindow&amp;quot;,&amp;quot;framewnd&amp;quot;);&lt;br /&gt;
 -- add it to the sheet&lt;br /&gt;
 sheet:addChildWindow(fw)&lt;br /&gt;
 &lt;br /&gt;
 -- set its size and position&lt;br /&gt;
 local sz = CEGUI.Size:new_local(0.5,0.5)&lt;br /&gt;
 local pos = CEGUI.Point:new_local(0.2,0.1)&lt;br /&gt;
 fw:setSize(sz)&lt;br /&gt;
 fw:setPosition(pos)&lt;br /&gt;
 -- disable user sizing&lt;br /&gt;
 fw:setProperty(&amp;quot;SizingEnabled&amp;quot;,&amp;quot;False&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 -- make the close button work&lt;br /&gt;
 fw:subscribeEvent(&amp;quot;CloseClicked&amp;quot;,&amp;quot;fwCloseClicked&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 -- the CloseClicked event handler&lt;br /&gt;
 function fwCloseClicked(eventArgs)&lt;br /&gt;
 	local we = CEGUI.toWindowEventArgs(eventArgs)&lt;br /&gt;
 	CEGUI.WindowManager:getSingleton():destroyWindow(we.window) -- destroy the frame window&lt;br /&gt;
 end&lt;br /&gt;
Creates a GUISheet and attaches it to the System. Then creates a FrameWindow, sets its size and position. Disables the sizing feature and subscribes a scripted event handler to destroy the window when the close button is clicked.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Alternative casting ==&lt;br /&gt;
 -- the CloseClicked event handler&lt;br /&gt;
 function fwCloseClicked(eventArgs)&lt;br /&gt;
 	local we = tolua.cast(eventArgs,&amp;quot;CEGUI::WindowEventArgs&amp;quot;)&lt;br /&gt;
 	CEGUI.WindowManager:getSingleton():destroyWindow(we.window) -- destroy the frame window&lt;br /&gt;
 end&lt;br /&gt;
A modified close button click handler (from the previous snippet) showing an alternative way to cast EventArgs to WindowEventArgs&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Load a layout ==&lt;br /&gt;
 local w = CEGUI.WindowManager:getSingleton():loadWindowLayout(&amp;quot;../datafiles/layouts/test.layout&amp;quot;)&lt;br /&gt;
 CEGUI.System:getSingleton():getGUISheet():addChildWindow(w)&lt;br /&gt;
Loads a XML layout and adds the returned window to the active GUISheet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Menubar with popup ==&lt;br /&gt;
 -- do the menubar&lt;br /&gt;
 local bar = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/Menubar&amp;quot;,&amp;quot;the_menu_bar&amp;quot;)&lt;br /&gt;
 bar:setSize(CEGUI.Size:new_local(1,0.1))&lt;br /&gt;
 CEGUI.System:getSingleton():getGUISheet():addChildWindow(bar)&lt;br /&gt;
 &lt;br /&gt;
 -- add a menuitem to the bar&lt;br /&gt;
 local item = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/MenubarItem&amp;quot;,&amp;quot;the_menu_bar_item&amp;quot;)&lt;br /&gt;
 item:setText(&amp;quot;Bar item&amp;quot;)&lt;br /&gt;
 bar:addChildWindow(item)&lt;br /&gt;
 &lt;br /&gt;
 -- add a popupmenu to the bar's menuitem&lt;br /&gt;
 local pop = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/PopupMenu&amp;quot;,&amp;quot;the_popup_menu&amp;quot;)&lt;br /&gt;
 item:addChildWindow(pop)&lt;br /&gt;
 &lt;br /&gt;
 -- add a few menuitems to the popup&lt;br /&gt;
 item = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/PopupMenuItem&amp;quot;,&amp;quot;the_popup_menu_item_1&amp;quot;)&lt;br /&gt;
 item:setText(&amp;quot;Popup item 1&amp;quot;)&lt;br /&gt;
 pop:addChildWindow(item)&lt;br /&gt;
 &lt;br /&gt;
 item = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/PopupMenuItem&amp;quot;,&amp;quot;the_popup_menu_item_2&amp;quot;)&lt;br /&gt;
 item:setText(&amp;quot;Popup item 2&amp;quot;)&lt;br /&gt;
 pop:addChildWindow(item)&lt;br /&gt;
Creates a simple menubar and adds a popupmenu with two items to it.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=135</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=135"/>
				<updated>2005-07-05T20:00:54Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== CrazyEddie's Beginner Guides ===&lt;br /&gt;
* [[The Beginner Guide to Getting CEGUI Rendering]] - How to initialise CEGUI to render properly.&lt;br /&gt;
* [[The Beginner Guide to Loading Data Files and Initialisation]] - How to load some data files and perform basic system initialisation.&lt;br /&gt;
* [[The Beginner Guide to Creating a CEGUI Window]] - How to create a simple window and get it on screen.&lt;br /&gt;
* [[The Beginner Guide to Injecting Inputs]] - How to inject inputs into CEGUI and get interactive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lua Scripting with CEGUI ===&lt;br /&gt;
* [[Getting Started with Lua and CEGUI]] - How to initialise CEGUI with a Lua script module and configuration file.&lt;br /&gt;
* [[Handling Events from Lua]] - How to load Lua script files and bind CEGUI events to Lua functions.&lt;br /&gt;
* [[Writing CEGUI scripts]] - Code snippets&lt;br /&gt;
* [[Adding LuaScriptModile to Sample_FirstWindow]] - Experience adding scripting to an existing sample.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== SDL Tutorials ===&lt;br /&gt;
* [[Using CEGUI with SDL and OpenGL]] - Guidelines on how to get SDL, OpenGL and CEGUI running together.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Writing_CEGUI_scripts&amp;diff=88</id>
		<title>Writing CEGUI scripts</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Writing_CEGUI_scripts&amp;diff=88"/>
				<updated>2005-07-04T14:40:43Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;All code on this page is Lua script using the CEGUILua bindings available on CVS HEAD.&lt;br /&gt;
The code snippets might not be specifically useful, but they should show off some of the posibilities with CEGUI and Lua used together. And give an idea of how to write these scripts.&lt;br /&gt;
&lt;br /&gt;
Off we go :)&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 20:56, 9 Jun 2005 (BST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Change logging level ==&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()	-- get the logger&lt;br /&gt;
 local lvl = logger:getLoggingLevel()		-- get logging level&lt;br /&gt;
 &lt;br /&gt;
 if lvl &amp;lt; CEGUI.Insane then			-- if logging level is less than insane&lt;br /&gt;
 	logger:setLoggingLevel(lvl+1)		-- then increase it&lt;br /&gt;
 end&lt;br /&gt;
Bumps up the logging level a notch unless we're already at Insane.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Load a scheme ==&lt;br /&gt;
 CEGUI.SchemeManager:getSingleton():loadScheme(&amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot;)&lt;br /&gt;
Loads the TaharezLook scheme.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Simple Interface ==&lt;br /&gt;
 -- create the GUI sheet&lt;br /&gt;
 local sheet = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;DefaultGUISheet&amp;quot;,&amp;quot;root&amp;quot;);&lt;br /&gt;
 CEGUI.System:getSingleton():setGUISheet(sheet) -- and attach it to the system&lt;br /&gt;
 &lt;br /&gt;
 -- create a FrameWindow&lt;br /&gt;
 local fw = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;TaharezLook/FrameWindow&amp;quot;,&amp;quot;framewnd&amp;quot;);&lt;br /&gt;
 -- add it to the sheet&lt;br /&gt;
 sheet:addChildWindow(fw)&lt;br /&gt;
 &lt;br /&gt;
 -- set its size and position&lt;br /&gt;
 local sz = CEGUI.Size:new_local(0.5,0.5)&lt;br /&gt;
 local pos = CEGUI.Point:new_local(0.2,0.1)&lt;br /&gt;
 fw:setSize(sz)&lt;br /&gt;
 fw:setPosition(pos)&lt;br /&gt;
 -- disable user sizing&lt;br /&gt;
 fw:setProperty(&amp;quot;SizingEnabled&amp;quot;,&amp;quot;False&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 -- make the close button work&lt;br /&gt;
 fw:subscribeEvent(&amp;quot;CloseClicked&amp;quot;,&amp;quot;fwCloseClicked&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 -- the CloseClicked event handler&lt;br /&gt;
 function fwCloseClicked(eventArgs)&lt;br /&gt;
 	local we = CEGUI.toWindowEventArgs(eventArgs)&lt;br /&gt;
 	CEGUI.WindowManager:getSingleton():destroyWindow(we.window) -- destroy the frame window&lt;br /&gt;
 end&lt;br /&gt;
Creates a GUISheet and attaches it to the System. Then creates a FrameWindow, sets its size and position. Disables the sizing feature and subscribes a scripted event handler to destroy the window when the close button is clicked.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Alternative casting ==&lt;br /&gt;
 -- the CloseClicked event handler&lt;br /&gt;
 function fwCloseClicked(eventArgs)&lt;br /&gt;
 	local we = tolua.cast(eventArgs,&amp;quot;CEGUI::WindowEventArgs&amp;quot;)&lt;br /&gt;
 	CEGUI.WindowManager:getSingleton():destroyWindow(we.window) -- destroy the frame window&lt;br /&gt;
 end&lt;br /&gt;
A modified close button click handler (from the previous snippet) showing an alternative way to cast EventArgs to WindowEventArgs&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Load a layout ==&lt;br /&gt;
 local w = CEGUI.WindowManager:getSingleton():loadWindowLayout(&amp;quot;../datafiles/layouts/test.layout&amp;quot;)&lt;br /&gt;
 CEGUI.System:getSingleton():getGUISheet():addChildWindow(w)&lt;br /&gt;
Loads a XML layout and adds the returned window to the active GUISheet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Menubar with popup ==&lt;br /&gt;
 -- do the menubar&lt;br /&gt;
 local bar = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/Menubar&amp;quot;,&amp;quot;the_menu_bar&amp;quot;)&lt;br /&gt;
 bar:setSize(CEGUI.Size:new_local(1,0.1))&lt;br /&gt;
 CEGUI.System:getSingleton():getGUISheet():addChildWindow(bar)&lt;br /&gt;
 &lt;br /&gt;
 -- add a menuitem to the bar&lt;br /&gt;
 local item = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/MenubarItem&amp;quot;,&amp;quot;the_menu_bar_item&amp;quot;)&lt;br /&gt;
 item:setText(&amp;quot;Bar item&amp;quot;)&lt;br /&gt;
 bar:addChildWindow(item)&lt;br /&gt;
 &lt;br /&gt;
 -- add a popupmenu to the bar's menuitem&lt;br /&gt;
 local pop = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/PopupMenu&amp;quot;,&amp;quot;the_popup_menu&amp;quot;)&lt;br /&gt;
 item:addChildWindow(pop)&lt;br /&gt;
 &lt;br /&gt;
 -- add a few menuitems to the popup&lt;br /&gt;
 item = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/PopupMenuItem&amp;quot;,&amp;quot;the_popup_menu_item_1&amp;quot;)&lt;br /&gt;
 item:setText(&amp;quot;Popup item 1&amp;quot;)&lt;br /&gt;
 pop:addChildWindow(item)&lt;br /&gt;
 &lt;br /&gt;
 item = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/PopupMenuItem&amp;quot;,&amp;quot;the_popup_menu_item_2&amp;quot;)&lt;br /&gt;
 item:setText(&amp;quot;Popup item 2&amp;quot;)&lt;br /&gt;
 pop:addChildWindow(item)&lt;br /&gt;
Creates a simple menubar and adds a popupmenu with two items to it.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Writing_CEGUI_scripts&amp;diff=58</id>
		<title>Writing CEGUI scripts</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Writing_CEGUI_scripts&amp;diff=58"/>
				<updated>2005-07-04T14:30:55Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;All code on this page is Lua script using the CEGUILua bindings available on CVS HEAD.&lt;br /&gt;
The code snippets might not be specifically useful, but they should show off some of the posibilities with CEGUI and Lua used together. And give an idea of how to write these scripts.&lt;br /&gt;
&lt;br /&gt;
Off we go :)&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 20:56, 9 Jun 2005 (BST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Change logging level ==&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()	-- get the logger&lt;br /&gt;
 local lvl = logger:getLoggingLevel()		-- get logging level&lt;br /&gt;
 &lt;br /&gt;
 if lvl &amp;lt; CEGUI.Insane then			-- if logging level is less than insane&lt;br /&gt;
 	logger:setLoggingLevel(lvl+1)		-- then increase it&lt;br /&gt;
 end&lt;br /&gt;
Bumps up the logging level a notch unless we're already at Insane.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Load a scheme ==&lt;br /&gt;
 CEGUI.SchemeManager:getSingleton():loadScheme(&amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot;)&lt;br /&gt;
Loads the TaharezLook scheme.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Simple Interface ==&lt;br /&gt;
 -- create the GUI sheet&lt;br /&gt;
 local sheet = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;DefaultGUISheet&amp;quot;,&amp;quot;root&amp;quot;);&lt;br /&gt;
 CEGUI.System:getSingleton():setGUISheet(sheet) -- and attach it to the system&lt;br /&gt;
 &lt;br /&gt;
 -- create a FrameWindow&lt;br /&gt;
 local fw = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;TaharezLook/FrameWindow&amp;quot;,&amp;quot;framewnd&amp;quot;);&lt;br /&gt;
 -- add it to the sheet&lt;br /&gt;
 sheet:addChildWindow(fw)&lt;br /&gt;
 &lt;br /&gt;
 -- set its size and position&lt;br /&gt;
 local sz = CEGUI.Size:new_local(0.5,0.5)&lt;br /&gt;
 local pos = CEGUI.Point:new_local(0.2,0.1)&lt;br /&gt;
 fw:setSize(sz)&lt;br /&gt;
 fw:setPosition(pos)&lt;br /&gt;
 -- disable user sizing&lt;br /&gt;
 fw:setProperty(&amp;quot;SizingEnabled&amp;quot;,&amp;quot;False&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 -- make the close button work&lt;br /&gt;
 fw:subscribeEvent(&amp;quot;CloseClicked&amp;quot;,&amp;quot;fwCloseClicked&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 -- the CloseClicked event handler&lt;br /&gt;
 function fwCloseClicked(eventArgs)&lt;br /&gt;
 	local we = CEGUI.toWindowEventArgs(eventArgs)&lt;br /&gt;
 	CEGUI.WindowManager:getSingleton():destroyWindow(we.window) -- destroy the frame window&lt;br /&gt;
 end&lt;br /&gt;
Creates a GUISheet and attaches it to the System. Then creates a FrameWindow, sets its size and position. Disables the sizing feature and subscribes a scripted event handler to destroy the window when the close button is clicked.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Load a layout ==&lt;br /&gt;
 local w = CEGUI.WindowManager:getSingleton():loadWindowLayout(&amp;quot;../datafiles/layouts/test.layout&amp;quot;)&lt;br /&gt;
 CEGUI.System:getSingleton():getGUISheet():addChildWindow(w)&lt;br /&gt;
Loads a XML layout and adds the returned window to the active GUISheet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Menubar with popup ==&lt;br /&gt;
 -- do the menubar&lt;br /&gt;
 local bar = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/Menubar&amp;quot;,&amp;quot;the_menu_bar&amp;quot;)&lt;br /&gt;
 bar:setSize(CEGUI.Size:new_local(1,0.1))&lt;br /&gt;
 CEGUI.System:getSingleton():getGUISheet():addChildWindow(bar)&lt;br /&gt;
 &lt;br /&gt;
 -- add a menuitem to the bar&lt;br /&gt;
 local item = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/MenubarItem&amp;quot;,&amp;quot;the_menu_bar_item&amp;quot;)&lt;br /&gt;
 item:setText(&amp;quot;Bar item&amp;quot;)&lt;br /&gt;
 bar:addChildWindow(item)&lt;br /&gt;
 &lt;br /&gt;
 -- add a popupmenu to the bar's menuitem&lt;br /&gt;
 local pop = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/PopupMenu&amp;quot;,&amp;quot;the_popup_menu&amp;quot;)&lt;br /&gt;
 item:addChildWindow(pop)&lt;br /&gt;
 &lt;br /&gt;
 -- add a few menuitems to the popup&lt;br /&gt;
 item = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/PopupMenuItem&amp;quot;,&amp;quot;the_popup_menu_item_1&amp;quot;)&lt;br /&gt;
 item:setText(&amp;quot;Popup item 1&amp;quot;)&lt;br /&gt;
 pop:addChildWindow(item)&lt;br /&gt;
 &lt;br /&gt;
 item = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;WindowsLook/PopupMenuItem&amp;quot;,&amp;quot;the_popup_menu_item_2&amp;quot;)&lt;br /&gt;
 item:setText(&amp;quot;Popup item 2&amp;quot;)&lt;br /&gt;
 pop:addChildWindow(item)&lt;br /&gt;
Creates a simple menubar and adds a popupmenu with two items to it.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Writing_CEGUI_scripts&amp;diff=47</id>
		<title>Writing CEGUI scripts</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Writing_CEGUI_scripts&amp;diff=47"/>
				<updated>2005-06-09T19:56:21Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;All code on this page is Lua script using the CEGUILua bindings available on CVS HEAD.&lt;br /&gt;
The code snippets might not be specifically useful, but they should show off some of the posibilities with CEGUI and Lua used together. And give an idea of how to write these scripts.&lt;br /&gt;
&lt;br /&gt;
Off we go :)&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 20:56, 9 Jun 2005 (BST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Change logging level ==&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()	-- get the logger&lt;br /&gt;
 local lvl = logger:getLoggingLevel()		-- get logging level&lt;br /&gt;
 &lt;br /&gt;
 if lvl &amp;lt; CEGUI.Insane then			-- if logging level is less than insane&lt;br /&gt;
 	logger:setLoggingLevel(lvl+1)		-- then increase it&lt;br /&gt;
 end&lt;br /&gt;
Bumps up the logging level a notch unless we're already at Insane.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Load a scheme ==&lt;br /&gt;
 CEGUI.SchemeManager:getSingleton():loadScheme(&amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot;)&lt;br /&gt;
Loads the TaharezLook scheme.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Simple Interface ==&lt;br /&gt;
 -- create the GUI sheet&lt;br /&gt;
 local sheet = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;DefaultGUISheet&amp;quot;,&amp;quot;root&amp;quot;);&lt;br /&gt;
 CEGUI.System:getSingleton():setGUISheet(sheet) -- and attach it to the system&lt;br /&gt;
 &lt;br /&gt;
 -- create a FrameWindow&lt;br /&gt;
 local fw = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;TaharezLook/FrameWindow&amp;quot;,&amp;quot;framewnd&amp;quot;);&lt;br /&gt;
 -- add it to the sheet&lt;br /&gt;
 sheet:addChildWindow(fw)&lt;br /&gt;
 &lt;br /&gt;
 -- set its size and position&lt;br /&gt;
 local sz = CEGUI.Size:new_local(0.5,0.5)&lt;br /&gt;
 local pos = CEGUI.Point:new_local(0.2,0.1)&lt;br /&gt;
 fw:setSize(sz)&lt;br /&gt;
 fw:setPosition(pos)&lt;br /&gt;
 -- disable user sizing&lt;br /&gt;
 fw:setProperty(&amp;quot;SizingEnabled&amp;quot;,&amp;quot;False&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 -- make the close button work&lt;br /&gt;
 fw:subscribeEvent(&amp;quot;CloseClicked&amp;quot;,&amp;quot;fwCloseClicked&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 -- the CloseClicked event handler&lt;br /&gt;
 function fwCloseClicked(eventArgs)&lt;br /&gt;
 	local we = CEGUI.toWindowEventArgs(eventArgs)&lt;br /&gt;
 	CEGUI.WindowManager:getSingleton():destroyWindow(we.window) -- destroy the frame window&lt;br /&gt;
 end&lt;br /&gt;
Creates a GUISheet and attaches it to the System. Then creates a FrameWindow, sets its size and position. Disables the sizing feature and subscribes a scripted event handler to destroy the window when the close button is clicked.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Load a layout ==&lt;br /&gt;
 local w = CEGUI.WindowManager:getSingleton():loadLayout(&amp;quot;../datafiles/layouts/test.layout&amp;quot;)&lt;br /&gt;
 CEGUI.System:getSingleton():getGUISheet():addChildWindow(w)&lt;br /&gt;
Loads a XML layout and adds the returned window to the active GUISheet.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Writing_CEGUI_scripts&amp;diff=43</id>
		<title>Writing CEGUI scripts</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Writing_CEGUI_scripts&amp;diff=43"/>
				<updated>2005-06-02T02:17:08Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;All code on this page is Lua script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Change logging level ==&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()	-- get the logger&lt;br /&gt;
 local lvl = logger:getLoggingLevel()		-- get logging level&lt;br /&gt;
 &lt;br /&gt;
 if lvl &amp;lt; CEGUI.Insane then			-- if logging level is less than insane&lt;br /&gt;
 	logger:setLoggingLevel(lvl+1)		-- then increase it&lt;br /&gt;
 end&lt;br /&gt;
Bumps up the logging level a notch unless we're already at Insane.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Load a scheme ==&lt;br /&gt;
 CEGUI.SchemeManager:getSingleton():loadScheme(&amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot;)&lt;br /&gt;
Loads the TaharezLook scheme.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Simple Interface ==&lt;br /&gt;
 -- create the GUI sheet&lt;br /&gt;
 local sheet = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;DefaultGUISheet&amp;quot;,&amp;quot;root&amp;quot;);&lt;br /&gt;
 CEGUI.System:getSingleton():setGUISheet(sheet) -- and attach it to the system&lt;br /&gt;
 &lt;br /&gt;
 -- create a FrameWindow&lt;br /&gt;
 local fw = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;TaharezLook/FrameWindow&amp;quot;,&amp;quot;framewnd&amp;quot;);&lt;br /&gt;
 -- add it to the sheet&lt;br /&gt;
 sheet:addChildWindow(fw)&lt;br /&gt;
 &lt;br /&gt;
 -- set its size and position&lt;br /&gt;
 local sz = CEGUI.Size:new_local(0.5,0.5)&lt;br /&gt;
 local pos = CEGUI.Point:new_local(0.2,0.1)&lt;br /&gt;
 fw:setSize(sz)&lt;br /&gt;
 fw:setPosition(pos)&lt;br /&gt;
 -- disable user sizing&lt;br /&gt;
 fw:setProperty(&amp;quot;SizingEnabled&amp;quot;,&amp;quot;False&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 -- make the close button work&lt;br /&gt;
 fw:subscribeEvent(&amp;quot;CloseClicked&amp;quot;,&amp;quot;fwCloseClicked&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 -- the CloseClicked event handler&lt;br /&gt;
 function fwCloseClicked(eventArgs)&lt;br /&gt;
 	local we = CEGUI.toWindowEventArgs(eventArgs)&lt;br /&gt;
 	CEGUI.WindowManager:getSingleton():destroyWindow(we.window) -- destroy the frame window&lt;br /&gt;
 end&lt;br /&gt;
Creates a GUISheet and attaches it to the System. Then creates a FrameWindow, sets its size and position. Disables the sizing feature and subscribes a scripted event handler to destroy the window when the close button is clicked.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Load a layout ==&lt;br /&gt;
 local w = CEGUI.WindowManager:getSingleton():loadLayout(&amp;quot;../datafiles/layouts/test.layout&amp;quot;)&lt;br /&gt;
 CEGUI.System:getSingleton():getGUISheet():addChildWindow(w)&lt;br /&gt;
Loads a XML layout and adds the returned window to the active GUISheet.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=53</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=53"/>
				<updated>2005-06-02T02:03:02Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== CrazyEddie's 'Imbeciles' Guides ===&lt;br /&gt;
* [[The Imbeciles Guide to Getting CEGUI Rendering]] - How to initialise CEGUI to render properly.&lt;br /&gt;
* [[The Imbeciles Guide to Loading Data Files and Initialisation]] - How to load some data files and perform basic system initialisation.&lt;br /&gt;
* [[The Imbeciles Guide to Creating a CEGUI Window]] - How to create a simple window and get it on screen.&lt;br /&gt;
* [[The Imbeciles Guide to Injecting Inputs]] - How to inject inputs into CEGUI and get interactive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lua Scripting with CEGUI Guides ===&lt;br /&gt;
* [[Getting Started with Lua and CEGUI]] - How to initialise CEGUI with a Lua script module and configuration file.&lt;br /&gt;
* [[Handling Events from Lua]] - How to load Lua script files and bind CEGUI events to Lua functions.&lt;br /&gt;
* [[Writing CEGUI scripts]] - Code snippets&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== SDL Tutorials ===&lt;br /&gt;
* [[Using CEGUI with SDL and OpenGL]] - Guidelines on how to get SDL, OpenGL and CEGUI running together.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Writing_CEGUI_scripts&amp;diff=42</id>
		<title>Writing CEGUI scripts</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Writing_CEGUI_scripts&amp;diff=42"/>
				<updated>2005-06-02T02:02:47Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Lua language is very versatile. It has mechanisms to override alot of its functionality, and [http://www.codenix.com/~tolua/ tolua++] makes heavy use of these mechanisms, in not just being a clever tool to generate Lua bindings for C++ code, it also introduces a set of new functions to allow basic object-oriented programming in Lua.&lt;br /&gt;
&lt;br /&gt;
All code on this page is Lua script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Change logging level ==&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()	-- get the logger&lt;br /&gt;
 local lvl = logger:getLoggingLevel()		-- get logging level&lt;br /&gt;
 &lt;br /&gt;
 if lvl &amp;lt; CEGUI.Insane then			-- if logging level is less than insane&lt;br /&gt;
 	logger:setLoggingLevel(lvl+1)		-- then increase it&lt;br /&gt;
 end&lt;br /&gt;
Bumps up the logging level a notch unless we're already at Insane.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Load a scheme ==&lt;br /&gt;
 CEGUI.SchemeManager:getSingleton():loadScheme(&amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot;)&lt;br /&gt;
Loads the TaharezLook scheme.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Simple Interface ==&lt;br /&gt;
 -- create the GUI sheet&lt;br /&gt;
 local sheet = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;DefaultGUISheet&amp;quot;,&amp;quot;root&amp;quot;);&lt;br /&gt;
 CEGUI.System:getSingleton():setGUISheet(sheet) -- and attach it to the system&lt;br /&gt;
 &lt;br /&gt;
 -- create a FrameWindow&lt;br /&gt;
 local fw = CEGUI.WindowManager:getSingleton():createWindow(&amp;quot;TaharezLook/FrameWindow&amp;quot;,&amp;quot;framewnd&amp;quot;);&lt;br /&gt;
 -- add it to the sheet&lt;br /&gt;
 sheet:addChildWindow(fw)&lt;br /&gt;
 &lt;br /&gt;
 -- set its size and position&lt;br /&gt;
 local sz = CEGUI.Size:new_local(0.5,0.5)&lt;br /&gt;
 local pos = CEGUI.Point:new_local(0.2,0.1)&lt;br /&gt;
 fw:setSize(sz)&lt;br /&gt;
 fw:setPosition(pos)&lt;br /&gt;
 -- disable user sizing&lt;br /&gt;
 fw:setProperty(&amp;quot;SizingEnabled&amp;quot;,&amp;quot;False&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 -- make the close button work&lt;br /&gt;
 fw:subscribeEvent(&amp;quot;CloseClicked&amp;quot;,&amp;quot;fwCloseClicked&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 -- the CloseClicked event handler&lt;br /&gt;
 function fwCloseClicked(eventArgs)&lt;br /&gt;
 	local we = CEGUI.toWindowEventArgs(eventArgs)&lt;br /&gt;
 	CEGUI.WindowManager:getSingleton():destroyWindow(we.window) -- destroy the frame window&lt;br /&gt;
 end&lt;br /&gt;
Creates a GUISheet and attaches it to the System. Then creates a FrameWindow, sets its size and position. Disables the sizing feature and subscribes a scripted event handler to destroy the window when the close button is clicked.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Load a layout ==&lt;br /&gt;
 local w = CEGUI.WindowManager:getSingleton():loadLayout(&amp;quot;../datafiles/layouts/test.layout&amp;quot;)&lt;br /&gt;
 CEGUI.System:getSingleton():getGUISheet():addChildWindow(w)&lt;br /&gt;
Loads a XML layout and adds the returned window to the active GUISheet.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=54</id>
		<title>Using CEGUI with SDL and OpenGL</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=54"/>
				<updated>2005-06-01T03:02:21Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.libsdl.org SDL (Simple DirectMedia Layer)] is an excellent library for writing portable games and other multimedia applications, but as it is a low-level library, it has no native support for GUI interfaces.&lt;br /&gt;
&lt;br /&gt;
When using [http://www.opengl.org OpenGL] for rendering, using CEGUI with SDL is not hard.&lt;br /&gt;
&lt;br /&gt;
I'll assume that you've read the imbiciles tutorials, and have used SDL with OpenGL.&lt;br /&gt;
And know C / C++ ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Initialisation ===&lt;br /&gt;
Before we can do anything, we need to initialise our libraries.&lt;br /&gt;
First SDL:&lt;br /&gt;
&lt;br /&gt;
 if (SDLInit(SDL_INIT_VIDEO|SDL_INIT_TIMER)&amp;lt;0)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to initialise SDL: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we initialise SDL with video and timer support. We need this for CEGUI.&lt;br /&gt;
O.K. now SDL is ready to go. So let's fire up OpenGL:&lt;br /&gt;
&lt;br /&gt;
 if (SDL_SetVideoMode(800,600,0,SDL_OPENGL)==NULL)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to set OpenGL videomode: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   SDL_Quit();&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now OpenGL is ready. But we still need to set a decent configuration:&lt;br /&gt;
&lt;br /&gt;
 glEnable(GL_CULL_FACE);&lt;br /&gt;
 glClearColor(0.0f,0.0f,0.0f,1.0f);&lt;br /&gt;
 glViewport(0,0, 800,600);&lt;br /&gt;
&lt;br /&gt;
The OpenGL renderer that comes with CEGUI sets the matrices itself, so if you're using CEGUI for all your rendering needs this would be fine. Normally you would want the normal perspective projection setup though:&lt;br /&gt;
&lt;br /&gt;
 glMatrixMode(GL_PROJECTION);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
 gluPerspective(45.0, 800.0/600.0, 0.1,100.0);&lt;br /&gt;
 glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
&lt;br /&gt;
SDL and OpenGL are now both ready for action. So it's time to initialise CEGUI.&lt;br /&gt;
First we need the renderer.&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;renderers/OpenGLGUIRenderer/openglrenderer.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It must be created before starting CEGUI.&lt;br /&gt;
&lt;br /&gt;
 CEGUI::OpenGLRenderer* renderer = new CEGUI::OpenGLRenderer(0,800,600);&lt;br /&gt;
&lt;br /&gt;
Then the CEGUI::System must be initialised:&lt;br /&gt;
&lt;br /&gt;
 new CEGUI::System(renderer);&lt;br /&gt;
&lt;br /&gt;
Remember that you have to load a widget set, set the mouse cursor and a default font before CEGUI is completely ready. This is described in the other tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the SDL cursor is displayed, so we'll remove that:&lt;br /&gt;
&lt;br /&gt;
 SDL_ShowCursor(SDL_DISABLE);&lt;br /&gt;
&lt;br /&gt;
As keypress characters needs to be injected into CEGUI, we activate unicode translation for SDL key events:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableUNICODE(1);&lt;br /&gt;
&lt;br /&gt;
This makes it alot easier as we don't have to worry about modifier keys and keyboard layouts ourselves. More about this later on...&lt;br /&gt;
&lt;br /&gt;
Key repeat is a nice feature for the text input widgets in CEGUI, so we use SDL to generate them:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);&lt;br /&gt;
&lt;br /&gt;
Everything is ready now, and we can start the main loop :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Main Loop ===&lt;br /&gt;
To make it all happen, we use a simple main loop that just keeps pushing on those frames:&lt;br /&gt;
&lt;br /&gt;
 void main_loop()&lt;br /&gt;
 {&lt;br /&gt;
   bool must_quit = false;&lt;br /&gt;
   &lt;br /&gt;
   // get &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
   double last_time_pulse = 0.001*static_cast&amp;lt;double&amp;gt;(SDL_GetTicks());&lt;br /&gt;
   &lt;br /&gt;
   while (!must_quit)&lt;br /&gt;
   {&lt;br /&gt;
     inject_input(must_quit);&lt;br /&gt;
     inject_time_pulse(last_time_pulse);&lt;br /&gt;
     render_gui();&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This function will run the main loop until the ''bool'' value ''must_quit'' becomes ''true''. In this tutorial this will happen when the user clicks the close button provided by the window manager (fx. [http://www.microsoft.com Microsoft] Windows).&lt;br /&gt;
&lt;br /&gt;
The ''double'' value ''last_time_pulse'' holds the time of the latest time pulse injection. More about this later.&lt;br /&gt;
&lt;br /&gt;
Each function in the ''while'' loop will be described below.&lt;br /&gt;
&lt;br /&gt;
There are endless ways of making your main loop. I took a simple approach to ease writing this tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Injecting Input ===&lt;br /&gt;
When the user press or release keyboard or mouse buttons, we need to tell CEGUI about it, for this we use the injection functions of ''CEGUI::System''.&lt;br /&gt;
&lt;br /&gt;
Here is what our inject_input function looks like:&lt;br /&gt;
&lt;br /&gt;
 void inject_input(bool&amp;amp; must_quit)&lt;br /&gt;
 {&lt;br /&gt;
   SDL_Event e;&lt;br /&gt;
   &lt;br /&gt;
   // go through all available events&lt;br /&gt;
   while (SDL_PollEvent(&amp;amp;e))&lt;br /&gt;
   {&lt;br /&gt;
     // we use a switch to determine the event type&lt;br /&gt;
     switch (e.type)&lt;br /&gt;
     {&lt;br /&gt;
       // mouse motion handler&lt;br /&gt;
       case SDL_MOUSEMOTION:&lt;br /&gt;
         // we inject the mouse position directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
         );&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     // mouse down handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button down event&lt;br /&gt;
         handle_mouse_down(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // mouse up handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button up event&lt;br /&gt;
         handle_mouse_up(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // key down&lt;br /&gt;
       case SDL_KEYDOWN:&lt;br /&gt;
         // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
         &lt;br /&gt;
         // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
         // this is described in more detail below.&lt;br /&gt;
         if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
         {&lt;br /&gt;
           CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
         }&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // key up&lt;br /&gt;
       case SDL_KEYUP:&lt;br /&gt;
         // like before we inject the scancode directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // WM quit event occured&lt;br /&gt;
       case SDL_QUIT:&lt;br /&gt;
         must_quit = true;&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
First I'll explain the events that get handled directly in the ''inject_input'' function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Motion''':&lt;br /&gt;
&lt;br /&gt;
 // we inject the mouse position directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
There is nothing special here. Like stated in the comment the mouse position is just injected directly.&lt;br /&gt;
&lt;br /&gt;
There are two ways of injecting mouse motion. One where you inject how much the cursor moved, and one where you inject the mouse cursor position. The last one is failsafe.&lt;br /&gt;
Then first one only works correctly in fullscreen mode, or with input grabbed. The reason for this is that in regular windowed mode, the mouse can be moved outside the application window, and during this time no mouse motion event are generated. So if we enter the window at another position, the real mousecursor and CEGUI's mouse cursor will be offset, which will break mouse usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Down'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This event takes a little more work. CEGUI requires that key characters (the printable character the key represents) are injected alongside key codes.&lt;br /&gt;
&lt;br /&gt;
 // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
Luckily the key code is just the SDL scancode, so we inject that directly.&lt;br /&gt;
&lt;br /&gt;
 // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
 // this is described in more detail below.&lt;br /&gt;
 if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
 {&lt;br /&gt;
   CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Instead of formatting the keypress ourselves, we let SDL do it for us. For more information, take a look at the SDL documentation for this feature. [http://sdldoc.csn.ul.ie/sdlkeysym.php SDL_keysym].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This one is simple. Only the keycode need to injected. So we just use the scancode directly:&lt;br /&gt;
&lt;br /&gt;
 // like before we inject the scancode directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Down and Mouse Wheel'''&amp;lt;br /&amp;gt;&lt;br /&gt;
CEGUI and SDL are a little different when it comes to mouse button and mouse wheel events. So a little conversion is necessary. Here's the ''handle_mouse_down'' function that gets called when a mouse button down event occurs in SDL. It takes one parameter, a ''Uint8'' describing the mouse button that was pressed.&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_down(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		// handle real mouse buttons&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		&lt;br /&gt;
 		// handle the mouse wheel&lt;br /&gt;
 		case SDL_BUTTON_WHEELDOWN:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( -1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_WHEELUP:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( +1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
I chose a very &amp;quot;manual&amp;quot; conversion, but it works fine. Everything should be pretty self-explainatory.&lt;br /&gt;
As you can see mouse wheel events are emitted as mouse button down events in SDL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
The mouse button up event is handled very much like the mouse button down event, except there are no mousewheel release events.&lt;br /&gt;
Like ''handle_mouse_down'' it takes one parameter, a ''Uint8'' describing the mouse button that was released:&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_up(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Time Pulses ===&lt;br /&gt;
SDL has a built-in millisecond counter which we will use for this example. There are other ways to use timers with SDL, but I chose this approach as it is simple to use, and provides decent precision.&lt;br /&gt;
&lt;br /&gt;
Remember in the main loop where we stored the current &amp;quot;run-time&amp;quot; in seconds ? This value will be passed as a reference to ''inject_time_pulse'' function which in turn will set a new value to it.&lt;br /&gt;
&lt;br /&gt;
CEGUI's interface for injecting time pulses requires that you pass the time in seconds that has passed since the last time pulse injection. Let's take a look at the function:&lt;br /&gt;
&lt;br /&gt;
 void inject_time_pulse(double&amp;amp; last_time_pulse)&lt;br /&gt;
 {&lt;br /&gt;
 	// get current &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
 	double t = 0.001*SDL_GetTicks();&lt;br /&gt;
 &lt;br /&gt;
 	// inject the time that passed since the last call &lt;br /&gt;
 	CEGUI::System::getSingleton().injectTimePulse( float(t-last_time_pulse) );&lt;br /&gt;
 &lt;br /&gt;
 	// store the new time as the last time&lt;br /&gt;
 	last_time_pulse = t;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The first line gets the actual &amp;quot;run-time&amp;quot; when called.&lt;br /&gt;
* The second line injects the time pulse as the difference between the current time and the last time.&lt;br /&gt;
* The third line stores the current time as the last time a time pulse was injected.&lt;br /&gt;
&lt;br /&gt;
This will work for about 47 days... After that the counter wraps to zero and it breaks...&lt;br /&gt;
I'll leave it up to you to fix that if it's a problem.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Rendering ===&lt;br /&gt;
Now all thats left is rendering something. :)&lt;br /&gt;
&lt;br /&gt;
 void render_gui()&lt;br /&gt;
 {&lt;br /&gt;
 	// clear the colour buffer&lt;br /&gt;
 	glClear( GL_COLOR_BUFFER_BIT );&lt;br /&gt;
 &lt;br /&gt;
 	// render the GUI :)&lt;br /&gt;
 	CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
 &lt;br /&gt;
 	// Update the screen&lt;br /&gt;
 	SDL_GL_SwapBuffers();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The line:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
&lt;br /&gt;
does all the CEGUI magic and sets OpenGL state itself. As long as the viewport is setup, it will render the GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Error Handling ===&lt;br /&gt;
The neat C++ architecture of CEGUI suggests that C++ exceptions are used for error handling. This is completely true.&lt;br /&gt;
Whenever an error occurs, a sub-class of ''CEGUI::Exception'' is thrown.&lt;br /&gt;
&lt;br /&gt;
There are many scenarios where an exception can be thrown. And whether or not these should be considered fatal depends on the application. To make sure you catch the CEGUI exceptions a regular ''try'' block is used. Like so:&lt;br /&gt;
&lt;br /&gt;
 try&lt;br /&gt;
 {&lt;br /&gt;
 	// do some cegui code&lt;br /&gt;
 }&lt;br /&gt;
 catch (CEGUI::Exception&amp;amp; e)&lt;br /&gt;
 {&lt;br /&gt;
 	fprintf(stderr,&amp;quot;CEGUI Exception occured: %s&amp;quot;, e.getMessage().c_str());&lt;br /&gt;
 	// you could quit here&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That's it. Now you know how to use SDL, OpenGL and CEGUI together. Have fun.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 16:21, 8 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=41</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=41"/>
				<updated>2005-05-23T23:36:03Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== CrazyEddie's 'Imbeciles' Guides ===&lt;br /&gt;
* [[The Imbeciles Guide to Getting CEGUI Rendering]] - How to initialise CEGUI to render properly.&lt;br /&gt;
* [[The Imbeciles Guide to Loading Data Files and Initialisation]] - How to load some data files and perform basic system initialisation.&lt;br /&gt;
* [[The Imbeciles Guide to Creating a CEGUI Window]] - How to create a simple window and get it on screen.&lt;br /&gt;
* [[The Imbeciles Guide to Injecting Inputs]] - How to inject inputs into CEGUI and get interactive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lindquist's Lua Scripting with CEGUI Guides ===&lt;br /&gt;
* [[Getting Started with Lua and CEGUI]] - How to initialise CEGUI with a Lua script module and configuration file.&lt;br /&gt;
* [[Handling Events from Lua]] - How to load Lua script files and bind CEGUI events to Lua functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== SDL Tutorials ===&lt;br /&gt;
* [[Using CEGUI with SDL and OpenGL]] - Guidelines on how to get SDL, OpenGL and CEGUI running together.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=40</id>
		<title>Using CEGUI with SDL and OpenGL</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=40"/>
				<updated>2005-05-22T22:20:11Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.libsdl.org SDL (Simple DirectMedia Layer)] is an excellent library for writing portable games and other multimedia applications, but as it is a low-level library, it has no native support for GUI interfaces.&lt;br /&gt;
&lt;br /&gt;
When using [http://www.opengl.org OpenGL] for rendering, using CEGUI with SDL is not hard.&lt;br /&gt;
&lt;br /&gt;
I'll assume that you've read the imbiciles tutorials, and have used SDL with OpenGL.&lt;br /&gt;
And know C / C++ ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Initialisation ===&lt;br /&gt;
Before we can do anything, we need to initialise our libraries.&lt;br /&gt;
First SDL:&lt;br /&gt;
&lt;br /&gt;
 if (SDLInit(SDL_INIT_VIDEO|SDL_INIT_TIMER)&amp;lt;0)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to initialise SDL: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we initialise SDL with video and timer support. We need this for CEGUI.&lt;br /&gt;
O.K. now SDL is ready to go. So let's fire up OpenGL:&lt;br /&gt;
&lt;br /&gt;
 if (SDL_SetVideoMode(800,600,0,SDL_OPENGL)==NULL)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to set OpenGL videomode: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   SDL_Quit();&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now OpenGL is ready. But we still need to set a decent configuiration:&lt;br /&gt;
&lt;br /&gt;
 glEnable(GL_CULL_FACE);&lt;br /&gt;
 glClearColor(0.0f,0.0f,0.0f,1.0f);&lt;br /&gt;
 glViewport(0,0, 800,600);&lt;br /&gt;
&lt;br /&gt;
The OpenGL renderer that comes with CEGUI sets the matrices itself, so if you're only using CEGUI to display graphics this would be fine. Normally you would want a default 3D perspective setup:&lt;br /&gt;
&lt;br /&gt;
 glMatrixMode(GL_PROJECTION);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
 gluPerspective(45.0, 800.0/600.0, 0.1,100.0);&lt;br /&gt;
 glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
&lt;br /&gt;
SDL and OpenGL are now both ready for action. So it's time to initialise CEGUI.&lt;br /&gt;
First we need the renderer.&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;renderers/OpenGLGUIRenderer/openglrenderer.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It must be created before starting CEGUI.&lt;br /&gt;
&lt;br /&gt;
 CEGUI::OpenGLRenderer* renderer = new CEGUI::OpenGLRenderer(0,800,600);&lt;br /&gt;
&lt;br /&gt;
Then the CEGUI::System must be initialised:&lt;br /&gt;
&lt;br /&gt;
 new CEGUI::System(renderer);&lt;br /&gt;
&lt;br /&gt;
Remember that you have to load a widget set, set the mouse cursor and a default font before CEGUI is completely ready. This is described in the other tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the SDL cursor is displayed, so we'll remove that:&lt;br /&gt;
&lt;br /&gt;
 SDL_ShowCursor(SDL_DISABLE);&lt;br /&gt;
&lt;br /&gt;
As keypress characters needs to be injected into CEGUI, we activate unicode translation for SDL key events:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableUNICODE(1);&lt;br /&gt;
&lt;br /&gt;
This makes it alot easier as we don't have to worry about modifier keys and keyboard layouts ourselves. More about this later on...&lt;br /&gt;
&lt;br /&gt;
Key repeat is a nice feature for the text input widgets in CEGUI, so we use SDL to generate them:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);&lt;br /&gt;
&lt;br /&gt;
Everything is ready now, and we can start the main loop :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Main Loop ===&lt;br /&gt;
To make is all happen, we use a simple main loop that just keeps pushing on those frames:&lt;br /&gt;
&lt;br /&gt;
 void main_loop()&lt;br /&gt;
 {&lt;br /&gt;
   bool must_quit = false;&lt;br /&gt;
   &lt;br /&gt;
   // get &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
   double last_time_pulse = 0.001*static_cast&amp;lt;double&amp;gt;(SDL_GetTicks());&lt;br /&gt;
   &lt;br /&gt;
   while (!must_quit)&lt;br /&gt;
   {&lt;br /&gt;
     inject_input(must_quit);&lt;br /&gt;
     inject_time_pulse(last_time_pulse);&lt;br /&gt;
     render_gui();&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This function will run the main loop until the ''bool'' value ''must_quit'' becomes ''true''. In this tutorial this will happen when the user clicks the close button provided by the window manager (fx. Windows).&lt;br /&gt;
&lt;br /&gt;
The ''double'' value ''last_time_pulse'' holds the time of the latest time pulse injection. More about this later.&lt;br /&gt;
&lt;br /&gt;
Each function in the ''while'' loop will be described below.&lt;br /&gt;
&lt;br /&gt;
There are endless ways of making your main loop. I took a simple approach to ease writing this tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Injecting Input ===&lt;br /&gt;
When the user presses or release keyboard or mouse buttons, we need to tell CEGUI about it so we use the injection functions of ''CEGUI::System''.&lt;br /&gt;
&lt;br /&gt;
Here is what our inject_input function looks like:&lt;br /&gt;
&lt;br /&gt;
 void inject_input(bool&amp;amp; must_quit)&lt;br /&gt;
 {&lt;br /&gt;
   SDL_Event e;&lt;br /&gt;
   &lt;br /&gt;
   // go through all available events&lt;br /&gt;
   while (SDL_PollEvent(&amp;amp;e))&lt;br /&gt;
   {&lt;br /&gt;
     // we use a switch to determine the event type&lt;br /&gt;
     switch (e.type)&lt;br /&gt;
     {&lt;br /&gt;
       // mouse motion handler&lt;br /&gt;
       case SDL_MOUSEMOTION:&lt;br /&gt;
         // we inject the mouse position directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
         );&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     // mouse down handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button down event&lt;br /&gt;
         handle_mouse_down(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // mouse up handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button up event&lt;br /&gt;
         handle_mouse_up(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // key down&lt;br /&gt;
       case SDL_KEYDOWN:&lt;br /&gt;
         // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
         &lt;br /&gt;
         // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
         // this is described in more detail below.&lt;br /&gt;
         if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
         {&lt;br /&gt;
           CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
         }&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // key up&lt;br /&gt;
       case SDL_KEYUP:&lt;br /&gt;
         // like before we inject the scancode directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // WM quit event occured&lt;br /&gt;
       case SDL_QUIT:&lt;br /&gt;
         must_quit = true;&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
First I'll explain the events that get handled directly in the ''inject_input'' function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Motion''':&lt;br /&gt;
&lt;br /&gt;
 // we inject the mouse position directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
There is nothing special here. Like stated in the comment the mouse position is just injected directly.&lt;br /&gt;
&lt;br /&gt;
There are two ways of injecting mouse motion. One where you inject how much the cursor moved, and one where you inject the mouse cursor position. The last one is failsafe.&lt;br /&gt;
Then first one only works correctly in fullscreen mode, or with input grabbed. The reason for this is that in regular windowed mode, the mouse can be moved outside the application window, and during this time no mouse motion event are generated. So if we enter the window at another position, the real mousecursor and CEGUI's mouse cursor will be offset, which will break mouse usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Down'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This event is takes a little more work. CEGUI requires that key characters (the printable character the key represents) are injected alongside key codes.&lt;br /&gt;
&lt;br /&gt;
 // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
Luckily the key code is just the SDL scancode, so we inject that directly.&lt;br /&gt;
&lt;br /&gt;
 // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
 // this is described in more detail below.&lt;br /&gt;
 if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
 {&lt;br /&gt;
   CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Instead of formatting the keypress ourselves, we let SDL do it for us. For more information, take a look at the SDL documentation for this feature. [http://sdldoc.csn.ul.ie/sdlkeysym.php SDL_keysym].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This one is simple. Only the keycode need to injected. So we just use the scancode directly:&lt;br /&gt;
&lt;br /&gt;
 // like before we inject the scancode directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Down and Mouse Wheel'''&amp;lt;br /&amp;gt;&lt;br /&gt;
CEGUI and SDL are a little different when it comes to mouse button and mouse wheel event. So a little conversion is necessary. Here's the ''handle_mouse_down'' function that gets called when a mouse button down event occurs in SDL. It takes one parameter, a ''Uint8'' describing the mouse button that was pressed.&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_down(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		// handle real mouse buttons&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		&lt;br /&gt;
 		// handle the mouse wheel&lt;br /&gt;
 		case SDL_BUTTON_WHEELDOWN:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( -1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_WHEELUP:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( +1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
I chose a very &amp;quot;manual&amp;quot; conversion, but it works fine. Everything should be pretty self-explainatory.&lt;br /&gt;
As you can see mouse wheel events are emitted as mouse button down events in SDL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
The mouse button up event is handled very much like the mouse button down event, except there are no mousewheel release events.&lt;br /&gt;
Like ''handle_mouse_down'' it takes one parameter, a ''Uint8'' describing the mouse button that was pressed:&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_up(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Time Pulses ===&lt;br /&gt;
SDL has a built-in millisecond counter which we will use for this example. There are other to use timers with SDL, but I chose this approach as it is simple to use.&lt;br /&gt;
&lt;br /&gt;
Remember in the main loop where we stored the current &amp;quot;run-time&amp;quot; in seconds ? This value will be passed as a reference to ''inject_time_pulse'' which in turn will set a new value in it.&lt;br /&gt;
&lt;br /&gt;
CEGUI's interface for injecting time pulses requires that you pass the time in seconds that has passed since the last time pulse injection. Long sentence but it not that hard. Let's take a look at the function:&lt;br /&gt;
&lt;br /&gt;
 void inject_time_pulse(double&amp;amp; last_time_pulse)&lt;br /&gt;
 {&lt;br /&gt;
 	// get current &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
 	double t = 0.001*SDL_GetTicks();&lt;br /&gt;
 &lt;br /&gt;
 	// inject the time that passed since the last call &lt;br /&gt;
 	CEGUI::System::getSingleton().injectTimePulse( float(t-last_time_pulse) );&lt;br /&gt;
 &lt;br /&gt;
 	// store the new time as the last time&lt;br /&gt;
 	last_time_pulse = t;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The first line gets the actual &amp;quot;run-time&amp;quot; when called.&lt;br /&gt;
* The second line injects the time pulse as the difference between the current time and the last time.&lt;br /&gt;
* The third line stores the current time as the last time a time pulse was injected.&lt;br /&gt;
&lt;br /&gt;
This will work for about 47 days... After that the counter wraps to zero and it breaks...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Rendering ===&lt;br /&gt;
Now all thats left is rendering something. :)&lt;br /&gt;
&lt;br /&gt;
 void render_gui()&lt;br /&gt;
 {&lt;br /&gt;
 	// clear the colour buffer&lt;br /&gt;
 	glClear( GL_COLOR_BUFFER_BIT );&lt;br /&gt;
 &lt;br /&gt;
 	// render the GUI :)&lt;br /&gt;
 	CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
 &lt;br /&gt;
 	// Update the screen&lt;br /&gt;
 	SDL_GL_SwapBuffers();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The line:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
&lt;br /&gt;
does all the CEGUI magic and sets OpenGL state itself. As long as the viewport is setup, it will render the GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Error Handling ===&lt;br /&gt;
The neat C++ architecture of CEGUI suggests that C++ exceptions are used for error handling. This is completely true.&lt;br /&gt;
Whenever an error occurs, a sub-class of ''CEGUI::Exception'' is thrown.&lt;br /&gt;
&lt;br /&gt;
There are many scenarios where an exception can be thrown though, but a simple approach would be to simply treat all CEGUI exceptions as ''fatal errors''. That is - clean up and exit the application.&lt;br /&gt;
&lt;br /&gt;
 try&lt;br /&gt;
 {&lt;br /&gt;
 	// do some cegui code&lt;br /&gt;
 }&lt;br /&gt;
 catch (CEGUI::Exception&amp;amp; e)&lt;br /&gt;
 {&lt;br /&gt;
 	fprintf(stderr,&amp;quot;CEGUI Exception occured: %s&amp;quot;, e.getMessage().c_str());&lt;br /&gt;
 	// you could quit here&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That's it. Now you know how to use SDL, OpenGL and CEGUI together. Have fun.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 16:21, 8 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=398</id>
		<title>Getting Started with Lua and CEGUI</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=398"/>
				<updated>2005-05-20T16:52:06Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Lua scripting module for CEGUI is based on [http://www.lua.org Lua 5.0.2] and [http://www.codenix.com/~tolua/ tolua++ 1.0.6pre2-1].&lt;br /&gt;
As these libraries were difficult (or impossible) to find in working precompiled versions, I decided to include them with the scripting module (That is the source is included, and there are makefiles available).&lt;br /&gt;
There is no link to the tolua++ version used on their website, but it's available [http://www.codenix.com/~tolua/tolua++_1.0.6pre2-1.tar.gz here]&lt;br /&gt;
&lt;br /&gt;
When using CEGUI with a scripting module a lot of the interface programming can be replaced by scripts, these script can be modified and used without recompling your program, thus leave more time for tweaking your UI instead of waiting for your compiler to finish.&lt;br /&gt;
&lt;br /&gt;
The current Lua script module is still fairly early in development.&lt;br /&gt;
It supports most of the core system, and the base window class, more specific widgets can currently only be configured using the properties system.&lt;br /&gt;
&lt;br /&gt;
At this time the Lua script module is only in CVS.&lt;br /&gt;
&lt;br /&gt;
Ok. Let's get started. I assume that you are familiar with the CEGUI basics. Initialisation, creating windows etc. and Lua, so I'll pick up from about there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initialisation ==&lt;br /&gt;
The Lua scripting module exports all the manager classes and such it is possible to do the basic CEGUI initialization from Lua.&lt;br /&gt;
&lt;br /&gt;
the basic CEGUI init sequence is like this:&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;LuaScriptModule.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 CEGUI::''YourRendererOfChoice''* renderer = new ''YourRendererOfChoice'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule();&lt;br /&gt;
 new CEGUI::System( renderer, script_module );&lt;br /&gt;
&lt;br /&gt;
now the CEGUI::System is created and the scripting module is attached properly.&lt;br /&gt;
In this case the constructor of the LuaScriptModule created a Lua state for us. You can also pass a lua_State* as the first parameter to the LuaScriptModule constructor to use your own Lua state instead:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 lua_State* s = ''your_lua_state'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule(s);&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You would probably want to do this if you are using custom functions in the init-script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Init / Exit Script ==&lt;br /&gt;
CEGUI supports a configuration file. The filename for this is an optional parameter to the CEGUI::System constructor. It defaults to cegui.config&lt;br /&gt;
&lt;br /&gt;
This configuration file gives you the posibility to execute a script file during system creation and destruction.&lt;br /&gt;
A configuration file could look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;CEGUIConfig InitScript=&amp;quot;../datafiles/scripts/init_script.lua&amp;quot; TerminateScript=&amp;quot;../datafiles/scripts/exit_script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
init_script.lua is a text file containing the Lua script code to be executed on init.&lt;br /&gt;
Here's an example:&lt;br /&gt;
&lt;br /&gt;
 -- get CEGUI singletons&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()&lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;gt;&amp;gt;&amp;gt; Init script says hello&amp;quot; )&lt;br /&gt;
 --logger:setLoggingLevel( CEGUI.Informative )&lt;br /&gt;
 &lt;br /&gt;
 -- get a local reference to the singletons we use (not required)&lt;br /&gt;
 local system    = CEGUI.System:getSingleton()&lt;br /&gt;
 local fontman   = CEGUI.FontManager:getSingleton()&lt;br /&gt;
 local schememan = CEGUI.SchemeManager:getSingleton()&lt;br /&gt;
 &lt;br /&gt;
 -- load schemes&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot; )&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/WindowsLook.scheme&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 -- load and set default font&lt;br /&gt;
 local font = fontman:createFont( &amp;quot;../datafiles/fonts/Commonwealth-10.font&amp;quot; )&lt;br /&gt;
 system:setDefaultFont( font )&lt;br /&gt;
 &lt;br /&gt;
 -- set default mouse cursor&lt;br /&gt;
 system:setDefaultMouseCursor( &amp;quot;TaharezLook&amp;quot;,&amp;quot;MouseArrow&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;lt;&amp;lt;&amp;lt; Init script says goodbye&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
you don't have to have both init and exit scripts, but if you allocate &amp;quot;global&amp;quot; memory from the initscript you should free it in the exit script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you know how to initialise CEGUI with the Lua scripting module.&lt;br /&gt;
More tutorials will follow soon with more advanced topics.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 19:25, 5 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=33</id>
		<title>Getting Started with Lua and CEGUI</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=33"/>
				<updated>2005-05-10T10:58:29Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Lua scripting module for CEGUI is based on [http://www.lua.org Lua 5.0.2] and [http://www.codenix.com/~tolua/ tolua++ 1.0.6pre2-1].&lt;br /&gt;
As these libraries were difficult (or impossible) to find in working precompiled versions, I decided to include them with the scripting module.&lt;br /&gt;
There is no link to the tolua++ version used on their website, but it's available [http://www.codenix.com/~tolua/tolua++_1.0.6pre2-1.tar.gz here]&lt;br /&gt;
&lt;br /&gt;
When using CEGUI with a scripting module a lot of the interface programming can be replaced by scripts, these script can be modified and used without recompling your program, thus leave more time for tweaking your UI instead of waiting for your compiler to finish.&lt;br /&gt;
&lt;br /&gt;
The current Lua script module is still fairly early in development.&lt;br /&gt;
It supports most of the core system, and the base window class, more specific widgets can currently only be configured using the properties system.&lt;br /&gt;
&lt;br /&gt;
At this time the Lua script module is only in CVS.&lt;br /&gt;
&lt;br /&gt;
Ok. Let's get started. I assume that you are familiar with the CEGUI basics. Initialisation, creating windows etc. and Lua, so I'll pick up from about there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initialisation ==&lt;br /&gt;
The Lua scripting module exports all the manager classes and such it is possible to do the basic CEGUI initialization from Lua.&lt;br /&gt;
&lt;br /&gt;
the basic CEGUI init sequence is like this:&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;LuaScriptModule.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 CEGUI::''YourRendererOfChoice''* renderer = new ''YourRendererOfChoice'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule();&lt;br /&gt;
 new CEGUI::System( renderer, script_module );&lt;br /&gt;
&lt;br /&gt;
now the CEGUI::System is created and the scripting module is attached properly.&lt;br /&gt;
In this case the constructor of the LuaScriptModule created a Lua state for us. You can also pass a lua_State* as the first parameter to the LuaScriptModule constructor to use your own Lua state instead:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 lua_State* s = ''your_lua_state'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule(s);&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You would probably want to do this if you are using custom functions in the init-script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Init / Exit Script ==&lt;br /&gt;
CEGUI supports a configuration file. The filename for this is an optional parameter to the CEGUI::System constructor. It defaults to cegui.config&lt;br /&gt;
&lt;br /&gt;
This configuration file gives you the posibility to execute a script file during system creation and destruction.&lt;br /&gt;
A configuration file could look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;CEGUIConfig InitScript=&amp;quot;../datafiles/scripts/init_script.lua&amp;quot; TerminateScript=&amp;quot;../datafiles/scripts/exit_script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
init_script.lua is a text file containing the Lua script code to be executed on init.&lt;br /&gt;
Here's an example:&lt;br /&gt;
&lt;br /&gt;
 -- get CEGUI singletons&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()&lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;gt;&amp;gt;&amp;gt; Init script says hello&amp;quot; )&lt;br /&gt;
 --logger:setLoggingLevel( CEGUI.Informative )&lt;br /&gt;
 &lt;br /&gt;
 -- get a local reference to the singletons we use (not required)&lt;br /&gt;
 local system    = CEGUI.System:getSingleton()&lt;br /&gt;
 local fontman   = CEGUI.FontManager:getSingleton()&lt;br /&gt;
 local schememan = CEGUI.SchemeManager:getSingleton()&lt;br /&gt;
 &lt;br /&gt;
 -- load schemes&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot; )&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/WindowsLook.scheme&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 -- load and set default font&lt;br /&gt;
 local font = fontman:createFont( &amp;quot;../datafiles/fonts/Commonwealth-10.font&amp;quot; )&lt;br /&gt;
 system:setDefaultFont( font )&lt;br /&gt;
 &lt;br /&gt;
 -- set default mouse cursor&lt;br /&gt;
 system:setDefaultMouseCursor( &amp;quot;TaharezLook&amp;quot;,&amp;quot;MouseArrow&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;lt;&amp;lt;&amp;lt; Init script says goodbye&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
you don't have to have both init and exit scripts, but if you allocate &amp;quot;global&amp;quot; memory from the initscript you should free it in the exit script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you know how to initialise CEGUI with the Lua scripting module.&lt;br /&gt;
More tutorials will follow soon with more advanced topics.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 19:25, 5 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=32</id>
		<title>Getting Started with Lua and CEGUI</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=32"/>
				<updated>2005-05-08T22:47:37Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Lua scripting module for CEGUI is based on [http://www.lua.org Lua 5.0.2] and [http://www.codenix.com/~tolua/ tolua++ 1.0.6pre2-1].&lt;br /&gt;
As these libraries were difficult (or impossible) to find in working precompiled versions, I decided to include them with the scripting module.&lt;br /&gt;
&lt;br /&gt;
When using CEGUI with a scripting module a lot of the interface programming can be replaced by scripts, these script can be modified and used without recompling your program, thus leave more time for tweaking your UI instead of waiting for your compiler to finish.&lt;br /&gt;
&lt;br /&gt;
The current Lua script module is still fairly early in development.&lt;br /&gt;
It supports most of the core system, and the base window class, more specific widgets can currently only be configured using the properties system.&lt;br /&gt;
&lt;br /&gt;
At this time the Lua script module is only in CVS.&lt;br /&gt;
&lt;br /&gt;
Ok. Let's get started. I assume that you are familiar with the CEGUI basics. Initialisation, creating windows etc. and Lua, so I'll pick up from about there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initialisation ==&lt;br /&gt;
The Lua scripting module exports all the manager classes and such it is possible to do the basic CEGUI initialization from Lua.&lt;br /&gt;
&lt;br /&gt;
the basic CEGUI init sequence is like this:&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;LuaScriptModule.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 CEGUI::''YourRendererOfChoice''* renderer = new ''YourRendererOfChoice'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule();&lt;br /&gt;
 new CEGUI::System( renderer, script_module );&lt;br /&gt;
&lt;br /&gt;
now the CEGUI::System is created and the scripting module is attached properly.&lt;br /&gt;
In this case the constructor of the LuaScriptModule created a Lua state for us. You can also pass a lua_State* as the first parameter to the LuaScriptModule constructor to use your own Lua state instead:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 lua_State* s = ''your_lua_state'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule(s);&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You would probably want to do this if you are using custom functions in the init-script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Init / Exit Script ==&lt;br /&gt;
CEGUI supports a configuration file. The filename for this is an optional parameter to the CEGUI::System constructor. It defaults to cegui.config&lt;br /&gt;
&lt;br /&gt;
This configuration file gives you the posibility to execute a script file during system creation and destruction.&lt;br /&gt;
A configuration file could look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;CEGUIConfig InitScript=&amp;quot;../datafiles/scripts/init_script.lua&amp;quot; TerminateScript=&amp;quot;../datafiles/scripts/exit_script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
init_script.lua is a text file containing the Lua script code to be executed on init.&lt;br /&gt;
Here's an example:&lt;br /&gt;
&lt;br /&gt;
 -- get CEGUI singletons&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()&lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;gt;&amp;gt;&amp;gt; Init script says hello&amp;quot; )&lt;br /&gt;
 --logger:setLoggingLevel( CEGUI.Informative )&lt;br /&gt;
 &lt;br /&gt;
 -- get a local reference to the singletons we use (not required)&lt;br /&gt;
 local system    = CEGUI.System:getSingleton()&lt;br /&gt;
 local fontman   = CEGUI.FontManager:getSingleton()&lt;br /&gt;
 local schememan = CEGUI.SchemeManager:getSingleton()&lt;br /&gt;
 &lt;br /&gt;
 -- load schemes&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot; )&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/WindowsLook.scheme&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 -- load and set default font&lt;br /&gt;
 local font = fontman:createFont( &amp;quot;../datafiles/fonts/Commonwealth-10.font&amp;quot; )&lt;br /&gt;
 system:setDefaultFont( font )&lt;br /&gt;
 &lt;br /&gt;
 -- set default mouse cursor&lt;br /&gt;
 system:setDefaultMouseCursor( &amp;quot;TaharezLook&amp;quot;,&amp;quot;MouseArrow&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;lt;&amp;lt;&amp;lt; Init script says goodbye&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
you don't have to have both init and exit scripts, but if you allocate &amp;quot;global&amp;quot; memory from the initscript you should free it in the exit script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you know how to initialise CEGUI with the Lua scripting module.&lt;br /&gt;
More tutorials will follow soon with more advanced topics.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 19:25, 5 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=31</id>
		<title>Getting Started with Lua and CEGUI</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=31"/>
				<updated>2005-05-08T22:46:57Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Lua scripting module for CEGUI is based on [http://www.lua.org Lua 5.0.2] and [http://www.codenix.com/~tolua/ tolua++ 1.0.6pre2-1].&lt;br /&gt;
As these libraries were diffucult to find in working precompiled versions, I decided to include them with the scripting module.&lt;br /&gt;
&lt;br /&gt;
When using CEGUI with a scripting module a lot of the interface programming can be replaced by scripts, these script can be modified and used without recompling your program, thus leave more time for tweaking your UI instead of waiting for your compiler to finish.&lt;br /&gt;
&lt;br /&gt;
The current Lua script module is still fairly early in development.&lt;br /&gt;
It supports most of the core system, and the base window class, more specific widgets can currently only be configured using the properties system.&lt;br /&gt;
&lt;br /&gt;
At this time the Lua script module is only in CVS.&lt;br /&gt;
&lt;br /&gt;
Ok. Let's get started. I assume that you are familiar with the CEGUI basics. Initialisation, creating windows etc. and Lua, so I'll pick up from about there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initialisation ==&lt;br /&gt;
The Lua scripting module exports all the manager classes and such it is possible to do the basic CEGUI initialization from Lua.&lt;br /&gt;
&lt;br /&gt;
the basic CEGUI init sequence is like this:&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;LuaScriptModule.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 CEGUI::''YourRendererOfChoice''* renderer = new ''YourRendererOfChoice'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule();&lt;br /&gt;
 new CEGUI::System( renderer, script_module );&lt;br /&gt;
&lt;br /&gt;
now the CEGUI::System is created and the scripting module is attached properly.&lt;br /&gt;
In this case the constructor of the LuaScriptModule created a Lua state for us. You can also pass a lua_State* as the first parameter to the LuaScriptModule constructor to use your own Lua state instead:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 lua_State* s = ''your_lua_state'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule(s);&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You would probably want to do this if you are using custom functions in the init-script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Init / Exit Script ==&lt;br /&gt;
CEGUI supports a configuration file. The filename for this is an optional parameter to the CEGUI::System constructor. It defaults to cegui.config&lt;br /&gt;
&lt;br /&gt;
This configuration file gives you the posibility to execute a script file during system creation and destruction.&lt;br /&gt;
A configuration file could look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;CEGUIConfig InitScript=&amp;quot;../datafiles/scripts/init_script.lua&amp;quot; TerminateScript=&amp;quot;../datafiles/scripts/exit_script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
init_script.lua is a text file containing the Lua script code to be executed on init.&lt;br /&gt;
Here's an example:&lt;br /&gt;
&lt;br /&gt;
 -- get CEGUI singletons&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()&lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;gt;&amp;gt;&amp;gt; Init script says hello&amp;quot; )&lt;br /&gt;
 --logger:setLoggingLevel( CEGUI.Informative )&lt;br /&gt;
 &lt;br /&gt;
 -- get a local reference to the singletons we use (not required)&lt;br /&gt;
 local system    = CEGUI.System:getSingleton()&lt;br /&gt;
 local fontman   = CEGUI.FontManager:getSingleton()&lt;br /&gt;
 local schememan = CEGUI.SchemeManager:getSingleton()&lt;br /&gt;
 &lt;br /&gt;
 -- load schemes&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot; )&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/WindowsLook.scheme&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 -- load and set default font&lt;br /&gt;
 local font = fontman:createFont( &amp;quot;../datafiles/fonts/Commonwealth-10.font&amp;quot; )&lt;br /&gt;
 system:setDefaultFont( font )&lt;br /&gt;
 &lt;br /&gt;
 -- set default mouse cursor&lt;br /&gt;
 system:setDefaultMouseCursor( &amp;quot;TaharezLook&amp;quot;,&amp;quot;MouseArrow&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;lt;&amp;lt;&amp;lt; Init script says goodbye&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
you don't have to have both init and exit scripts, but if you allocate &amp;quot;global&amp;quot; memory from the initscript you should free it in the exit script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you know how to initialise CEGUI with the Lua scripting module.&lt;br /&gt;
More tutorials will follow soon with more advanced topics.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 19:25, 5 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=34</id>
		<title>Using CEGUI with SDL and OpenGL</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=34"/>
				<updated>2005-05-08T19:18:22Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: /* Rendering */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.libsdl.org SDL (Simple DirectMedia Layer)] is an excellent library for writing portable games and other multimedia applications, but as it is a low-level library, it has no native support for GUI interfaces.&lt;br /&gt;
&lt;br /&gt;
When using [http://www.opengl.org OpenGL] for rendering, using CEGUI with SDL is not hard.&lt;br /&gt;
&lt;br /&gt;
I'll assume that you've read the imbiciles tutorials, and have used SDL with OpenGL.&lt;br /&gt;
And know C / C++ ...&lt;br /&gt;
&lt;br /&gt;
=== Initialisation ===&lt;br /&gt;
Before we can do anything, we need to initialise our libraries.&lt;br /&gt;
First SDL:&lt;br /&gt;
&lt;br /&gt;
 if (SDLInit(SDL_INIT_VIDEO|SDL_INIT_TIMER)&amp;lt;0)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to initialise SDL: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we initialise SDL with video and timer support. We need this for CEGUI.&lt;br /&gt;
O.K. now SDL is ready to go. So let's fire up OpenGL:&lt;br /&gt;
&lt;br /&gt;
 if (SDL_SetVideoMode(800,600,0,SDL_OPENGL)==NULL)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to set OpenGL videomode: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   SDL_Quit();&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now OpenGL is ready. But we still need to set a decent configuiration:&lt;br /&gt;
&lt;br /&gt;
 glEnable(GL_CULL_FACE);&lt;br /&gt;
 glClearColor(0.0f,0.0f,0.0f,1.0f);&lt;br /&gt;
 glViewport(0,0, 800,600);&lt;br /&gt;
&lt;br /&gt;
The OpenGL renderer that comes with CEGUI sets the matrices itself, so if you're only using CEGUI to display graphics this would be fine. Normally you would want a default 3D perspective setup:&lt;br /&gt;
&lt;br /&gt;
 glMatrixMode(GL_PROJECTION);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
 gluPerspective(45.0, 800.0/600.0, 0.1,100.0);&lt;br /&gt;
 glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
&lt;br /&gt;
SDL and OpenGL are now both ready for action. So it's time to initialise CEGUI.&lt;br /&gt;
First we need the renderer.&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;renderers/OpenGLGUIRenderer/openglrenderer.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It must be created before starting CEGUI.&lt;br /&gt;
&lt;br /&gt;
 CEGUI::OpenGLRenderer* renderer = new CEGUI::OpenGLRenderer(0,800,600);&lt;br /&gt;
&lt;br /&gt;
Then the CEGUI::System must be initialised:&lt;br /&gt;
&lt;br /&gt;
 new CEGUI::System(renderer);&lt;br /&gt;
&lt;br /&gt;
Remember that you have to load a widget set, set the mouse cursor and a default font before CEGUI is completely ready. This is described in the other tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the SDL cursor is displayed, so we'll remove that:&lt;br /&gt;
&lt;br /&gt;
 SDL_ShowCursor(SDL_DISABLE);&lt;br /&gt;
&lt;br /&gt;
As keypress characters needs to be injected into CEGUI, we activate unicode translation for SDL key events:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableUNICODE(1);&lt;br /&gt;
&lt;br /&gt;
This makes it alot easier as we don't have to worry about modifier keys and keyboard layouts ourselves. More about this later on...&lt;br /&gt;
&lt;br /&gt;
Key repeat is a nice feature for the text input widgets in CEGUI, so we use SDL to generate them:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);&lt;br /&gt;
&lt;br /&gt;
Everything is ready now, and we can start the main loop :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Main Loop ===&lt;br /&gt;
To make is all happen, we use a simple main loop that just keeps pushing on those frames:&lt;br /&gt;
&lt;br /&gt;
 void main_loop()&lt;br /&gt;
 {&lt;br /&gt;
   bool must_quit = false;&lt;br /&gt;
   &lt;br /&gt;
   // get &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
   double last_time_pulse = 0.001*static_cast&amp;lt;double&amp;gt;(SDL_GetTicks());&lt;br /&gt;
   &lt;br /&gt;
   while (!must_quit)&lt;br /&gt;
   {&lt;br /&gt;
     inject_input(must_quit);&lt;br /&gt;
     inject_time_pulse(last_time_pulse);&lt;br /&gt;
     render_gui();&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This function will run the main loop until the ''bool'' value ''must_quit'' becomes ''true''. In this tutorial this will happen when the user clicks the close button provided by the window manager (fx. Windows).&lt;br /&gt;
&lt;br /&gt;
The ''double'' value ''last_time_pulse'' holds the time of the latest time pulse injection. More about this later.&lt;br /&gt;
&lt;br /&gt;
Each function in the ''while'' loop will be described below.&lt;br /&gt;
&lt;br /&gt;
There are endless ways of making your main loop. I took a simple approach to ease writing this tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Injecting Input ===&lt;br /&gt;
When the user presses or release keyboard or mouse buttons, we need to tell CEGUI about it so we use the injection functions of ''CEGUI::System''.&lt;br /&gt;
&lt;br /&gt;
Here is what our inject_input function looks like:&lt;br /&gt;
&lt;br /&gt;
 void inject_input(bool&amp;amp; must_quit)&lt;br /&gt;
 {&lt;br /&gt;
   SDL_Event e;&lt;br /&gt;
   &lt;br /&gt;
   // go through all available events&lt;br /&gt;
   while (SDL_PollEvent(&amp;amp;e))&lt;br /&gt;
   {&lt;br /&gt;
     // we use a switch to determine the event type&lt;br /&gt;
     switch (e.type)&lt;br /&gt;
     {&lt;br /&gt;
       // mouse motion handler&lt;br /&gt;
       case SDL_MOUSEMOTION:&lt;br /&gt;
         // we inject the mouse position directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
         );&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     // mouse down handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button down event&lt;br /&gt;
         handle_mouse_down(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // mouse up handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button up event&lt;br /&gt;
         handle_mouse_up(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // key down&lt;br /&gt;
       case SDL_KEYDOWN:&lt;br /&gt;
         // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
         &lt;br /&gt;
         // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
         // this is described in more detail below.&lt;br /&gt;
         if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
         {&lt;br /&gt;
           CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
         }&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // key up&lt;br /&gt;
       case SDL_KEYUP:&lt;br /&gt;
         // like before we inject the scancode directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // WM quit event occured&lt;br /&gt;
       case SDL_QUIT:&lt;br /&gt;
         must_quit = true;&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
First I'll explain the events that get handled directly in the ''inject_input'' function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Motion''':&lt;br /&gt;
&lt;br /&gt;
 // we inject the mouse position directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
There is nothing special here. Like stated in the comment the mouse position is just injected directly.&lt;br /&gt;
&lt;br /&gt;
There are two ways of injecting mouse motion. One where you inject how much the cursor moved, and one where you inject the mouse cursor position. The last one is failsafe.&lt;br /&gt;
Then first one only works correctly in fullscreen mode, or with input grabbed. The reason for this is that in regular windowed mode, the mouse can be moved outside the application window, and during this time no mouse motion event are generated. So if we enter the window at another position, the real mousecursor and CEGUI's mouse cursor will be offset, which will break mouse usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Down'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This event is takes a little more work. CEGUI requires that key characters (the printable character the key represents) are injected alongside key codes.&lt;br /&gt;
&lt;br /&gt;
 // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
Luckily the key code is just the SDL scancode, so we inject that directly.&lt;br /&gt;
&lt;br /&gt;
 // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
 // this is described in more detail below.&lt;br /&gt;
 if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
 {&lt;br /&gt;
   CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Instead of formatting the keypress ourselves, we let SDL do it for us. For more information, take a look at the SDL documentation for this feature. [http://sdldoc.csn.ul.ie/sdlkeysym.php SDL_keysym].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This one is simple. Only the keycode need to injected. So we just use the scancode directly:&lt;br /&gt;
&lt;br /&gt;
 // like before we inject the scancode directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Down and Mouse Wheel'''&amp;lt;br /&amp;gt;&lt;br /&gt;
CEGUI and SDL are a little different when it comes to mouse button and mouse wheel event. So a little conversion is necessary. Here's the ''handle_mouse_down'' function that gets called when a mouse button down event occurs in SDL. It takes one parameter, a ''Uint8'' describing the mouse button that was pressed.&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_down(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		// handle real mouse buttons&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		&lt;br /&gt;
 		// handle the mouse wheel&lt;br /&gt;
 		case SDL_BUTTON_WHEELDOWN:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( -1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_WHEELUP:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( +1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
I chose a very &amp;quot;manual&amp;quot; conversion, but it works fine. Everything should be pretty self-explainatory.&lt;br /&gt;
As you can see mouse wheel events are emitted as mouse button down events in SDL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
The mouse button up event is handled very much like the mouse button down event, except there are no mousewheel release events.&lt;br /&gt;
Like ''handle_mouse_down'' it takes one parameter, a ''Uint8'' describing the mouse button that was pressed:&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_up(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Time Pulses ===&lt;br /&gt;
SDL has a built-in millisecond counter which we will use for this example. There are other to use timers with SDL, but I chose this approach as it is simple to use.&lt;br /&gt;
&lt;br /&gt;
Remember in the main loop where we stored the current &amp;quot;run-time&amp;quot; in seconds ? This value will be passed as a reference to ''inject_time_pulse'' which in turn will set a new value in it.&lt;br /&gt;
&lt;br /&gt;
CEGUI's interface for injecting time pulses requires that you pass the time in seconds that has passed since the last time pulse injection. Long sentence but it not that hard. Let's take a look at the function:&lt;br /&gt;
&lt;br /&gt;
 void inject_time_pulse(double&amp;amp; last_time_pulse)&lt;br /&gt;
 {&lt;br /&gt;
 	// get current &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
 	double t = 0.001*SDL_GetTicks();&lt;br /&gt;
 &lt;br /&gt;
 	// inject the time that passed since the last call &lt;br /&gt;
 	CEGUI::System::getSingleton().injectTimePulse( float(t-last_time_pulse) );&lt;br /&gt;
 &lt;br /&gt;
 	// store the new time as the last time&lt;br /&gt;
 	last_time_pulse = t;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The first line gets the actual &amp;quot;run-time&amp;quot; when called.&lt;br /&gt;
* The second line injects the time pulse as the difference between the current time and the last time.&lt;br /&gt;
* The third line stores the current time as the last time a time pulse was injected.&lt;br /&gt;
&lt;br /&gt;
This will work for about 47 days... After that the counter wraps to zero and it breaks...&lt;br /&gt;
&lt;br /&gt;
=== Rendering ===&lt;br /&gt;
Now all thats left is rendering something. :)&lt;br /&gt;
&lt;br /&gt;
 void render_gui()&lt;br /&gt;
 {&lt;br /&gt;
 	// clear the colour buffer&lt;br /&gt;
 	glClear( GL_COLOR_BUFFER_BIT );&lt;br /&gt;
 &lt;br /&gt;
 	// render the GUI :)&lt;br /&gt;
 	CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
 &lt;br /&gt;
 	// Update the screen&lt;br /&gt;
 	SDL_GL_SwapBuffers();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The line:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
&lt;br /&gt;
does all the CEGUI magic and sets OpenGL state itself. As long as the viewport is setup, it will render the GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That's it. Now you know how to use SDL, OpenGL and CEGUI together. Have fun.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 16:21, 8 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=29</id>
		<title>Using CEGUI with SDL and OpenGL</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=29"/>
				<updated>2005-05-08T19:18:01Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: /* Time Pulses */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.libsdl.org SDL (Simple DirectMedia Layer)] is an excellent library for writing portable games and other multimedia applications, but as it is a low-level library, it has no native support for GUI interfaces.&lt;br /&gt;
&lt;br /&gt;
When using [http://www.opengl.org OpenGL] for rendering, using CEGUI with SDL is not hard.&lt;br /&gt;
&lt;br /&gt;
I'll assume that you've read the imbiciles tutorials, and have used SDL with OpenGL.&lt;br /&gt;
And know C / C++ ...&lt;br /&gt;
&lt;br /&gt;
=== Initialisation ===&lt;br /&gt;
Before we can do anything, we need to initialise our libraries.&lt;br /&gt;
First SDL:&lt;br /&gt;
&lt;br /&gt;
 if (SDLInit(SDL_INIT_VIDEO|SDL_INIT_TIMER)&amp;lt;0)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to initialise SDL: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we initialise SDL with video and timer support. We need this for CEGUI.&lt;br /&gt;
O.K. now SDL is ready to go. So let's fire up OpenGL:&lt;br /&gt;
&lt;br /&gt;
 if (SDL_SetVideoMode(800,600,0,SDL_OPENGL)==NULL)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to set OpenGL videomode: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   SDL_Quit();&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now OpenGL is ready. But we still need to set a decent configuiration:&lt;br /&gt;
&lt;br /&gt;
 glEnable(GL_CULL_FACE);&lt;br /&gt;
 glClearColor(0.0f,0.0f,0.0f,1.0f);&lt;br /&gt;
 glViewport(0,0, 800,600);&lt;br /&gt;
&lt;br /&gt;
The OpenGL renderer that comes with CEGUI sets the matrices itself, so if you're only using CEGUI to display graphics this would be fine. Normally you would want a default 3D perspective setup:&lt;br /&gt;
&lt;br /&gt;
 glMatrixMode(GL_PROJECTION);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
 gluPerspective(45.0, 800.0/600.0, 0.1,100.0);&lt;br /&gt;
 glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
&lt;br /&gt;
SDL and OpenGL are now both ready for action. So it's time to initialise CEGUI.&lt;br /&gt;
First we need the renderer.&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;renderers/OpenGLGUIRenderer/openglrenderer.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It must be created before starting CEGUI.&lt;br /&gt;
&lt;br /&gt;
 CEGUI::OpenGLRenderer* renderer = new CEGUI::OpenGLRenderer(0,800,600);&lt;br /&gt;
&lt;br /&gt;
Then the CEGUI::System must be initialised:&lt;br /&gt;
&lt;br /&gt;
 new CEGUI::System(renderer);&lt;br /&gt;
&lt;br /&gt;
Remember that you have to load a widget set, set the mouse cursor and a default font before CEGUI is completely ready. This is described in the other tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the SDL cursor is displayed, so we'll remove that:&lt;br /&gt;
&lt;br /&gt;
 SDL_ShowCursor(SDL_DISABLE);&lt;br /&gt;
&lt;br /&gt;
As keypress characters needs to be injected into CEGUI, we activate unicode translation for SDL key events:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableUNICODE(1);&lt;br /&gt;
&lt;br /&gt;
This makes it alot easier as we don't have to worry about modifier keys and keyboard layouts ourselves. More about this later on...&lt;br /&gt;
&lt;br /&gt;
Key repeat is a nice feature for the text input widgets in CEGUI, so we use SDL to generate them:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);&lt;br /&gt;
&lt;br /&gt;
Everything is ready now, and we can start the main loop :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Main Loop ===&lt;br /&gt;
To make is all happen, we use a simple main loop that just keeps pushing on those frames:&lt;br /&gt;
&lt;br /&gt;
 void main_loop()&lt;br /&gt;
 {&lt;br /&gt;
   bool must_quit = false;&lt;br /&gt;
   &lt;br /&gt;
   // get &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
   double last_time_pulse = 0.001*static_cast&amp;lt;double&amp;gt;(SDL_GetTicks());&lt;br /&gt;
   &lt;br /&gt;
   while (!must_quit)&lt;br /&gt;
   {&lt;br /&gt;
     inject_input(must_quit);&lt;br /&gt;
     inject_time_pulse(last_time_pulse);&lt;br /&gt;
     render_gui();&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This function will run the main loop until the ''bool'' value ''must_quit'' becomes ''true''. In this tutorial this will happen when the user clicks the close button provided by the window manager (fx. Windows).&lt;br /&gt;
&lt;br /&gt;
The ''double'' value ''last_time_pulse'' holds the time of the latest time pulse injection. More about this later.&lt;br /&gt;
&lt;br /&gt;
Each function in the ''while'' loop will be described below.&lt;br /&gt;
&lt;br /&gt;
There are endless ways of making your main loop. I took a simple approach to ease writing this tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Injecting Input ===&lt;br /&gt;
When the user presses or release keyboard or mouse buttons, we need to tell CEGUI about it so we use the injection functions of ''CEGUI::System''.&lt;br /&gt;
&lt;br /&gt;
Here is what our inject_input function looks like:&lt;br /&gt;
&lt;br /&gt;
 void inject_input(bool&amp;amp; must_quit)&lt;br /&gt;
 {&lt;br /&gt;
   SDL_Event e;&lt;br /&gt;
   &lt;br /&gt;
   // go through all available events&lt;br /&gt;
   while (SDL_PollEvent(&amp;amp;e))&lt;br /&gt;
   {&lt;br /&gt;
     // we use a switch to determine the event type&lt;br /&gt;
     switch (e.type)&lt;br /&gt;
     {&lt;br /&gt;
       // mouse motion handler&lt;br /&gt;
       case SDL_MOUSEMOTION:&lt;br /&gt;
         // we inject the mouse position directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
         );&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     // mouse down handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button down event&lt;br /&gt;
         handle_mouse_down(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // mouse up handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button up event&lt;br /&gt;
         handle_mouse_up(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // key down&lt;br /&gt;
       case SDL_KEYDOWN:&lt;br /&gt;
         // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
         &lt;br /&gt;
         // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
         // this is described in more detail below.&lt;br /&gt;
         if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
         {&lt;br /&gt;
           CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
         }&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // key up&lt;br /&gt;
       case SDL_KEYUP:&lt;br /&gt;
         // like before we inject the scancode directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // WM quit event occured&lt;br /&gt;
       case SDL_QUIT:&lt;br /&gt;
         must_quit = true;&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
First I'll explain the events that get handled directly in the ''inject_input'' function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Motion''':&lt;br /&gt;
&lt;br /&gt;
 // we inject the mouse position directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
There is nothing special here. Like stated in the comment the mouse position is just injected directly.&lt;br /&gt;
&lt;br /&gt;
There are two ways of injecting mouse motion. One where you inject how much the cursor moved, and one where you inject the mouse cursor position. The last one is failsafe.&lt;br /&gt;
Then first one only works correctly in fullscreen mode, or with input grabbed. The reason for this is that in regular windowed mode, the mouse can be moved outside the application window, and during this time no mouse motion event are generated. So if we enter the window at another position, the real mousecursor and CEGUI's mouse cursor will be offset, which will break mouse usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Down'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This event is takes a little more work. CEGUI requires that key characters (the printable character the key represents) are injected alongside key codes.&lt;br /&gt;
&lt;br /&gt;
 // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
Luckily the key code is just the SDL scancode, so we inject that directly.&lt;br /&gt;
&lt;br /&gt;
 // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
 // this is described in more detail below.&lt;br /&gt;
 if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
 {&lt;br /&gt;
   CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Instead of formatting the keypress ourselves, we let SDL do it for us. For more information, take a look at the SDL documentation for this feature. [http://sdldoc.csn.ul.ie/sdlkeysym.php SDL_keysym].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This one is simple. Only the keycode need to injected. So we just use the scancode directly:&lt;br /&gt;
&lt;br /&gt;
 // like before we inject the scancode directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Down and Mouse Wheel'''&amp;lt;br /&amp;gt;&lt;br /&gt;
CEGUI and SDL are a little different when it comes to mouse button and mouse wheel event. So a little conversion is necessary. Here's the ''handle_mouse_down'' function that gets called when a mouse button down event occurs in SDL. It takes one parameter, a ''Uint8'' describing the mouse button that was pressed.&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_down(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		// handle real mouse buttons&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		&lt;br /&gt;
 		// handle the mouse wheel&lt;br /&gt;
 		case SDL_BUTTON_WHEELDOWN:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( -1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_WHEELUP:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( +1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
I chose a very &amp;quot;manual&amp;quot; conversion, but it works fine. Everything should be pretty self-explainatory.&lt;br /&gt;
As you can see mouse wheel events are emitted as mouse button down events in SDL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
The mouse button up event is handled very much like the mouse button down event, except there are no mousewheel release events.&lt;br /&gt;
Like ''handle_mouse_down'' it takes one parameter, a ''Uint8'' describing the mouse button that was pressed:&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_up(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Time Pulses ===&lt;br /&gt;
SDL has a built-in millisecond counter which we will use for this example. There are other to use timers with SDL, but I chose this approach as it is simple to use.&lt;br /&gt;
&lt;br /&gt;
Remember in the main loop where we stored the current &amp;quot;run-time&amp;quot; in seconds ? This value will be passed as a reference to ''inject_time_pulse'' which in turn will set a new value in it.&lt;br /&gt;
&lt;br /&gt;
CEGUI's interface for injecting time pulses requires that you pass the time in seconds that has passed since the last time pulse injection. Long sentence but it not that hard. Let's take a look at the function:&lt;br /&gt;
&lt;br /&gt;
 void inject_time_pulse(double&amp;amp; last_time_pulse)&lt;br /&gt;
 {&lt;br /&gt;
 	// get current &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
 	double t = 0.001*SDL_GetTicks();&lt;br /&gt;
 &lt;br /&gt;
 	// inject the time that passed since the last call &lt;br /&gt;
 	CEGUI::System::getSingleton().injectTimePulse( float(t-last_time_pulse) );&lt;br /&gt;
 &lt;br /&gt;
 	// store the new time as the last time&lt;br /&gt;
 	last_time_pulse = t;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The first line gets the actual &amp;quot;run-time&amp;quot; when called.&lt;br /&gt;
* The second line injects the time pulse as the difference between the current time and the last time.&lt;br /&gt;
* The third line stores the current time as the last time a time pulse was injected.&lt;br /&gt;
&lt;br /&gt;
This will work for about 47 days... After that the counter wraps to zero and it breaks...&lt;br /&gt;
&lt;br /&gt;
=== Rendering ===&lt;br /&gt;
Now all thats left is rendering something. :)&lt;br /&gt;
&lt;br /&gt;
 void render_gui()&lt;br /&gt;
 {&lt;br /&gt;
 	// clear the colour buffer&lt;br /&gt;
 	glClear( GL_COLOR_BUFFER_BIT );&lt;br /&gt;
 &lt;br /&gt;
 	// render the GUI :)&lt;br /&gt;
 	CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
 &lt;br /&gt;
 	// Update the screen&lt;br /&gt;
 	SDL_GL_SwapBuffers();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The line:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
&lt;br /&gt;
does all the CEGUI magic and sets state itself. As long as the viewport is setup, it will render the GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That's it. Now you know how to use SDL, OpenGL and CEGUI together. Have fun.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 16:21, 8 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=28</id>
		<title>Using CEGUI with SDL and OpenGL</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=28"/>
				<updated>2005-05-08T19:17:41Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.libsdl.org SDL (Simple DirectMedia Layer)] is an excellent library for writing portable games and other multimedia applications, but as it is a low-level library, it has no native support for GUI interfaces.&lt;br /&gt;
&lt;br /&gt;
When using [http://www.opengl.org OpenGL] for rendering, using CEGUI with SDL is not hard.&lt;br /&gt;
&lt;br /&gt;
I'll assume that you've read the imbiciles tutorials, and have used SDL with OpenGL.&lt;br /&gt;
And know C / C++ ...&lt;br /&gt;
&lt;br /&gt;
=== Initialisation ===&lt;br /&gt;
Before we can do anything, we need to initialise our libraries.&lt;br /&gt;
First SDL:&lt;br /&gt;
&lt;br /&gt;
 if (SDLInit(SDL_INIT_VIDEO|SDL_INIT_TIMER)&amp;lt;0)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to initialise SDL: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we initialise SDL with video and timer support. We need this for CEGUI.&lt;br /&gt;
O.K. now SDL is ready to go. So let's fire up OpenGL:&lt;br /&gt;
&lt;br /&gt;
 if (SDL_SetVideoMode(800,600,0,SDL_OPENGL)==NULL)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to set OpenGL videomode: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   SDL_Quit();&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now OpenGL is ready. But we still need to set a decent configuiration:&lt;br /&gt;
&lt;br /&gt;
 glEnable(GL_CULL_FACE);&lt;br /&gt;
 glClearColor(0.0f,0.0f,0.0f,1.0f);&lt;br /&gt;
 glViewport(0,0, 800,600);&lt;br /&gt;
&lt;br /&gt;
The OpenGL renderer that comes with CEGUI sets the matrices itself, so if you're only using CEGUI to display graphics this would be fine. Normally you would want a default 3D perspective setup:&lt;br /&gt;
&lt;br /&gt;
 glMatrixMode(GL_PROJECTION);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
 gluPerspective(45.0, 800.0/600.0, 0.1,100.0);&lt;br /&gt;
 glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
&lt;br /&gt;
SDL and OpenGL are now both ready for action. So it's time to initialise CEGUI.&lt;br /&gt;
First we need the renderer.&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;renderers/OpenGLGUIRenderer/openglrenderer.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It must be created before starting CEGUI.&lt;br /&gt;
&lt;br /&gt;
 CEGUI::OpenGLRenderer* renderer = new CEGUI::OpenGLRenderer(0,800,600);&lt;br /&gt;
&lt;br /&gt;
Then the CEGUI::System must be initialised:&lt;br /&gt;
&lt;br /&gt;
 new CEGUI::System(renderer);&lt;br /&gt;
&lt;br /&gt;
Remember that you have to load a widget set, set the mouse cursor and a default font before CEGUI is completely ready. This is described in the other tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the SDL cursor is displayed, so we'll remove that:&lt;br /&gt;
&lt;br /&gt;
 SDL_ShowCursor(SDL_DISABLE);&lt;br /&gt;
&lt;br /&gt;
As keypress characters needs to be injected into CEGUI, we activate unicode translation for SDL key events:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableUNICODE(1);&lt;br /&gt;
&lt;br /&gt;
This makes it alot easier as we don't have to worry about modifier keys and keyboard layouts ourselves. More about this later on...&lt;br /&gt;
&lt;br /&gt;
Key repeat is a nice feature for the text input widgets in CEGUI, so we use SDL to generate them:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);&lt;br /&gt;
&lt;br /&gt;
Everything is ready now, and we can start the main loop :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Main Loop ===&lt;br /&gt;
To make is all happen, we use a simple main loop that just keeps pushing on those frames:&lt;br /&gt;
&lt;br /&gt;
 void main_loop()&lt;br /&gt;
 {&lt;br /&gt;
   bool must_quit = false;&lt;br /&gt;
   &lt;br /&gt;
   // get &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
   double last_time_pulse = 0.001*static_cast&amp;lt;double&amp;gt;(SDL_GetTicks());&lt;br /&gt;
   &lt;br /&gt;
   while (!must_quit)&lt;br /&gt;
   {&lt;br /&gt;
     inject_input(must_quit);&lt;br /&gt;
     inject_time_pulse(last_time_pulse);&lt;br /&gt;
     render_gui();&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This function will run the main loop until the ''bool'' value ''must_quit'' becomes ''true''. In this tutorial this will happen when the user clicks the close button provided by the window manager (fx. Windows).&lt;br /&gt;
&lt;br /&gt;
The ''double'' value ''last_time_pulse'' holds the time of the latest time pulse injection. More about this later.&lt;br /&gt;
&lt;br /&gt;
Each function in the ''while'' loop will be described below.&lt;br /&gt;
&lt;br /&gt;
There are endless ways of making your main loop. I took a simple approach to ease writing this tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Injecting Input ===&lt;br /&gt;
When the user presses or release keyboard or mouse buttons, we need to tell CEGUI about it so we use the injection functions of ''CEGUI::System''.&lt;br /&gt;
&lt;br /&gt;
Here is what our inject_input function looks like:&lt;br /&gt;
&lt;br /&gt;
 void inject_input(bool&amp;amp; must_quit)&lt;br /&gt;
 {&lt;br /&gt;
   SDL_Event e;&lt;br /&gt;
   &lt;br /&gt;
   // go through all available events&lt;br /&gt;
   while (SDL_PollEvent(&amp;amp;e))&lt;br /&gt;
   {&lt;br /&gt;
     // we use a switch to determine the event type&lt;br /&gt;
     switch (e.type)&lt;br /&gt;
     {&lt;br /&gt;
       // mouse motion handler&lt;br /&gt;
       case SDL_MOUSEMOTION:&lt;br /&gt;
         // we inject the mouse position directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
         );&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     // mouse down handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button down event&lt;br /&gt;
         handle_mouse_down(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // mouse up handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button up event&lt;br /&gt;
         handle_mouse_up(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // key down&lt;br /&gt;
       case SDL_KEYDOWN:&lt;br /&gt;
         // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
         &lt;br /&gt;
         // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
         // this is described in more detail below.&lt;br /&gt;
         if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
         {&lt;br /&gt;
           CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
         }&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // key up&lt;br /&gt;
       case SDL_KEYUP:&lt;br /&gt;
         // like before we inject the scancode directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // WM quit event occured&lt;br /&gt;
       case SDL_QUIT:&lt;br /&gt;
         must_quit = true;&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
First I'll explain the events that get handled directly in the ''inject_input'' function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Motion''':&lt;br /&gt;
&lt;br /&gt;
 // we inject the mouse position directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
There is nothing special here. Like stated in the comment the mouse position is just injected directly.&lt;br /&gt;
&lt;br /&gt;
There are two ways of injecting mouse motion. One where you inject how much the cursor moved, and one where you inject the mouse cursor position. The last one is failsafe.&lt;br /&gt;
Then first one only works correctly in fullscreen mode, or with input grabbed. The reason for this is that in regular windowed mode, the mouse can be moved outside the application window, and during this time no mouse motion event are generated. So if we enter the window at another position, the real mousecursor and CEGUI's mouse cursor will be offset, which will break mouse usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Down'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This event is takes a little more work. CEGUI requires that key characters (the printable character the key represents) are injected alongside key codes.&lt;br /&gt;
&lt;br /&gt;
 // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
Luckily the key code is just the SDL scancode, so we inject that directly.&lt;br /&gt;
&lt;br /&gt;
 // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
 // this is described in more detail below.&lt;br /&gt;
 if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
 {&lt;br /&gt;
   CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Instead of formatting the keypress ourselves, we let SDL do it for us. For more information, take a look at the SDL documentation for this feature. [http://sdldoc.csn.ul.ie/sdlkeysym.php SDL_keysym].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This one is simple. Only the keycode need to injected. So we just use the scancode directly:&lt;br /&gt;
&lt;br /&gt;
 // like before we inject the scancode directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Down and Mouse Wheel'''&amp;lt;br /&amp;gt;&lt;br /&gt;
CEGUI and SDL are a little different when it comes to mouse button and mouse wheel event. So a little conversion is necessary. Here's the ''handle_mouse_down'' function that gets called when a mouse button down event occurs in SDL. It takes one parameter, a ''Uint8'' describing the mouse button that was pressed.&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_down(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		// handle real mouse buttons&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		&lt;br /&gt;
 		// handle the mouse wheel&lt;br /&gt;
 		case SDL_BUTTON_WHEELDOWN:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( -1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_WHEELUP:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( +1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
I chose a very &amp;quot;manual&amp;quot; conversion, but it works fine. Everything should be pretty self-explainatory.&lt;br /&gt;
As you can see mouse wheel events are emitted as mouse button down events in SDL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
The mouse button up event is handled very much like the mouse button down event, except there are no mousewheel release events.&lt;br /&gt;
Like ''handle_mouse_down'' it takes one parameter, a ''Uint8'' describing the mouse button that was pressed:&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_up(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Time Pulses ===&lt;br /&gt;
SDL has a built-in millisecond counter which we will use for this example. There are other to use timers with SDL, but I chose this approach as it is simple to use.&lt;br /&gt;
&lt;br /&gt;
Remember in the main loop where we stored the current &amp;quot;run-time&amp;quot; in seconds ? This value will be passed as a reference to ''inject_time_pulse'' which in turn will set a new value in it.&lt;br /&gt;
&lt;br /&gt;
CEGUI's interface for injecting time pulses requires that you pass the time in seconds that has passed since the last time pulse injection. Long sentence but it not that hard. Let's take a look at the function:&lt;br /&gt;
&lt;br /&gt;
 void inject_time_pulse(double&amp;amp; last_time_pulse)&lt;br /&gt;
 {&lt;br /&gt;
 	// get current &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
 	double t = 0.001*SDL_GetTicks();&lt;br /&gt;
&lt;br /&gt;
 	// inject the time that passed since the last call &lt;br /&gt;
 	CEGUI::System::getSingleton().injectTimePulse( float(t-last_time_pulse) );&lt;br /&gt;
 &lt;br /&gt;
 	// store the new time as the last time&lt;br /&gt;
 	last_time_pulse = t;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The first line gets the actual &amp;quot;run-time&amp;quot; when called.&lt;br /&gt;
* The second line injects the time pulse as the difference between the current time and the last time.&lt;br /&gt;
* The third line stores the current time as the last time a time pulse was injected.&lt;br /&gt;
&lt;br /&gt;
This will work for about 47 days... After that the counter wraps to zero and it breaks...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Rendering ===&lt;br /&gt;
Now all thats left is rendering something. :)&lt;br /&gt;
&lt;br /&gt;
 void render_gui()&lt;br /&gt;
 {&lt;br /&gt;
 	// clear the colour buffer&lt;br /&gt;
 	glClear( GL_COLOR_BUFFER_BIT );&lt;br /&gt;
 &lt;br /&gt;
 	// render the GUI :)&lt;br /&gt;
 	CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
 &lt;br /&gt;
 	// Update the screen&lt;br /&gt;
 	SDL_GL_SwapBuffers();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The line:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
&lt;br /&gt;
does all the CEGUI magic and sets state itself. As long as the viewport is setup, it will render the GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That's it. Now you know how to use SDL, OpenGL and CEGUI together. Have fun.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 16:21, 8 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=27</id>
		<title>Using CEGUI with SDL and OpenGL</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=27"/>
				<updated>2005-05-08T19:16:57Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: /* Time Pulses */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.libsdl.org SDL (Simple DirectMedia Layer)] is an excellent library for writing portable games and other multimedia applications, but as it is a low-level library, it has no native support for GUI interfaces.&lt;br /&gt;
&lt;br /&gt;
When using [http://www.opengl.org OpenGL] for rendering, using CEGUI with SDL is not hard.&lt;br /&gt;
&lt;br /&gt;
I'll assume that you've read the imbiciles tutorials, and have used SDL with OpenGL.&lt;br /&gt;
And know C / C++ ...&lt;br /&gt;
&lt;br /&gt;
=== Initialisation ===&lt;br /&gt;
Before we can do anything, we need to initialise our libraries.&lt;br /&gt;
First SDL:&lt;br /&gt;
&lt;br /&gt;
 if (SDLInit(SDL_INIT_VIDEO|SDL_INIT_TIMER)&amp;lt;0)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to initialise SDL: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we initialise SDL with video and timer support. We need this for CEGUI.&lt;br /&gt;
O.K. now SDL is ready to go. So let's fire up OpenGL:&lt;br /&gt;
&lt;br /&gt;
 if (SDL_SetVideoMode(800,600,0,SDL_OPENGL)==NULL)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to set OpenGL videomode: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   SDL_Quit();&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now OpenGL is ready. But we still need to set a decent configuiration:&lt;br /&gt;
&lt;br /&gt;
 glEnable(GL_CULL_FACE);&lt;br /&gt;
 glClearColor(0.0f,0.0f,0.0f,1.0f);&lt;br /&gt;
 glViewport(0,0, 800,600);&lt;br /&gt;
&lt;br /&gt;
The OpenGL renderer that comes with CEGUI sets the matrices itself, so if you're only using CEGUI to display graphics this would be fine. Normally you would want a default 3D perspective setup:&lt;br /&gt;
&lt;br /&gt;
 glMatrixMode(GL_PROJECTION);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
 gluPerspective(45.0, 800.0/600.0, 0.1,100.0);&lt;br /&gt;
 glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
&lt;br /&gt;
SDL and OpenGL are now both ready for action. So it's time to initialise CEGUI.&lt;br /&gt;
First we need the renderer.&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;renderers/OpenGLGUIRenderer/openglrenderer.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It must be created before starting CEGUI.&lt;br /&gt;
&lt;br /&gt;
 CEGUI::OpenGLRenderer* renderer = new CEGUI::OpenGLRenderer(0,800,600);&lt;br /&gt;
&lt;br /&gt;
Then the CEGUI::System must be initialised:&lt;br /&gt;
&lt;br /&gt;
 new CEGUI::System(renderer);&lt;br /&gt;
&lt;br /&gt;
Remember that you have to load a widget set, set the mouse cursor and a default font before CEGUI is completely ready. This is described in the other tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the SDL cursor is displayed, so we'll remove that:&lt;br /&gt;
&lt;br /&gt;
 SDL_ShowCursor(SDL_DISABLE);&lt;br /&gt;
&lt;br /&gt;
As keypress characters needs to be injected into CEGUI, we activate unicode translation for SDL key events:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableUNICODE(1);&lt;br /&gt;
&lt;br /&gt;
This makes it alot easier as we don't have to worry about modifier keys and keyboard layouts ourselves. More about this later on...&lt;br /&gt;
&lt;br /&gt;
Key repeat is a nice feature for the text input widgets in CEGUI, so we use SDL to generate them:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);&lt;br /&gt;
&lt;br /&gt;
Everything is ready now, and we can start the main loop :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Main Loop ===&lt;br /&gt;
To make is all happen, we use a simple main loop that just keeps pushing on those frames:&lt;br /&gt;
&lt;br /&gt;
 void main_loop()&lt;br /&gt;
 {&lt;br /&gt;
   bool must_quit = false;&lt;br /&gt;
   &lt;br /&gt;
   // get &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
   double last_time_pulse = 0.001*static_cast&amp;lt;double&amp;gt;(SDL_GetTicks());&lt;br /&gt;
   &lt;br /&gt;
   while (!must_quit)&lt;br /&gt;
   {&lt;br /&gt;
     inject_input(must_quit);&lt;br /&gt;
     inject_time_pulse(last_time_pulse);&lt;br /&gt;
     render_gui();&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This function will run the main loop until the ''bool'' value ''must_quit'' becomes ''true''. In this tutorial this will happen when the user clicks the close button provided by the window manager (fx. Windows).&lt;br /&gt;
&lt;br /&gt;
The ''double'' value ''last_time_pulse'' holds the time of the latest time pulse injection. More about this later.&lt;br /&gt;
&lt;br /&gt;
Each function in the ''while'' loop will be described below.&lt;br /&gt;
&lt;br /&gt;
There are endless ways of making your main loop. I took a simple approach to ease writing this tutorial.&lt;br /&gt;
&lt;br /&gt;
=== Injecting Input ===&lt;br /&gt;
When the user presses or release keyboard or mouse buttons, we need to tell CEGUI about it so we use the injection functions of ''CEGUI::System''.&lt;br /&gt;
&lt;br /&gt;
Here is what our inject_input function looks like:&lt;br /&gt;
&lt;br /&gt;
 void inject_input(bool&amp;amp; must_quit)&lt;br /&gt;
 {&lt;br /&gt;
   SDL_Event e;&lt;br /&gt;
   &lt;br /&gt;
   // go through all available events&lt;br /&gt;
   while (SDL_PollEvent(&amp;amp;e))&lt;br /&gt;
   {&lt;br /&gt;
     // we use a switch to determine the event type&lt;br /&gt;
     switch (e.type)&lt;br /&gt;
     {&lt;br /&gt;
       // mouse motion handler&lt;br /&gt;
       case SDL_MOUSEMOTION:&lt;br /&gt;
         // we inject the mouse position directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
         );&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     // mouse down handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button down event&lt;br /&gt;
         handle_mouse_down(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // mouse up handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button up event&lt;br /&gt;
         handle_mouse_up(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // key down&lt;br /&gt;
       case SDL_KEYDOWN:&lt;br /&gt;
         // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
         &lt;br /&gt;
         // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
         // this is described in more detail below.&lt;br /&gt;
         if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
         {&lt;br /&gt;
           CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
         }&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // key up&lt;br /&gt;
       case SDL_KEYUP:&lt;br /&gt;
         // like before we inject the scancode directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // WM quit event occured&lt;br /&gt;
       case SDL_QUIT:&lt;br /&gt;
         must_quit = true;&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
First I'll explain the events that get handled directly in the ''inject_input'' function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Motion''':&lt;br /&gt;
&lt;br /&gt;
 // we inject the mouse position directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
There is nothing special here. Like stated in the comment the mouse position is just injected directly.&lt;br /&gt;
&lt;br /&gt;
There are two ways of injecting mouse motion. One where you inject how much the cursor moved, and one where you inject the mouse cursor position. The last one is failsafe.&lt;br /&gt;
Then first one only works correctly in fullscreen mode, or with input grabbed. The reason for this is that in regular windowed mode, the mouse can be moved outside the application window, and during this time no mouse motion event are generated. So if we enter the window at another position, the real mousecursor and CEGUI's mouse cursor will be offset, which will break mouse usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Down'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This event is takes a little more work. CEGUI requires that key characters (the printable character the key represents) are injected alongside key codes.&lt;br /&gt;
&lt;br /&gt;
 // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
Luckily the key code is just the SDL scancode, so we inject that directly.&lt;br /&gt;
&lt;br /&gt;
 // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
 // this is described in more detail below.&lt;br /&gt;
 if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
 {&lt;br /&gt;
   CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Instead of formatting the keypress ourselves, we let SDL do it for us. For more information, take a look at the SDL documentation for this feature. [http://sdldoc.csn.ul.ie/sdlkeysym.php SDL_keysym].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This one is simple. Only the keycode need to injected. So we just use the scancode directly:&lt;br /&gt;
&lt;br /&gt;
 // like before we inject the scancode directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Down and Mouse Wheel'''&amp;lt;br /&amp;gt;&lt;br /&gt;
CEGUI and SDL are a little different when it comes to mouse button and mouse wheel event. So a little conversion is necessary. Here's the ''handle_mouse_down'' function that gets called when a mouse button down event occurs in SDL. It takes one parameter, a ''Uint8'' describing the mouse button that was pressed.&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_down(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		// handle real mouse buttons&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		&lt;br /&gt;
 		// handle the mouse wheel&lt;br /&gt;
 		case SDL_BUTTON_WHEELDOWN:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( -1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_WHEELUP:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( +1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
I chose a very &amp;quot;manual&amp;quot; conversion, but it works fine. Everything should be pretty self-explainatory.&lt;br /&gt;
As you can see mouse wheel events are emitted as mouse button down events in SDL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
The mouse button up event is handled very much like the mouse button down event, except there are no mousewheel release events.&lt;br /&gt;
Like ''handle_mouse_down'' it takes one parameter, a ''Uint8'' describing the mouse button that was pressed:&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_up(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Time Pulses ===&lt;br /&gt;
SDL has a built-in millisecond counter which we will use for this example. There are other to use timers with SDL, but I chose this approach as it is simple to use.&lt;br /&gt;
&lt;br /&gt;
Remember in the main loop where we stored the current &amp;quot;run-time&amp;quot; in seconds ? This value will be passed as a reference to ''inject_time_pulse'' which in turn will set a new value in it.&lt;br /&gt;
&lt;br /&gt;
CEGUI's interface for injecting time pulses requires that you pass the time in seconds that has passed since the last time pulse injection. Long sentence but it not that hard. Let's take a look at the function:&lt;br /&gt;
&lt;br /&gt;
 void inject_time_pulse(double&amp;amp; last_time_pulse)&lt;br /&gt;
 {&lt;br /&gt;
 	// get current &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
 	double t = 0.001*SDL_GetTicks();&lt;br /&gt;
&lt;br /&gt;
 	// inject the time that passed since the last call &lt;br /&gt;
 	CEGUI::System::getSingleton().injectTimePulse( float(t-last_time_pulse) );&lt;br /&gt;
 &lt;br /&gt;
 	// store the new time as the last time&lt;br /&gt;
 	last_time_pulse = t;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The first line gets the actual &amp;quot;run-time&amp;quot; when called.&lt;br /&gt;
* The second line injects the time pulse as the difference between the current time and the last time.&lt;br /&gt;
* The third line stores the current time as the last time a time pulse was injected.&lt;br /&gt;
&lt;br /&gt;
This will work for about 47 days... After that the counter wraps to zero and it breaks...&lt;br /&gt;
&lt;br /&gt;
=== Rendering ===&lt;br /&gt;
Now all thats left is rendering something. :)&lt;br /&gt;
&lt;br /&gt;
 void render_gui()&lt;br /&gt;
 {&lt;br /&gt;
 	// clear the colour buffer&lt;br /&gt;
 	glClear( GL_COLOR_BUFFER_BIT );&lt;br /&gt;
 &lt;br /&gt;
 	// render the GUI :)&lt;br /&gt;
 	CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
 &lt;br /&gt;
 	// Update the screen&lt;br /&gt;
 	SDL_GL_SwapBuffers();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The line:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
&lt;br /&gt;
does all the CEGUI magic and sets state itself. As long as the viewport is setup, it will render the GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That's it. Now you know how to use SDL, OpenGL and CEGUI together. Have fun.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 16:21, 8 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=26</id>
		<title>Using CEGUI with SDL and OpenGL</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=26"/>
				<updated>2005-05-08T19:15:26Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: /* Rendering */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.libsdl.org SDL (Simple DirectMedia Layer)] is an excellent library for writing portable games and other multimedia applications, but as it is a low-level library, it has no native support for GUI interfaces.&lt;br /&gt;
&lt;br /&gt;
When using [http://www.opengl.org OpenGL] for rendering, using CEGUI with SDL is not hard.&lt;br /&gt;
&lt;br /&gt;
I'll assume that you've read the imbiciles tutorials, and have used SDL with OpenGL.&lt;br /&gt;
And know C / C++ ...&lt;br /&gt;
&lt;br /&gt;
=== Initialisation ===&lt;br /&gt;
Before we can do anything, we need to initialise our libraries.&lt;br /&gt;
First SDL:&lt;br /&gt;
&lt;br /&gt;
 if (SDLInit(SDL_INIT_VIDEO|SDL_INIT_TIMER)&amp;lt;0)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to initialise SDL: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we initialise SDL with video and timer support. We need this for CEGUI.&lt;br /&gt;
O.K. now SDL is ready to go. So let's fire up OpenGL:&lt;br /&gt;
&lt;br /&gt;
 if (SDL_SetVideoMode(800,600,0,SDL_OPENGL)==NULL)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to set OpenGL videomode: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   SDL_Quit();&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now OpenGL is ready. But we still need to set a decent configuiration:&lt;br /&gt;
&lt;br /&gt;
 glEnable(GL_CULL_FACE);&lt;br /&gt;
 glClearColor(0.0f,0.0f,0.0f,1.0f);&lt;br /&gt;
 glViewport(0,0, 800,600);&lt;br /&gt;
&lt;br /&gt;
The OpenGL renderer that comes with CEGUI sets the matrices itself, so if you're only using CEGUI to display graphics this would be fine. Normally you would want a default 3D perspective setup:&lt;br /&gt;
&lt;br /&gt;
 glMatrixMode(GL_PROJECTION);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
 gluPerspective(45.0, 800.0/600.0, 0.1,100.0);&lt;br /&gt;
 glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
&lt;br /&gt;
SDL and OpenGL are now both ready for action. So it's time to initialise CEGUI.&lt;br /&gt;
First we need the renderer.&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;renderers/OpenGLGUIRenderer/openglrenderer.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It must be created before starting CEGUI.&lt;br /&gt;
&lt;br /&gt;
 CEGUI::OpenGLRenderer* renderer = new CEGUI::OpenGLRenderer(0,800,600);&lt;br /&gt;
&lt;br /&gt;
Then the CEGUI::System must be initialised:&lt;br /&gt;
&lt;br /&gt;
 new CEGUI::System(renderer);&lt;br /&gt;
&lt;br /&gt;
Remember that you have to load a widget set, set the mouse cursor and a default font before CEGUI is completely ready. This is described in the other tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the SDL cursor is displayed, so we'll remove that:&lt;br /&gt;
&lt;br /&gt;
 SDL_ShowCursor(SDL_DISABLE);&lt;br /&gt;
&lt;br /&gt;
As keypress characters needs to be injected into CEGUI, we activate unicode translation for SDL key events:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableUNICODE(1);&lt;br /&gt;
&lt;br /&gt;
This makes it alot easier as we don't have to worry about modifier keys and keyboard layouts ourselves. More about this later on...&lt;br /&gt;
&lt;br /&gt;
Key repeat is a nice feature for the text input widgets in CEGUI, so we use SDL to generate them:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);&lt;br /&gt;
&lt;br /&gt;
Everything is ready now, and we can start the main loop :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Main Loop ===&lt;br /&gt;
To make is all happen, we use a simple main loop that just keeps pushing on those frames:&lt;br /&gt;
&lt;br /&gt;
 void main_loop()&lt;br /&gt;
 {&lt;br /&gt;
   bool must_quit = false;&lt;br /&gt;
   &lt;br /&gt;
   // get &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
   double last_time_pulse = 0.001*static_cast&amp;lt;double&amp;gt;(SDL_GetTicks());&lt;br /&gt;
   &lt;br /&gt;
   while (!must_quit)&lt;br /&gt;
   {&lt;br /&gt;
     inject_input(must_quit);&lt;br /&gt;
     inject_time_pulse(last_time_pulse);&lt;br /&gt;
     render_gui();&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This function will run the main loop until the ''bool'' value ''must_quit'' becomes ''true''. In this tutorial this will happen when the user clicks the close button provided by the window manager (fx. Windows).&lt;br /&gt;
&lt;br /&gt;
The ''double'' value ''last_time_pulse'' holds the time of the latest time pulse injection. More about this later.&lt;br /&gt;
&lt;br /&gt;
Each function in the ''while'' loop will be described below.&lt;br /&gt;
&lt;br /&gt;
There are endless ways of making your main loop. I took a simple approach to ease writing this tutorial.&lt;br /&gt;
&lt;br /&gt;
=== Injecting Input ===&lt;br /&gt;
When the user presses or release keyboard or mouse buttons, we need to tell CEGUI about it so we use the injection functions of ''CEGUI::System''.&lt;br /&gt;
&lt;br /&gt;
Here is what our inject_input function looks like:&lt;br /&gt;
&lt;br /&gt;
 void inject_input(bool&amp;amp; must_quit)&lt;br /&gt;
 {&lt;br /&gt;
   SDL_Event e;&lt;br /&gt;
   &lt;br /&gt;
   // go through all available events&lt;br /&gt;
   while (SDL_PollEvent(&amp;amp;e))&lt;br /&gt;
   {&lt;br /&gt;
     // we use a switch to determine the event type&lt;br /&gt;
     switch (e.type)&lt;br /&gt;
     {&lt;br /&gt;
       // mouse motion handler&lt;br /&gt;
       case SDL_MOUSEMOTION:&lt;br /&gt;
         // we inject the mouse position directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
         );&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     // mouse down handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button down event&lt;br /&gt;
         handle_mouse_down(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // mouse up handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button up event&lt;br /&gt;
         handle_mouse_up(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // key down&lt;br /&gt;
       case SDL_KEYDOWN:&lt;br /&gt;
         // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
         &lt;br /&gt;
         // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
         // this is described in more detail below.&lt;br /&gt;
         if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
         {&lt;br /&gt;
           CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
         }&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // key up&lt;br /&gt;
       case SDL_KEYUP:&lt;br /&gt;
         // like before we inject the scancode directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // WM quit event occured&lt;br /&gt;
       case SDL_QUIT:&lt;br /&gt;
         must_quit = true;&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
First I'll explain the events that get handled directly in the ''inject_input'' function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Motion''':&lt;br /&gt;
&lt;br /&gt;
 // we inject the mouse position directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
There is nothing special here. Like stated in the comment the mouse position is just injected directly.&lt;br /&gt;
&lt;br /&gt;
There are two ways of injecting mouse motion. One where you inject how much the cursor moved, and one where you inject the mouse cursor position. The last one is failsafe.&lt;br /&gt;
Then first one only works correctly in fullscreen mode, or with input grabbed. The reason for this is that in regular windowed mode, the mouse can be moved outside the application window, and during this time no mouse motion event are generated. So if we enter the window at another position, the real mousecursor and CEGUI's mouse cursor will be offset, which will break mouse usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Down'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This event is takes a little more work. CEGUI requires that key characters (the printable character the key represents) are injected alongside key codes.&lt;br /&gt;
&lt;br /&gt;
 // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
Luckily the key code is just the SDL scancode, so we inject that directly.&lt;br /&gt;
&lt;br /&gt;
 // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
 // this is described in more detail below.&lt;br /&gt;
 if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
 {&lt;br /&gt;
   CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Instead of formatting the keypress ourselves, we let SDL do it for us. For more information, take a look at the SDL documentation for this feature. [http://sdldoc.csn.ul.ie/sdlkeysym.php SDL_keysym].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This one is simple. Only the keycode need to injected. So we just use the scancode directly:&lt;br /&gt;
&lt;br /&gt;
 // like before we inject the scancode directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Down and Mouse Wheel'''&amp;lt;br /&amp;gt;&lt;br /&gt;
CEGUI and SDL are a little different when it comes to mouse button and mouse wheel event. So a little conversion is necessary. Here's the ''handle_mouse_down'' function that gets called when a mouse button down event occurs in SDL. It takes one parameter, a ''Uint8'' describing the mouse button that was pressed.&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_down(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		// handle real mouse buttons&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		&lt;br /&gt;
 		// handle the mouse wheel&lt;br /&gt;
 		case SDL_BUTTON_WHEELDOWN:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( -1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_WHEELUP:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( +1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
I chose a very &amp;quot;manual&amp;quot; conversion, but it works fine. Everything should be pretty self-explainatory.&lt;br /&gt;
As you can see mouse wheel events are emitted as mouse button down events in SDL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
The mouse button up event is handled very much like the mouse button down event, except there are no mousewheel release events.&lt;br /&gt;
Like ''handle_mouse_down'' it takes one parameter, a ''Uint8'' describing the mouse button that was pressed:&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_up(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Time Pulses ===&lt;br /&gt;
SDL has a built-in millisecond counter which we will use for this example. There are other to use timers with SDL, but I chose this approach as it is simple to use.&lt;br /&gt;
&lt;br /&gt;
Remember in the main loop where we stored the current &amp;quot;run-time&amp;quot; in seconds ? This value will be passed as a reference to ''inject_time_pulse'' which in turn will set a new value in it.&lt;br /&gt;
&lt;br /&gt;
CEGUI's interface for injecting time pulses requires that you pass the time in seconds that has passed since the last time pulse injection. Long sentence but it not that hard. Let's take a look at the function:&lt;br /&gt;
&lt;br /&gt;
 void inject_time_pulse(double&amp;amp; last_time_pulse)&lt;br /&gt;
 {&lt;br /&gt;
 	// get current &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
 	double t = 0.001*SDL_GetTicks();&lt;br /&gt;
&lt;br /&gt;
 	// inject the time that passed since the last call &lt;br /&gt;
 	CEGUI::System::getSingleton().injectTimePulse( float(t-last_time_pulse) );&lt;br /&gt;
 &lt;br /&gt;
 	// store the new time as the last time&lt;br /&gt;
 	last_time_pulse = t;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The first line get the actual &amp;quot;run-time&amp;quot; when called.&lt;br /&gt;
* The second line injects the time pulse as the difference between the current time and the last time.&lt;br /&gt;
* The third line stores the current time as the last time a time pulse was injected.&lt;br /&gt;
&lt;br /&gt;
This will work for about 47 days... After that the counter wraps to zero and it breaks...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Rendering ===&lt;br /&gt;
Now all thats left is rendering something. :)&lt;br /&gt;
&lt;br /&gt;
 void render_gui()&lt;br /&gt;
 {&lt;br /&gt;
 	// clear the colour buffer&lt;br /&gt;
 	glClear( GL_COLOR_BUFFER_BIT );&lt;br /&gt;
 &lt;br /&gt;
 	// render the GUI :)&lt;br /&gt;
 	CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
 &lt;br /&gt;
 	// Update the screen&lt;br /&gt;
 	SDL_GL_SwapBuffers();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The line:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
&lt;br /&gt;
does all the CEGUI magic and sets state itself. As long as the viewport is setup, it will render the GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That's it. Now you know how to use SDL, OpenGL and CEGUI together. Have fun.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 16:21, 8 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=35</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=35"/>
				<updated>2005-05-08T15:23:25Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== CrazyEddie's 'Imbeciles' Guides ===&lt;br /&gt;
* [[The Imbeciles Guide to Getting CEGUI Rendering]] - How to initialise CEGUI to render properly.&lt;br /&gt;
* [[The Imbeciles Guide to Loading Data Files and Initialisation]] - How to load some data files and perform basic system initialisation.&lt;br /&gt;
* [[The Imbeciles Guide to Creating a CEGUI Window]] - How to create a simple window and get it on screen.&lt;br /&gt;
* [[The Imbeciles Guide to Injecting Inputs]] - How to inject inputs into CEGUI and get interactive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lindquist's Lua Scripting with CEGUI Guides ===&lt;br /&gt;
* [[Getting Started with Lua and CEGUI]] - How to initialise CEGUI with a Lua script module and configuration file.&lt;br /&gt;
* [[Handling Events from Lua]] - How to load Lua script files and bind CEGUI events to Lua functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== SDL Tutorials ===&lt;br /&gt;
* [[Using CEGUI with SDL and OpenGL]] - How to get SDL, OpenGL and CEGUI running together.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=24</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=24"/>
				<updated>2005-05-08T15:23:10Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== CrazyEddie's 'Imbeciles' Guides ===&lt;br /&gt;
* [[The Imbeciles Guide to Getting CEGUI Rendering]] - How to initialise CEGUI to render properly.&lt;br /&gt;
* [[The Imbeciles Guide to Loading Data Files and Initialisation]] - How to load some data files and perform basic system initialisation.&lt;br /&gt;
* [[The Imbeciles Guide to Creating a CEGUI Window]] - How to create a simple window and get it on screen.&lt;br /&gt;
* [[The Imbeciles Guide to Injecting Inputs]] - How to inject inputs into CEGUI and get interactive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lindquist's Lua Scripting with CEGUI Guides ===&lt;br /&gt;
* [[Getting Started with Lua and CEGUI]] - How to initialise CEGUI with a Lua script module and configuration file.&lt;br /&gt;
* [[Handling Events from Lua]] - How to load Lua script files and bind CEGUI events to Lua functions.&lt;br /&gt;
&lt;br /&gt;
=== SDL Tutorials ===&lt;br /&gt;
* [[Using CEGUI with SDL and OpenGL]] - How to get SDL, OpenGL and CEGUI running together.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=25</id>
		<title>Using CEGUI with SDL and OpenGL</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Using_CEGUI_with_SDL_and_OpenGL&amp;diff=25"/>
				<updated>2005-05-08T15:21:13Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.libsdl.org SDL (Simple DirectMedia Layer)] is an excellent library for writing portable games and other multimedia applications, but as it is a low-level library, it has no native support for GUI interfaces.&lt;br /&gt;
&lt;br /&gt;
When using [http://www.opengl.org OpenGL] for rendering, using CEGUI with SDL is not hard.&lt;br /&gt;
&lt;br /&gt;
I'll assume that you've read the imbiciles tutorials, and have used SDL with OpenGL.&lt;br /&gt;
And know C / C++ ...&lt;br /&gt;
&lt;br /&gt;
=== Initialisation ===&lt;br /&gt;
Before we can do anything, we need to initialise our libraries.&lt;br /&gt;
First SDL:&lt;br /&gt;
&lt;br /&gt;
 if (SDLInit(SDL_INIT_VIDEO|SDL_INIT_TIMER)&amp;lt;0)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to initialise SDL: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we initialise SDL with video and timer support. We need this for CEGUI.&lt;br /&gt;
O.K. now SDL is ready to go. So let's fire up OpenGL:&lt;br /&gt;
&lt;br /&gt;
 if (SDL_SetVideoMode(800,600,0,SDL_OPENGL)==NULL)&lt;br /&gt;
 {&lt;br /&gt;
   fprintf(stderr, &amp;quot;Unable to set OpenGL videomode: %s&amp;quot;, SDL_GetError());&lt;br /&gt;
   SDL_Quit();&lt;br /&gt;
   exit(0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now OpenGL is ready. But we still need to set a decent configuiration:&lt;br /&gt;
&lt;br /&gt;
 glEnable(GL_CULL_FACE);&lt;br /&gt;
 glClearColor(0.0f,0.0f,0.0f,1.0f);&lt;br /&gt;
 glViewport(0,0, 800,600);&lt;br /&gt;
&lt;br /&gt;
The OpenGL renderer that comes with CEGUI sets the matrices itself, so if you're only using CEGUI to display graphics this would be fine. Normally you would want a default 3D perspective setup:&lt;br /&gt;
&lt;br /&gt;
 glMatrixMode(GL_PROJECTION);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
 gluPerspective(45.0, 800.0/600.0, 0.1,100.0);&lt;br /&gt;
 glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
 glLoadIdentity();&lt;br /&gt;
&lt;br /&gt;
SDL and OpenGL are now both ready for action. So it's time to initialise CEGUI.&lt;br /&gt;
First we need the renderer.&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;renderers/OpenGLGUIRenderer/openglrenderer.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It must be created before starting CEGUI.&lt;br /&gt;
&lt;br /&gt;
 CEGUI::OpenGLRenderer* renderer = new CEGUI::OpenGLRenderer(0,800,600);&lt;br /&gt;
&lt;br /&gt;
Then the CEGUI::System must be initialised:&lt;br /&gt;
&lt;br /&gt;
 new CEGUI::System(renderer);&lt;br /&gt;
&lt;br /&gt;
Remember that you have to load a widget set, set the mouse cursor and a default font before CEGUI is completely ready. This is described in the other tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the SDL cursor is displayed, so we'll remove that:&lt;br /&gt;
&lt;br /&gt;
 SDL_ShowCursor(SDL_DISABLE);&lt;br /&gt;
&lt;br /&gt;
As keypress characters needs to be injected into CEGUI, we activate unicode translation for SDL key events:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableUNICODE(1);&lt;br /&gt;
&lt;br /&gt;
This makes it alot easier as we don't have to worry about modifier keys and keyboard layouts ourselves. More about this later on...&lt;br /&gt;
&lt;br /&gt;
Key repeat is a nice feature for the text input widgets in CEGUI, so we use SDL to generate them:&lt;br /&gt;
&lt;br /&gt;
 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);&lt;br /&gt;
&lt;br /&gt;
Everything is ready now, and we can start the main loop :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Main Loop ===&lt;br /&gt;
To make is all happen, we use a simple main loop that just keeps pushing on those frames:&lt;br /&gt;
&lt;br /&gt;
 void main_loop()&lt;br /&gt;
 {&lt;br /&gt;
   bool must_quit = false;&lt;br /&gt;
   &lt;br /&gt;
   // get &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
   double last_time_pulse = 0.001*static_cast&amp;lt;double&amp;gt;(SDL_GetTicks());&lt;br /&gt;
   &lt;br /&gt;
   while (!must_quit)&lt;br /&gt;
   {&lt;br /&gt;
     inject_input(must_quit);&lt;br /&gt;
     inject_time_pulse(last_time_pulse);&lt;br /&gt;
     render_gui();&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This function will run the main loop until the ''bool'' value ''must_quit'' becomes ''true''. In this tutorial this will happen when the user clicks the close button provided by the window manager (fx. Windows).&lt;br /&gt;
&lt;br /&gt;
The ''double'' value ''last_time_pulse'' holds the time of the latest time pulse injection. More about this later.&lt;br /&gt;
&lt;br /&gt;
Each function in the ''while'' loop will be described below.&lt;br /&gt;
&lt;br /&gt;
There are endless ways of making your main loop. I took a simple approach to ease writing this tutorial.&lt;br /&gt;
&lt;br /&gt;
=== Injecting Input ===&lt;br /&gt;
When the user presses or release keyboard or mouse buttons, we need to tell CEGUI about it so we use the injection functions of ''CEGUI::System''.&lt;br /&gt;
&lt;br /&gt;
Here is what our inject_input function looks like:&lt;br /&gt;
&lt;br /&gt;
 void inject_input(bool&amp;amp; must_quit)&lt;br /&gt;
 {&lt;br /&gt;
   SDL_Event e;&lt;br /&gt;
   &lt;br /&gt;
   // go through all available events&lt;br /&gt;
   while (SDL_PollEvent(&amp;amp;e))&lt;br /&gt;
   {&lt;br /&gt;
     // we use a switch to determine the event type&lt;br /&gt;
     switch (e.type)&lt;br /&gt;
     {&lt;br /&gt;
       // mouse motion handler&lt;br /&gt;
       case SDL_MOUSEMOTION:&lt;br /&gt;
         // we inject the mouse position directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
           static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
         );&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     // mouse down handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button down event&lt;br /&gt;
         handle_mouse_down(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // mouse up handler&lt;br /&gt;
       case SDL_MOUSEBUTTONDOWN:&lt;br /&gt;
         // let a special function handle the mouse button up event&lt;br /&gt;
         handle_mouse_up(e.button.button);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // key down&lt;br /&gt;
       case SDL_KEYDOWN:&lt;br /&gt;
         // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
         &lt;br /&gt;
         // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
         // this is described in more detail below.&lt;br /&gt;
         if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
         {&lt;br /&gt;
           CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
         }&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
       // key up&lt;br /&gt;
       case SDL_KEYUP:&lt;br /&gt;
         // like before we inject the scancode directly.&lt;br /&gt;
         CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       // WM quit event occured&lt;br /&gt;
       case SDL_QUIT:&lt;br /&gt;
         must_quit = true;&lt;br /&gt;
         break;&lt;br /&gt;
     &lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
First I'll explain the events that get handled directly in the ''inject_input'' function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Motion''':&lt;br /&gt;
&lt;br /&gt;
 // we inject the mouse position directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectMousePosition(&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.x),&lt;br /&gt;
   static_cast&amp;lt;float&amp;gt;(e.motion.y)&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
There is nothing special here. Like stated in the comment the mouse position is just injected directly.&lt;br /&gt;
&lt;br /&gt;
There are two ways of injecting mouse motion. One where you inject how much the cursor moved, and one where you inject the mouse cursor position. The last one is failsafe.&lt;br /&gt;
Then first one only works correctly in fullscreen mode, or with input grabbed. The reason for this is that in regular windowed mode, the mouse can be moved outside the application window, and during this time no mouse motion event are generated. So if we enter the window at another position, the real mousecursor and CEGUI's mouse cursor will be offset, which will break mouse usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Down'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This event is takes a little more work. CEGUI requires that key characters (the printable character the key represents) are injected alongside key codes.&lt;br /&gt;
&lt;br /&gt;
 // to tell CEGUI that a key was pressed, we inject the scancode.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
Luckily the key code is just the SDL scancode, so we inject that directly.&lt;br /&gt;
&lt;br /&gt;
 // as for the character it's a litte more complicated. we'll use for translated unicode value.&lt;br /&gt;
 // this is described in more detail below.&lt;br /&gt;
 if ((e.key.keysym.unicode &amp;amp; 0xFF80) == 0)&lt;br /&gt;
 {&lt;br /&gt;
   CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode &amp;amp; 0x7F);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Instead of formatting the keypress ourselves, we let SDL do it for us. For more information, take a look at the SDL documentation for this feature. [http://sdldoc.csn.ul.ie/sdlkeysym.php SDL_keysym].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Key Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This one is simple. Only the keycode need to injected. So we just use the scancode directly:&lt;br /&gt;
&lt;br /&gt;
 // like before we inject the scancode directly.&lt;br /&gt;
 CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Down and Mouse Wheel'''&amp;lt;br /&amp;gt;&lt;br /&gt;
CEGUI and SDL are a little different when it comes to mouse button and mouse wheel event. So a little conversion is necessary. Here's the ''handle_mouse_down'' function that gets called when a mouse button down event occurs in SDL. It takes one parameter, a ''Uint8'' describing the mouse button that was pressed.&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_down(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		// handle real mouse buttons&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		&lt;br /&gt;
 		// handle the mouse wheel&lt;br /&gt;
 		case SDL_BUTTON_WHEELDOWN:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( -1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_WHEELUP:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseWheelChange( +1 );&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
I chose a very &amp;quot;manual&amp;quot; conversion, but it works fine. Everything should be pretty self-explainatory.&lt;br /&gt;
As you can see mouse wheel events are emitted as mouse button down events in SDL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mouse Button Up'''&amp;lt;br /&amp;gt;&lt;br /&gt;
The mouse button up event is handled very much like the mouse button down event, except there are no mousewheel release events.&lt;br /&gt;
Like ''handle_mouse_down'' it takes one parameter, a ''Uint8'' describing the mouse button that was pressed:&lt;br /&gt;
&lt;br /&gt;
 void handle_mouse_up(Uint8 button)&lt;br /&gt;
 	{&lt;br /&gt;
 	switch ( button )&lt;br /&gt;
 		{&lt;br /&gt;
 		case SDL_BUTTON_LEFT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_MIDDLE:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case SDL_BUTTON_RIGHT:&lt;br /&gt;
 			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);&lt;br /&gt;
 			break;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Time Pulses ===&lt;br /&gt;
SDL has a built-in millisecond counter which we will use for this example. There are other to use timers with SDL, but I chose this approach as it is simple to use.&lt;br /&gt;
&lt;br /&gt;
Remember in the main loop where we stored the current &amp;quot;run-time&amp;quot; in seconds ? This value will be passed as a reference to ''inject_time_pulse'' which in turn will set a new value in it.&lt;br /&gt;
&lt;br /&gt;
CEGUI's interface for injecting time pulses requires that you pass the time in seconds that has passed since the last time pulse injection. Long sentence but it not that hard. Let's take a look at the function:&lt;br /&gt;
&lt;br /&gt;
 void inject_time_pulse(double&amp;amp; last_time_pulse)&lt;br /&gt;
 {&lt;br /&gt;
 	// get current &amp;quot;run-time&amp;quot; in seconds&lt;br /&gt;
 	double t = 0.001*SDL_GetTicks();&lt;br /&gt;
&lt;br /&gt;
 	// inject the time that passed since the last call &lt;br /&gt;
 	CEGUI::System::getSingleton().injectTimePulse( float(t-last_time_pulse) );&lt;br /&gt;
 &lt;br /&gt;
 	// store the new time as the last time&lt;br /&gt;
 	last_time_pulse = t;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The first line get the actual &amp;quot;run-time&amp;quot; when called.&lt;br /&gt;
* The second line injects the time pulse as the difference between the current time and the last time.&lt;br /&gt;
* The third line stores the current time as the last time a time pulse was injected.&lt;br /&gt;
&lt;br /&gt;
This will work for about 47 days... After that the counter wraps to zero and it breaks...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Rendering ===&lt;br /&gt;
Now all thats left is rendering something. :)&lt;br /&gt;
&lt;br /&gt;
 void render_gui()&lt;br /&gt;
 {&lt;br /&gt;
 	// clear the colour buffer&lt;br /&gt;
 	glClear( GL_COLOR_BUFFER_BIT );&lt;br /&gt;
 	// render the GUI :)&lt;br /&gt;
 	CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
 	// Update the screen&lt;br /&gt;
 	SDL_GL_SwapBuffers();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The line:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::getSingleton().renderGUI();&lt;br /&gt;
&lt;br /&gt;
does all the CEGUI magic and sets state itself. As long as the viewport is setup, it will render the GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That's it. Now you know how to use SDL, OpenGL and CEGUI together. Have fun.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 16:21, 8 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=30</id>
		<title>Getting Started with Lua and CEGUI</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=30"/>
				<updated>2005-05-07T23:51:30Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Lua scripting module for CEGUI is based on [http://www.lua.org Lua 5.0.2] and [http://www.codenix.com/~tolua/ tolua++ 1.0.5].&lt;br /&gt;
As these libraries were diffucult to find in working precompiled versions, I decided to include them with the scripting module.&lt;br /&gt;
&lt;br /&gt;
When using CEGUI with a scripting module a lot of the interface programming can be replaced by scripts, these script can be modified and used without recompling your program, thus leave more time for tweaking your UI instead of waiting for your compiler to finish.&lt;br /&gt;
&lt;br /&gt;
The current Lua script module is still fairly early in development.&lt;br /&gt;
It supports most of the core system, and the base window class, more specific widgets can currently only be configured using the properties system.&lt;br /&gt;
&lt;br /&gt;
At this time the Lua script module is only in CVS.&lt;br /&gt;
&lt;br /&gt;
Ok. Let's get started. I assume that you are familiar with the CEGUI basics. Initialisation, creating windows etc. and Lua, so I'll pick up from about there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initialisation ==&lt;br /&gt;
The Lua scripting module exports all the manager classes and such it is possible to do the basic CEGUI initialization from Lua.&lt;br /&gt;
&lt;br /&gt;
the basic CEGUI init sequence is like this:&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;LuaScriptModule.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 CEGUI::''YourRendererOfChoice''* renderer = new ''YourRendererOfChoice'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule();&lt;br /&gt;
 new CEGUI::System( renderer, script_module );&lt;br /&gt;
&lt;br /&gt;
now the CEGUI::System is created and the scripting module is attached properly.&lt;br /&gt;
In this case the constructor of the LuaScriptModule created a Lua state for us. You can also pass a lua_State* as the first parameter to the LuaScriptModule constructor to use your own Lua state instead:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 lua_State* s = ''your_lua_state'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule(s);&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You would probably want to do this if you are using custom functions in the init-script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Init / Exit Script ==&lt;br /&gt;
CEGUI supports a configuration file. The filename for this is an optional parameter to the CEGUI::System constructor. It defaults to cegui.config&lt;br /&gt;
&lt;br /&gt;
This configuration file gives you the posibility to execute a script file during system creation and destruction.&lt;br /&gt;
A configuration file could look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;CEGUIConfig InitScript=&amp;quot;../datafiles/scripts/init_script.lua&amp;quot; TerminateScript=&amp;quot;../datafiles/scripts/exit_script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
init_script.lua is a text file containing the Lua script code to be executed on init.&lt;br /&gt;
Here's an example:&lt;br /&gt;
&lt;br /&gt;
 -- get CEGUI singletons&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()&lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;gt;&amp;gt;&amp;gt; Init script says hello&amp;quot; )&lt;br /&gt;
 --logger:setLoggingLevel( CEGUI.Informative )&lt;br /&gt;
 &lt;br /&gt;
 -- get a local reference to the singletons we use (not required)&lt;br /&gt;
 local system    = CEGUI.System:getSingleton()&lt;br /&gt;
 local fontman   = CEGUI.FontManager:getSingleton()&lt;br /&gt;
 local schememan = CEGUI.SchemeManager:getSingleton()&lt;br /&gt;
 &lt;br /&gt;
 -- load schemes&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot; )&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/WindowsLook.scheme&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 -- load and set default font&lt;br /&gt;
 local font = fontman:createFont( &amp;quot;../datafiles/fonts/Commonwealth-10.font&amp;quot; )&lt;br /&gt;
 system:setDefaultFont( font )&lt;br /&gt;
 &lt;br /&gt;
 -- set default mouse cursor&lt;br /&gt;
 system:setDefaultMouseCursor( &amp;quot;TaharezLook&amp;quot;,&amp;quot;MouseArrow&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;lt;&amp;lt;&amp;lt; Init script says goodbye&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
you don't have to have both init and exit scripts, but if you allocate &amp;quot;global&amp;quot; memory from the initscript you should free it in the exit script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you know how to initialise CEGUI with the Lua scripting module.&lt;br /&gt;
More tutorials will follow soon with more advanced topics.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 19:25, 5 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Handling_Events_from_Lua&amp;diff=48</id>
		<title>Handling Events from Lua</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Handling_Events_from_Lua&amp;diff=48"/>
				<updated>2005-05-07T19:40:56Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Moving the handling of GUI events outside of your project code, and into Lua scripts can add a great deal of flexibilty to your interface. Simple GUI related stuff can be easily prototyped, and modified during testing.&lt;br /&gt;
&lt;br /&gt;
Event handlers in Lua are just regular Lua functions that take one parameter. An CEGUI::EventArgs struct.&lt;br /&gt;
The functions you register as event handlers must already be registered with the system, so unless you load them all from your init-script, you will need to load some script files before doing any Lua handled events.&lt;br /&gt;
&lt;br /&gt;
Here we go...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Loading the script files ==&lt;br /&gt;
There are two ways of loading your script files. You can use the C++ interface or you can do it from Lua in your init-script.&lt;br /&gt;
The two approaches are very alike, as the Lua version uses a direct binding to the same C++ function.&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::executeScriptFile(const CEGUI::String&amp;amp; filename, const CEGUI::String&amp;amp; resourceGroup = &amp;quot;&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
Obviously this function takes two parameters, a filename and the resource group.&lt;br /&gt;
I think most people ignore the last parameter pretty much.&lt;br /&gt;
&lt;br /&gt;
Calling this function with the Lua scripting module correctly attached to CEGUI, will execute the specified Lua script file.&lt;br /&gt;
This means that functions etc. declared within these files will be accessible to your program, except of course if they are declared ''local''.&lt;br /&gt;
&lt;br /&gt;
So. From C++ you would do something like this:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::getSingleton().executeScriptFile(&amp;quot;../datafiles/scripts/guiscript.lua&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
If anything goes wrong an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
From Lua you could use this code:&lt;br /&gt;
&lt;br /&gt;
 CEGUI.System:getSingleton():executeScriptFile(&amp;quot;../datafiles/scripts/guiscript.lua&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
any global code in these script files will also be executed so be sure to manage each execution if necessary (with a counter fx).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Registering Events to Lua Functions ==&lt;br /&gt;
Now that we have our scripts loaded and all, we are ready to bind some events to our scripted handlers.&lt;br /&gt;
&lt;br /&gt;
The function to use when binding scripted events is a little different from the regular C++ one.&lt;br /&gt;
&lt;br /&gt;
 Event::Connection subscribeScriptedEvent(const String&amp;amp; name, const String&amp;amp; subscriber_name);&lt;br /&gt;
&lt;br /&gt;
''name'' is the name of the event you want to subscribe. As usual. ''subscriber_name'' is a string holding the name of the Lua function to bind to the event.&lt;br /&gt;
&lt;br /&gt;
After this call the Lua function specified will be registered as the event handler. And works exactly like the C++ version (except being Lua of course)&lt;br /&gt;
&lt;br /&gt;
Here's a little snippet to bind a PushButton Clicked event to a Lua function:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::PushButton* pb = (CEGUI::PushButton*)CEGUI::WindowManager::getSingleton().createWindow(&amp;quot;TaharezLook/Button&amp;quot;,&amp;quot;lua_powered_button&amp;quot;);&lt;br /&gt;
 pb-&amp;gt;setSize(CEGUI::Size(0.1f,0.1f));&lt;br /&gt;
 pb-&amp;gt;setPosition(CEGUI::Point(0.1f,0.1f));&lt;br /&gt;
 pb-&amp;gt;subscribeScriptedEvent(&amp;quot;Clicked&amp;quot;,&amp;quot;luabtn_clicked&amp;quot;);&lt;br /&gt;
 CEGUI::System::getSingleton().getGUISheet()-&amp;gt;addChildWindow(pb);&lt;br /&gt;
&lt;br /&gt;
This code would create a simple TaharezLook button, subscribe the Lua function ''luabtn_clicked'' to its ''Clicked'' event, and finally add it to the current GUI sheet.&lt;br /&gt;
&lt;br /&gt;
Now let's take a look at that Lua event handler:&lt;br /&gt;
&lt;br /&gt;
 function luabtn_clicked(e)&lt;br /&gt;
 {&lt;br /&gt;
   local we = CEGUI.toWindowEventArgs(e)&lt;br /&gt;
   we.window:setText(&amp;quot;handled from Lua&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make sure the button text is ''handled from Lua'' when the button is clicked.&lt;br /&gt;
We use a utility function:&lt;br /&gt;
&lt;br /&gt;
 CEGUI.toWindowEventArgs(e)&lt;br /&gt;
&lt;br /&gt;
it's obvious what it does, and converters for the other EventArgs class are also available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Registering Lua Event Handlers from XML Layouts ==&lt;br /&gt;
It's very easy to bind scripted event handlers to the windows in your XML layouts.&lt;br /&gt;
&lt;br /&gt;
Take a look a this example:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;GUILayout&amp;gt;&lt;br /&gt;
 &amp;lt;Window Type=&amp;quot;TaharezLook/Button&amp;quot; Name=&amp;quot;lua_powered_button&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;Property Name=&amp;quot;Width&amp;quot; Value=&amp;quot;0.1&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;Property Name=&amp;quot;Height&amp;quot; Value=&amp;quot;0.1&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;Property Name=&amp;quot;XPosition&amp;quot; Value=&amp;quot;0.1&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;Property Name=&amp;quot;YPosition&amp;quot; Value=&amp;quot;0.1&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;Event Name=&amp;quot;Clicked&amp;quot; Function=&amp;quot;luabtn_clicked&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;/Window&amp;gt;&lt;br /&gt;
 &amp;lt;/GUILayout&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This simple layout create the same button as described above and even bind the scripted event handler to it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
now you know how to do stuff with your GUI without writing C++ code.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 17:10, 6 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=22</id>
		<title>Getting Started with Lua and CEGUI</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=22"/>
				<updated>2005-05-06T18:41:56Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: /* Init / Exit Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Lua scripting module for CEGUI is based on pure [http://www.lua.org Lua 5.0.2] and [http://www.codenix.com/~tolua/ tolua++ 1.0.4].&lt;br /&gt;
As these libraries were diffucult to find in working precompiled versions, I decided to include them with the scripting module.&lt;br /&gt;
&lt;br /&gt;
When using CEGUI with a scripting module a lot of the interface programming can be replaced by scripts, these script can be modified and used without recompling your program, thus leave more time for tweaking your UI instead of waiting for your compiler to finish.&lt;br /&gt;
&lt;br /&gt;
The current Lua script module is still fairly early in development.&lt;br /&gt;
It supports most of the core system, and the base window class, more specific widgets can currently only be configured using the properties system.&lt;br /&gt;
&lt;br /&gt;
At this time the Lua script module is only in CVS.&lt;br /&gt;
&lt;br /&gt;
Ok. Let's get started. I assume that you are familiar with the CEGUI basics. Initialisation, creating windows etc. and Lua, so I'll pick up from about there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initialisation ==&lt;br /&gt;
The Lua scripting module exports all the manager classes and such it is possible to do the basic CEGUI initialization from Lua.&lt;br /&gt;
&lt;br /&gt;
the basic CEGUI init sequence is like this:&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;LuaScriptModule.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 CEGUI::''YourRendererOfChoice''* renderer = new ''YourRendererOfChoice'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule();&lt;br /&gt;
 new CEGUI::System( renderer, script_module );&lt;br /&gt;
&lt;br /&gt;
now the CEGUI::System is created and the scripting module is attached properly.&lt;br /&gt;
In this case the constructor of the LuaScriptModule created a Lua state for us. You can also pass a lua_State* as the first parameter to the LuaScriptModule constructor to use your own Lua state instead:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 lua_State* s = ''your_lua_state'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule(s);&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You would probably want to do this if you are using custom functions in the init-script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Init / Exit Script ==&lt;br /&gt;
CEGUI supports a configuration file. The filename for this is an optional parameter to the CEGUI::System constructor. It defaults to cegui.config&lt;br /&gt;
&lt;br /&gt;
This configuration file gives you the posibility to execute a script file during system creation and destruction.&lt;br /&gt;
A configuration file could look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;CEGUIConfig InitScript=&amp;quot;../datafiles/scripts/init_script.lua&amp;quot; TerminateScript=&amp;quot;../datafiles/scripts/exit_script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
init_script.lua is a text file containing the Lua script code to be executed on init.&lt;br /&gt;
Here's an example:&lt;br /&gt;
&lt;br /&gt;
 -- get CEGUI singletons&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()&lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;gt;&amp;gt;&amp;gt; Init script says hello&amp;quot; )&lt;br /&gt;
 --logger:setLoggingLevel( CEGUI.Informative )&lt;br /&gt;
 &lt;br /&gt;
 -- get a local reference to the singletons we use (not required)&lt;br /&gt;
 local system    = CEGUI.System:getSingleton()&lt;br /&gt;
 local fontman   = CEGUI.FontManager:getSingleton()&lt;br /&gt;
 local schememan = CEGUI.SchemeManager:getSingleton()&lt;br /&gt;
 &lt;br /&gt;
 -- load schemes&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot; )&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/WindowsLook.scheme&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 -- load and set default font&lt;br /&gt;
 local font = fontman:createFont( &amp;quot;../datafiles/fonts/Commonwealth-10.font&amp;quot; )&lt;br /&gt;
 system:setDefaultFont( font )&lt;br /&gt;
 &lt;br /&gt;
 -- set default mouse cursor&lt;br /&gt;
 system:setDefaultMouseCursor( &amp;quot;TaharezLook&amp;quot;,&amp;quot;MouseArrow&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;lt;&amp;lt;&amp;lt; Init script says goodbye&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
you don't have to have both init and exit scripts, but if you allocate &amp;quot;global&amp;quot; memory from the initscript you should free it in the exit script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you know how to initialise CEGUI with the Lua scripting module.&lt;br /&gt;
More tutorials will follow soon with more advanced topics.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 19:25, 5 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=20</id>
		<title>Getting Started with Lua and CEGUI</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=20"/>
				<updated>2005-05-06T18:41:10Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Lua scripting module for CEGUI is based on pure [http://www.lua.org Lua 5.0.2] and [http://www.codenix.com/~tolua/ tolua++ 1.0.4].&lt;br /&gt;
As these libraries were diffucult to find in working precompiled versions, I decided to include them with the scripting module.&lt;br /&gt;
&lt;br /&gt;
When using CEGUI with a scripting module a lot of the interface programming can be replaced by scripts, these script can be modified and used without recompling your program, thus leave more time for tweaking your UI instead of waiting for your compiler to finish.&lt;br /&gt;
&lt;br /&gt;
The current Lua script module is still fairly early in development.&lt;br /&gt;
It supports most of the core system, and the base window class, more specific widgets can currently only be configured using the properties system.&lt;br /&gt;
&lt;br /&gt;
At this time the Lua script module is only in CVS.&lt;br /&gt;
&lt;br /&gt;
Ok. Let's get started. I assume that you are familiar with the CEGUI basics. Initialisation, creating windows etc. and Lua, so I'll pick up from about there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initialisation ==&lt;br /&gt;
The Lua scripting module exports all the manager classes and such it is possible to do the basic CEGUI initialization from Lua.&lt;br /&gt;
&lt;br /&gt;
the basic CEGUI init sequence is like this:&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;LuaScriptModule.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 CEGUI::''YourRendererOfChoice''* renderer = new ''YourRendererOfChoice'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule();&lt;br /&gt;
 new CEGUI::System( renderer, script_module );&lt;br /&gt;
&lt;br /&gt;
now the CEGUI::System is created and the scripting module is attached properly.&lt;br /&gt;
In this case the constructor of the LuaScriptModule created a Lua state for us. You can also pass a lua_State* as the first parameter to the LuaScriptModule constructor to use your own Lua state instead:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 lua_State* s = ''your_lua_state'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule(s);&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You would probably want to do this if you are using custom functions in the init-script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Init / Exit Script ==&lt;br /&gt;
CEGUI supports a configuration file. The filename for this is an optional parameter to the CEGUI::System constructor. It defaults to cegui.config&lt;br /&gt;
&lt;br /&gt;
This configuration file gives you the posibility to execute a script file during system creation and destruction.&lt;br /&gt;
A configuration file could look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;CEGUIConfig InitScript=&amp;quot;../datafiles/scripts/init_script.lua&amp;quot; TerminateScript=&amp;quot;../datafiles/scripts/exit_script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
init_script.lua is a text file containing the Lua script code to be executed on init.&lt;br /&gt;
Here's an example:&lt;br /&gt;
&lt;br /&gt;
 -- get CEGUI singletons&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()&lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;gt;&amp;gt;&amp;gt; Init script says hello&amp;quot; )&lt;br /&gt;
 --logger:setLoggingLevel( CEGUI.Informative )&lt;br /&gt;
 &lt;br /&gt;
 -- get a local reference to the singletons we use (not required)&lt;br /&gt;
 local system	= CEGUI.System:getSingleton()&lt;br /&gt;
 local fontman	= CEGUI.FontManager:getSingleton()&lt;br /&gt;
 local schememan= CEGUI.SchemeManager:getSingleton()&lt;br /&gt;
 &lt;br /&gt;
 -- load schemes&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot; )&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/WindowsLook.scheme&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 -- load and set default font&lt;br /&gt;
 local font = fontman:createFont( &amp;quot;../datafiles/fonts/Commonwealth-10.font&amp;quot; )&lt;br /&gt;
 system:setDefaultFont( font )&lt;br /&gt;
 &lt;br /&gt;
 -- set default mouse cursor&lt;br /&gt;
 system:setDefaultMouseCursor( &amp;quot;TaharezLook&amp;quot;,&amp;quot;MouseArrow&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;lt;&amp;lt;&amp;lt; Init script says goodbye&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
you don't have to have both init and exit scripts, but if you allocate &amp;quot;global&amp;quot; memory from the initscript you should free it in the exit script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you know how to initialise CEGUI with the Lua scripting module.&lt;br /&gt;
More tutorials will follow soon with more advanced topics.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 19:25, 5 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=23</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=23"/>
				<updated>2005-05-06T16:10:36Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: /* Lindquist's Lua Scripting with CEGUI Guides */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== CrazyEddie's 'Imbeciles' Guides ===&lt;br /&gt;
* [[The Imbeciles Guide to Getting CEGUI Rendering]] - How to initialise CEGUI to render properly.&lt;br /&gt;
* [[The Imbeciles Guide to Loading Data Files and Initialisation]] - How to load some data files and perform basic system initialisation.&lt;br /&gt;
* [[The Imbeciles Guide to Creating a CEGUI Window]] - How to create a simple window and get it on screen.&lt;br /&gt;
* [[The Imbeciles Guide to Injecting Inputs]] - How to inject inputs into CEGUI and get interactive.&lt;br /&gt;
&lt;br /&gt;
=== Lindquist's Lua Scripting with CEGUI Guides ===&lt;br /&gt;
* [[Getting Started with Lua and CEGUI]] - How to initialise CEGUI with a Lua script module and configuration file.&lt;br /&gt;
* [[Handling Events from Lua]] - How to load Lua script files and bind CEGUI events to Lua functions.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Handling_Events_from_Lua&amp;diff=21</id>
		<title>Handling Events from Lua</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Handling_Events_from_Lua&amp;diff=21"/>
				<updated>2005-05-06T16:10:30Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Moving the handling of GUI events outside of your project code, and into Lua scripts can add a great deal of flexibilty to your interface. Simple GUI related stuff can be easily prototyped, and modified during testing.&lt;br /&gt;
&lt;br /&gt;
Event handlers in Lua are just regular Lua functions that take one parameter. An CEGUI::EventArgs struct.&lt;br /&gt;
The functions you register as event handlers must already be registered with the system, so unless you load them all from your init-script, you will need to load some script files before doing any Lua handled events.&lt;br /&gt;
&lt;br /&gt;
Here we go...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Loading the script files ==&lt;br /&gt;
There are two ways of loading your script files. You can use the C++ interface or you can do it from Lua in your init-script.&lt;br /&gt;
The two approaches are very alike, as the Lua version uses a direct binding to the same C++ function.&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::executeScriptFile(const CEGUI::String&amp;amp; filename, const CEGUI::String&amp;amp; resourceGroup = &amp;quot;&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
Obviously this function takes two parameters, a filename and the resource group.&lt;br /&gt;
I think most people ignore the last parameter pretty much.&lt;br /&gt;
&lt;br /&gt;
Calling this function with the Lua scripting module correctly attached to CEGUI, will execute the specified Lua script file.&lt;br /&gt;
This means that functions etc. declared within these files will be accessible to your program, except of course if they are declared ''local''.&lt;br /&gt;
&lt;br /&gt;
So. From C++ you would do something like this:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::System::getSingleton().executeScriptFile(&amp;quot;../datafiles/scripts/guiscript.lua&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
If anything goes wrong an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
From Lua you could use this code:&lt;br /&gt;
&lt;br /&gt;
 CEGUI.System:getSingleton():executeScriptFile(&amp;quot;../datafiles/scripts/guiscript.lua&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
any global code in these script files will also be executed so be sure to manage each execution if necessary (with a counter fx).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Registering Events to Lua Functions ==&lt;br /&gt;
Now that we have our scripts loaded and all, we are ready to bind some events to our scripted handlers.&lt;br /&gt;
&lt;br /&gt;
The function to use when binding scripted events is a little different from the regular C++ one.&lt;br /&gt;
&lt;br /&gt;
 Event::Connection subscribeScriptedEvent(const String&amp;amp; name, const String&amp;amp; subscriber_name);&lt;br /&gt;
&lt;br /&gt;
''name'' is the name of the event you want to subscribe. As usual. ''subscriber_name'' is a string holding the name of the Lua function to bind to the event.&lt;br /&gt;
&lt;br /&gt;
After this call the Lua function specified will be registered as the event handler. And works exactly like the C++ version (except being Lua of course)&lt;br /&gt;
&lt;br /&gt;
Here's a little snippet to bind a PushButton Clicked event to a Lua function:&lt;br /&gt;
&lt;br /&gt;
 CEGUI::PushButton* pb = (CEGUI::PushButton*)CEGUI::WindowManager::getSingleton().createWindow(&amp;quot;TaharezLook/Button&amp;quot;,&amp;quot;lua_powered_button&amp;quot;);&lt;br /&gt;
 pb-&amp;gt;setSize(CEGUI::Size(0.1f,0.1f));&lt;br /&gt;
 pb-&amp;gt;setPosition(CEGUI::Point(0.1f,0.1f));&lt;br /&gt;
 pb-&amp;gt;subscribeScriptedEvent(&amp;quot;Clicked&amp;quot;,&amp;quot;luabtn_clicked&amp;quot;);&lt;br /&gt;
 CEGUI::System::getSingleton().getGUISheet()-&amp;gt;addChildWindow(pb);&lt;br /&gt;
&lt;br /&gt;
This code would create a simple TaharezLook button, subscribe the Lua function ''luabtn_clicked'' to its ''Clicked'' event, and finally add it to the current GUI sheet.&lt;br /&gt;
&lt;br /&gt;
Now let's take a look at that Lua event handler:&lt;br /&gt;
&lt;br /&gt;
 function luabtn_clicked(e)&lt;br /&gt;
 {&lt;br /&gt;
   local we = CEGUI.toWindowEventArgs(e)&lt;br /&gt;
   we.window:setText(&amp;quot;handled from Lua&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make sure the button text is ''handled from Lua'' when the button is clicked.&lt;br /&gt;
We use a utility function:&lt;br /&gt;
&lt;br /&gt;
 CEGUI.toWindowEventArgs(e)&lt;br /&gt;
&lt;br /&gt;
it's obvious what it does, and converters for the other EventArgs class are also available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
now you know how to do stuff with your GUI without writing C++ code.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 17:10, 6 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=19</id>
		<title>Getting Started with Lua and CEGUI</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=19"/>
				<updated>2005-05-05T18:25:29Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Lua scripting module for CEGUI is based on pure [http://www.lua.org Lua 5.0.2] and [http://www.codenix.com/~tolua/ tolua++ 1.0.4].&lt;br /&gt;
As these libraries were diffucult to find in working precompiled versions, I decided to include them with the scripting module.&lt;br /&gt;
&lt;br /&gt;
When using CEGUI with a scripting module a lot of the interface programming can be replaced by scripts, these script can be modified and used without recompling your program, thus leave more time for tweaking your UI instead of waiting for your compiler to finish.&lt;br /&gt;
&lt;br /&gt;
The current Lua script module is still fairly early in development.&lt;br /&gt;
It supports most of the core system, and the base window class, more specific widgets can currently only be configured using the properties system.&lt;br /&gt;
&lt;br /&gt;
At this time the Lua script module is only in CVS.&lt;br /&gt;
&lt;br /&gt;
Ok. Let's get started. I assume that you are familiar with the CEGUI basics. Initialisation, creating windows etc. so I'll pick up from about there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initialisation ==&lt;br /&gt;
The Lua scripting module exports all the manager classes and such it is possible to do the basic CEGUI initialization from Lua.&lt;br /&gt;
&lt;br /&gt;
the basic CEGUI init sequence is like this:&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;LuaScriptModule.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 CEGUI::''YourRendererOfChoice''* renderer = new ''YourRendererOfChoice'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule();&lt;br /&gt;
 new CEGUI::System( renderer, script_module );&lt;br /&gt;
&lt;br /&gt;
now the CEGUI::System is created and the scripting module is attached properly.&lt;br /&gt;
In this case the constructor of the LuaScriptModule created a Lua state for us. You can also pass a lua_State* as the first parameter to the LuaScriptModule constructor to use your own Lua state instead:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 lua_State* s = ''your_lua_state'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule(s);&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You would probably want to do this if you are using custom functions in the init-script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Init / Exit Script ==&lt;br /&gt;
CEGUI supports a configuration file. The filename for this is an optional parameter to the CEGUI::System constructor. It defaults to cegui.config&lt;br /&gt;
&lt;br /&gt;
This configuration file gives you the posibility to execute a script file during system creation and destruction.&lt;br /&gt;
A configuration file could look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;CEGUIConfig InitScript=&amp;quot;../datafiles/scripts/init_script.lua&amp;quot; TerminateScript=&amp;quot;../datafiles/scripts/exit_script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
init_script.lua is a text file containing the Lua script code to be executed on init.&lt;br /&gt;
Here's an example:&lt;br /&gt;
&lt;br /&gt;
 -- get CEGUI singletons&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()&lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;gt;&amp;gt;&amp;gt; Init script says hello&amp;quot; )&lt;br /&gt;
 --logger:setLoggingLevel( CEGUI.Informative )&lt;br /&gt;
 &lt;br /&gt;
 -- get a local reference to the singletons we use (not required)&lt;br /&gt;
 local system	= CEGUI.System:getSingleton()&lt;br /&gt;
 local fontman	= CEGUI.FontManager:getSingleton()&lt;br /&gt;
 local schememan= CEGUI.SchemeManager:getSingleton()&lt;br /&gt;
 &lt;br /&gt;
 -- load schemes&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot; )&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/WindowsLook.scheme&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 -- load and set default font&lt;br /&gt;
 local font = fontman:createFont( &amp;quot;../datafiles/fonts/Commonwealth-10.font&amp;quot; )&lt;br /&gt;
 system:setDefaultFont( font )&lt;br /&gt;
 &lt;br /&gt;
 -- set default mouse cursor&lt;br /&gt;
 system:setDefaultMouseCursor( &amp;quot;TaharezLook&amp;quot;,&amp;quot;MouseArrow&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;lt;&amp;lt;&amp;lt; Init script says goodbye&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
you don't have to have both init and exit scripts, but if you allocate &amp;quot;global&amp;quot; memory from the initscript you should free it in the exit script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you know how to initialise CEGUI with the Lua scripting module.&lt;br /&gt;
More tutorials will follow soon with more advanced topics.&lt;br /&gt;
&lt;br /&gt;
--[[User:Lindquist|Lindquist]] 19:25, 5 May 2005 (BST)&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=17</id>
		<title>Getting Started with Lua and CEGUI</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Getting_Started_with_Lua_and_CEGUI&amp;diff=17"/>
				<updated>2005-05-05T18:23:22Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Lua scripting module for CEGUI is based on pure [http://www.lua.org Lua 5.0.2] and [http://www.codenix.com/~tolua/ tolua++ 1.0.4].&lt;br /&gt;
As these libraries were diffucult to find in working precompiled versions, I decided to include them with the scripting module.&lt;br /&gt;
&lt;br /&gt;
When using CEGUI with a scripting module a lot of the interface programming can be replaced by scripts, these script can be modified and used without recompling your program, thus leave more time for tweaking your UI instead of waiting for your compiler to finish.&lt;br /&gt;
&lt;br /&gt;
The current Lua script module is still fairly early in development.&lt;br /&gt;
It supports most of the core system, and the base window class, more specific widgets can currently only be configured using the properties system.&lt;br /&gt;
&lt;br /&gt;
At this time the Lua script module is only in CVS.&lt;br /&gt;
&lt;br /&gt;
Ok. Let's get started. I assume that you are familiar with the CEGUI basics. Initialisation, creating windows etc. so I'll pick up from about there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initialisation ==&lt;br /&gt;
The Lua scripting module exports all the manager classes and such it is possible to do the basic CEGUI initialization from Lua.&lt;br /&gt;
&lt;br /&gt;
the basic CEGUI init sequence is like this:&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;LuaScriptModule.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 CEGUI::''YourRendererOfChoice''* renderer = new ''YourRendererOfChoice'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule();&lt;br /&gt;
 new CEGUI::System( renderer, script_module );&lt;br /&gt;
&lt;br /&gt;
now the CEGUI::System is created and the scripting module is attached properly.&lt;br /&gt;
In this case the constructor of the LuaScriptModule created a Lua state for us. You can also pass a lua_State* as the first parameter to the LuaScriptModule constructor to use your own Lua state instead:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 lua_State* s = ''your_lua_state'';&lt;br /&gt;
 CEGUI::LuaScriptModule* script_module = new CEGUI::LuaScriptModule(s);&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You would probably want to do this if you are using custom functions in the init-script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Init / Exit Script ==&lt;br /&gt;
CEGUI supports a configuration file. The filename for this is an optional parameter to the CEGUI::System constructor. It defaults to cegui.config&lt;br /&gt;
&lt;br /&gt;
This configuration file gives you the posibility to execute a script file during system creation and destruction.&lt;br /&gt;
A configuration file could look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;CEGUIConfig InitScript=&amp;quot;../datafiles/scripts/init_script.lua&amp;quot; TerminateScript=&amp;quot;../datafiles/scripts/exit_script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
init_script.lua is a text file containing the Lua script code to be executed on init.&lt;br /&gt;
Here's an example:&lt;br /&gt;
&lt;br /&gt;
 -- get CEGUI singletons&lt;br /&gt;
 local logger = CEGUI.Logger:getSingleton()&lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;gt;&amp;gt;&amp;gt; Init script says hello&amp;quot; )&lt;br /&gt;
 --logger:setLoggingLevel( CEGUI.Informative )&lt;br /&gt;
 &lt;br /&gt;
 -- get a local reference to the singletons we use (not required)&lt;br /&gt;
 local system	= CEGUI.System:getSingleton()&lt;br /&gt;
 local fontman	= CEGUI.FontManager:getSingleton()&lt;br /&gt;
 local schememan= CEGUI.SchemeManager:getSingleton()&lt;br /&gt;
 &lt;br /&gt;
 -- load schemes&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/TaharezLook.scheme&amp;quot; )&lt;br /&gt;
 schememan:loadScheme( &amp;quot;../datafiles/schemes/WindowsLook.scheme&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 -- load and set default font&lt;br /&gt;
 local font = fontman:createFont( &amp;quot;../datafiles/fonts/Commonwealth-10.font&amp;quot; )&lt;br /&gt;
 system:setDefaultFont( font )&lt;br /&gt;
 &lt;br /&gt;
 -- set default mouse cursor&lt;br /&gt;
 system:setDefaultMouseCursor( &amp;quot;TaharezLook&amp;quot;,&amp;quot;MouseArrow&amp;quot; )&lt;br /&gt;
 &lt;br /&gt;
 logger:logEvent( &amp;quot;&amp;lt;&amp;lt;&amp;lt; Init script says goodbye&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
you don't have to have both init and exit scripts, but if you allocate &amp;quot;global&amp;quot; memory from the initscript you should free it in the exit script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you know how to initialise CEGUI with the Lua scripting module.&lt;br /&gt;
More tutorials will follow soon with more advanced topics.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=18</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Tutorials&amp;diff=18"/>
				<updated>2005-05-05T18:23:16Z</updated>
		
		<summary type="html">&lt;p&gt;Lindquist: /* Lindquist's Lua Scripting and CEGUI Guides */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== CrazyEddie's 'Imbeciles' Guides ===&lt;br /&gt;
* [[The Imbeciles Guide to Getting CEGUI Rendering]] - How to initialise CEGUI to render properly.&lt;br /&gt;
* [[The Imbeciles Guide to Loading Data Files and Initialisation]] - How to load some data files and perform basic system initialisation.&lt;br /&gt;
* [[The Imbeciles Guide to Creating a CEGUI Window]] - How to create a simple window and get it on screen.&lt;br /&gt;
* [[The Imbeciles Guide to Injecting Inputs]] - How to inject inputs into CEGUI and get interactive.&lt;br /&gt;
&lt;br /&gt;
=== Lindquist's Lua Scripting with CEGUI Guides ===&lt;br /&gt;
* [[Getting Started with Lua and CEGUI]] - How to initialise CEGUI with a Lua script module and configuration file.&lt;/div&gt;</summary>
		<author><name>Lindquist</name></author>	</entry>

	</feed>