<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://cegui.org.uk/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Avengre</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.uk/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Avengre"/>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/Special:Contributions/Avengre"/>
		<updated>2026-04-09T21:01:24Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=Helpful_Links&amp;diff=5689</id>
		<title>Helpful Links</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=Helpful_Links&amp;diff=5689"/>
				<updated>2015-05-27T12:41:43Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Retrieving source/binaries ==&lt;br /&gt;
*[http://cegui.org.uk/download Download Releases (CEGUI &amp;amp; CEED)...]&lt;br /&gt;
*[https://bitbucket.org/cegui/cegui ...or get the latest version from the repository] (Be sure to choose correct branch! More info about the branches is available on the repo page)&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
*[http://static.cegui.org.uk/docs/current/index.html Beginner's Tutorials on how to initialise, update and render CEGUI] (choose your API version on the top right)&lt;br /&gt;
*[http://static.cegui.org.uk/docs/current/namespaceCEGUI.html List of CEGUI classes] (choose your API version on the top right)&lt;br /&gt;
*[http://www.cegui.org.uk/docs/current/fal_man.html Falagard Skinning System Manual] - in case you want to edit the looknfeel (=skinning) files&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous useful links ==&lt;br /&gt;
*[http://static.cegui.org.uk/static/TaharezLookProperties.html Properties available in the TaharezLook skin]&lt;br /&gt;
*[http://static.cegui.org.uk/static/VanillaProperties.html Properties available in the Vanilla skin]&lt;br /&gt;
*[http://static.cegui.org.uk/static/WindowsLookProperties.html Properties available in the WindowsLook skin]&lt;br /&gt;
&lt;br /&gt;
== Porting Guides ==&lt;br /&gt;
*[[Changes_and_Porting_Tips_for_0.8.0 |Porting from v0.7.x to v0.8.x ]]&lt;br /&gt;
*[[Changes_and_Porting_Tips_for_0.7.0 | Porting from v0.6.x / v0.5.x to v0.7.x]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=Porting_tips_and_changes_from_0.7.X_to_0.8.X&amp;diff=4488</id>
		<title>Porting tips and changes from 0.7.X to 0.8.X</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=Porting_tips_and_changes_from_0.7.X_to_0.8.X&amp;diff=4488"/>
				<updated>2011-06-06T13:54:32Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
&lt;br /&gt;
{{Section|1=Introduction|2=&lt;br /&gt;
This is work in progress, so while this page will be kept as up-to-date as possible, what you read here on any given day will never be definitive and is subject to further change until such time as a stable release is made.  There are no current download packages contain the code this page relates to; this code is only available from the cegui_mk2/trunk directory in the subversion repository (see [[Obtaining the library source from Subversion]]).&lt;br /&gt;
}}&lt;br /&gt;
{{Section|1=Major renames/API changes|2=&lt;br /&gt;
* CEGUI::Window was renamed to CEGUI::Widget as Widget is the coined term for that, WindowManager renamed to WidgetManager, etc... (not in mercurial yet!)&lt;br /&gt;
* The stock/standard window renderer set (now widget renderer set) FalagardWRBase was renamed to StandardWRSet to avoid confusion with core [[Falagard]] facilities (not in mercurial yet!)&lt;br /&gt;
* Image class is now an abstract interface.  BasicImage implementation is provided, and used for internally created Image objects.&lt;br /&gt;
* Imageset class is removed.  You now use the new ImageManager to access defined images.&lt;br /&gt;
* ImagesetManager class is removed.  You now use the new ImageManager.&lt;br /&gt;
* Windows now don't have absolute names! Every window's name only has to be unique in it's parent window.&lt;br /&gt;
}}&lt;br /&gt;
{{Section|1=Name this section|2=&lt;br /&gt;
* Image::draw renamed to Image::render&lt;br /&gt;
* PropertyHelper has been turned into a template class, instead of PropertyHelper::uintToString you do PropertyHelper&amp;lt;uint&amp;gt;::toString, instead of PropertyHelper::stringToUint you do PropertyHelper&amp;lt;uint&amp;gt;::fromString&lt;br /&gt;
* All instances of the word caret that were incorrectly spelt 'carat' have been corrected.  This affects all APIs, properties, events and datafiles.&lt;br /&gt;
* Window::EventWindowUpdated renamed to Window::EventUpdated and the associated string is changed from &amp;quot;WindowUpdate&amp;quot; to &amp;quot;Updated&amp;quot;&lt;br /&gt;
* ListHeader::SegmentNameSuffix changed type from character array to CEGUI::String&lt;br /&gt;
* EventMouseEnters renamed to EventMouseEntersSurface (old name removed)&lt;br /&gt;
* EventMouseLeaves renamed to EventMouseLeavesSurface (old name removed)&lt;br /&gt;
* BiDiVisualMapping renamed to BidiVisualMapping.  Also renamed the files, so CEGUIBiDiVisualMapping.h is now CEGUIBidiVisualMapping.h&lt;br /&gt;
* class colour renamed to Colour, as a side effect the &amp;quot;colour&amp;quot; interpolator is now &amp;quot;Colour&amp;quot; interpolator, this breaks animation definitions!&lt;br /&gt;
* Point typedef removed, please use Vector2 instead&lt;br /&gt;
* Many event string values changed to match the C++ name (but without the Event prefix).  A list of which strings changed value will appear here soon.&lt;br /&gt;
* Window::setRestoreCapture renamed to Window::setRestoreOldCapture&lt;br /&gt;
* CEGUI now supports custom memory allocation, see [[Memory Allocation]] to check if this concerns you or not.&lt;br /&gt;
* Window::addChildWindow renamed to Window::addChild, Window::removeChildWindow renamed to Window::removeChild, several other methods (mostly in layout containers) changed from *ChildWindow* to *Child*&lt;br /&gt;
* CEGUI::String can now be just a typedef or a class, depending on String configuration (CEGUI can now use std::string as CEGUI::String for apps not requiring unicode)&lt;br /&gt;
* Window::getChild_impl method completely removed, it was only used by Window::getParentPixelSize, shouldn't be hard to replace&lt;br /&gt;
* Vector2, Vector3, Size and Rect are now templated, you should use Vector2&amp;lt;float&amp;gt; (or just Vector2&amp;lt;&amp;gt; as a shortcut since float is the default type) instead of Vector2, UVector2 class was removed, UVector2 is now just a typedef to Vector2&amp;lt;UDim&amp;gt;. Same with Vector3, Size and Rect.&lt;br /&gt;
* Texture::saveToMemory is renamed Texture::blitToMemory.&lt;br /&gt;
* Renderer and Texture interfaces changed in order to support named textures.&lt;br /&gt;
* Window::isDisabled(localOnly) is now split into Window::isDisabled (= old isDisabled(true) and Window::isEffectiveDisabled (= old isDisabled(false))&lt;br /&gt;
* Window::isVisible(localOnly) is now split into Window::isVisible (= old isDisabled(true) and Window::isEffectiveVisible (= old isVisible(false))&lt;br /&gt;
* WindowManager::loadWindowLayout is renamed to WindowManager::loadLayoutFromFile&lt;br /&gt;
* NamedXMLResourceManager::create is renamed to NamedXMLResourceManager::createFromFile  (Ex. CEGUI::SchemeManager::createFromFile)&lt;br /&gt;
* Property from Window called &amp;quot;ZOrderChangeEnabled&amp;quot; renamed to &amp;quot;ZOrderingEnabled&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;MouseButtonDownAutoRepeat&amp;quot; renamed to &amp;quot;MouseAutoRepeatEnabled&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;CustomTooltipType&amp;quot; renamed to &amp;quot;TooltipType&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;RiseOnClick&amp;quot; renamed to &amp;quot;RiseOnClickEnabled&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;UnifiedAreaRect&amp;quot; renamed to &amp;quot;Area&amp;quot;, &amp;quot;UnifiedSize&amp;quot; renamed to &amp;quot;Size&amp;quot;, etc...&lt;br /&gt;
* CEGUI::DefaultLogger no longer throws const char* but a real exception in setLogFilename - http://www.cegui.org.uk/mantis/view.php?id=443&lt;br /&gt;
* CEGUI now has inbuilt copy, cut, paste support, if you used a custom solution, you might want to check CEGUI::Clipboard and System::injectCopy,Cut,PasteRequest&lt;br /&gt;
}}&lt;br /&gt;
{{Section|1=PyCEGUI|2=&lt;br /&gt;
* EventSet.subscribeEvent now has a different, more pythonic syntax, any python callable (bound member function, free function, lambda, functor, ...) is allowed (EventSet.subscribeEvent(&amp;quot;EventName&amp;quot;, instance, &amp;quot;someMethodInIt&amp;quot;) is now EventSet.subscribeEvent(&amp;quot;EventName&amp;quot;, instance.someMethodInIt)&lt;br /&gt;
}}&lt;br /&gt;
[[Category:Manuals]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=Porting_tips_and_changes_from_0.7.X_to_0.8.X&amp;diff=4487</id>
		<title>Porting tips and changes from 0.7.X to 0.8.X</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=Porting_tips_and_changes_from_0.7.X_to_0.8.X&amp;diff=4487"/>
				<updated>2011-06-06T13:52:53Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
&lt;br /&gt;
{{Section|1=Introduction|2=&lt;br /&gt;
This is work in progress, so while this page will be kept as up-to-date as possible, what you read here on any given day will never be definitive and is subject to further change until such time as a stable release is made.  There are no current download packages contain the code this page relates to; this code is only available from the cegui_mk2/trunk directory in the subversion repository (see [[Obtaining the library source from Subversion]]).&lt;br /&gt;
}}&lt;br /&gt;
{{Section|1=Major renames/API changes|2=&lt;br /&gt;
* CEGUI::Window was renamed to CEGUI::Widget as Widget is the coined term for that, WindowManager renamed to WidgetManager, etc... (not in mercurial yet!)&lt;br /&gt;
* The stock/standard window renderer set (now widget renderer set) FalagardWRBase was renamed to StandardWRSet to avoid confusion with core [[Falagard]] facilities (not in mercurial yet!)&lt;br /&gt;
* Image class is now an abstract interface.  BasicImage implementation is provided, and used for internally created Image objects.&lt;br /&gt;
* Imageset class is removed.  You now use the new ImageManager to access defined images.&lt;br /&gt;
* ImagesetManager class is removed.  You now use the new ImageManager.&lt;br /&gt;
* Windows now don't have absolute names! Every window's name only has to be unique in it's parent window.&lt;br /&gt;
}}&lt;br /&gt;
{{Section|1=Name this section|2=&lt;br /&gt;
* WindowManager::isWindowPresent changed to WindowManager::isAlive&lt;br /&gt;
* Image::draw renamed to Image::render&lt;br /&gt;
* PropertyHelper has been turned into a template class, instead of PropertyHelper::uintToString you do PropertyHelper&amp;lt;uint&amp;gt;::toString, instead of PropertyHelper::stringToUint you do PropertyHelper&amp;lt;uint&amp;gt;::fromString&lt;br /&gt;
* All instances of the word caret that were incorrectly spelt 'carat' have been corrected.  This affects all APIs, properties, events and datafiles.&lt;br /&gt;
* Window::EventWindowUpdated renamed to Window::EventUpdated and the associated string is changed from &amp;quot;WindowUpdate&amp;quot; to &amp;quot;Updated&amp;quot;&lt;br /&gt;
* ListHeader::SegmentNameSuffix changed type from character array to CEGUI::String&lt;br /&gt;
* EventMouseEnters renamed to EventMouseEntersSurface (old name removed)&lt;br /&gt;
* EventMouseLeaves renamed to EventMouseLeavesSurface (old name removed)&lt;br /&gt;
* BiDiVisualMapping renamed to BidiVisualMapping.  Also renamed the files, so CEGUIBiDiVisualMapping.h is now CEGUIBidiVisualMapping.h&lt;br /&gt;
* class colour renamed to Colour, as a side effect the &amp;quot;colour&amp;quot; interpolator is now &amp;quot;Colour&amp;quot; interpolator, this breaks animation definitions!&lt;br /&gt;
* Point typedef removed, please use Vector2 instead&lt;br /&gt;
* Many event string values changed to match the C++ name (but without the Event prefix).  A list of which strings changed value will appear here soon.&lt;br /&gt;
* Window::setRestoreCapture renamed to Window::setRestoreOldCapture&lt;br /&gt;
* CEGUI now supports custom memory allocation, see [[Memory Allocation]] to check if this concerns you or not.&lt;br /&gt;
* Window::addChildWindow renamed to Window::addChild, Window::removeChildWindow renamed to Window::removeChild, several other methods (mostly in layout containers) changed from *ChildWindow* to *Child*&lt;br /&gt;
* CEGUI::String can now be just a typedef or a class, depending on String configuration (CEGUI can now use std::string as CEGUI::String for apps not requiring unicode)&lt;br /&gt;
* Window::getChild_impl method completely removed, it was only used by Window::getParentPixelSize, shouldn't be hard to replace&lt;br /&gt;
* Vector2, Vector3, Size and Rect are now templated, you should use Vector2&amp;lt;float&amp;gt; (or just Vector2&amp;lt;&amp;gt; as a shortcut since float is the default type) instead of Vector2, UVector2 class was removed, UVector2 is now just a typedef to Vector2&amp;lt;UDim&amp;gt;. Same with Vector3, Size and Rect.&lt;br /&gt;
* Texture::saveToMemory is renamed Texture::blitToMemory.&lt;br /&gt;
* Renderer and Texture interfaces changed in order to support named textures.&lt;br /&gt;
* Window::isDisabled(localOnly) is now split into Window::isDisabled (= old isDisabled(true) and Window::isEffectiveDisabled (= old isDisabled(false))&lt;br /&gt;
* Window::isVisible(localOnly) is now split into Window::isVisible (= old isDisabled(true) and Window::isEffectiveVisible (= old isVisible(false))&lt;br /&gt;
* WindowManager::loadWindowLayout is renamed to WindowManager::loadLayoutFromFile&lt;br /&gt;
* NamedXMLResourceManager::create is renamed to NamedXMLResourceManager::createFromFile  (Ex. CEGUI::SchemeManager::createFromFile)&lt;br /&gt;
* Property from Window called &amp;quot;ZOrderChangeEnabled&amp;quot; renamed to &amp;quot;ZOrderingEnabled&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;MouseButtonDownAutoRepeat&amp;quot; renamed to &amp;quot;MouseAutoRepeatEnabled&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;CustomTooltipType&amp;quot; renamed to &amp;quot;TooltipType&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;RiseOnClick&amp;quot; renamed to &amp;quot;RiseOnClickEnabled&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;UnifiedAreaRect&amp;quot; renamed to &amp;quot;Area&amp;quot;, &amp;quot;UnifiedSize&amp;quot; renamed to &amp;quot;Size&amp;quot;, etc...&lt;br /&gt;
* CEGUI::DefaultLogger no longer throws const char* but a real exception in setLogFilename - http://www.cegui.org.uk/mantis/view.php?id=443&lt;br /&gt;
* CEGUI now has inbuilt copy, cut, paste support, if you used a custom solution, you might want to check CEGUI::Clipboard and System::injectCopy,Cut,PasteRequest&lt;br /&gt;
}}&lt;br /&gt;
{{Section|1=PyCEGUI|2=&lt;br /&gt;
* EventSet.subscribeEvent now has a different, more pythonic syntax, any python callable (bound member function, free function, lambda, functor, ...) is allowed (EventSet.subscribeEvent(&amp;quot;EventName&amp;quot;, instance, &amp;quot;someMethodInIt&amp;quot;) is now EventSet.subscribeEvent(&amp;quot;EventName&amp;quot;, instance.someMethodInIt)&lt;br /&gt;
}}&lt;br /&gt;
[[Category:Manuals]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=Porting_tips_and_changes_from_0.7.X_to_0.8.X&amp;diff=4486</id>
		<title>Porting tips and changes from 0.7.X to 0.8.X</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=Porting_tips_and_changes_from_0.7.X_to_0.8.X&amp;diff=4486"/>
				<updated>2011-06-06T13:37:33Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
&lt;br /&gt;
{{Section|1=Introduction|2=&lt;br /&gt;
This is work in progress, so while this page will be kept as up-to-date as possible, what you read here on any given day will never be definitive and is subject to further change until such time as a stable release is made.  There are no current download packages contain the code this page relates to; this code is only available from the cegui_mk2/trunk directory in the subversion repository (see [[Obtaining the library source from Subversion]]).&lt;br /&gt;
}}&lt;br /&gt;
{{Section|1=Major renames/API changes|2=&lt;br /&gt;
* CEGUI::Window was renamed to CEGUI::Widget as Widget is the coined term for that, WindowManager renamed to WidgetManager, etc... (not in mercurial yet!)&lt;br /&gt;
* The stock/standard window renderer set (now widget renderer set) FalagardWRBase was renamed to StandardWRSet to avoid confusion with core [[Falagard]] facilities (not in mercurial yet!)&lt;br /&gt;
* Image class is now an abstract interface.  BasicImage implementation is provided, and used for internally created Image objects.&lt;br /&gt;
* Imageset class is removed.  You now use the new ImageManager to access defined images.&lt;br /&gt;
* ImagesetManager class is removed.  You now use the new ImageManager.&lt;br /&gt;
* Windows now don't have absolute names! Every window's name only has to be unique in it's parent window.&lt;br /&gt;
}}&lt;br /&gt;
{{Section|1=Name this section|2=&lt;br /&gt;
* Image::draw renamed to Image::render&lt;br /&gt;
* PropertyHelper has been turned into a template class, instead of PropertyHelper::uintToString you do PropertyHelper&amp;lt;uint&amp;gt;::toString, instead of PropertyHelper::stringToUint you do PropertyHelper&amp;lt;uint&amp;gt;::fromString&lt;br /&gt;
* All instances of the word caret that were incorrectly spelt 'carat' have been corrected.  This affects all APIs, properties, events and datafiles.&lt;br /&gt;
* Window::EventWindowUpdated renamed to Window::EventUpdated and the associated string is changed from &amp;quot;WindowUpdate&amp;quot; to &amp;quot;Updated&amp;quot;&lt;br /&gt;
* ListHeader::SegmentNameSuffix changed type from character array to CEGUI::String&lt;br /&gt;
* EventMouseEnters renamed to EventMouseEntersSurface (old name removed)&lt;br /&gt;
* EventMouseLeaves renamed to EventMouseLeavesSurface (old name removed)&lt;br /&gt;
* BiDiVisualMapping renamed to BidiVisualMapping.  Also renamed the files, so CEGUIBiDiVisualMapping.h is now CEGUIBidiVisualMapping.h&lt;br /&gt;
* class colour renamed to Colour, as a side effect the &amp;quot;colour&amp;quot; interpolator is now &amp;quot;Colour&amp;quot; interpolator, this breaks animation definitions!&lt;br /&gt;
* Point typedef removed, please use Vector2 instead&lt;br /&gt;
* Many event string values changed to match the C++ name (but without the Event prefix).  A list of which strings changed value will appear here soon.&lt;br /&gt;
* Window::setRestoreCapture renamed to Window::setRestoreOldCapture&lt;br /&gt;
* CEGUI now supports custom memory allocation, see [[Memory Allocation]] to check if this concerns you or not.&lt;br /&gt;
* Window::addChildWindow renamed to Window::addChild, Window::removeChildWindow renamed to Window::removeChild, several other methods (mostly in layout containers) changed from *ChildWindow* to *Child*&lt;br /&gt;
* CEGUI::String can now be just a typedef or a class, depending on String configuration (CEGUI can now use std::string as CEGUI::String for apps not requiring unicode)&lt;br /&gt;
* Window::getChild_impl method completely removed, it was only used by Window::getParentPixelSize, shouldn't be hard to replace&lt;br /&gt;
* Vector2, Vector3, Size and Rect are now templated, you should use Vector2&amp;lt;float&amp;gt; (or just Vector2&amp;lt;&amp;gt; as a shortcut since float is the default type) instead of Vector2, UVector2 class was removed, UVector2 is now just a typedef to Vector2&amp;lt;UDim&amp;gt;. Same with Vector3, Size and Rect.&lt;br /&gt;
* Texture::saveToMemory is renamed Texture::blitToMemory.&lt;br /&gt;
* Renderer and Texture interfaces changed in order to support named textures.&lt;br /&gt;
* Window::isDisabled(localOnly) is now split into Window::isDisabled (= old isDisabled(true) and Window::isEffectiveDisabled (= old isDisabled(false))&lt;br /&gt;
* Window::isVisible(localOnly) is now split into Window::isVisible (= old isDisabled(true) and Window::isEffectiveVisible (= old isVisible(false))&lt;br /&gt;
* WindowManager::loadWindowLayout is renamed to WindowManager::loadLayoutFromFile&lt;br /&gt;
* NamedXMLResourceManager::create is renamed to NamedXMLResourceManager::createFromFile  (Ex. CEGUI::SchemeManager::createFromFile)&lt;br /&gt;
* Property from Window called &amp;quot;ZOrderChangeEnabled&amp;quot; renamed to &amp;quot;ZOrderingEnabled&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;MouseButtonDownAutoRepeat&amp;quot; renamed to &amp;quot;MouseAutoRepeatEnabled&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;CustomTooltipType&amp;quot; renamed to &amp;quot;TooltipType&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;RiseOnClick&amp;quot; renamed to &amp;quot;RiseOnClickEnabled&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;UnifiedAreaRect&amp;quot; renamed to &amp;quot;Area&amp;quot;, &amp;quot;UnifiedSize&amp;quot; renamed to &amp;quot;Size&amp;quot;, etc...&lt;br /&gt;
* CEGUI::DefaultLogger no longer throws const char* but a real exception in setLogFilename - http://www.cegui.org.uk/mantis/view.php?id=443&lt;br /&gt;
* CEGUI now has inbuilt copy, cut, paste support, if you used a custom solution, you might want to check CEGUI::Clipboard and System::injectCopy,Cut,PasteRequest&lt;br /&gt;
}}&lt;br /&gt;
{{Section|1=PyCEGUI|2=&lt;br /&gt;
* EventSet.subscribeEvent now has a different, more pythonic syntax, any python callable (bound member function, free function, lambda, functor, ...) is allowed (EventSet.subscribeEvent(&amp;quot;EventName&amp;quot;, instance, &amp;quot;someMethodInIt&amp;quot;) is now EventSet.subscribeEvent(&amp;quot;EventName&amp;quot;, instance.someMethodInIt)&lt;br /&gt;
}}&lt;br /&gt;
[[Category:Manuals]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=Porting_tips_and_changes_from_0.7.X_to_0.8.X&amp;diff=4485</id>
		<title>Porting tips and changes from 0.7.X to 0.8.X</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=Porting_tips_and_changes_from_0.7.X_to_0.8.X&amp;diff=4485"/>
				<updated>2011-06-06T13:25:34Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
&lt;br /&gt;
{{Section|1=Introduction|2=&lt;br /&gt;
This is work in progress, so while this page will be kept as up-to-date as possible, what you read here on any given day will never be definitive and is subject to further change until such time as a stable release is made.  There are no current download packages contain the code this page relates to; this code is only available from the cegui_mk2/trunk directory in the subversion repository (see [[Obtaining the library source from Subversion]]).&lt;br /&gt;
}}&lt;br /&gt;
{{Section|1=Major renames/API changes|2=&lt;br /&gt;
* CEGUI::Window was renamed to CEGUI::Widget as Widget is the coined term for that, WindowManager renamed to WidgetManager, etc... (not in mercurial yet!)&lt;br /&gt;
* The stock/standard window renderer set (now widget renderer set) FalagardWRBase was renamed to StandardWRSet to avoid confusion with core [[Falagard]] facilities (not in mercurial yet!)&lt;br /&gt;
* Image class is now an abstract interface.  BasicImage implementation is provided, and used for internally created Image objects.&lt;br /&gt;
* Imageset class is removed.  You now use the new ImageManager to access defined images.&lt;br /&gt;
* ImagesetManager class is removed.  You now use the new ImageManager.&lt;br /&gt;
* Windows now don't have absolute names! Every window's name only has to be unique in it's parent window.&lt;br /&gt;
}}&lt;br /&gt;
{{Section|1=Name this section|2=&lt;br /&gt;
* PropertyHelper has been turned into a template class, instead of PropertyHelper::uintToString you do PropertyHelper&amp;lt;uint&amp;gt;::toString, instead of PropertyHelper::stringToUint you do PropertyHelper&amp;lt;uint&amp;gt;::fromString&lt;br /&gt;
* All instances of the word caret that were incorrectly spelt 'carat' have been corrected.  This affects all APIs, properties, events and datafiles.&lt;br /&gt;
* Window::EventWindowUpdated renamed to Window::EventUpdated and the associated string is changed from &amp;quot;WindowUpdate&amp;quot; to &amp;quot;Updated&amp;quot;&lt;br /&gt;
* ListHeader::SegmentNameSuffix changed type from character array to CEGUI::String&lt;br /&gt;
* EventMouseEnters renamed to EventMouseEntersSurface (old name removed)&lt;br /&gt;
* EventMouseLeaves renamed to EventMouseLeavesSurface (old name removed)&lt;br /&gt;
* BiDiVisualMapping renamed to BidiVisualMapping.  Also renamed the files, so CEGUIBiDiVisualMapping.h is now CEGUIBidiVisualMapping.h&lt;br /&gt;
* class colour renamed to Colour, as a side effect the &amp;quot;colour&amp;quot; interpolator is now &amp;quot;Colour&amp;quot; interpolator, this breaks animation definitions!&lt;br /&gt;
* Point typedef removed, please use Vector2 instead&lt;br /&gt;
* Many event string values changed to match the C++ name (but without the Event prefix).  A list of which strings changed value will appear here soon.&lt;br /&gt;
* Window::setRestoreCapture renamed to Window::setRestoreOldCapture&lt;br /&gt;
* CEGUI now supports custom memory allocation, see [[Memory Allocation]] to check if this concerns you or not.&lt;br /&gt;
* Window::addChildWindow renamed to Window::addChild, Window::removeChildWindow renamed to Window::removeChild, several other methods (mostly in layout containers) changed from *ChildWindow* to *Child*&lt;br /&gt;
* CEGUI::String can now be just a typedef or a class, depending on String configuration (CEGUI can now use std::string as CEGUI::String for apps not requiring unicode)&lt;br /&gt;
* Window::getChild_impl method completely removed, it was only used by Window::getParentPixelSize, shouldn't be hard to replace&lt;br /&gt;
* Vector2, Vector3, Size and Rect are now templated, you should use Vector2&amp;lt;float&amp;gt; (or just Vector2&amp;lt;&amp;gt; as a shortcut since float is the default type) instead of Vector2, UVector2 class was removed, UVector2 is now just a typedef to Vector2&amp;lt;UDim&amp;gt;. Same with Vector3, Size and Rect.&lt;br /&gt;
* Texture::saveToMemory is renamed Texture::blitToMemory.&lt;br /&gt;
* Renderer and Texture interfaces changed in order to support named textures.&lt;br /&gt;
* Window::isDisabled(localOnly) is now split into Window::isDisabled (= old isDisabled(true) and Window::isEffectiveDisabled (= old isDisabled(false))&lt;br /&gt;
* Window::isVisible(localOnly) is now split into Window::isVisible (= old isDisabled(true) and Window::isEffectiveVisible (= old isVisible(false))&lt;br /&gt;
* WindowManager::loadWindowLayout is renamed to WindowManager::loadLayoutFromFile&lt;br /&gt;
* NamedXMLResourceManager::create is renamed to NamedXMLResourceManager::createFromFile  (Ex. CEGUI::SchemeManager::createFromFile)&lt;br /&gt;
* Property from Window called &amp;quot;ZOrderChangeEnabled&amp;quot; renamed to &amp;quot;ZOrderingEnabled&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;MouseButtonDownAutoRepeat&amp;quot; renamed to &amp;quot;MouseAutoRepeatEnabled&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;CustomTooltipType&amp;quot; renamed to &amp;quot;TooltipType&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;RiseOnClick&amp;quot; renamed to &amp;quot;RiseOnClickEnabled&amp;quot;&lt;br /&gt;
* Property from Window called &amp;quot;UnifiedAreaRect&amp;quot; renamed to &amp;quot;Area&amp;quot;, &amp;quot;UnifiedSize&amp;quot; renamed to &amp;quot;Size&amp;quot;, etc...&lt;br /&gt;
* CEGUI::DefaultLogger no longer throws const char* but a real exception in setLogFilename - http://www.cegui.org.uk/mantis/view.php?id=443&lt;br /&gt;
* CEGUI now has inbuilt copy, cut, paste support, if you used a custom solution, you might want to check CEGUI::Clipboard and System::injectCopy,Cut,PasteRequest&lt;br /&gt;
}}&lt;br /&gt;
{{Section|1=PyCEGUI|2=&lt;br /&gt;
* EventSet.subscribeEvent now has a different, more pythonic syntax, any python callable (bound member function, free function, lambda, functor, ...) is allowed (EventSet.subscribeEvent(&amp;quot;EventName&amp;quot;, instance, &amp;quot;someMethodInIt&amp;quot;) is now EventSet.subscribeEvent(&amp;quot;EventName&amp;quot;, instance.someMethodInIt)&lt;br /&gt;
}}&lt;br /&gt;
[[Category:Manuals]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Auto_Repeat_Key&amp;diff=4383</id>
		<title>CEGUI In Practice - Auto Repeat Key</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Auto_Repeat_Key&amp;diff=4383"/>
				<updated>2011-03-24T17:59:59Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|8}}&lt;br /&gt;
&lt;br /&gt;
== Auto Key== &lt;br /&gt;
&lt;br /&gt;
== CEGUI In Practice 8 ==&lt;br /&gt;
&lt;br /&gt;
This tutorial will build upon a previous tutorial we looked at, [[CEGUI_In_Practice_-_Managing_input | Managing Input]].&lt;br /&gt;
&lt;br /&gt;
If you've done any thing involving a keyboard recently, you'll have noticed how much you rely on RepeatKeys.  For example, when you hold down the backspace to delete something you typed, thats a RepeatKey.  CEGUI does not handle this automatically, as it is a GUI Library, not an input library.  And since CEGUI only takes single inputs, we need to do some work on our own.  I recently stumbled across an example on another website (See references) that was a good example of this.  So we'll implement it ourselves to see how to use it with CEGUI.  Below is the code.&lt;br /&gt;
&lt;br /&gt;
===The Header File===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#pragma once&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;OIS.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
class AutoRepeatKey {&lt;br /&gt;
private:&lt;br /&gt;
 &lt;br /&gt;
    OIS::KeyCode m_nKey;&lt;br /&gt;
    unsigned int m_nChar;&lt;br /&gt;
 &lt;br /&gt;
    float m_fElapsed;&lt;br /&gt;
    float m_fDelay;&lt;br /&gt;
 &lt;br /&gt;
    float m_fRepeatDelay;&lt;br /&gt;
    float m_fInitialDelay;&lt;br /&gt;
 &lt;br /&gt;
protected:&lt;br /&gt;
 &lt;br /&gt;
    virtual void repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar) = 0;&lt;br /&gt;
 &lt;br /&gt;
public:&lt;br /&gt;
 &lt;br /&gt;
    AutoRepeatKey(float a_fRepeatDelay = 0.035f, float a_fInitialDelay = 0.300f);&lt;br /&gt;
 &lt;br /&gt;
    void begin(const OIS::KeyEvent &amp;amp;evt);&lt;br /&gt;
 &lt;br /&gt;
    void end(const OIS::KeyEvent &amp;amp;evt);&lt;br /&gt;
 &lt;br /&gt;
    void update(float a_fElapsed); // Elapsed time in seconds&lt;br /&gt;
};&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The CPP File===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;AutoRepeatKey.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
AutoRepeatKey::AutoRepeatKey(float a_fRepeatDelay, float a_fInitialDelay):&lt;br /&gt;
    m_nKey(OIS::KC_UNASSIGNED),&lt;br /&gt;
    m_fRepeatDelay(a_fRepeatDelay),&lt;br /&gt;
    m_fInitialDelay(a_fInitialDelay)&lt;br /&gt;
{}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::begin(const OIS::KeyEvent &amp;amp;evt) {&lt;br /&gt;
    m_nKey = evt.key;&lt;br /&gt;
    m_nChar = evt.text;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed = 0;&lt;br /&gt;
    m_fDelay = m_fInitialDelay;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::end(const OIS::KeyEvent &amp;amp;evt) {&lt;br /&gt;
    if (m_nKey != evt.key) return;&lt;br /&gt;
 &lt;br /&gt;
    m_nKey = OIS::KC_UNASSIGNED;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::update(float a_fElapsed) {&lt;br /&gt;
    if (m_nKey == OIS::KC_UNASSIGNED) return;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed += a_fElapsed;&lt;br /&gt;
    if (m_fElapsed &amp;lt; m_fDelay) return;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed -= m_fDelay;&lt;br /&gt;
    m_fDelay = m_fRepeatDelay;&lt;br /&gt;
 &lt;br /&gt;
    do {&lt;br /&gt;
        repeatKey(m_nKey, m_nChar);&lt;br /&gt;
 &lt;br /&gt;
        m_fElapsed -= m_fRepeatDelay;&lt;br /&gt;
    } while (m_fElapsed &amp;gt;= m_fRepeatDelay);&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed = 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Understanding the Code ===&lt;br /&gt;
&lt;br /&gt;
if you think about how an auto key works there is a sequence of events that take place.  The key is pressed down and held for a certain period of time.  After that threshold of time with the key down is hit, it begins to press that key every so often.  Then once the key is released, it will stop injecting key inputs.&lt;br /&gt;
&lt;br /&gt;
=== Applying our knowledge ===&lt;br /&gt;
Pretty straight forward.  So lets do some implementation.&lt;br /&gt;
&lt;br /&gt;
Previously we wrote a few lines of code that injected input to CEGUI.  Because there is a virtual function located in AutoRepeatKey we have to create a definition of that.  We'll have to create a custom class, and then inherit AutoRepatKey:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
class MyInput : public AutoRepeatKey&lt;br /&gt;
public:&lt;br /&gt;
  void InjectOISKey(bool bButtonDown, OIS::KeyEvent inKey)&lt;br /&gt;
{&lt;br /&gt;
	if (bButtonDown)&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().injectKeyDown(inKey.key);&lt;br /&gt;
		CEGUI::System::getSingleton().injectChar(inKey.text);&lt;br /&gt;
	}&lt;br /&gt;
	else&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().injectKeyUp(inKey.key);&lt;br /&gt;
	}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
protected:&lt;br /&gt;
  void repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar){};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is what we're gonna start with.  Its pretty simple.  Right now the program will compile, but do nothing different than the previous time we visited the Input Tutorial.  &lt;br /&gt;
&lt;br /&gt;
Now, we decided that we need to acknowledge the KeyDown as the start of the autokey, and the keyup as the ending.  InjectOISKey is where we actually deal with the key being up or down, so lets mark our start and stop of the autokey detection there.  Change the InjectOISKey function to be as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void InjectOISKey(bool bButtonDown, OIS::KeyEvent inKey)&lt;br /&gt;
{&lt;br /&gt;
	if (bButtonDown)&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().injectKeyDown(inKey.key);&lt;br /&gt;
		CEGUI::System::getSingleton().injectChar(inKey.text);&lt;br /&gt;
                begin(inKey);                   // &amp;lt;---- New line:  Trigger beginning of AutoKeyRepeat&lt;br /&gt;
	}&lt;br /&gt;
	else&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().in jectKeyUp(inKey.key);&lt;br /&gt;
                end(inKey);                    // &amp;lt;----- New Line:  Trigger end of AutoKeyRepeat&lt;br /&gt;
	}&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Those will start and stop the internal timers for the autokeyrepeat.&lt;br /&gt;
&lt;br /&gt;
Now we need to determine how exactly we will handle each of the key repeats. This will be pretty simple, as we just need to do the same stuff we normally do during a keypress.  Inject the KeyDown to CEGUI, inject the Char, inject the KeyUp.  Tho we don't want to just call the above function again or it would call begin/end and stuff could get strange and ugly.&lt;br /&gt;
&lt;br /&gt;
Here is the definition of repeatKey we will use&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar)&lt;br /&gt;
{&lt;br /&gt;
    // Now remember the key is still down, so we need to simulate the key being released, and then repressed immediatly&lt;br /&gt;
    CEGUI::System::getSingleton().injectKeyUp(a_nKey.key);   // Key UP&lt;br /&gt;
    CEGUI::System::getSingleton().injectKeyDown(a_nKey.key); // Key Down&lt;br /&gt;
    CEGUI::System::getSingleton().injectChar(a_nChar);       // What that key means&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now repeatKey will be called once the key has been depressed longer than our initial delay time, and will be called again for everytime the delay between keyrepeats has been met.  But we need to tell this autokey about it.  So somehwere in your code (probably around your Polling calls) you will want to call:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
MyInput::update(float inTimeDelta);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You may want to add some functions to AutoRepeatKey to allow you to adjust m_fRepeatDelay and m_fInitialDelay.  right now they are adjusted by the constructor of AutoRepeatKey which may not be optimal for your implementation.&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
Well there you have it, stolen and ripped code implemented into our input handler.  But then again, you're using CEGUI so using foreign and alien code shouldn't be anything daunting!   &lt;br /&gt;
&lt;br /&gt;
Till next time!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
http://www.ogre3d.org/tikiwiki/Auto+Repeat+Key+Input&amp;amp;structure=Cookbook&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Auto_Repeat_Key&amp;diff=4381</id>
		<title>CEGUI In Practice - Auto Repeat Key</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Auto_Repeat_Key&amp;diff=4381"/>
				<updated>2011-03-24T17:59:08Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: moved Auto Repeat Key to CEGUI In Practice - Auto Repeat Key: Addition of tutorial&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Auto Key== &lt;br /&gt;
&lt;br /&gt;
== CEGUI In Practice 7 ==&lt;br /&gt;
&lt;br /&gt;
This tutorial will build upon a previous tutorial we looked at, [[CEGUI_In_Practice_-_Managing_input | Managing Input]].&lt;br /&gt;
&lt;br /&gt;
If you've done any thing involving a keyboard recently, you'll have noticed how much you rely on RepeatKeys.  For example, when you hold down the backspace to delete something you typed, thats a RepeatKey.  CEGUI does not handle this automatically, as it is a GUI Library, not an input library.  And since CEGUI only takes single inputs, we need to do some work on our own.  I recently stumbled across an example on another website (See references) that was a good example of this.  So we'll implement it ourselves to see how to use it with CEGUI.  Below is the code.&lt;br /&gt;
&lt;br /&gt;
===The Header File===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#pragma once&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;OIS.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
class AutoRepeatKey {&lt;br /&gt;
private:&lt;br /&gt;
 &lt;br /&gt;
    OIS::KeyCode m_nKey;&lt;br /&gt;
    unsigned int m_nChar;&lt;br /&gt;
 &lt;br /&gt;
    float m_fElapsed;&lt;br /&gt;
    float m_fDelay;&lt;br /&gt;
 &lt;br /&gt;
    float m_fRepeatDelay;&lt;br /&gt;
    float m_fInitialDelay;&lt;br /&gt;
 &lt;br /&gt;
protected:&lt;br /&gt;
 &lt;br /&gt;
    virtual void repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar) = 0;&lt;br /&gt;
 &lt;br /&gt;
public:&lt;br /&gt;
 &lt;br /&gt;
    AutoRepeatKey(float a_fRepeatDelay = 0.035f, float a_fInitialDelay = 0.300f);&lt;br /&gt;
 &lt;br /&gt;
    void begin(const OIS::KeyEvent &amp;amp;evt);&lt;br /&gt;
 &lt;br /&gt;
    void end(const OIS::KeyEvent &amp;amp;evt);&lt;br /&gt;
 &lt;br /&gt;
    void update(float a_fElapsed); // Elapsed time in seconds&lt;br /&gt;
};&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The CPP File===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;AutoRepeatKey.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
AutoRepeatKey::AutoRepeatKey(float a_fRepeatDelay, float a_fInitialDelay):&lt;br /&gt;
    m_nKey(OIS::KC_UNASSIGNED),&lt;br /&gt;
    m_fRepeatDelay(a_fRepeatDelay),&lt;br /&gt;
    m_fInitialDelay(a_fInitialDelay)&lt;br /&gt;
{}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::begin(const OIS::KeyEvent &amp;amp;evt) {&lt;br /&gt;
    m_nKey = evt.key;&lt;br /&gt;
    m_nChar = evt.text;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed = 0;&lt;br /&gt;
    m_fDelay = m_fInitialDelay;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::end(const OIS::KeyEvent &amp;amp;evt) {&lt;br /&gt;
    if (m_nKey != evt.key) return;&lt;br /&gt;
 &lt;br /&gt;
    m_nKey = OIS::KC_UNASSIGNED;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::update(float a_fElapsed) {&lt;br /&gt;
    if (m_nKey == OIS::KC_UNASSIGNED) return;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed += a_fElapsed;&lt;br /&gt;
    if (m_fElapsed &amp;lt; m_fDelay) return;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed -= m_fDelay;&lt;br /&gt;
    m_fDelay = m_fRepeatDelay;&lt;br /&gt;
 &lt;br /&gt;
    do {&lt;br /&gt;
        repeatKey(m_nKey, m_nChar);&lt;br /&gt;
 &lt;br /&gt;
        m_fElapsed -= m_fRepeatDelay;&lt;br /&gt;
    } while (m_fElapsed &amp;gt;= m_fRepeatDelay);&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed = 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Understanding the Code ===&lt;br /&gt;
&lt;br /&gt;
if you think about how an auto key works there is a sequence of events that take place.  The key is pressed down and held for a certain period of time.  After that threshold of time with the key down is hit, it begins to press that key every so often.  Then once the key is released, it will stop injecting key inputs.&lt;br /&gt;
&lt;br /&gt;
=== Applying our knowledge ===&lt;br /&gt;
Pretty straight forward.  So lets do some implementation.&lt;br /&gt;
&lt;br /&gt;
Previously we wrote a few lines of code that injected input to CEGUI.  Because there is a virtual function located in AutoRepeatKey we have to create a definition of that.  We'll have to create a custom class, and then inherit AutoRepatKey:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
class MyInput : public AutoRepeatKey&lt;br /&gt;
public:&lt;br /&gt;
  void InjectOISKey(bool bButtonDown, OIS::KeyEvent inKey)&lt;br /&gt;
{&lt;br /&gt;
	if (bButtonDown)&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().injectKeyDown(inKey.key);&lt;br /&gt;
		CEGUI::System::getSingleton().injectChar(inKey.text);&lt;br /&gt;
	}&lt;br /&gt;
	else&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().injectKeyUp(inKey.key);&lt;br /&gt;
	}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
protected:&lt;br /&gt;
  void repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar){};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is what we're gonna start with.  Its pretty simple.  Right now the program will compile, but do nothing different than the previous time we visited the Input Tutorial.  &lt;br /&gt;
&lt;br /&gt;
Now, we decided that we need to acknowledge the KeyDown as the start of the autokey, and the keyup as the ending.  InjectOISKey is where we actually deal with the key being up or down, so lets mark our start and stop of the autokey detection there.  Change the InjectOISKey function to be as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void InjectOISKey(bool bButtonDown, OIS::KeyEvent inKey)&lt;br /&gt;
{&lt;br /&gt;
	if (bButtonDown)&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().injectKeyDown(inKey.key);&lt;br /&gt;
		CEGUI::System::getSingleton().injectChar(inKey.text);&lt;br /&gt;
                begin(inKey);                   // &amp;lt;---- New line:  Trigger beginning of AutoKeyRepeat&lt;br /&gt;
	}&lt;br /&gt;
	else&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().in jectKeyUp(inKey.key);&lt;br /&gt;
                end(inKey);                    // &amp;lt;----- New Line:  Trigger end of AutoKeyRepeat&lt;br /&gt;
	}&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Those will start and stop the internal timers for the autokeyrepeat.&lt;br /&gt;
&lt;br /&gt;
Now we need to determine how exactly we will handle each of the key repeats. This will be pretty simple, as we just need to do the same stuff we normally do during a keypress.  Inject the KeyDown to CEGUI, inject the Char, inject the KeyUp.  Tho we don't want to just call the above function again or it would call begin/end and stuff could get strange and ugly.&lt;br /&gt;
&lt;br /&gt;
Here is the definition of repeatKey we will use&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar)&lt;br /&gt;
{&lt;br /&gt;
    // Now remember the key is still down, so we need to simulate the key being released, and then repressed immediatly&lt;br /&gt;
    CEGUI::System::getSingleton().injectKeyUp(a_nKey.key);   // Key UP&lt;br /&gt;
    CEGUI::System::getSingleton().injectKeyDown(a_nKey.key); // Key Down&lt;br /&gt;
    CEGUI::System::getSingleton().injectChar(a_nChar);       // What that key means&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now repeatKey will be called once the key has been depressed longer than our initial delay time, and will be called again for everytime the delay between keyrepeats has been met.  But we need to tell this autokey about it.  So somehwere in your code (probably around your Polling calls) you will want to call:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
MyInput::update(float inTimeDelta);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You may want to add some functions to AutoRepeatKey to allow you to adjust m_fRepeatDelay and m_fInitialDelay.  right now they are adjusted by the constructor of AutoRepeatKey which may not be optimal for your implementation.&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
Well there you have it, stolen and ripped code implemented into our input handler.  But then again, you're using CEGUI so using foreign and alien code shouldn't be anything daunting!   &lt;br /&gt;
&lt;br /&gt;
Till next time!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
http://www.ogre3d.org/tikiwiki/Auto+Repeat+Key+Input&amp;amp;structure=Cookbook&lt;br /&gt;
&lt;br /&gt;
[[Category:HowTo]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=Auto_Repeat_Key&amp;diff=4382</id>
		<title>Auto Repeat Key</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=Auto_Repeat_Key&amp;diff=4382"/>
				<updated>2011-03-24T17:59:08Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: moved Auto Repeat Key to CEGUI In Practice - Auto Repeat Key: Addition of tutorial&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[CEGUI In Practice - Auto Repeat Key]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Auto_Repeat_Key&amp;diff=4380</id>
		<title>CEGUI In Practice - Auto Repeat Key</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Auto_Repeat_Key&amp;diff=4380"/>
				<updated>2011-03-24T17:58:05Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Auto Key== &lt;br /&gt;
&lt;br /&gt;
== CEGUI In Practice 7 ==&lt;br /&gt;
&lt;br /&gt;
This tutorial will build upon a previous tutorial we looked at, [[CEGUI_In_Practice_-_Managing_input | Managing Input]].&lt;br /&gt;
&lt;br /&gt;
If you've done any thing involving a keyboard recently, you'll have noticed how much you rely on RepeatKeys.  For example, when you hold down the backspace to delete something you typed, thats a RepeatKey.  CEGUI does not handle this automatically, as it is a GUI Library, not an input library.  And since CEGUI only takes single inputs, we need to do some work on our own.  I recently stumbled across an example on another website (See references) that was a good example of this.  So we'll implement it ourselves to see how to use it with CEGUI.  Below is the code.&lt;br /&gt;
&lt;br /&gt;
===The Header File===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#pragma once&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;OIS.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
class AutoRepeatKey {&lt;br /&gt;
private:&lt;br /&gt;
 &lt;br /&gt;
    OIS::KeyCode m_nKey;&lt;br /&gt;
    unsigned int m_nChar;&lt;br /&gt;
 &lt;br /&gt;
    float m_fElapsed;&lt;br /&gt;
    float m_fDelay;&lt;br /&gt;
 &lt;br /&gt;
    float m_fRepeatDelay;&lt;br /&gt;
    float m_fInitialDelay;&lt;br /&gt;
 &lt;br /&gt;
protected:&lt;br /&gt;
 &lt;br /&gt;
    virtual void repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar) = 0;&lt;br /&gt;
 &lt;br /&gt;
public:&lt;br /&gt;
 &lt;br /&gt;
    AutoRepeatKey(float a_fRepeatDelay = 0.035f, float a_fInitialDelay = 0.300f);&lt;br /&gt;
 &lt;br /&gt;
    void begin(const OIS::KeyEvent &amp;amp;evt);&lt;br /&gt;
 &lt;br /&gt;
    void end(const OIS::KeyEvent &amp;amp;evt);&lt;br /&gt;
 &lt;br /&gt;
    void update(float a_fElapsed); // Elapsed time in seconds&lt;br /&gt;
};&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The CPP File===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;AutoRepeatKey.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
AutoRepeatKey::AutoRepeatKey(float a_fRepeatDelay, float a_fInitialDelay):&lt;br /&gt;
    m_nKey(OIS::KC_UNASSIGNED),&lt;br /&gt;
    m_fRepeatDelay(a_fRepeatDelay),&lt;br /&gt;
    m_fInitialDelay(a_fInitialDelay)&lt;br /&gt;
{}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::begin(const OIS::KeyEvent &amp;amp;evt) {&lt;br /&gt;
    m_nKey = evt.key;&lt;br /&gt;
    m_nChar = evt.text;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed = 0;&lt;br /&gt;
    m_fDelay = m_fInitialDelay;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::end(const OIS::KeyEvent &amp;amp;evt) {&lt;br /&gt;
    if (m_nKey != evt.key) return;&lt;br /&gt;
 &lt;br /&gt;
    m_nKey = OIS::KC_UNASSIGNED;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::update(float a_fElapsed) {&lt;br /&gt;
    if (m_nKey == OIS::KC_UNASSIGNED) return;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed += a_fElapsed;&lt;br /&gt;
    if (m_fElapsed &amp;lt; m_fDelay) return;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed -= m_fDelay;&lt;br /&gt;
    m_fDelay = m_fRepeatDelay;&lt;br /&gt;
 &lt;br /&gt;
    do {&lt;br /&gt;
        repeatKey(m_nKey, m_nChar);&lt;br /&gt;
 &lt;br /&gt;
        m_fElapsed -= m_fRepeatDelay;&lt;br /&gt;
    } while (m_fElapsed &amp;gt;= m_fRepeatDelay);&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed = 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Understanding the Code ===&lt;br /&gt;
&lt;br /&gt;
if you think about how an auto key works there is a sequence of events that take place.  The key is pressed down and held for a certain period of time.  After that threshold of time with the key down is hit, it begins to press that key every so often.  Then once the key is released, it will stop injecting key inputs.&lt;br /&gt;
&lt;br /&gt;
=== Applying our knowledge ===&lt;br /&gt;
Pretty straight forward.  So lets do some implementation.&lt;br /&gt;
&lt;br /&gt;
Previously we wrote a few lines of code that injected input to CEGUI.  Because there is a virtual function located in AutoRepeatKey we have to create a definition of that.  We'll have to create a custom class, and then inherit AutoRepatKey:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
class MyInput : public AutoRepeatKey&lt;br /&gt;
public:&lt;br /&gt;
  void InjectOISKey(bool bButtonDown, OIS::KeyEvent inKey)&lt;br /&gt;
{&lt;br /&gt;
	if (bButtonDown)&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().injectKeyDown(inKey.key);&lt;br /&gt;
		CEGUI::System::getSingleton().injectChar(inKey.text);&lt;br /&gt;
	}&lt;br /&gt;
	else&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().injectKeyUp(inKey.key);&lt;br /&gt;
	}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
protected:&lt;br /&gt;
  void repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar){};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is what we're gonna start with.  Its pretty simple.  Right now the program will compile, but do nothing different than the previous time we visited the Input Tutorial.  &lt;br /&gt;
&lt;br /&gt;
Now, we decided that we need to acknowledge the KeyDown as the start of the autokey, and the keyup as the ending.  InjectOISKey is where we actually deal with the key being up or down, so lets mark our start and stop of the autokey detection there.  Change the InjectOISKey function to be as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void InjectOISKey(bool bButtonDown, OIS::KeyEvent inKey)&lt;br /&gt;
{&lt;br /&gt;
	if (bButtonDown)&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().injectKeyDown(inKey.key);&lt;br /&gt;
		CEGUI::System::getSingleton().injectChar(inKey.text);&lt;br /&gt;
                begin(inKey);                   // &amp;lt;---- New line:  Trigger beginning of AutoKeyRepeat&lt;br /&gt;
	}&lt;br /&gt;
	else&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().in jectKeyUp(inKey.key);&lt;br /&gt;
                end(inKey);                    // &amp;lt;----- New Line:  Trigger end of AutoKeyRepeat&lt;br /&gt;
	}&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Those will start and stop the internal timers for the autokeyrepeat.&lt;br /&gt;
&lt;br /&gt;
Now we need to determine how exactly we will handle each of the key repeats. This will be pretty simple, as we just need to do the same stuff we normally do during a keypress.  Inject the KeyDown to CEGUI, inject the Char, inject the KeyUp.  Tho we don't want to just call the above function again or it would call begin/end and stuff could get strange and ugly.&lt;br /&gt;
&lt;br /&gt;
Here is the definition of repeatKey we will use&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar)&lt;br /&gt;
{&lt;br /&gt;
    // Now remember the key is still down, so we need to simulate the key being released, and then repressed immediatly&lt;br /&gt;
    CEGUI::System::getSingleton().injectKeyUp(a_nKey.key);   // Key UP&lt;br /&gt;
    CEGUI::System::getSingleton().injectKeyDown(a_nKey.key); // Key Down&lt;br /&gt;
    CEGUI::System::getSingleton().injectChar(a_nChar);       // What that key means&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now repeatKey will be called once the key has been depressed longer than our initial delay time, and will be called again for everytime the delay between keyrepeats has been met.  But we need to tell this autokey about it.  So somehwere in your code (probably around your Polling calls) you will want to call:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
MyInput::update(float inTimeDelta);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You may want to add some functions to AutoRepeatKey to allow you to adjust m_fRepeatDelay and m_fInitialDelay.  right now they are adjusted by the constructor of AutoRepeatKey which may not be optimal for your implementation.&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
Well there you have it, stolen and ripped code implemented into our input handler.  But then again, you're using CEGUI so using foreign and alien code shouldn't be anything daunting!   &lt;br /&gt;
&lt;br /&gt;
Till next time!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
http://www.ogre3d.org/tikiwiki/Auto+Repeat+Key+Input&amp;amp;structure=Cookbook&lt;br /&gt;
&lt;br /&gt;
[[Category:HowTo]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Managing_input&amp;diff=4379</id>
		<title>CEGUI In Practice - Managing input</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Managing_input&amp;diff=4379"/>
				<updated>2011-03-24T17:33:03Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|3}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI In-Practice ==&lt;br /&gt;
&lt;br /&gt;
Once again Welcome back! In this tutorial we will learn how to interact with the CEGUI System at runtime, a VERY useful feature to have for a Graphical User '''Interface'''! &lt;br /&gt;
&lt;br /&gt;
CEGUI Has been designed to work on many systems, using many different renderers. As such it is tied to no particular input system. Unfortunately for us to demonstrate how to interact with CEGUI, we need to pick one and USE it don't we? So I have decided to use OIS [http://sourceforge.net/projects/wgois/]. Although I will attempt to keep OIS Specific functions and structures seperate, if they slip in, there is the reference to the system I'm using.&lt;br /&gt;
&lt;br /&gt;
==== Input Injection ====&lt;br /&gt;
&lt;br /&gt;
The first thing to note, is that not surprisingly CEGUI has made it easy to deal with inputing user actions into CEGUI. Whenever an action happens (User typing, hitting Escape, clicking a button) CEGUI will need to be informed about it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::System::injectKeyDown(uint key_code); // Tells CEGUI Key has been Pressed&lt;br /&gt;
CEGUI::System::injectKeyUp(uint key_code); // Tells CEGUI Key has been Released&lt;br /&gt;
&lt;br /&gt;
CEGUI::System::injectChar(utf32 code_point); &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Inject keydown/up are good for sending Shift, controls, enters, etc. While the injectChar is pretty self explanatory for what it means, it injects a 'letter'.&lt;br /&gt;
&lt;br /&gt;
Handling the mouse works in a similiar method as above. The following code shows how you would inform CEGUI about a Left Mouse Button Keypress.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::System::injectMouseButtonDown(CEGUI::MouseButton::LeftButton);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can imagine, there is a injectMouseButtonUp() as well for letting CEGUI know when the mouse is released.&lt;br /&gt;
&lt;br /&gt;
And what about when the mouse itself moves? Of course thats covered&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::System::injectMouseMove(float delta_x, float delta_y);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The delta is in Screen pixels that the mouse moved since the last CEGUI Update. &lt;br /&gt;
&lt;br /&gt;
Up until know, we haven't actually given CEGUI any processor time. If we're going to be moving a mouse, or clicking buttons, we're going to want CEGUI to display these actions. So we need to let CEGUI know how much time has passed since its last render.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::System::injectTimePulse(float timeElapsed);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows you to inject a time pulse, based on the number of Seconds that have passed. However often you update CEGUI is up to you, but most games will want to update the GUI by injectingTime pulses during every update cycle. If you're building more of a Tool Application you might not need constant updates.&lt;br /&gt;
&lt;br /&gt;
==== On ward! ====&lt;br /&gt;
&lt;br /&gt;
I'm going to assume that you are using OIS and are knowledgable about its uses. Here are two functions which will allow you to interact with CEGUI&lt;br /&gt;
&lt;br /&gt;
The following will input keypresses when typing. It injects the key down and up actions (By key code) and the characters that associate with those keypresses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void InjectOISKey(bool bButtonDown, OIS::KeyEvent inKey)&lt;br /&gt;
{&lt;br /&gt;
	if (bButtonDown)&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().injectKeyDown(inKey.key);&lt;br /&gt;
		CEGUI::System::getSingleton().injectChar(inKey.text);&lt;br /&gt;
	}&lt;br /&gt;
	else&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingleton().injectKeyUp(inKey.key);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following function will handle injection of OIS Mouse Button presses and releases&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void InjectOISMouseButton(bool bButtonDown, OIS::MouseButtonID inButton)&lt;br /&gt;
{&lt;br /&gt;
	if (bButtonDown == true)&lt;br /&gt;
	{&lt;br /&gt;
		switch (inButton)&lt;br /&gt;
		{&lt;br /&gt;
		case OIS::MB_Left:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MouseButton::LeftButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Middle:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MouseButton::MiddleButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Right:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MouseButton::RightButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Button3:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MouseButton::X1Button);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Button4:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MouseButton::X2Button);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_NULL:	&lt;br /&gt;
			break;&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else // bButtonDown = false&lt;br /&gt;
	{&lt;br /&gt;
		switch (inButton)&lt;br /&gt;
		{&lt;br /&gt;
		case OIS::MB_Left:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MouseButton::LeftButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Middle:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MouseButton::MiddleButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Right:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MouseButton::RightButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Button3:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MouseButton::X1Button);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Button4:&lt;br /&gt;
			CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MouseButton::X2Button);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_NULL:	&lt;br /&gt;
			break;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This above function will Convert a OIS Input for the mouse and change it to CEGUI. Right now the codes match, but if they ever change it will provide an example of how to use OIS with CEGUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
Understandably this section is a little quicker. But it gives you information about how to start interacting with CEGUI. The next tutorial will teach us how to actually deal with keypresses and make interesting things happen. Until then!&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Auto_Repeat_Key&amp;diff=4378</id>
		<title>CEGUI In Practice - Auto Repeat Key</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Auto_Repeat_Key&amp;diff=4378"/>
				<updated>2011-03-24T17:25:07Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Auto Key== &lt;br /&gt;
&lt;br /&gt;
This is an example of how to implement an AutoRepeatKey using OIS.  Although this uses OIS the concept is likely similar &lt;br /&gt;
to other Input libraries, so you should be able to adapt it.&lt;br /&gt;
&lt;br /&gt;
To implement this, you would have to define repeatKey in your own class (And inherit AutoRepeatKey) to do what you want when the repeatKey is triggered.  For example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class MyKeyInput : public AutoRepeatKey&lt;br /&gt;
{&lt;br /&gt;
protected:&lt;br /&gt;
  repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar)&lt;br /&gt;
  {&lt;br /&gt;
    CEGUI::System::getSingletonPtr()-&amp;gt;injectKeyDown(a_nKey.key);   // Simulate another keypress&lt;br /&gt;
    CEGUI::System::getSingletonPtr()-&amp;gt;injectKeyUp(a_nKey.key);     // simulate another keyrelease&lt;br /&gt;
    CEGUI::System::getSingletonPtr()-&amp;gt;injectChar(a_nKey.text);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Header File&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#pragma once&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;OIS.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
class AutoRepeatKey {&lt;br /&gt;
private:&lt;br /&gt;
 &lt;br /&gt;
    OIS::KeyCode m_nKey;&lt;br /&gt;
    unsigned int m_nChar;&lt;br /&gt;
 &lt;br /&gt;
    float m_fElapsed;&lt;br /&gt;
    float m_fDelay;&lt;br /&gt;
 &lt;br /&gt;
    float m_fRepeatDelay;&lt;br /&gt;
    float m_fInitialDelay;&lt;br /&gt;
 &lt;br /&gt;
protected:&lt;br /&gt;
 &lt;br /&gt;
    virtual void repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar) = 0;&lt;br /&gt;
 &lt;br /&gt;
public:&lt;br /&gt;
 &lt;br /&gt;
    AutoRepeatKey(float a_fRepeatDelay = 0.035f, float a_fInitialDelay = 0.300f);&lt;br /&gt;
 &lt;br /&gt;
    void begin(const OIS::KeyEvent &amp;amp;evt);&lt;br /&gt;
 &lt;br /&gt;
    void end(const OIS::KeyEvent &amp;amp;evt);&lt;br /&gt;
 &lt;br /&gt;
    void update(float a_fElapsed); // Elapsed time in seconds&lt;br /&gt;
};&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CPP File&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;AutoRepeatKey.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
AutoRepeatKey::AutoRepeatKey(float a_fRepeatDelay, float a_fInitialDelay):&lt;br /&gt;
    m_nKey(OIS::KC_UNASSIGNED),&lt;br /&gt;
    m_fRepeatDelay(a_fRepeatDelay),&lt;br /&gt;
    m_fInitialDelay(a_fInitialDelay)&lt;br /&gt;
{}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::begin(const OIS::KeyEvent &amp;amp;evt) {&lt;br /&gt;
    m_nKey = evt.key;&lt;br /&gt;
    m_nChar = evt.text;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed = 0;&lt;br /&gt;
    m_fDelay = m_fInitialDelay;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::end(const OIS::KeyEvent &amp;amp;evt) {&lt;br /&gt;
    if (m_nKey != evt.key) return;&lt;br /&gt;
 &lt;br /&gt;
    m_nKey = OIS::KC_UNASSIGNED;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::update(float a_fElapsed) {&lt;br /&gt;
    if (m_nKey == OIS::KC_UNASSIGNED) return;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed += a_fElapsed;&lt;br /&gt;
    if (m_fElapsed &amp;lt; m_fDelay) return;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed -= m_fDelay;&lt;br /&gt;
    m_fDelay = m_fRepeatDelay;&lt;br /&gt;
 &lt;br /&gt;
    do {&lt;br /&gt;
        repeatKey(m_nKey, m_nChar);&lt;br /&gt;
 &lt;br /&gt;
        m_fElapsed -= m_fRepeatDelay;&lt;br /&gt;
    } while (m_fElapsed &amp;gt;= m_fRepeatDelay);&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed = 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
http://www.ogre3d.org/tikiwiki/Auto+Repeat+Key+Input&amp;amp;structure=Cookbook&lt;br /&gt;
&lt;br /&gt;
[[Category:HowTo]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Auto_Repeat_Key&amp;diff=4377</id>
		<title>CEGUI In Practice - Auto Repeat Key</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Auto_Repeat_Key&amp;diff=4377"/>
				<updated>2011-03-24T17:18:32Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Auto Key== &lt;br /&gt;
&lt;br /&gt;
This is an example of how to implement an AutoRepeatKey using OIS.  Although this uses OIS the concept is likely similar &lt;br /&gt;
to other Input libraries, so you should be able to adapt it.&lt;br /&gt;
&lt;br /&gt;
To implement this, you would have to define repeatKey in your own class (And inherit AutoRepeatKey) to do what you want when the repeatKey is triggered.  For example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class MyKeyInput : public AutoRepeatKey&lt;br /&gt;
{&lt;br /&gt;
protected:&lt;br /&gt;
  repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar)&lt;br /&gt;
  {&lt;br /&gt;
    CEGUI::System::getSingletonPtr()-&amp;gt;injectKeyDown(a_nKey.key);&lt;br /&gt;
    CEGUI::System::getSingletonPtr()-&amp;gt;injectKeyUp(a_nKey.key);&lt;br /&gt;
    CEGUI::System::getSingletonPtr()-&amp;gt;injectChar(a_nKey.text);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Header File&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#pragma once&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;OIS.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
class AutoRepeatKey {&lt;br /&gt;
private:&lt;br /&gt;
 &lt;br /&gt;
    OIS::KeyCode m_nKey;&lt;br /&gt;
    unsigned int m_nChar;&lt;br /&gt;
 &lt;br /&gt;
    float m_fElapsed;&lt;br /&gt;
    float m_fDelay;&lt;br /&gt;
 &lt;br /&gt;
    float m_fRepeatDelay;&lt;br /&gt;
    float m_fInitialDelay;&lt;br /&gt;
 &lt;br /&gt;
protected:&lt;br /&gt;
 &lt;br /&gt;
    virtual void repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar) = 0;&lt;br /&gt;
 &lt;br /&gt;
public:&lt;br /&gt;
 &lt;br /&gt;
    AutoRepeatKey(float a_fRepeatDelay = 0.035f, float a_fInitialDelay = 0.300f);&lt;br /&gt;
 &lt;br /&gt;
    void begin(const OIS::KeyEvent &amp;amp;evt);&lt;br /&gt;
 &lt;br /&gt;
    void end(const OIS::KeyEvent &amp;amp;evt);&lt;br /&gt;
 &lt;br /&gt;
    void update(float a_fElapsed); // Elapsed time in seconds&lt;br /&gt;
};&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CPP File&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;AutoRepeatKey.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
AutoRepeatKey::AutoRepeatKey(float a_fRepeatDelay, float a_fInitialDelay):&lt;br /&gt;
    m_nKey(OIS::KC_UNASSIGNED),&lt;br /&gt;
    m_fRepeatDelay(a_fRepeatDelay),&lt;br /&gt;
    m_fInitialDelay(a_fInitialDelay)&lt;br /&gt;
{}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::begin(const OIS::KeyEvent &amp;amp;evt) {&lt;br /&gt;
    m_nKey = evt.key;&lt;br /&gt;
    m_nChar = evt.text;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed = 0;&lt;br /&gt;
    m_fDelay = m_fInitialDelay;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::end(const OIS::KeyEvent &amp;amp;evt) {&lt;br /&gt;
    if (m_nKey != evt.key) return;&lt;br /&gt;
 &lt;br /&gt;
    m_nKey = OIS::KC_UNASSIGNED;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::update(float a_fElapsed) {&lt;br /&gt;
    if (m_nKey == OIS::KC_UNASSIGNED) return;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed += a_fElapsed;&lt;br /&gt;
    if (m_fElapsed &amp;lt; m_fDelay) return;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed -= m_fDelay;&lt;br /&gt;
    m_fDelay = m_fRepeatDelay;&lt;br /&gt;
 &lt;br /&gt;
    do {&lt;br /&gt;
        repeatKey(m_nKey, m_nChar);&lt;br /&gt;
 &lt;br /&gt;
        m_fElapsed -= m_fRepeatDelay;&lt;br /&gt;
    } while (m_fElapsed &amp;gt;= m_fRepeatDelay);&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed = 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
http://www.ogre3d.org/tikiwiki/Auto+Repeat+Key+Input&amp;amp;structure=Cookbook&lt;br /&gt;
&lt;br /&gt;
[[Category:HowTo]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Auto_Repeat_Key&amp;diff=4373</id>
		<title>CEGUI In Practice - Auto Repeat Key</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Auto_Repeat_Key&amp;diff=4373"/>
				<updated>2011-03-24T17:11:11Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: Created page with &amp;quot;== Auto Key==   This is an example of how to implement an AutoRepeatKey using OIS.  Although this uses OIS the concept is likely similar  to other Input libraries, so you should ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Auto Key== &lt;br /&gt;
&lt;br /&gt;
This is an example of how to implement an AutoRepeatKey using OIS.  Although this uses OIS the concept is likely similar &lt;br /&gt;
to other Input libraries, so you should be able to adapt it.&lt;br /&gt;
&lt;br /&gt;
To implement this, you would have to define repeatKey in your own class (And inherit AutoRepeatKey) to do what you want when the repeatKey is triggered.  For example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class MyKeyInput : public AutoRepeatKey&lt;br /&gt;
{&lt;br /&gt;
protected:&lt;br /&gt;
  repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar)&lt;br /&gt;
  {&lt;br /&gt;
    CEGUI::System::getSingletonPtr()-&amp;gt;injectKeyDown(a_nKey.key);&lt;br /&gt;
    CEGUI::System::getSingletonPtr()-&amp;gt;injectChar(a_nKey.text);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Header File&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#pragma once&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;OIS.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
class AutoRepeatKey {&lt;br /&gt;
private:&lt;br /&gt;
 &lt;br /&gt;
    OIS::KeyCode m_nKey;&lt;br /&gt;
    unsigned int m_nChar;&lt;br /&gt;
 &lt;br /&gt;
    float m_fElapsed;&lt;br /&gt;
    float m_fDelay;&lt;br /&gt;
 &lt;br /&gt;
    float m_fRepeatDelay;&lt;br /&gt;
    float m_fInitialDelay;&lt;br /&gt;
 &lt;br /&gt;
protected:&lt;br /&gt;
 &lt;br /&gt;
    virtual void repeatKey(OIS::KeyCode a_nKey, unsigned int a_nChar) = 0;&lt;br /&gt;
 &lt;br /&gt;
public:&lt;br /&gt;
 &lt;br /&gt;
    AutoRepeatKey(float a_fRepeatDelay = 0.035f, float a_fInitialDelay = 0.300f);&lt;br /&gt;
 &lt;br /&gt;
    void begin(const OIS::KeyEvent &amp;amp;evt);&lt;br /&gt;
 &lt;br /&gt;
    void end(const OIS::KeyEvent &amp;amp;evt);&lt;br /&gt;
 &lt;br /&gt;
    void update(float a_fElapsed); // Elapsed time in seconds&lt;br /&gt;
};&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CPP File&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;AutoRepeatKey.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
AutoRepeatKey::AutoRepeatKey(float a_fRepeatDelay, float a_fInitialDelay):&lt;br /&gt;
    m_nKey(OIS::KC_UNASSIGNED),&lt;br /&gt;
    m_fRepeatDelay(a_fRepeatDelay),&lt;br /&gt;
    m_fInitialDelay(a_fInitialDelay)&lt;br /&gt;
{}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::begin(const OIS::KeyEvent &amp;amp;evt) {&lt;br /&gt;
    m_nKey = evt.key;&lt;br /&gt;
    m_nChar = evt.text;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed = 0;&lt;br /&gt;
    m_fDelay = m_fInitialDelay;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::end(const OIS::KeyEvent &amp;amp;evt) {&lt;br /&gt;
    if (m_nKey != evt.key) return;&lt;br /&gt;
 &lt;br /&gt;
    m_nKey = OIS::KC_UNASSIGNED;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void AutoRepeatKey::update(float a_fElapsed) {&lt;br /&gt;
    if (m_nKey == OIS::KC_UNASSIGNED) return;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed += a_fElapsed;&lt;br /&gt;
    if (m_fElapsed &amp;lt; m_fDelay) return;&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed -= m_fDelay;&lt;br /&gt;
    m_fDelay = m_fRepeatDelay;&lt;br /&gt;
 &lt;br /&gt;
    do {&lt;br /&gt;
        repeatKey(m_nKey, m_nChar);&lt;br /&gt;
 &lt;br /&gt;
        m_fElapsed -= m_fRepeatDelay;&lt;br /&gt;
    } while (m_fElapsed &amp;gt;= m_fRepeatDelay);&lt;br /&gt;
 &lt;br /&gt;
    m_fElapsed = 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
References:&lt;br /&gt;
&lt;br /&gt;
http://www.ogre3d.org/tikiwiki/Auto+Repeat+Key+Input&amp;amp;structure=Cookbook&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Creating_widgets&amp;diff=4338</id>
		<title>CEGUI In Practice - Creating widgets</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Creating_widgets&amp;diff=4338"/>
				<updated>2011-03-09T17:59:26Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|2}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI In-Practice 2 ==&lt;br /&gt;
&lt;br /&gt;
Welcome back.  This is the second installment of CEGUI In-Practice tutorial series.  In this we will build upon the previous tutorial, [[CEGUI In Practice - Introduction]].  We will show how to create Widgets and manage them.&lt;br /&gt;
&lt;br /&gt;
=== The Widget ===&lt;br /&gt;
&lt;br /&gt;
In the last example we showed how to bootstrap the system with Ogre, and gave a brief introduction to CEGUI's script files.  Now we will work on understanding what a widget is and how to use them.  Lets jump in and create a window which will display a box with an image in the middle of the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *myImageWindow = CEGUI::WindowManager::getSingleton().createWindow(&amp;quot;TaharezLook/StaticImage&amp;quot;,&amp;quot;PrettyWindow&amp;quot; ); &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CEGUI uses numerous derived classes code-side to create windows.  The base class CEGUI::Window is the generic window. the CEGUI::WindowManager calls a factory class when creating a window which returns the windows pointer. The first argument, &amp;quot;TaharezLook/StaticImage&amp;quot; tells the factory what kind of window to make.  These windows are defined in .scheme, which are subsequently defined more depth in other .xml files. The second argument is the name which the window will have.  &lt;br /&gt;
&lt;br /&gt;
[Note: As a point to note, there is no strict requirement on naming of windows, except to avoid repeat names.  Some users tend to prefer a naming convention using ParentName/ChildName.  ie.  &amp;quot;ConsoleWindow/SendButton&amp;quot; or &amp;quot;_MasterRoot/HealthBar&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
Once we have created the window, myImageWindow will be a pointer to a CEGUI::{{DoxygenClass|DefaultWindow|0.7}} which is derived from CEGUI::{{DoxygenClass|Window|0.7}}. If you look in the .scheme file you can see can see what a Widget is derived from via the TargetType= tag.&lt;br /&gt;
&lt;br /&gt;
Next we need to set some properties for this window. There are two ways of doing this. The first is via the propertyset, or the second way by calling the function. The latter way can be more annoying at times, as you may have to cast the window to the correct type to get access to the member functions, but may be more intuitive depending on how you think.&lt;br /&gt;
&lt;br /&gt;
=== The Unified Dimension System ===&lt;br /&gt;
&lt;br /&gt;
We created our widget, now we need to position it and define its size. Lets do that via code shall we?&lt;br /&gt;
&lt;br /&gt;
Before we jump in too far, we need to understand how CEGUI Handles positions. CEGUI Uses a Unified Dimension system. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::UDim(scale,offset)&amp;lt;/source&amp;gt;&lt;br /&gt;
The first number is the relative point on the screen between (0,1). So if we were looking at the X axis (left to right on the screen) a UDim(0.5,0) would be Halfway across the screen with zero pixels offset. Udim(0.0,50) would be starting at the left side of the screen +50 pixels. You can combine them too Udim(0.75,10) would be 3/4 of the way across the screen, with an additional 10 pixels.&lt;br /&gt;
&lt;br /&gt;
A point on the screen (or a UVector2) is made up of two UDims:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::UVector2(UDim x,UDim y)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As such, a CEGUI::Rect is as you would imagine, 4 UDims&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::URect(CEGUI::Udim left,CEGUI::Udim top,CEGUI::Udim right,CEGUI::Udim bottom)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So now that we know how positions are done, lets move our created window to the middle of the screen:&lt;br /&gt;
==== The Widget in Practice ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;myImageWindow-&amp;gt;setPosition(CEGUI::UVector2(CEGUI::UDim(0.5,0),CEGUI::UDim(0.5,0)));&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That may look a little ugly but break it down. setPosition takes a UVector2, and each UVector2 is made up of an X and Y Udim, which is made up of a Scale and Absolute float. &lt;br /&gt;
&lt;br /&gt;
So, we have moved our window to the middle of the screen.. but CEGUI doesn't know how big to make it? So set its size to 150 pixels by 100 pixels [Note: I dropped the namespace for this to increase readability]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;myImageWindow-&amp;gt;setSize(UVector2(UDim(0,150),UDim(0,100)));&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case we specified the Udim using 0 for scales, and the actual pixel size in the absolute argument. The Absolute argument is additive to the scale, and in this case we didn't want to have the size be affected by the scale argument. If we were creating a splash screen that took up the entire window, we would likely want the size to be UVector2(UDim(1,0),UDim(1,0) with the position being at UVector2(Udim(0,0), UDim(0,0).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that we have created the window to the size we want. We need to tell it what image to display! That we will do by using the PropertySet as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
myImageWindow-&amp;gt;setProperty(&amp;quot;Image&amp;quot;,&amp;quot;set:TaharezLook image:full_image&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first agument is what Property we want to set, and the second argument is what value to set. The second argument is a string broken into two pieces in this example. We need to know what ImageSet we are looking in, which is referenced following the 'set:' portion. And then the image via the 'image:' portion. In this case we want it to show the full_image.&lt;br /&gt;
&lt;br /&gt;
A Listing of properties for TaharezLook is available here [http://cegui.org.uk/static/TaharezLookProperties.html]&lt;br /&gt;
&lt;br /&gt;
Now that we have created the window. We need to attach it to the current root window.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::System::getGUISheet()-&amp;gt;addChildWindow(myImageWindow);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will allow the Window to be displayed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
So with this quick tutorial we got a very short introduction to PropertySet usage (Important!) and a little bit about how the Unified Dimension System in CEGUI Works. While still not terribly useful, we're beginning to understand how to use some of CEGUI's faculties. Next up, we'll learn how to get some interactivity from this thing.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice7&amp;diff=4329</id>
		<title>CEGUI In Practice7</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice7&amp;diff=4329"/>
				<updated>2011-03-07T18:54:06Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: moved CEGUI In Practice7 to CEGUI In Practice - User Data&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[CEGUI In Practice - User Data]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_User_Data&amp;diff=4328</id>
		<title>CEGUI In Practice - User Data</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_User_Data&amp;diff=4328"/>
				<updated>2011-03-07T18:54:06Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: moved CEGUI In Practice7 to CEGUI In Practice - User Data&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|7}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== CEGUI InPractice 7 ==&lt;br /&gt;
&lt;br /&gt;
This tutorial will be a short tutorial, as i will show how to do a small addon to the previous tutorial [[CEGUI In Practice - A Game Console]] showing you how to associate the ConsoleRoot with our GameConsoleWindow class. While not terribly useful in this situation, it can demonstrate a useful feature that you likely will use in your own game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== UserData ====&lt;br /&gt;
&lt;br /&gt;
User data in CEGUI is basically a void pointer.  This allows you to assign a custom structure or variable to each cegui window.  This is extremely useful as it allows you to greater incorporate CEGUI into your development.  For the previous example we created a Class to encompass our Console window which was great as it allowed us to easily encapsulate all the CEGUI windows and their handlers into a neat and easy to use function.  It was pretty easy to go from GameConsoleWindow to each of the classes (by accessing the m_ConsoleWindow in the class and getChild() method).  However, its not so easy to from the CEGUI::Window back up to the class level without recompiling CEGUI and creating custom widgets, unless you use userData.  &lt;br /&gt;
&lt;br /&gt;
Its almost so easy to use that its a waste of wiki space to show this, but regardless I see alot of posts about it on the IRC channel.  Here is a line we would add to our CreateCEGUIWindow(); function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::CreateCEGUIWindow()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
  &lt;br /&gt;
            CEGUI::System::getSingleton().getGUISheet()-&amp;gt;addChildWindow(m_ConsoleWindow);&lt;br /&gt;
            (this)-&amp;gt;RegisterHandlers();&lt;br /&gt;
            m_ConsoleWindow-&amp;gt;setUserData(this);    // &amp;lt;------ Add this line&lt;br /&gt;
...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That adds a pointer to the class we're currently in, which is an instance of GameConsoleWindow.  Note tho, it stores this as a void* so when we go back to this pointer later, it will not know what type of data this is, so you will need to cast it back:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
     GameConsoleWindow *ConsoleClass = NULL;&lt;br /&gt;
&lt;br /&gt;
     ConsoleClass = static_cast&amp;lt;GameConsoleWindow*&amp;gt;(m_ConsoleWindow-&amp;gt;getUserData());&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will convert the void* we stored above, into the ConsoleClass pointer.  You could probably use dynamic_cast but then you'd need to turn on RTT, which is not always required for performance reasons.  Regardless you can see how easily this is done.  We will use this in a later tutorial demonstrating how to implement an inventory system.&lt;br /&gt;
&lt;br /&gt;
Until next time..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_User_Data&amp;diff=4327</id>
		<title>CEGUI In Practice - User Data</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_User_Data&amp;diff=4327"/>
				<updated>2011-03-07T18:53:32Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|7}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== CEGUI InPractice 7 ==&lt;br /&gt;
&lt;br /&gt;
This tutorial will be a short tutorial, as i will show how to do a small addon to the previous tutorial [[CEGUI In Practice - A Game Console]] showing you how to associate the ConsoleRoot with our GameConsoleWindow class. While not terribly useful in this situation, it can demonstrate a useful feature that you likely will use in your own game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== UserData ====&lt;br /&gt;
&lt;br /&gt;
User data in CEGUI is basically a void pointer.  This allows you to assign a custom structure or variable to each cegui window.  This is extremely useful as it allows you to greater incorporate CEGUI into your development.  For the previous example we created a Class to encompass our Console window which was great as it allowed us to easily encapsulate all the CEGUI windows and their handlers into a neat and easy to use function.  It was pretty easy to go from GameConsoleWindow to each of the classes (by accessing the m_ConsoleWindow in the class and getChild() method).  However, its not so easy to from the CEGUI::Window back up to the class level without recompiling CEGUI and creating custom widgets, unless you use userData.  &lt;br /&gt;
&lt;br /&gt;
Its almost so easy to use that its a waste of wiki space to show this, but regardless I see alot of posts about it on the IRC channel.  Here is a line we would add to our CreateCEGUIWindow(); function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::CreateCEGUIWindow()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
  &lt;br /&gt;
            CEGUI::System::getSingleton().getGUISheet()-&amp;gt;addChildWindow(m_ConsoleWindow);&lt;br /&gt;
            (this)-&amp;gt;RegisterHandlers();&lt;br /&gt;
            m_ConsoleWindow-&amp;gt;setUserData(this);    // &amp;lt;------ Add this line&lt;br /&gt;
...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That adds a pointer to the class we're currently in, which is an instance of GameConsoleWindow.  Note tho, it stores this as a void* so when we go back to this pointer later, it will not know what type of data this is, so you will need to cast it back:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
     GameConsoleWindow *ConsoleClass = NULL;&lt;br /&gt;
&lt;br /&gt;
     ConsoleClass = static_cast&amp;lt;GameConsoleWindow*&amp;gt;(m_ConsoleWindow-&amp;gt;getUserData());&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will convert the void* we stored above, into the ConsoleClass pointer.  You could probably use dynamic_cast but then you'd need to turn on RTT, which is not always required for performance reasons.  Regardless you can see how easily this is done.  We will use this in a later tutorial demonstrating how to implement an inventory system.&lt;br /&gt;
&lt;br /&gt;
Until next time..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_User_Data&amp;diff=4326</id>
		<title>CEGUI In Practice - User Data</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_User_Data&amp;diff=4326"/>
				<updated>2011-03-07T18:52:59Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CEGUI InPractice 7 ==&lt;br /&gt;
&lt;br /&gt;
This tutorial will be a short tutorial, as i will show how to do a small addon to the previous tutorial [[CEGUI In Practice - A Game Console]] showing you how to associate the ConsoleRoot with our GameConsoleWindow class. While not terribly useful in this situation, it can demonstrate a useful feature that you likely will use in your own game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== UserData ====&lt;br /&gt;
&lt;br /&gt;
User data in CEGUI is basically a void pointer.  This allows you to assign a custom structure or variable to each cegui window.  This is extremely useful as it allows you to greater incorporate CEGUI into your development.  For the previous example we created a Class to encompass our Console window which was great as it allowed us to easily encapsulate all the CEGUI windows and their handlers into a neat and easy to use function.  It was pretty easy to go from GameConsoleWindow to each of the classes (by accessing the m_ConsoleWindow in the class and getChild() method).  However, its not so easy to from the CEGUI::Window back up to the class level without recompiling CEGUI and creating custom widgets, unless you use userData.  &lt;br /&gt;
&lt;br /&gt;
Its almost so easy to use that its a waste of wiki space to show this, but regardless I see alot of posts about it on the IRC channel.  Here is a line we would add to our CreateCEGUIWindow(); function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::CreateCEGUIWindow()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
  &lt;br /&gt;
            CEGUI::System::getSingleton().getGUISheet()-&amp;gt;addChildWindow(m_ConsoleWindow);&lt;br /&gt;
            (this)-&amp;gt;RegisterHandlers();&lt;br /&gt;
            m_ConsoleWindow-&amp;gt;setUserData(this);    // &amp;lt;------ Add this line&lt;br /&gt;
...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That adds a pointer to the class we're currently in, which is an instance of GameConsoleWindow.  Note tho, it stores this as a void* so when we go back to this pointer later, it will not know what type of data this is, so you will need to cast it back:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
     GameConsoleWindow *ConsoleClass = NULL;&lt;br /&gt;
&lt;br /&gt;
     ConsoleClass = static_cast&amp;lt;GameConsoleWindow*&amp;gt;(m_ConsoleWindow-&amp;gt;getUserData());&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will convert the void* we stored above, into the ConsoleClass pointer.  You could probably use dynamic_cast but then you'd need to turn on RTT, which is not always required for performance reasons.  Regardless you can see how easily this is done.  We will use this in a later tutorial demonstrating how to implement an inventory system.&lt;br /&gt;
&lt;br /&gt;
Until next time..&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_User_Data&amp;diff=4317</id>
		<title>CEGUI In Practice - User Data</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_User_Data&amp;diff=4317"/>
				<updated>2011-03-06T15:36:42Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: Created page with &amp;quot;== CEGUI InPractice 7 ==  This tutorial will be a short tutorial, as i will show how to do a small addon to the previous tutorial CEGUI_In_Practice_-_A_Game_Console showing y...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CEGUI InPractice 7 ==&lt;br /&gt;
&lt;br /&gt;
This tutorial will be a short tutorial, as i will show how to do a small addon to the previous tutorial [[CEGUI_In_Practice_-_A_Game_Console]] showing you how to associate the ConsoleRoot with our GameConsoleWindow class.  While not terribly useful in this situation, it can demonstrate a useful feature that you likely will use in your own game.&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_InPractice_6&amp;diff=4292</id>
		<title>CEGUI InPractice 6</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_InPractice_6&amp;diff=4292"/>
				<updated>2011-03-04T22:33:51Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: moved CEGUI InPractice 6 to CEGUI In Practice - A Game Console: More Applicable naming&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[CEGUI In Practice - A Game Console]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4291</id>
		<title>CEGUI In Practice - A Game Console</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4291"/>
				<updated>2011-03-04T22:33:51Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: moved CEGUI InPractice 6 to CEGUI In Practice - A Game Console: More Applicable naming&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|6}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI InPractice 6 ==&lt;br /&gt;
&lt;br /&gt;
Welcome back! This tutorial we will put together the knowledge from the past few chapters to create a functioning Console window. The last few tutorials have given us the basics. Now its time to put that knowledge to use and make something we can use in our game.&lt;br /&gt;
&lt;br /&gt;
==== Game Plan ====&lt;br /&gt;
&lt;br /&gt;
Okay, now lets look at what we need to do. We will want to be able to type in commands, press the send button, and have them output into the text box. We will also probably want to acknowledge when enter is pressed as thats the 'normal' feel of typing into a chat.&lt;br /&gt;
&lt;br /&gt;
We discussed earlier how to send input to CEGUI ([[CEGUI In Practice - Managing input]]), so we will have to assume that you have that working (and probably built the application structure behind it). We will also assume you used the previous tutorial's layout file and naming for the console window ( [[CEGUI In Practice - Using .layout files]]).&lt;br /&gt;
&lt;br /&gt;
Due to the fact that we are getting to a slightly more advanced implementation of CEGUI here, and because we may want the ConsoleWindow to do other more useful things (like parsing strings for /say commands) I'm going to create a class to encompass the CEGUI ConsoleWindow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class GameConsoleWindow&lt;br /&gt;
{&lt;br /&gt;
    public:&lt;br /&gt;
       GameConsoleWindow();                   // Constructor&lt;br /&gt;
    private:&lt;br /&gt;
       void CreateCEGUIWindow();                                  // The function which will load in the CEGUI Window and register event handlers&lt;br /&gt;
       void RegisterHandlers();                                   // Register our handler functions&lt;br /&gt;
       void Handle_TextSubmitted(const CEGUI::EventArgs &amp;amp;e);      // Handle when we press Enter after typing&lt;br /&gt;
       void Handle_SendButtonPressed(const CEGUI::EventArgs &amp;amp;e);  // Handle when we press the Send button         &lt;br /&gt;
       void ParseText(CEGUI::String inMsg);                       // Parse the text the user submitted.&lt;br /&gt;
       void OutputText(CEGUI::String inMsg,                       // Post the message to the ChatHistory listbox.&lt;br /&gt;
              CEGUI::Colour colour = CEGUI::Colour( 0xFFFFFFFF)); //   with a white color default&lt;br /&gt;
       &lt;br /&gt;
       CEGUI::Window *m_ConsoleWindow;                            // This will be a pointer to the ConsoleRoot window.&lt;br /&gt;
       CEGUI::String sNamePrefix;                                  // This will be the prefix name we give the layout&lt;br /&gt;
       static int iInstanceNumber;                                 // This will be the instance number for this class. &lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright, so that will be our class. It might look daunting, but don't worry it will all make sense in the end.&lt;br /&gt;
&lt;br /&gt;
==== The Constructor ====&lt;br /&gt;
&lt;br /&gt;
I'm going to use the constructor as the main point of automation here.  And while I believe it is normally bad practice to call functions which could potentially fail within a constructor, i'm going to anyway for ease of this tutorial.  We will have it Initialize some variables, and then call the CreateCEGUIWindow function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
GameConsoleWindow::GameConsoleWindow()&lt;br /&gt;
{&lt;br /&gt;
   m_ConsoleWindow = NULL;       // Always good practice to initialize a pointer to a NULL value, helps when switching to Release Builds.&lt;br /&gt;
   iInstanceNumber = 0;&lt;br /&gt;
   sNamePrefix = &amp;quot;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
==== Setting up the Window ====&lt;br /&gt;
&lt;br /&gt;
Now we need to setup the window. We have done this before in the .layout tutorial so we will do it again here. However, we mentioned before that you could use a prefix when loading a .layout to avoid name conflicts if you load multiple layouts. So we need to account for that. Will we need multiple consoles? Who knows, might as well build it in while we're designing it right?&lt;br /&gt;
&lt;br /&gt;
Lets write the CreateCEGUIWindow function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::CreateCEGUIWindow()&lt;br /&gt;
{&lt;br /&gt;
	// Get a local pointer to the CEGUI Window Manager, Purely for convenience to reduce typing&lt;br /&gt;
	CEGUI::WindowManager *pWindowManager = CEGUI::WindowManager::getSingletonPtr();&lt;br /&gt;
&lt;br /&gt;
        // Now before we load anything, lets increase our instance number to ensure no conflicts.  &lt;br /&gt;
        // I like the format #_ConsoleRoot so thats how i'm gonna make the prefix.  This simply&lt;br /&gt;
        // Increments the iInstanceNumber then puts it + a _ into the sNamePrefix string. &lt;br /&gt;
        sNamePrefix = ++iInstanceNumber + &amp;quot;_&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        // Now that we can ensure that we have a safe prefix, and won't have any naming conflicts lets create the window&lt;br /&gt;
        // and assign it to our member window pointer m_ConsoleWindow&lt;br /&gt;
        m_ConsoleWindow = pWindowManager-&amp;gt;loadWindowLayout(inLayoutName,sNamePrefix);&lt;br /&gt;
&lt;br /&gt;
        // Being a good programmer, its a good idea to ensure that we got a valid window back. &lt;br /&gt;
        if (m_ConsoleWindow)&lt;br /&gt;
        {&lt;br /&gt;
            // Lets add our new window to the Root GUI Window&lt;br /&gt;
            CEGUI::System::getSingletonPtr()-&amp;gt;getGUISheet()-&amp;gt;addChildWindow(m_ConsoleWindow);&lt;br /&gt;
            // Now register the handlers for the events (Clicking, typing, etc)&lt;br /&gt;
            (this)-&amp;gt;RegisterHandlers();&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            // Something bad happened and we didn't successfully create the window lets output the information&lt;br /&gt;
            CEGUI::Logger::getSingletonPtr()-&amp;gt;logEvent(&amp;quot;Error: Unable to load the ConsoleWindow from .layout&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright so that created the window. And after the window was created, we Registered its handlers. Lets look at how we go about&lt;br /&gt;
registering those handlers. Below is the RegisterHandlers function, it will probably look familiar if you have been reading along:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::RegisterHandlers()&lt;br /&gt;
{&lt;br /&gt;
    // Alright now we need to register the handlers.  We mentioned above we want to acknowledge when the user presses Enter, and &lt;br /&gt;
      // when they click the 'Send' button.  So we need to register each of those events&lt;br /&gt;
&lt;br /&gt;
    // First lets register the Send button.  Our buttons name is &amp;quot;ConsoleRoot/SendButton&amp;quot;, but don't forget we prepended a name to      &lt;br /&gt;
      // all the windows which were loaded.  So we need to take that into account here.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/SendButton&amp;quot;)-&amp;gt;subscribeEvent(&lt;br /&gt;
                        CEGUI::PushButton::EventClicked,    // If we recall our button was of type CEGUI::PushButton in the .scheme&lt;br /&gt;
                                                            // and we want to acknowledge the EventClicked action.&lt;br /&gt;
                        CEGUI::Event::Subscriber(           // What function to call when this is clicked.  Remember, all functions &lt;br /&gt;
                                                            // are contained within (this) class.&lt;br /&gt;
                        &amp;amp;GameConsoleWindow::Handle_SendButtonPressed,  // Call Handle_SendButtonPressed member of GameConsoleWindow&lt;br /&gt;
                        this));                             // Using (this) instance we're in right now&lt;br /&gt;
&lt;br /&gt;
    // Now for the TextSubmitted, we will be registering the event on the edit box, which is where the users cursor will be when   &lt;br /&gt;
      //they press Enter.  I'm not going to break this down as much, because I believe that is very ugly to read, but was a good  &lt;br /&gt;
      //way of expressing it.  Here is the function call.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;subscribeEvent(CEGUI::Editbox::EventMouseClick,&lt;br /&gt;
                        CEGUI::Event::Subscriber(&amp;amp;GameConsoleWindow::Handle_TextSubmitted,this));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That last line looks pretty ugly, but remember if you include namespace CEGUI; you won't have all those Ugly CEGUI:: prefixing all the code.  As you can see, once you get the hang of registering events its pretty easy.  One thing to note, is there are more than one way to account for certain actions.  On the button, you could also have registered for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    CEGUI::PushButton::EventMouseClick&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonDown&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonUp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Depending on what result you were looking for, and where you wanted the action to take place.  For example, windows interfaces usually react on the MouseButtonUp, allowing the user to click it, and then slide off the mouse if it wasn't what they really wanted to press.&lt;br /&gt;
&lt;br /&gt;
==== The Handlers ====&lt;br /&gt;
&lt;br /&gt;
Now that we have registered the events, we need to actually write the functions which will handle those events.  We need to handle both the Text Submitted, and the SendButton's event.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::Handle_TextSubmitted(const CEGUI::EventArgs &amp;amp;e)&lt;br /&gt;
{&lt;br /&gt;
    // The following line of code is not really needed in this particular example, but is good to show.  The EventArgs by itself &lt;br /&gt;
     // only has limited uses. You will find it more useful to cast this to another type of Event.  In this case WindowEventArgs&lt;br /&gt;
     // could be much more useful as we are dealing with a CEGUI::Window.  Notably, this will allow you access to the .window&lt;br /&gt;
     // member of the argument, which will have a pointer to the window which called the event.  You can imagine that would be&lt;br /&gt;
     // useful!&lt;br /&gt;
    const CEGUI::WindowEventArgs* args = static_cast&amp;lt;const CEGUI::WindowEventArgs*&amp;gt;(&amp;amp;e);&lt;br /&gt;
&lt;br /&gt;
    // Now we need to get the text that is in the edit box right now.&lt;br /&gt;
    CEGUI::String Msg = mWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;getText();&lt;br /&gt;
&lt;br /&gt;
    // Since we have that string, lets send it to the TextParser which will handle it from here&lt;br /&gt;
    (this)-&amp;gt;ParseText(Msg);&lt;br /&gt;
&lt;br /&gt;
    // Now that we've finished with the text, we need to ensure that we clear out the EditBox.  This is what we would expect&lt;br /&gt;
      // To happen after we press enter&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;setText(&amp;quot;&amp;quot;);&lt;br /&gt;
} &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you might be wondering why we didn't just Parse the text in here?  Well If the user presses Enter, or presses the Send button the text will either way have to be parsed, and it will be parsed in the same manner.  So why write the same code twice?&lt;br /&gt;
&lt;br /&gt;
Below is the code for handling the SendButton being pressed.  I know I just harped on rewriting code, and this will ironically look alot like the Code for when text has been submitted.  But thats because we don't really need the button to do much.  We probably could have just had the ButtonPress trigger the Handle_TextSubmitted above when we registered the handlers, but what if we wanted a clicking noise to be played when the player pressed the button?  Then we would need a seperate handler for the Send button.  Anyway 'nuff said, lets show the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::Handle_SendButtonPressed(const CEGUI::EventArgs &amp;amp;e)&lt;br /&gt;
{&lt;br /&gt;
    CEGUI::String Msg = mWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;getText();&lt;br /&gt;
    (this)-&amp;gt;ParseText(Msg);&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;setText(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Parsing that Text ====&lt;br /&gt;
&lt;br /&gt;
This portion is not going to be so much CEGUI Related as it will be string manipulation.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void GameConsoleWindow::ParseText(CEGUI::String inMsg); &lt;br /&gt;
&lt;br /&gt;
       // I personally like working with std::string. So i'm going to convert it here.&lt;br /&gt;
       std::string inString = inMsg.c_str();&lt;br /&gt;
&lt;br /&gt;
	if (inString.length() &amp;gt;= 1) // Be sure we got a string longer than 0&lt;br /&gt;
	{&lt;br /&gt;
		if (inString.at(0) == '/') // Check if the first letter is a 'command'&lt;br /&gt;
		{&lt;br /&gt;
			std::string::size_type commandEnd = inString.find(&amp;quot; &amp;quot;, 1);&lt;br /&gt;
			std::string command = inString.substr(1, commandEnd - 1);&lt;br /&gt;
			std::string commandArgs = inString.substr(commandEnd + 1, inString.length() - (commandEnd + 1));&lt;br /&gt;
			//convert command to lower case&lt;br /&gt;
			for(std::string::size_type i=0; i &amp;lt; command.length(); i++)&lt;br /&gt;
			{&lt;br /&gt;
				command[i] = tolower(command[i]);&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Begin processing&lt;br /&gt;
&lt;br /&gt;
			if (command == &amp;quot;say&amp;quot;)&lt;br /&gt;
			{&lt;br /&gt;
				std::string outString = &amp;quot;You:&amp;quot; + inString;  // Append our 'name' to the message we'll display in the list&lt;br /&gt;
                         	mConsole-&amp;gt;OutputMessage(outString);&lt;br /&gt;
			}&lt;br /&gt;
			else if (command == &amp;quot;quit&amp;quot;)&lt;br /&gt;
			{&lt;br /&gt;
				// do a /quit &lt;br /&gt;
			}&lt;br /&gt;
			else if (command == &amp;quot;help&amp;quot;)&lt;br /&gt;
			{&lt;br /&gt;
				// do a /help&lt;br /&gt;
			}&lt;br /&gt;
			else&lt;br /&gt;
			{&lt;br /&gt;
				std::string outString = &amp;quot;&amp;lt;&amp;quot; + inString + &amp;quot;&amp;gt; is an invalid command.&amp;quot;;&lt;br /&gt;
				(this)-&amp;gt;OutputText(outString,CEGUI::Colour(1.0f,0.0f,0.0f));  // With red ANGRY colors!&lt;br /&gt;
			}&lt;br /&gt;
		} // End if /&lt;br /&gt;
		else&lt;br /&gt;
		{&lt;br /&gt;
	            (this)-&amp;gt;OutputText(inString);  // no commands, just output what they wrote&lt;br /&gt;
		}&lt;br /&gt;
	}  &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Phew, thats kinda an annoying function isn't it?  Well, the point to note is that it checks for a forward slash, if it finds one then it enters the if/else conditions to see if it found an applicable command.  If it does it does something.  In this example it handles the actions right there, if you were to write it a little more advanced, it could goto a (this)-&amp;gt;ShowHelp() or (this)-&amp;gt;QuitGame().  &lt;br /&gt;
&lt;br /&gt;
The point to note is the OutputText.  That will add the items to the ListBox of Chat history.  We will work on that function now.&lt;br /&gt;
&lt;br /&gt;
==== OutputText ====&lt;br /&gt;
&lt;br /&gt;
A point to note here.  A CEGUI::Listbox window doesn't naturally word wrap.  And wordwrapping is a very nice thing to have in a chat window, as everyone has different resolutions on their screens, and some people REALLY like to ramble! (But not this magnificant author of course!).  So we will use a Custom created widget which is available on the forums [http://www.cegui.org.uk/phpBB2/viewtopic.php?f=10&amp;amp;t=4322].  you could use a normal listbox, but you wouldn't get word-wrapping.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt; &lt;br /&gt;
void GameConsoleWindow::OutputText(std::string message, CEGUI::Colour colour)&lt;br /&gt;
{&lt;br /&gt;
	&lt;br /&gt;
	// Get a pointer to the ChatBox so we don't have to use this ugly getChild function everytime.&lt;br /&gt;
	CEGUI::Listbox *outputWindow =  static_cast&amp;lt;CEGUI::Listbox*&amp;gt;(m_ConsoleWindow-&amp;gt;getChild(&amp;quot;ConsoleRoot/ChatBox&amp;quot;));&lt;br /&gt;
	&lt;br /&gt;
	CEGUI::FormattedListboxTextItem *newItem=0;       // This will hold the actual text and will be the listbox segment / item&lt;br /&gt;
&lt;br /&gt;
	newItem = new CEGUI::FormattedListboxTextItem(message,CEGUI::HTF_WORDWRAP_LEFT_ALIGNED);   // Instance the Item with Left&lt;br /&gt;
                                                                                                   //   wordwrapped alignment&lt;br /&gt;
	newItem-&amp;gt;setTextColours(colour);                // Set the text color&lt;br /&gt;
	outputWindow-&amp;gt;addItem(newItem);                 // Add the new ListBoxTextItem to the ListBox&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
And that ladies and gentleman, is our Console box.  Not too terrible was it? Now of course, remember there are many ways to skin the proverbial cat.  This is just an example of ways to do things.  If you would like some homework, you could investigate why the SendButton does weird things when you drag and resize the window.  I'll give you a hint, look at the way we're defining how big the ConsoleRoot is and where its child windows are placed...  and what implications we might have by using relative scales for things..  Okay, i guess that was a big hint wasn't it!  &lt;br /&gt;
&lt;br /&gt;
Till next time...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4290</id>
		<title>CEGUI In Practice - A Game Console</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4290"/>
				<updated>2011-03-04T21:01:21Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|6}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI InPractice 6 ==&lt;br /&gt;
&lt;br /&gt;
Welcome back! This tutorial we will put together the knowledge from the past few chapters to create a functioning Console window. The last few tutorials have given us the basics. Now its time to put that knowledge to use and make something we can use in our game.&lt;br /&gt;
&lt;br /&gt;
==== Game Plan ====&lt;br /&gt;
&lt;br /&gt;
Okay, now lets look at what we need to do. We will want to be able to type in commands, press the send button, and have them output into the text box. We will also probably want to acknowledge when enter is pressed as thats the 'normal' feel of typing into a chat.&lt;br /&gt;
&lt;br /&gt;
We discussed earlier how to send input to CEGUI ([[CEGUI In Practice - Managing input]]), so we will have to assume that you have that working (and probably built the application structure behind it). We will also assume you used the previous tutorial's layout file and naming for the console window ( [[CEGUI In Practice - Using .layout files]]).&lt;br /&gt;
&lt;br /&gt;
Due to the fact that we are getting to a slightly more advanced implementation of CEGUI here, and because we may want the ConsoleWindow to do other more useful things (like parsing strings for /say commands) I'm going to create a class to encompass the CEGUI ConsoleWindow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class GameConsoleWindow&lt;br /&gt;
{&lt;br /&gt;
    public:&lt;br /&gt;
       GameConsoleWindow();                   // Constructor&lt;br /&gt;
    private:&lt;br /&gt;
       void CreateCEGUIWindow();                                  // The function which will load in the CEGUI Window and register event handlers&lt;br /&gt;
       void RegisterHandlers();                                   // Register our handler functions&lt;br /&gt;
       void Handle_TextSubmitted(const CEGUI::EventArgs &amp;amp;e);      // Handle when we press Enter after typing&lt;br /&gt;
       void Handle_SendButtonPressed(const CEGUI::EventArgs &amp;amp;e);  // Handle when we press the Send button         &lt;br /&gt;
       void ParseText(CEGUI::String inMsg);                       // Parse the text the user submitted.&lt;br /&gt;
       void OutputText(CEGUI::String inMsg,                       // Post the message to the ChatHistory listbox.&lt;br /&gt;
              CEGUI::Colour colour = CEGUI::Colour( 0xFFFFFFFF)); //   with a white color default&lt;br /&gt;
       &lt;br /&gt;
       CEGUI::Window *m_ConsoleWindow;                            // This will be a pointer to the ConsoleRoot window.&lt;br /&gt;
       CEGUI::String sNamePrefix;                                  // This will be the prefix name we give the layout&lt;br /&gt;
       static int iInstanceNumber;                                 // This will be the instance number for this class. &lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright, so that will be our class. It might look daunting, but don't worry it will all make sense in the end.&lt;br /&gt;
&lt;br /&gt;
==== The Constructor ====&lt;br /&gt;
&lt;br /&gt;
I'm going to use the constructor as the main point of automation here.  And while I believe it is normally bad practice to call functions which could potentially fail within a constructor, i'm going to anyway for ease of this tutorial.  We will have it Initialize some variables, and then call the CreateCEGUIWindow function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
GameConsoleWindow::GameConsoleWindow()&lt;br /&gt;
{&lt;br /&gt;
   m_ConsoleWindow = NULL;       // Always good practice to initialize a pointer to a NULL value, helps when switching to Release Builds.&lt;br /&gt;
   iInstanceNumber = 0;&lt;br /&gt;
   sNamePrefix = &amp;quot;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
==== Setting up the Window ====&lt;br /&gt;
&lt;br /&gt;
Now we need to setup the window. We have done this before in the .layout tutorial so we will do it again here. However, we mentioned before that you could use a prefix when loading a .layout to avoid name conflicts if you load multiple layouts. So we need to account for that. Will we need multiple consoles? Who knows, might as well build it in while we're designing it right?&lt;br /&gt;
&lt;br /&gt;
Lets write the CreateCEGUIWindow function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::CreateCEGUIWindow()&lt;br /&gt;
{&lt;br /&gt;
	// Get a local pointer to the CEGUI Window Manager, Purely for convenience to reduce typing&lt;br /&gt;
	CEGUI::WindowManager *pWindowManager = CEGUI::WindowManager::getSingletonPtr();&lt;br /&gt;
&lt;br /&gt;
        // Now before we load anything, lets increase our instance number to ensure no conflicts.  &lt;br /&gt;
        // I like the format #_ConsoleRoot so thats how i'm gonna make the prefix.  This simply&lt;br /&gt;
        // Increments the iInstanceNumber then puts it + a _ into the sNamePrefix string. &lt;br /&gt;
        sNamePrefix = ++iInstanceNumber + &amp;quot;_&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        // Now that we can ensure that we have a safe prefix, and won't have any naming conflicts lets create the window&lt;br /&gt;
        // and assign it to our member window pointer m_ConsoleWindow&lt;br /&gt;
        m_ConsoleWindow = pWindowManager-&amp;gt;loadWindowLayout(inLayoutName,sNamePrefix);&lt;br /&gt;
&lt;br /&gt;
        // Being a good programmer, its a good idea to ensure that we got a valid window back. &lt;br /&gt;
        if (m_ConsoleWindow)&lt;br /&gt;
        {&lt;br /&gt;
            // Lets add our new window to the Root GUI Window&lt;br /&gt;
            CEGUI::System::getSingletonPtr()-&amp;gt;getGUISheet()-&amp;gt;addChildWindow(m_ConsoleWindow);&lt;br /&gt;
            // Now register the handlers for the events (Clicking, typing, etc)&lt;br /&gt;
            (this)-&amp;gt;RegisterHandlers();&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            // Something bad happened and we didn't successfully create the window lets output the information&lt;br /&gt;
            CEGUI::Logger::getSingletonPtr()-&amp;gt;logEvent(&amp;quot;Error: Unable to load the ConsoleWindow from .layout&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright so that created the window. And after the window was created, we Registered its handlers. Lets look at how we go about&lt;br /&gt;
registering those handlers. Below is the RegisterHandlers function, it will probably look familiar if you have been reading along:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::RegisterHandlers()&lt;br /&gt;
{&lt;br /&gt;
    // Alright now we need to register the handlers.  We mentioned above we want to acknowledge when the user presses Enter, and &lt;br /&gt;
      // when they click the 'Send' button.  So we need to register each of those events&lt;br /&gt;
&lt;br /&gt;
    // First lets register the Send button.  Our buttons name is &amp;quot;ConsoleRoot/SendButton&amp;quot;, but don't forget we prepended a name to      &lt;br /&gt;
      // all the windows which were loaded.  So we need to take that into account here.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/SendButton&amp;quot;)-&amp;gt;subscribeEvent(&lt;br /&gt;
                        CEGUI::PushButton::EventClicked,    // If we recall our button was of type CEGUI::PushButton in the .scheme&lt;br /&gt;
                                                            // and we want to acknowledge the EventClicked action.&lt;br /&gt;
                        CEGUI::Event::Subscriber(           // What function to call when this is clicked.  Remember, all functions &lt;br /&gt;
                                                            // are contained within (this) class.&lt;br /&gt;
                        &amp;amp;GameConsoleWindow::Handle_SendButtonPressed,  // Call Handle_SendButtonPressed member of GameConsoleWindow&lt;br /&gt;
                        this));                             // Using (this) instance we're in right now&lt;br /&gt;
&lt;br /&gt;
    // Now for the TextSubmitted, we will be registering the event on the edit box, which is where the users cursor will be when   &lt;br /&gt;
      //they press Enter.  I'm not going to break this down as much, because I believe that is very ugly to read, but was a good  &lt;br /&gt;
      //way of expressing it.  Here is the function call.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;subscribeEvent(CEGUI::Editbox::EventMouseClick,&lt;br /&gt;
                        CEGUI::Event::Subscriber(&amp;amp;GameConsoleWindow::Handle_TextSubmitted,this));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That last line looks pretty ugly, but remember if you include namespace CEGUI; you won't have all those Ugly CEGUI:: prefixing all the code.  As you can see, once you get the hang of registering events its pretty easy.  One thing to note, is there are more than one way to account for certain actions.  On the button, you could also have registered for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    CEGUI::PushButton::EventMouseClick&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonDown&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonUp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Depending on what result you were looking for, and where you wanted the action to take place.  For example, windows interfaces usually react on the MouseButtonUp, allowing the user to click it, and then slide off the mouse if it wasn't what they really wanted to press.&lt;br /&gt;
&lt;br /&gt;
==== The Handlers ====&lt;br /&gt;
&lt;br /&gt;
Now that we have registered the events, we need to actually write the functions which will handle those events.  We need to handle both the Text Submitted, and the SendButton's event.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::Handle_TextSubmitted(const CEGUI::EventArgs &amp;amp;e)&lt;br /&gt;
{&lt;br /&gt;
    // The following line of code is not really needed in this particular example, but is good to show.  The EventArgs by itself &lt;br /&gt;
     // only has limited uses. You will find it more useful to cast this to another type of Event.  In this case WindowEventArgs&lt;br /&gt;
     // could be much more useful as we are dealing with a CEGUI::Window.  Notably, this will allow you access to the .window&lt;br /&gt;
     // member of the argument, which will have a pointer to the window which called the event.  You can imagine that would be&lt;br /&gt;
     // useful!&lt;br /&gt;
    const CEGUI::WindowEventArgs* args = static_cast&amp;lt;const CEGUI::WindowEventArgs*&amp;gt;(&amp;amp;e);&lt;br /&gt;
&lt;br /&gt;
    // Now we need to get the text that is in the edit box right now.&lt;br /&gt;
    CEGUI::String Msg = mWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;getText();&lt;br /&gt;
&lt;br /&gt;
    // Since we have that string, lets send it to the TextParser which will handle it from here&lt;br /&gt;
    (this)-&amp;gt;ParseText(Msg);&lt;br /&gt;
&lt;br /&gt;
    // Now that we've finished with the text, we need to ensure that we clear out the EditBox.  This is what we would expect&lt;br /&gt;
      // To happen after we press enter&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;setText(&amp;quot;&amp;quot;);&lt;br /&gt;
} &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you might be wondering why we didn't just Parse the text in here?  Well If the user presses Enter, or presses the Send button the text will either way have to be parsed, and it will be parsed in the same manner.  So why write the same code twice?&lt;br /&gt;
&lt;br /&gt;
Below is the code for handling the SendButton being pressed.  I know I just harped on rewriting code, and this will ironically look alot like the Code for when text has been submitted.  But thats because we don't really need the button to do much.  We probably could have just had the ButtonPress trigger the Handle_TextSubmitted above when we registered the handlers, but what if we wanted a clicking noise to be played when the player pressed the button?  Then we would need a seperate handler for the Send button.  Anyway 'nuff said, lets show the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::Handle_SendButtonPressed(const CEGUI::EventArgs &amp;amp;e)&lt;br /&gt;
{&lt;br /&gt;
    CEGUI::String Msg = mWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;getText();&lt;br /&gt;
    (this)-&amp;gt;ParseText(Msg);&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;setText(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Parsing that Text ====&lt;br /&gt;
&lt;br /&gt;
This portion is not going to be so much CEGUI Related as it will be string manipulation.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void GameConsoleWindow::ParseText(CEGUI::String inMsg); &lt;br /&gt;
&lt;br /&gt;
       // I personally like working with std::string. So i'm going to convert it here.&lt;br /&gt;
       std::string inString = inMsg.c_str();&lt;br /&gt;
&lt;br /&gt;
	if (inString.length() &amp;gt;= 1) // Be sure we got a string longer than 0&lt;br /&gt;
	{&lt;br /&gt;
		if (inString.at(0) == '/') // Check if the first letter is a 'command'&lt;br /&gt;
		{&lt;br /&gt;
			std::string::size_type commandEnd = inString.find(&amp;quot; &amp;quot;, 1);&lt;br /&gt;
			std::string command = inString.substr(1, commandEnd - 1);&lt;br /&gt;
			std::string commandArgs = inString.substr(commandEnd + 1, inString.length() - (commandEnd + 1));&lt;br /&gt;
			//convert command to lower case&lt;br /&gt;
			for(std::string::size_type i=0; i &amp;lt; command.length(); i++)&lt;br /&gt;
			{&lt;br /&gt;
				command[i] = tolower(command[i]);&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Begin processing&lt;br /&gt;
&lt;br /&gt;
			if (command == &amp;quot;say&amp;quot;)&lt;br /&gt;
			{&lt;br /&gt;
				std::string outString = &amp;quot;You:&amp;quot; + inString;  // Append our 'name' to the message we'll display in the list&lt;br /&gt;
                         	mConsole-&amp;gt;OutputMessage(outString);&lt;br /&gt;
			}&lt;br /&gt;
			else if (command == &amp;quot;quit&amp;quot;)&lt;br /&gt;
			{&lt;br /&gt;
				// do a /quit &lt;br /&gt;
			}&lt;br /&gt;
			else if (command == &amp;quot;help&amp;quot;)&lt;br /&gt;
			{&lt;br /&gt;
				// do a /help&lt;br /&gt;
			}&lt;br /&gt;
			else&lt;br /&gt;
			{&lt;br /&gt;
				std::string outString = &amp;quot;&amp;lt;&amp;quot; + inString + &amp;quot;&amp;gt; is an invalid command.&amp;quot;;&lt;br /&gt;
				(this)-&amp;gt;OutputText(outString,CEGUI::Colour(1.0f,0.0f,0.0f));  // With red ANGRY colors!&lt;br /&gt;
			}&lt;br /&gt;
		} // End if /&lt;br /&gt;
		else&lt;br /&gt;
		{&lt;br /&gt;
	            (this)-&amp;gt;OutputText(inString);  // no commands, just output what they wrote&lt;br /&gt;
		}&lt;br /&gt;
	}  &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Phew, thats kinda an annoying function isn't it?  Well, the point to note is that it checks for a forward slash, if it finds one then it enters the if/else conditions to see if it found an applicable command.  If it does it does something.  In this example it handles the actions right there, if you were to write it a little more advanced, it could goto a (this)-&amp;gt;ShowHelp() or (this)-&amp;gt;QuitGame().  &lt;br /&gt;
&lt;br /&gt;
The point to note is the OutputText.  That will add the items to the ListBox of Chat history.  We will work on that function now.&lt;br /&gt;
&lt;br /&gt;
==== OutputText ====&lt;br /&gt;
&lt;br /&gt;
A point to note here.  A CEGUI::Listbox window doesn't naturally word wrap.  And wordwrapping is a very nice thing to have in a chat window, as everyone has different resolutions on their screens, and some people REALLY like to ramble! (But not this magnificant author of course!).  So we will use a Custom created widget which is available on the forums [http://www.cegui.org.uk/phpBB2/viewtopic.php?f=10&amp;amp;t=4322].  you could use a normal listbox, but you wouldn't get word-wrapping.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt; &lt;br /&gt;
void GameConsoleWindow::OutputText(std::string message, CEGUI::Colour colour)&lt;br /&gt;
{&lt;br /&gt;
	&lt;br /&gt;
	// Get a pointer to the ChatBox so we don't have to use this ugly getChild function everytime.&lt;br /&gt;
	CEGUI::Listbox *outputWindow =  static_cast&amp;lt;CEGUI::Listbox*&amp;gt;(m_ConsoleWindow-&amp;gt;getChild(&amp;quot;ConsoleRoot/ChatBox&amp;quot;));&lt;br /&gt;
	&lt;br /&gt;
	CEGUI::FormattedListboxTextItem *newItem=0;       // This will hold the actual text and will be the listbox segment / item&lt;br /&gt;
&lt;br /&gt;
	newItem = new CEGUI::FormattedListboxTextItem(message,CEGUI::HTF_WORDWRAP_LEFT_ALIGNED);   // Instance the Item with Left&lt;br /&gt;
                                                                                                   //   wordwrapped alignment&lt;br /&gt;
	newItem-&amp;gt;setTextColours(colour);                // Set the text color&lt;br /&gt;
	outputWindow-&amp;gt;addItem(newItem);                 // Add the new ListBoxTextItem to the ListBox&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
And that ladies and gentleman, is our Console box.  Not too terrible was it? Now of course, remember there are many ways to skin the proverbial cat.  This is just an example of ways to do things.  If you would like some homework, you could investigate why the SendButton does weird things when you drag and resize the window.  I'll give you a hint, look at the way we're defining how big the ConsoleRoot is and where its child windows are placed...  and what implications we might have by using relative scales for things..  Okay, i guess that was a big hint wasn't it!  &lt;br /&gt;
&lt;br /&gt;
Till next time...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4289</id>
		<title>CEGUI In Practice - A Game Console</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4289"/>
				<updated>2011-03-04T20:46:04Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|6}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI InPractice 6 ==&lt;br /&gt;
&lt;br /&gt;
Welcome back! This tutorial we will put together the knowledge from the past few chapters to create a functioning Console window. The last few tutorials have given us the basics. Now its time to put that knowledge to use and make something we can use in our game.&lt;br /&gt;
&lt;br /&gt;
==== Game Plan ====&lt;br /&gt;
&lt;br /&gt;
Okay, now lets look at what we need to do. We will want to be able to type in commands, press the send button, and have them output into the text box. We will also probably want to acknowledge when enter is pressed as thats the 'normal' feel of typing into a chat.&lt;br /&gt;
&lt;br /&gt;
We discussed earlier how to send input to CEGUI ([[CEGUI In Practice - Managing input]]), so we will have to assume that you have that working (and probably built the application structure behind it). We will also assume you used the previous tutorial's layout file and naming for the console window ( [[CEGUI In Practice - Using .layout files]]).&lt;br /&gt;
&lt;br /&gt;
Due to the fact that we are getting to a slightly more advanced implementation of CEGUI here, and because we may want the ConsoleWindow to do other more useful things (like parsing strings for /say commands) I'm going to create a class to encompass the CEGUI ConsoleWindow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class GameConsoleWindow&lt;br /&gt;
{&lt;br /&gt;
    public:&lt;br /&gt;
       GameConsoleWindow();                   // Constructor&lt;br /&gt;
    private:&lt;br /&gt;
       void CreateCEGUIWindow();                                  // The function which will load in the CEGUI Window and register event handlers&lt;br /&gt;
       void RegisterHandlers();                                   // Register our handler functions&lt;br /&gt;
       void Handle_TextSubmitted(const CEGUI::EventArgs &amp;amp;e);      // Handle when we press Enter after typing&lt;br /&gt;
       void Handle_SendButtonPressed(const CEGUI::EventArgs &amp;amp;e);  // Handle when we press the Send button         &lt;br /&gt;
       void ParseText(CEGUI::String inMsg);                       // Parse the text the user submitted.&lt;br /&gt;
       void OutputText(CEGUI::String inMsg,                       // Post the message to the ChatHistory listbox.&lt;br /&gt;
              CEGUI::Colour colour = CEGUI::Colour( 0xFFFFFFFF)); //   with a white color default&lt;br /&gt;
       &lt;br /&gt;
       CEGUI::Window *m_ConsoleWindow;                            // This will be a pointer to the ConsoleRoot window.&lt;br /&gt;
       CEGUI::String sNamePrefix;                                  // This will be the prefix name we give the layout&lt;br /&gt;
       static int iInstanceNumber;                                 // This will be the instance number for this class. &lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright, so that will be our class. It might look daunting, but don't worry it will all make sense in the end.&lt;br /&gt;
&lt;br /&gt;
==== The Constructor ====&lt;br /&gt;
&lt;br /&gt;
I'm going to use the constructor as the main point of automation here.  And while I believe it is normally bad practice to call functions which could potentially fail within a constructor, i'm going to anyway for ease of this tutorial.  We will have it Initialize some variables, and then call the CreateCEGUIWindow function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
GameConsoleWindow::GameConsoleWindow()&lt;br /&gt;
{&lt;br /&gt;
   m_ConsoleWindow = NULL;       // Always good practice to initialize a pointer to a NULL value, helps when switching to Release Builds.&lt;br /&gt;
   iInstanceNumber = 0;&lt;br /&gt;
   sNamePrefix = &amp;quot;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
==== Setting up the Window ====&lt;br /&gt;
&lt;br /&gt;
Now we need to setup the window. We have done this before in the .layout tutorial so we will do it again here. However, we mentioned before that you could use a prefix when loading a .layout to avoid name conflicts if you load multiple layouts. So we need to account for that. Will we need multiple consoles? Who knows, might as well build it in while we're designing it right?&lt;br /&gt;
&lt;br /&gt;
Lets write the CreateCEGUIWindow function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::CreateCEGUIWindow()&lt;br /&gt;
{&lt;br /&gt;
	// Get a local pointer to the CEGUI Window Manager, Purely for convenience to reduce typing&lt;br /&gt;
	CEGUI::WindowManager *pWindowManager = CEGUI::WindowManager::getSingletonPtr();&lt;br /&gt;
&lt;br /&gt;
        // Now before we load anything, lets increase our instance number to ensure no conflicts.  &lt;br /&gt;
        // I like the format #_ConsoleRoot so thats how i'm gonna make the prefix.  This simply&lt;br /&gt;
        // Increments the iInstanceNumber then puts it + a _ into the sNamePrefix string. &lt;br /&gt;
        sNamePrefix = ++iInstanceNumber + &amp;quot;_&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        // Now that we can ensure that we have a safe prefix, and won't have any naming conflicts lets create the window&lt;br /&gt;
        // and assign it to our member window pointer m_ConsoleWindow&lt;br /&gt;
        m_ConsoleWindow = pWindowManager-&amp;gt;loadWindowLayout(inLayoutName,sNamePrefix);&lt;br /&gt;
&lt;br /&gt;
        // Being a good programmer, its a good idea to ensure that we got a valid window back. &lt;br /&gt;
        if (m_ConsoleWindow)&lt;br /&gt;
        {&lt;br /&gt;
            // Lets add our new window to the Root GUI Window&lt;br /&gt;
            CEGUI::System::getSingletonPtr()-&amp;gt;getGUISheet()-&amp;gt;addChildWindow(m_ConsoleWindow);&lt;br /&gt;
            // Now register the handlers for the events (Clicking, typing, etc)&lt;br /&gt;
            (this)-&amp;gt;RegisterHandlers();&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            // Something bad happened and we didn't successfully create the window lets output the information&lt;br /&gt;
            CEGUI::Logger::getSingletonPtr()-&amp;gt;logEvent(&amp;quot;Error: Unable to load the ConsoleWindow from .layout&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright so that created the window. And after the window was created, we Registered its handlers. Lets look at how we go about&lt;br /&gt;
registering those handlers. Below is the RegisterHandlers function, it will probably look familiar if you have been reading along:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::RegisterHandlers()&lt;br /&gt;
{&lt;br /&gt;
    // Alright now we need to register the handlers.  We mentioned above we want to acknowledge when the user presses Enter, and &lt;br /&gt;
      // when they click the 'Send' button.  So we need to register each of those events&lt;br /&gt;
&lt;br /&gt;
    // First lets register the Send button.  Our buttons name is &amp;quot;ConsoleRoot/SendButton&amp;quot;, but don't forget we prepended a name to      &lt;br /&gt;
      // all the windows which were loaded.  So we need to take that into account here.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/SendButton&amp;quot;)-&amp;gt;subscribeEvent(&lt;br /&gt;
                        CEGUI::PushButton::EventClicked,    // If we recall our button was of type CEGUI::PushButton in the .scheme&lt;br /&gt;
                                                            // and we want to acknowledge the EventClicked action.&lt;br /&gt;
                        CEGUI::Event::Subscriber(           // What function to call when this is clicked.  Remember, all functions &lt;br /&gt;
                                                            // are contained within (this) class.&lt;br /&gt;
                        &amp;amp;GameConsoleWindow::Handle_SendButtonPressed,  // Call Handle_SendButtonPressed member of GameConsoleWindow&lt;br /&gt;
                        this));                             // Using (this) instance we're in right now&lt;br /&gt;
&lt;br /&gt;
    // Now for the TextSubmitted, we will be registering the event on the edit box, which is where the users cursor will be when   &lt;br /&gt;
      //they press Enter.  I'm not going to break this down as much, because I believe that is very ugly to read, but was a good  &lt;br /&gt;
      //way of expressing it.  Here is the function call.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;subscribeEvent(CEGUI::Editbox::EventMouseClick,&lt;br /&gt;
                        CEGUI::Event::Subscriber(&amp;amp;GameConsoleWindow::Handle_TextSubmitted,this));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That last line looks pretty ugly, but remember if you include namespace CEGUI; you won't have all those Ugly CEGUI:: prefixing all the code.  As you can see, once you get the hang of registering events its pretty easy.  One thing to note, is there are more than one way to account for certain actions.  On the button, you could also have registered for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    CEGUI::PushButton::EventMouseClick&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonDown&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonUp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Depending on what result you were looking for, and where you wanted the action to take place.  For example, windows interfaces usually react on the MouseButtonUp, allowing the user to click it, and then slide off the mouse if it wasn't what they really wanted to press.&lt;br /&gt;
&lt;br /&gt;
==== The Handlers ====&lt;br /&gt;
&lt;br /&gt;
Now that we have registered the events, we need to actually write the functions which will handle those events.  We need to handle both the Text Submitted, and the SendButton's event.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::Handle_TextSubmitted(const CEGUI::EventArgs &amp;amp;e)&lt;br /&gt;
{&lt;br /&gt;
    // The following line of code is not really needed in this particular example, but is good to show.  The EventArgs by itself &lt;br /&gt;
     // only has limited uses. You will find it more useful to cast this to another type of Event.  In this case WindowEventArgs&lt;br /&gt;
     // could be much more useful as we are dealing with a CEGUI::Window.  Notably, this will allow you access to the .window&lt;br /&gt;
     // member of the argument, which will have a pointer to the window which called the event.  You can imagine that would be&lt;br /&gt;
     // useful!&lt;br /&gt;
    const CEGUI::WindowEventArgs* args = static_cast&amp;lt;const CEGUI::WindowEventArgs*&amp;gt;(&amp;amp;e);&lt;br /&gt;
&lt;br /&gt;
    // Now we need to get the text that is in the edit box right now.&lt;br /&gt;
    CEGUI::String Msg = mWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;getText();&lt;br /&gt;
&lt;br /&gt;
    // Since we have that string, lets send it to the TextParser which will handle it from here&lt;br /&gt;
    (this)-&amp;gt;ParseText(Msg);&lt;br /&gt;
&lt;br /&gt;
    // Now that we've finished with the text, we need to ensure that we clear out the EditBox.  This is what we would expect&lt;br /&gt;
      // To happen after we press enter&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;setText(&amp;quot;&amp;quot;);&lt;br /&gt;
} &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you might be wondering why we didn't just Parse the text in here?  Well If the user presses Enter, or presses the Send button the text will either way have to be parsed, and it will be parsed in the same manner.  So why write the same code twice?&lt;br /&gt;
&lt;br /&gt;
Below is the code for handling the SendButton being pressed.  I know I just harped on rewriting code, and this will ironically look alot like the Code for when text has been submitted.  But thats because we don't really need the button to do much.  We probably could have just had the ButtonPress trigger the Handle_TextSubmitted above when we registered the handlers, but what if we wanted a clicking noise to be played when the player pressed the button?  Then we would need a seperate handler for the Send button.  Anyway 'nuff said, lets show the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::Handle_SendButtonPressed(const CEGUI::EventArgs &amp;amp;e)&lt;br /&gt;
{&lt;br /&gt;
    CEGUI::String Msg = mWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;getText();&lt;br /&gt;
    (this)-&amp;gt;ParseText(Msg);&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;setText(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Parsing that Text ====&lt;br /&gt;
&lt;br /&gt;
This portion is not going to be so much CEGUI Related as it will be string manipulation.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void GameConsoleWindow::ParseText(CEGUI::String inMsg); &lt;br /&gt;
&lt;br /&gt;
       // I personally like working with std::string. So i'm going to convert it here.&lt;br /&gt;
       std::string inString = inMsg.c_str();&lt;br /&gt;
&lt;br /&gt;
	if (inString.length() &amp;gt;= 1) // Be sure we got a string longer than 0&lt;br /&gt;
	{&lt;br /&gt;
		if (inString.at(0) == '/') // Check if the first letter is a 'command'&lt;br /&gt;
		{&lt;br /&gt;
			std::string::size_type commandEnd = inString.find(&amp;quot; &amp;quot;, 1);&lt;br /&gt;
			std::string command = inString.substr(1, commandEnd - 1);&lt;br /&gt;
			std::string commandArgs = inString.substr(commandEnd + 1, inString.length() - (commandEnd + 1));&lt;br /&gt;
			//convert command to lower case&lt;br /&gt;
			for(std::string::size_type i=0; i &amp;lt; command.length(); i++)&lt;br /&gt;
			{&lt;br /&gt;
				command[i] = tolower(command[i]);&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Begin processing&lt;br /&gt;
&lt;br /&gt;
			if (command == &amp;quot;say&amp;quot;)&lt;br /&gt;
			{&lt;br /&gt;
				std::string outString = &amp;quot;You:&amp;quot; + inString;  // Append our 'name' to the message we'll display in the list&lt;br /&gt;
                         	mConsole-&amp;gt;OutputMessage(outString);&lt;br /&gt;
			}&lt;br /&gt;
			else if (command == &amp;quot;quit&amp;quot;)&lt;br /&gt;
			{&lt;br /&gt;
				// do a /quit &lt;br /&gt;
			}&lt;br /&gt;
			else if (command == &amp;quot;help&amp;quot;)&lt;br /&gt;
			{&lt;br /&gt;
				// do a /help&lt;br /&gt;
			}&lt;br /&gt;
			else&lt;br /&gt;
			{&lt;br /&gt;
				std::string outString = &amp;quot;&amp;lt;&amp;quot; + inString + &amp;quot;&amp;gt; is an invalid command.&amp;quot;;&lt;br /&gt;
				(this)-&amp;gt;OutputText(outString,CEGUI::Colour(1.0f,0.0f,0.0f));  // With red ANGRY colors!&lt;br /&gt;
			}&lt;br /&gt;
		} // End if /&lt;br /&gt;
		else&lt;br /&gt;
		{&lt;br /&gt;
	            (this)-&amp;gt;OutputText(inString);  // no commands, just output what they wrote&lt;br /&gt;
		}&lt;br /&gt;
	}  &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Phew, thats kinda an annoying function isn't it?  Well, the point to note is that it checks for a forward slash, if it finds one then it enters the if/else conditions to see if it found an applicable command.  If it does it does something.  In this example it handles the actions right there, if you were to write it a little more advanced, it could goto a (this)-&amp;gt;ShowHelp() or (this)-&amp;gt;QuitGame().  &lt;br /&gt;
&lt;br /&gt;
The point to note is the OutputText.  That will add the items to the ListBox of Chat history.  We will work on that function now.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4288</id>
		<title>CEGUI In Practice - A Game Console</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4288"/>
				<updated>2011-03-04T20:29:39Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|6}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI InPractice 6 ==&lt;br /&gt;
&lt;br /&gt;
Welcome back! This tutorial we will put together the knowledge from the past few chapters to create a functioning Console window. The last few tutorials have given us the basics. Now its time to put that knowledge to use and make something we can use in our game.&lt;br /&gt;
&lt;br /&gt;
==== Game Plan ====&lt;br /&gt;
&lt;br /&gt;
Okay, now lets look at what we need to do. We will want to be able to type in commands, press the send button, and have them output into the text box. We will also probably want to acknowledge when enter is pressed as thats the 'normal' feel of typing into a chat.&lt;br /&gt;
&lt;br /&gt;
We discussed earlier how to send input to CEGUI ([[CEGUI In Practice - Managing input]]), so we will have to assume that you have that working (and probably built the application structure behind it). We will also assume you used the previous tutorial's layout file and naming for the console window ( [[CEGUI In Practice - Using .layout files]]).&lt;br /&gt;
&lt;br /&gt;
Due to the fact that we are getting to a slightly more advanced implementation of CEGUI here, and because we may want the ConsoleWindow to do other more useful things (like parsing strings for /say commands) I'm going to create a class to encompass the CEGUI ConsoleWindow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class GameConsoleWindow&lt;br /&gt;
{&lt;br /&gt;
    public:&lt;br /&gt;
       GameConsoleWindow();                   // Constructor&lt;br /&gt;
    private:&lt;br /&gt;
       void CreateCEGUIWindow();                                  // The function which will load in the CEGUI Window and register event handlers&lt;br /&gt;
       void RegisterHandlers();                                   // Register our handler functions&lt;br /&gt;
       void Handle_TextSubmitted(const CEGUI::EventArgs &amp;amp;e);      // Handle when we press Enter after typing&lt;br /&gt;
       void Handle_SendButtonPressed(const CEGUI::EventArgs &amp;amp;e);  // Handle when we press the Send button         &lt;br /&gt;
       void ParseText(CEGUI::String inMsg);                       // Parse the text the user submitted.&lt;br /&gt;
       void OutputText(CEGUI::String inMsg);                      // Post the message to the ChatHistory listbox.&lt;br /&gt;
       &lt;br /&gt;
       CEGUI::Window *m_ConsoleWindow;                            // This will be a pointer to the ConsoleRoot window.&lt;br /&gt;
       CEGUI::String sNamePrefix;                                  // This will be the prefix name we give the layout&lt;br /&gt;
       static int iInstanceNumber;                                 // This will be the instance number for this class. &lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright, so that will be our class. It might look daunting, but don't worry it will all make sense in the end.&lt;br /&gt;
&lt;br /&gt;
==== The Constructor ====&lt;br /&gt;
&lt;br /&gt;
I'm going to use the constructor as the main point of automation here.  And while I believe it is normally bad practice to call functions which could potentially fail within a constructor, i'm going to anyway for ease of this tutorial.  We will have it Initialize some variables, and then call the CreateCEGUIWindow function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
GameConsoleWindow::GameConsoleWindow()&lt;br /&gt;
{&lt;br /&gt;
   m_ConsoleWindow = NULL;       // Always good practice to initialize a pointer to a NULL value, helps when switching to Release Builds.&lt;br /&gt;
   iInstanceNumber = 0;&lt;br /&gt;
   sNamePrefix = &amp;quot;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
==== Setting up the Window ====&lt;br /&gt;
&lt;br /&gt;
Now we need to setup the window. We have done this before in the .layout tutorial so we will do it again here. However, we mentioned before that you could use a prefix when loading a .layout to avoid name conflicts if you load multiple layouts. So we need to account for that. Will we need multiple consoles? Who knows, might as well build it in while we're designing it right?&lt;br /&gt;
&lt;br /&gt;
Lets write the CreateCEGUIWindow function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::CreateCEGUIWindow()&lt;br /&gt;
{&lt;br /&gt;
	// Get a local pointer to the CEGUI Window Manager, Purely for convenience to reduce typing&lt;br /&gt;
	CEGUI::WindowManager *pWindowManager = CEGUI::WindowManager::getSingletonPtr();&lt;br /&gt;
&lt;br /&gt;
        // Now before we load anything, lets increase our instance number to ensure no conflicts.  &lt;br /&gt;
        // I like the format #_ConsoleRoot so thats how i'm gonna make the prefix.  This simply&lt;br /&gt;
        // Increments the iInstanceNumber then puts it + a _ into the sNamePrefix string. &lt;br /&gt;
        sNamePrefix = ++iInstanceNumber + &amp;quot;_&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        // Now that we can ensure that we have a safe prefix, and won't have any naming conflicts lets create the window&lt;br /&gt;
        // and assign it to our member window pointer m_ConsoleWindow&lt;br /&gt;
        m_ConsoleWindow = pWindowManager-&amp;gt;loadWindowLayout(inLayoutName,sNamePrefix);&lt;br /&gt;
&lt;br /&gt;
        // Being a good programmer, its a good idea to ensure that we got a valid window back. &lt;br /&gt;
        if (m_ConsoleWindow)&lt;br /&gt;
        {&lt;br /&gt;
            // Lets add our new window to the Root GUI Window&lt;br /&gt;
            CEGUI::System::getSingletonPtr()-&amp;gt;getGUISheet()-&amp;gt;addChildWindow(m_ConsoleWindow);&lt;br /&gt;
            // Now register the handlers for the events (Clicking, typing, etc)&lt;br /&gt;
            (this)-&amp;gt;RegisterHandlers();&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            // Something bad happened and we didn't successfully create the window lets output the information&lt;br /&gt;
            CEGUI::Logger::getSingletonPtr()-&amp;gt;logEvent(&amp;quot;Error: Unable to load the ConsoleWindow from .layout&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright so that created the window. And after the window was created, we Registered its handlers. Lets look at how we go about&lt;br /&gt;
registering those handlers. Below is the RegisterHandlers function, it will probably look familiar if you have been reading along:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::RegisterHandlers()&lt;br /&gt;
{&lt;br /&gt;
    // Alright now we need to register the handlers.  We mentioned above we want to acknowledge when the user presses Enter, and &lt;br /&gt;
      // when they click the 'Send' button.  So we need to register each of those events&lt;br /&gt;
&lt;br /&gt;
    // First lets register the Send button.  Our buttons name is &amp;quot;ConsoleRoot/SendButton&amp;quot;, but don't forget we prepended a name to      &lt;br /&gt;
      // all the windows which were loaded.  So we need to take that into account here.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/SendButton&amp;quot;)-&amp;gt;subscribeEvent(&lt;br /&gt;
                        CEGUI::PushButton::EventClicked,    // If we recall our button was of type CEGUI::PushButton in the .scheme&lt;br /&gt;
                                                            // and we want to acknowledge the EventClicked action.&lt;br /&gt;
                        CEGUI::Event::Subscriber(           // What function to call when this is clicked.  Remember, all functions &lt;br /&gt;
                                                            // are contained within (this) class.&lt;br /&gt;
                        &amp;amp;GameConsoleWindow::Handle_SendButtonPressed,  // Call Handle_SendButtonPressed member of GameConsoleWindow&lt;br /&gt;
                        this));                             // Using (this) instance we're in right now&lt;br /&gt;
&lt;br /&gt;
    // Now for the TextSubmitted, we will be registering the event on the edit box, which is where the users cursor will be when   &lt;br /&gt;
      //they press Enter.  I'm not going to break this down as much, because I believe that is very ugly to read, but was a good  &lt;br /&gt;
      //way of expressing it.  Here is the function call.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;subscribeEvent(CEGUI::Editbox::EventMouseClick,&lt;br /&gt;
                        CEGUI::Event::Subscriber(&amp;amp;GameConsoleWindow::Handle_TextSubmitted,this));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That last line looks pretty ugly, but remember if you include namespace CEGUI; you won't have all those Ugly CEGUI:: prefixing all the code.  As you can see, once you get the hang of registering events its pretty easy.  One thing to note, is there are more than one way to account for certain actions.  On the button, you could also have registered for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    CEGUI::PushButton::EventMouseClick&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonDown&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonUp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Depending on what result you were looking for, and where you wanted the action to take place.  For example, windows interfaces usually react on the MouseButtonUp, allowing the user to click it, and then slide off the mouse if it wasn't what they really wanted to press.&lt;br /&gt;
&lt;br /&gt;
==== The Handlers ====&lt;br /&gt;
&lt;br /&gt;
Now that we have registered the events, we need to actually write the functions which will handle those events.  We need to handle both the Text Submitted, and the SendButton's event.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::Handle_TextSubmitted(const CEGUI::EventArgs &amp;amp;e)&lt;br /&gt;
{&lt;br /&gt;
    // The following line of code is not really needed in this particular example, but is good to show.  The EventArgs by itself &lt;br /&gt;
     // only has limited uses. You will find it more useful to cast this to another type of Event.  In this case WindowEventArgs&lt;br /&gt;
     // could be much more useful as we are dealing with a CEGUI::Window.  Notably, this will allow you access to the .window&lt;br /&gt;
     // member of the argument, which will have a pointer to the window which called the event.  You can imagine that would be&lt;br /&gt;
     // useful!&lt;br /&gt;
    const CEGUI::WindowEventArgs* args = static_cast&amp;lt;const CEGUI::WindowEventArgs*&amp;gt;(&amp;amp;e);&lt;br /&gt;
&lt;br /&gt;
    // Now we need to get the text that is in the edit box right now.&lt;br /&gt;
    CEGUI::String Msg = mWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;getText();&lt;br /&gt;
&lt;br /&gt;
    // Since we have that string, lets send it to the TextParser which will handle it from here&lt;br /&gt;
    (this)-&amp;gt;ParseText(Msg);&lt;br /&gt;
&lt;br /&gt;
    // Now that we've finished with the text, we need to ensure that we clear out the EditBox.  This is what we would expect&lt;br /&gt;
      // To happen after we press enter&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;setText(&amp;quot;&amp;quot;);&lt;br /&gt;
} &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you might be wondering why we didn't just Parse the text in here?  Well If the user presses Enter, or presses the Send button the text will either way have to be parsed, and it will be parsed in the same manner.  So why write the same code twice?&lt;br /&gt;
&lt;br /&gt;
Below is the code for handling the SendButton being pressed.  I know I just harped on rewriting code, and this will ironically look alot like the Code for when text has been submitted.  But thats because we don't really need the button to do much.  We probably could have just had the ButtonPress trigger the Handle_TextSubmitted above when we registered the handlers, but what if we wanted a clicking noise to be played when the player pressed the button?  Then we would need a seperate handler for the Send button.  Anyway 'nuff said, lets show the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::Handle_SendButtonPressed(const CEGUI::EventArgs &amp;amp;e)&lt;br /&gt;
{&lt;br /&gt;
    CEGUI::String Msg = mWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;getText();&lt;br /&gt;
    (this)-&amp;gt;ParseText(Msg);&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;setText(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Parsing that Text ====&lt;br /&gt;
&lt;br /&gt;
This portion is not going to be so much CEGUI Related as it will be string manipulation.  &lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4287</id>
		<title>CEGUI In Practice - A Game Console</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4287"/>
				<updated>2011-03-04T20:24:40Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|6}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI InPractice 6 ==&lt;br /&gt;
&lt;br /&gt;
Welcome back! This tutorial we will put together the knowledge from the past few chapters to create a functioning Console window. The last few tutorials have given us the basics. Now its time to put that knowledge to use and make something we can use in our game.&lt;br /&gt;
&lt;br /&gt;
==== Game Plan ====&lt;br /&gt;
&lt;br /&gt;
Okay, now lets look at what we need to do. We will want to be able to type in commands, press the send button, and have them output into the text box. We will also probably want to acknowledge when enter is pressed as thats the 'normal' feel of typing into a chat.&lt;br /&gt;
&lt;br /&gt;
We discussed earlier how to send input to CEGUI ([[CEGUI In Practice - Managing input]]), so we will have to assume that you have that working (and probably built the application structure behind it). We will also assume you used the previous tutorial's layout file and naming for the console window ( [[CEGUI In Practice - Using .layout files]]).&lt;br /&gt;
&lt;br /&gt;
Due to the fact that we are getting to a slightly more advanced implementation of CEGUI here, and because we may want the ConsoleWindow to do other more useful things (like parsing strings for /say commands) I'm going to create a class to encompass the CEGUI ConsoleWindow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class GameConsoleWindow&lt;br /&gt;
{&lt;br /&gt;
    public:&lt;br /&gt;
       GameConsoleWindow();                   // Constructor&lt;br /&gt;
    private:&lt;br /&gt;
       void CreateCEGUIWindow();                                  // The function which will load in the CEGUI Window and register event handlers&lt;br /&gt;
       void RegisterHandlers();                                   // Register our handler functions&lt;br /&gt;
       void Handle_TextSubmitted(const CEGUI::EventArgs &amp;amp;e);      // Handle when we press Enter after typing&lt;br /&gt;
       void Handle_SendButtonPressed(const CEGUI::EventArgs &amp;amp;e);  // Handle when we press the Send button         &lt;br /&gt;
       void ParseText(CEGUI::String inMsg);                       // Parse the text the user submitted.&lt;br /&gt;
       void OutputText(CEGUI::String inMsg);                      // Post the message to the ChatHistory listbox.&lt;br /&gt;
       &lt;br /&gt;
       CEGUI::Window *m_ConsoleWindow;                            // This will be a pointer to the ConsoleRoot window.&lt;br /&gt;
       CEGUI::String sNamePrefix;                                  // This will be the prefix name we give the layout&lt;br /&gt;
       static int iInstanceNumber;                                 // This will be the instance number for this class. &lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright, so that will be our class. It might look daunting, but don't worry it will all make sense in the end.&lt;br /&gt;
&lt;br /&gt;
==== The Constructor ====&lt;br /&gt;
&lt;br /&gt;
I'm going to use the constructor as the main point of automation here.  And while I believe it is normally bad practice to call functions which could potentially fail within a constructor, i'm going to anyway for ease of this tutorial.  We will have it Initialize some variables, and then call the CreateCEGUIWindow function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
GameConsoleWindow::GameConsoleWindow()&lt;br /&gt;
{&lt;br /&gt;
   m_ConsoleWindow = NULL;       // Always good practice to initialize a pointer to a NULL value, helps when switching to Release Builds.&lt;br /&gt;
   iInstanceNumber = 0;&lt;br /&gt;
   sNamePrefix = &amp;quot;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
==== Setting up the Window ====&lt;br /&gt;
&lt;br /&gt;
Now we need to setup the window. We have done this before in the .layout tutorial so we will do it again here. However, we mentioned before that you could use a prefix when loading a .layout to avoid name conflicts if you load multiple layouts. So we need to account for that. Will we need multiple consoles? Who knows, might as well build it in while we're designing it right?&lt;br /&gt;
&lt;br /&gt;
Lets write the CreateCEGUIWindow function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::CreateCEGUIWindow()&lt;br /&gt;
{&lt;br /&gt;
	// Get a local pointer to the CEGUI Window Manager, Purely for convenience to reduce typing&lt;br /&gt;
	CEGUI::WindowManager *pWindowManager = CEGUI::WindowManager::getSingletonPtr();&lt;br /&gt;
&lt;br /&gt;
        // Now before we load anything, lets increase our instance number to ensure no conflicts.  &lt;br /&gt;
        // I like the format #_ConsoleRoot so thats how i'm gonna make the prefix.  This simply&lt;br /&gt;
        // Increments the iInstanceNumber then puts it + a _ into the sNamePrefix string. &lt;br /&gt;
        sNamePrefix = ++iInstanceNumber + &amp;quot;_&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        // Now that we can ensure that we have a safe prefix, and won't have any naming conflicts lets create the window&lt;br /&gt;
        // and assign it to our member window pointer m_ConsoleWindow&lt;br /&gt;
        m_ConsoleWindow = pWindowManager-&amp;gt;loadWindowLayout(inLayoutName,sNamePrefix);&lt;br /&gt;
&lt;br /&gt;
        // Being a good programmer, its a good idea to ensure that we got a valid window back. &lt;br /&gt;
        if (m_ConsoleWindow)&lt;br /&gt;
        {&lt;br /&gt;
            // Lets add our new window to the Root GUI Window&lt;br /&gt;
            CEGUI::System::getSingletonPtr()-&amp;gt;getGUISheet()-&amp;gt;addChildWindow(m_ConsoleWindow);&lt;br /&gt;
            // Now register the handlers for the events (Clicking, typing, etc)&lt;br /&gt;
            (this)-&amp;gt;RegisterHandlers();&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            // Something bad happened and we didn't successfully create the window lets output the information&lt;br /&gt;
            CEGUI::Logger::getSingletonPtr()-&amp;gt;logEvent(&amp;quot;Error: Unable to load the ConsoleWindow from .layout&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright so that created the window. And after the window was created, we Registered its handlers. Lets look at how we go about&lt;br /&gt;
registering those handlers. Below is the RegisterHandlers function, it will probably look familiar if you have been reading along:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::RegisterHandlers()&lt;br /&gt;
{&lt;br /&gt;
    // Alright now we need to register the handlers.  We mentioned above we want to acknowledge when the user presses Enter, and &lt;br /&gt;
      // when they click the 'Send' button.  So we need to register each of those events&lt;br /&gt;
&lt;br /&gt;
    // First lets register the Send button.  Our buttons name is &amp;quot;ConsoleRoot/SendButton&amp;quot;, but don't forget we prepended a name to      &lt;br /&gt;
      // all the windows which were loaded.  So we need to take that into account here.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/SendButton&amp;quot;)-&amp;gt;subscribeEvent(&lt;br /&gt;
                        CEGUI::PushButton::EventClicked,    // If we recall our button was of type CEGUI::PushButton in the .scheme&lt;br /&gt;
                                                            // and we want to acknowledge the EventClicked action.&lt;br /&gt;
                        CEGUI::Event::Subscriber(           // What function to call when this is clicked.  Remember, all functions &lt;br /&gt;
                                                            // are contained within (this) class.&lt;br /&gt;
                        &amp;amp;GameConsoleWindow::Handle_SendButtonPressed,  // Call Handle_SendButtonPressed member of GameConsoleWindow&lt;br /&gt;
                        this));                             // Using (this) instance we're in right now&lt;br /&gt;
&lt;br /&gt;
    // Now for the TextSubmitted, we will be registering the event on the edit box, which is where the users cursor will be when   &lt;br /&gt;
      //they press Enter.  I'm not going to break this down as much, because I believe that is very ugly to read, but was a good  &lt;br /&gt;
      //way of expressing it.  Here is the function call.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;subscribeEvent(CEGUI::Editbox::EventMouseClick,&lt;br /&gt;
                        CEGUI::Event::Subscriber(&amp;amp;GameConsoleWindow::Handle_TextSubmitted,this));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That last line looks pretty ugly, but remember if you include namespace CEGUI; you won't have all those Ugly CEGUI:: prefixing all the code.  As you can see, once you get the hang of registering events its pretty easy.  One thing to note, is there are more than one way to account for certain actions.  On the button, you could also have registered for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    CEGUI::PushButton::EventMouseClick&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonDown&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonUp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Depending on what result you were looking for, and where you wanted the action to take place.  For example, windows interfaces usually react on the MouseButtonUp, allowing the user to click it, and then slide off the mouse if it wasn't what they really wanted to press.&lt;br /&gt;
&lt;br /&gt;
==== The Handlers ====&lt;br /&gt;
&lt;br /&gt;
Now that we have registered the events, we need to actually write the functions which will handle those events.  We need to handle both the Text Submitted, and the SendButton's event.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::Handle_TextSubmitted(const CEGUI::EventArgs &amp;amp;e)&lt;br /&gt;
{&lt;br /&gt;
    // The following line of code is not really needed in this particular example, but is good to show.  The EventArgs by itself &lt;br /&gt;
     // only has limited uses. You will find it more useful to cast this to another type of Event.  In this case WindowEventArgs&lt;br /&gt;
     // could be much more useful as we are dealing with a CEGUI::Window.  Notably, this will allow you access to the .window&lt;br /&gt;
     // member of the argument, which will have a pointer to the window which called the event.  You can imagine that would be&lt;br /&gt;
     // useful!&lt;br /&gt;
    const CEGUI::WindowEventArgs* args = static_cast&amp;lt;const CEGUI::WindowEventArgs*&amp;gt;(&amp;amp;e);&lt;br /&gt;
&lt;br /&gt;
    // Now we need to get the text that is in the edit box right now.&lt;br /&gt;
    CEGUI::String Msg = mWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;getText();&lt;br /&gt;
&lt;br /&gt;
    // Since we have that string, lets send it to the TextParser which will handle it from here&lt;br /&gt;
    (this)-&amp;gt;ParseText(Msg);&lt;br /&gt;
&lt;br /&gt;
} &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4284</id>
		<title>CEGUI In Practice - A Game Console</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4284"/>
				<updated>2011-03-04T20:18:48Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|6}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI InPractice 6 ==&lt;br /&gt;
&lt;br /&gt;
Welcome back! This tutorial we will put together the knowledge from the past few chapters to create a functioning Console window. The last few tutorials have given us the basics. Now its time to put that knowledge to use and make something we can use in our game.&lt;br /&gt;
&lt;br /&gt;
==== Game Plan ====&lt;br /&gt;
&lt;br /&gt;
Okay, now lets look at what we need to do. We will want to be able to type in commands, press the send button, and have them output into the text box. We will also probably want to acknowledge when enter is pressed as thats the 'normal' feel of typing into a chat.&lt;br /&gt;
&lt;br /&gt;
We discussed earlier how to send input to CEGUI ([[CEGUI In Practice - Managing input]]), so we will have to assume that you have that working (and probably built the application structure behind it). We will also assume you used the previous tutorial's layout file and naming for the console window ( [[CEGUI In Practice - Using .layout files]]).&lt;br /&gt;
&lt;br /&gt;
Due to the fact that we are getting to a slightly more advanced implementation of CEGUI here, and because we may want the ConsoleWindow to do other more useful things (like parsing strings for /say commands) I'm going to create a class to encompass the CEGUI ConsoleWindow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class GameConsoleWindow&lt;br /&gt;
{&lt;br /&gt;
    public:&lt;br /&gt;
       GameConsoleWindow();                   // Constructor&lt;br /&gt;
    private:&lt;br /&gt;
       void CreateCEGUIWindow();                                  // The function which will load in the CEGUI Window and register event handlers&lt;br /&gt;
       void RegisterHandlers();                                   // Register our handler functions&lt;br /&gt;
       void Handle_TextSubmitted(const CEGUI::EventArgs &amp;amp;e);      // Handle when we press Enter after typing&lt;br /&gt;
       void Handle_SendButtonPressed(const CEGUI::EventArgs &amp;amp;e);  // Handle when we press the Send button         &lt;br /&gt;
       void ParseText(CEGUI::String inMsg);                       // Parse the text the user submitted.&lt;br /&gt;
       void OutputText(CEGUI::String inMsg);                      // Post the message to the ChatHistory listbox.&lt;br /&gt;
       &lt;br /&gt;
       CEGUI::Window *m_ConsoleWindow;                            // This will be a pointer to the ConsoleRoot window.&lt;br /&gt;
       CEGUI::String sNamePrefix;                                  // This will be the prefix name we give the layout&lt;br /&gt;
       static int iInstanceNumber;                                 // This will be the instance number for this class. &lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright, so that will be our class. It might look daunting, but don't worry it will all make sense in the end.&lt;br /&gt;
&lt;br /&gt;
==== The Constructor ====&lt;br /&gt;
&lt;br /&gt;
I'm going to use the constructor as the main point of automation here.  And while I believe it is normally bad practice to call functions which could potentially fail within a constructor, i'm going to anyway for ease of this tutorial.  We will have it Initialize some variables, and then call the CreateCEGUIWindow function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
GameConsoleWindow::GameConsoleWindow()&lt;br /&gt;
{&lt;br /&gt;
   m_ConsoleWindow = NULL;       // Always good practice to initialize a pointer to a NULL value, helps when switching to Release Builds.&lt;br /&gt;
   iInstanceNumber = 0;&lt;br /&gt;
   sNamePrefix = &amp;quot;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
==== Setting up the Window ====&lt;br /&gt;
&lt;br /&gt;
Now we need to setup the window. We have done this before in the .layout tutorial so we will do it again here. However, we mentioned before that you could use a prefix when loading a .layout to avoid name conflicts if you load multiple layouts. So we need to account for that. Will we need multiple consoles? Who knows, might as well build it in while we're designing it right?&lt;br /&gt;
&lt;br /&gt;
Lets write the CreateCEGUIWindow function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::CreateCEGUIWindow()&lt;br /&gt;
{&lt;br /&gt;
	// Get a local pointer to the CEGUI Window Manager, Purely for convenience to reduce typing&lt;br /&gt;
	CEGUI::WindowManager *pWindowManager = CEGUI::WindowManager::getSingletonPtr();&lt;br /&gt;
&lt;br /&gt;
        // Now before we load anything, lets increase our instance number to ensure no conflicts.  &lt;br /&gt;
        // I like the format #_ConsoleRoot so thats how i'm gonna make the prefix.  This simply&lt;br /&gt;
        // Increments the iInstanceNumber then puts it + a _ into the sNamePrefix string. &lt;br /&gt;
        sNamePrefix = ++iInstanceNumber + &amp;quot;_&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        // Now that we can ensure that we have a safe prefix, and won't have any naming conflicts lets create the window&lt;br /&gt;
        // and assign it to our member window pointer m_ConsoleWindow&lt;br /&gt;
        m_ConsoleWindow = pWindowManager-&amp;gt;loadWindowLayout(inLayoutName,sNamePrefix);&lt;br /&gt;
&lt;br /&gt;
        // Being a good programmer, its a good idea to ensure that we got a valid window back. &lt;br /&gt;
        if (m_ConsoleWindow)&lt;br /&gt;
        {&lt;br /&gt;
            // Lets add our new window to the Root GUI Window&lt;br /&gt;
            CEGUI::System::getSingletonPtr()-&amp;gt;getGUISheet()-&amp;gt;addChildWindow(m_ConsoleWindow);&lt;br /&gt;
            // Now register the handlers for the events (Clicking, typing, etc)&lt;br /&gt;
            (this)-&amp;gt;RegisterHandlers();&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            // Something bad happened and we didn't successfully create the window lets output the information&lt;br /&gt;
            CEGUI::Logger::getSingletonPtr()-&amp;gt;logEvent(&amp;quot;Error: Unable to load the ConsoleWindow from .layout&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright so that created the window. And after the window was created, we Registered its handlers. Lets look at how we go about&lt;br /&gt;
registering those handlers. Below is the RegisterHandlers function, it will probably look familiar if you have been reading along:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::RegisterHandlers()&lt;br /&gt;
{&lt;br /&gt;
    // Alright now we need to register the handlers.  We mentioned above we want to acknowledge when the user presses Enter, and &lt;br /&gt;
      // when they click the 'Send' button.  So we need to register each of those events&lt;br /&gt;
&lt;br /&gt;
    // First lets register the Send button.  Our buttons name is &amp;quot;ConsoleRoot/SendButton&amp;quot;, but don't forget we prepended a name to      &lt;br /&gt;
      // all the windows which were loaded.  So we need to take that into account here.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/SendButton&amp;quot;)-&amp;gt;subscribeEvent(&lt;br /&gt;
                        CEGUI::PushButton::EventClicked,    // If we recall our button was of type CEGUI::PushButton in the .scheme&lt;br /&gt;
                                                            // and we want to acknowledge the EventClicked action.&lt;br /&gt;
                        CEGUI::Event::Subscriber(           // What function to call when this is clicked.  Remember, all functions &lt;br /&gt;
                                                            // are contained within (this) class.&lt;br /&gt;
                        &amp;amp;GameConsoleWindow::Handle_SendButtonPressed,  // Call Handle_SendButtonPressed member of GameConsoleWindow&lt;br /&gt;
                        this));                             // Using (this) instance we're in right now&lt;br /&gt;
&lt;br /&gt;
    // Now for the TextSubmitted, we will be registering the event on the edit box, which is where the users cursor will be when   &lt;br /&gt;
      //they press Enter.  I'm not going to break this down as much, because I believe that is very ugly to read, but was a good  &lt;br /&gt;
      //way of expressing it.  Here is the function call.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;subscribeEvent(CEGUI::Editbox::EventMouseClick,&lt;br /&gt;
                        CEGUI::Event::Subscriber(&amp;amp;GameConsoleWindow::Handle_TextSubmitted,this));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That last line looks pretty ugly, but remember if you include namespace CEGUI; you won't have all those Ugly CEGUI:: prefixing all the code.  As you can see, once you get the hang of registering events its pretty easy.  One thing to note, is there are more than one way to account for certain actions.  On the button, you could also have registered for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    CEGUI::PushButton::EventMouseClick&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonDown&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonUp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Depending on what result you were looking for, and where you wanted the action to take place.  For example, windows interfaces usually react on the MouseButtonUp, allowing the user to click it, and then slide off the mouse if it wasn't what they really wanted to press.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4282</id>
		<title>CEGUI In Practice - A Game Console</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4282"/>
				<updated>2011-03-04T19:50:14Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|6}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI InPractice 6 ==&lt;br /&gt;
&lt;br /&gt;
Welcome back! This tutorial we will put together the knowledge from the past few chapters to create a functioning Console window. The last few tutorials have given us the basics. Now its time to put that knowledge to use and make something we can use in our game.&lt;br /&gt;
&lt;br /&gt;
==== Game Plan ====&lt;br /&gt;
&lt;br /&gt;
Okay, now lets look at what we need to do.  We will want to be able to type in commands, press the send button, and have them output into the text box.  We will also probably want to acknowledge when enter is pressed as thats the 'normal' feel of typing into a chat.&lt;br /&gt;
&lt;br /&gt;
We discussed earlier how to send input to CEGUI ([[CEGUI_In_Practice_-_Managing_input]]), so we will have to assume that you have that working (and probably built the application structure behind it).  We will also assume you used the previous tutorial's layout file and naming for the console window ( [[CEGUI_In_Practice_-_Using_.layout_files]]).&lt;br /&gt;
&lt;br /&gt;
Due to the fact that we are getting to a slightly more advanced implementation of CEGUI here, and because we may want the ConsoleWindow to do other more useful things (like parsing strings for /say commands) I'm going to create a class to encompass the CEGUI ConsoleWindow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class GameConsoleWindow&lt;br /&gt;
{&lt;br /&gt;
    public:&lt;br /&gt;
       GameConsoleWindow();                   // Constructor&lt;br /&gt;
    private:&lt;br /&gt;
       void CreateCEGUIWindow();                                  // The function which will load in the CEGUI Window and register event handlers&lt;br /&gt;
       void RegisterHandlers();                                   // Register our handler functions&lt;br /&gt;
       void Handle_TextSubmitted(const CEGUI::EventArgs &amp;amp;e);      // Handle when we press Enter after typing&lt;br /&gt;
       void Handle_SendButtonPressed(const CEGUI::EventArgs &amp;amp;e);  // Handle when we press the Send button         &lt;br /&gt;
       void ParseText(CEGUI::String inMsg);                       // Parse the text the user submitted.&lt;br /&gt;
       void OutputText(CEGUI::String inMsg);                      // Post the message to the ChatHistory listbox.&lt;br /&gt;
       &lt;br /&gt;
       CEGUI::Window *m_ConsoleWindow;                            // This will be a pointer to the ConsoleRoot window.&lt;br /&gt;
       CEGUI::String sNamePrefix;                                  // This will be the prefix name we give the layout&lt;br /&gt;
       static int iInstanceNumber;                                 // This will be the instance number for this class. &lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright, so that will be our class.  It might look daunting, but don't worry it will all make sense in the end.&lt;br /&gt;
&lt;br /&gt;
==== Setting up the Window ====&lt;br /&gt;
&lt;br /&gt;
Now we need to setup the window.  We have done this before in the .layout tutorial so we will do it again here.  However, we mentioned before that you could use a prefix when loading a .layout to avoid name conflicts if you load multiple layouts.  So we need to account for that.  Will we need multiple consoles?  Who knows, might as well build it in while we're designing it right?&lt;br /&gt;
&lt;br /&gt;
Lets write the CreateCEGUIWindow function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::CreateCEGUIWindow()&lt;br /&gt;
{&lt;br /&gt;
	// Get a local pointer to the CEGUI Window Manager, Purely for convenience to reduce typing&lt;br /&gt;
	CEGUI::WindowManager *pWindowManager = CEGUI::WindowManager::getSingletonPtr();&lt;br /&gt;
&lt;br /&gt;
        // Now before we load anything, lets increase our instance number to ensure no conflicts.  &lt;br /&gt;
        // I like the format #_ConsoleRoot so thats how i'm gonna make the prefix.  This simply&lt;br /&gt;
        // Increments the iInstanceNumber then puts it + a _ into the sNamePrefix string. &lt;br /&gt;
        sNamePrefix = ++iInstanceNumber + &amp;quot;_&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        // Now that we can ensure that we have a safe prefix, and won't have any naming conflicts lets create the window&lt;br /&gt;
        // and assign it to our member window pointer m_ConsoleWindow&lt;br /&gt;
        m_ConsoleWindow = pWindowManager-&amp;gt;loadWindowLayout(inLayoutName,sNamePrefix);&lt;br /&gt;
&lt;br /&gt;
        // Being a good programmer, its a good idea to ensure that we got a valid window back. &lt;br /&gt;
        if (m_ConsoleWindow)&lt;br /&gt;
        {&lt;br /&gt;
            // Lets add our new window to the Root GUI Window&lt;br /&gt;
            CEGUI::System::getSingletonPtr()-&amp;gt;getGUISheet()-&amp;gt;addChildWindow(m_ConsoleWindow);&lt;br /&gt;
            // Now register the handlers for the events (Clicking, typing, etc)&lt;br /&gt;
            (this)-&amp;gt;RegisterHandlers();&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            // Something bad happened and we didn't successfully create the window lets output the information&lt;br /&gt;
            CEGUI::Logger::getSingletonPtr()-&amp;gt;logEvent(&amp;quot;Error: Unable to load the ConsoleWindow from .layout&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright so that created the window.  And after the window was created, we Registered its handlers.  Lets look at how we go about&lt;br /&gt;
registering those handlers.  Below is the RegisterHandlers function, it will probably look familiar if you have been reading along:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::RegisterHandlers()&lt;br /&gt;
{&lt;br /&gt;
    // Alright now we need to register the handlers.  We mentioned above we want to acknowledge when the user presses Enter, and &lt;br /&gt;
      // when they click the 'Send' button.  So we need to register each of those events&lt;br /&gt;
&lt;br /&gt;
    // First lets register the Send button.  Our buttons name is &amp;quot;ConsoleRoot/SendButton&amp;quot;, but don't forget we prepended a name to      &lt;br /&gt;
      // all the windows which were loaded.  So we need to take that into account here.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/SendButton&amp;quot;)-&amp;gt;subscribeEvent(&lt;br /&gt;
                        CEGUI::PushButton::EventClicked,    // If we recall our button was of type CEGUI::PushButton in the .scheme&lt;br /&gt;
                                                            // and we want to acknowledge the EventClicked action.&lt;br /&gt;
                        CEGUI::Event::Subscriber(           // What function to call when this is clicked.  Remember, all functions &lt;br /&gt;
                                                            // are contained within (this) class.&lt;br /&gt;
                        &amp;amp;GameConsoleWindow::Handle_SendButtonPressed,  // Call Handle_SendButtonPressed member of GameConsoleWindow&lt;br /&gt;
                        this));                             // Using (this) instance we're in right now&lt;br /&gt;
&lt;br /&gt;
    // Now for the TextSubmitted, we will be registering the event on the edit box, which is where the users cursor will be when   &lt;br /&gt;
      //they press Enter.  I'm not going to break this down as much, because I believe that is very ugly to read, but was a good  &lt;br /&gt;
      //way of expressing it.  Here is the function call.&lt;br /&gt;
    m_ConsoleWindow-&amp;gt;getChild(sNamePrefix + &amp;quot;ConsoleRoot/EditBox&amp;quot;)-&amp;gt;subscribeEvent(CEGUI::Editbox::EventMouseClick,&lt;br /&gt;
                        CEGUI::Event::Subscriber(&amp;amp;GameConsoleWindow::Handle_TextSubmitted,this));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 That last line looks pretty ugly, but remember if you include namespace CEGUI; you won't have all those Ugly CEGUI:: prefixing all the code.  As you can see, once you get the hang of registering events its pretty easy.  One thing to note, is there are more than one way to account for certain actions.  On the button, you could also have registered for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    CEGUI::PushButton::EventMouseClick&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonDown&lt;br /&gt;
    CEGUI::PushButton::EventMouseButtonUp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
 depending on what result you were looking for, and where you wanted the action to take place.  For example, windows interfaces usually react on the MouseButtonUp, allowing the user to click it, and then slide off the mouse if it wasn't what they really wanted to press.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4281</id>
		<title>CEGUI In Practice - A Game Console</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4281"/>
				<updated>2011-03-04T19:32:51Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|6}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI InPractice 6 ==&lt;br /&gt;
&lt;br /&gt;
Welcome back! This tutorial we will put together the knowledge from the past few chapters to create a functioning Console window. The last few tutorials have given us the basics. Now its time to put that knowledge to use and make something we can use in our game.&lt;br /&gt;
&lt;br /&gt;
==== Game Plan ====&lt;br /&gt;
&lt;br /&gt;
Okay, now lets look at what we need to do.  We will want to be able to type in commands, press the send button, and have them output into the text box.  We will also probably want to acknowledge when enter is pressed as thats the 'normal' feel of typing into a chat.&lt;br /&gt;
&lt;br /&gt;
We discussed earlier how to send input to CEGUI ([[CEGUI_In_Practice_-_Managing_input]]), so we will have to assume that you have that working (and probably built the application structure behind it).  We will also assume you used the previous tutorial's layout file and naming for the console window ( [[CEGUI_In_Practice_-_Using_.layout_files]]).&lt;br /&gt;
&lt;br /&gt;
Due to the fact that we are getting to a slightly more advanced implementation of CEGUI here, and because we may want the ConsoleWindow to do other more useful things (like parsing strings for /say commands) I'm going to create a class to encompass the CEGUI ConsoleWindow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class GameConsoleWindow&lt;br /&gt;
{&lt;br /&gt;
    public:&lt;br /&gt;
       GameConsoleWindow();                   // Constructor&lt;br /&gt;
    private:&lt;br /&gt;
       void CreateCEGUIWindow();                                  // The function which will load in the CEGUI Window and register event handlers&lt;br /&gt;
       void RegisterHandlers();                                   // Register our handler functions&lt;br /&gt;
       void Handle_TextSubmitted(const CEGUI::EventArgs &amp;amp;e);      // Handle when we press Enter after typing&lt;br /&gt;
       void Handle_SendButtonPressed(const CEGUI::EventArgs &amp;amp;e);  // Handle when we press the Send button         &lt;br /&gt;
       void ParseText(CEGUI::String inMsg);                       // Parse the text the user submitted.&lt;br /&gt;
       void OutputText(CEGUI::String inMsg);                      // Post the message to the ChatHistory listbox.&lt;br /&gt;
       &lt;br /&gt;
       CEGUI::Window *m_ConsoleWindow;                            // This will be a pointer to the ConsoleRoot window.&lt;br /&gt;
       CEGUI::String sNamePrefix;                                  // This will be the prefix name we give the layout&lt;br /&gt;
       static int iInstanceNumber;                                 // This will be the instance number for this class. &lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright, so that will be our class.  It might look daunting, but don't worry it will all make sense in the end.&lt;br /&gt;
&lt;br /&gt;
==== Setting up the Window ====&lt;br /&gt;
&lt;br /&gt;
Now we need to setup the window.  We have done this before in the .layout tutorial so we will do it again here.  However, we mentioned before that you could use a prefix when loading a .layout to avoid name conflicts if you load multiple layouts.  So we need to account for that.  Will we need multiple consoles?  Who knows, might as well build it in while we're designing it right?&lt;br /&gt;
&lt;br /&gt;
Lets write the CreateCEGUIWindow function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void GameConsoleWindow::CreateCEGUIWindow()&lt;br /&gt;
{&lt;br /&gt;
	// Get a local pointer to the CEGUI Window Manager, Purely for convenience to reduce typing&lt;br /&gt;
	CEGUI::WindowManager *pWindowManager = CEGUI::WindowManager::getSingletonPtr();&lt;br /&gt;
&lt;br /&gt;
        // Now before we load anything, lets increase our instance number to ensure no conflicts.  &lt;br /&gt;
        // I like the format #_ConsoleRoot so thats how i'm gonna make the prefix.  This simply&lt;br /&gt;
        // Increments the iInstanceNumber then puts it + a _ into the sNamePrefix string. &lt;br /&gt;
        sNamePrefix = ++iInstanceNumber + &amp;quot;_&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        // Now that we can ensure that we have a safe prefix, and won't have any naming conflicts lets create the window&lt;br /&gt;
        // and assign it to our member window pointer m_ConsoleWindow&lt;br /&gt;
        m_ConsoleWindow = pWindowManager-&amp;gt;loadWindowLayout(inLayoutName,sNamePrefix);&lt;br /&gt;
&lt;br /&gt;
        // Being a good programmer, its a good idea to ensure that we got a valid window back. &lt;br /&gt;
        if (m_ConsoleWindow)&lt;br /&gt;
        {&lt;br /&gt;
            // Lets add our new window to the Root GUI Window&lt;br /&gt;
            CEGUI::System::getSingletonPtr()-&amp;gt;getGUISheet()-&amp;gt;addChildWindow(m_ConsoleWindow);&lt;br /&gt;
            // Now register the handlers for the events (Clicking, typing, etc)&lt;br /&gt;
            (this)-&amp;gt;RegisterHandlers();&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            // Something bad happened and we didn't successfully create the window lets output the information&lt;br /&gt;
            CEGUI::Logger::getSingletonPtr()-&amp;gt;logEvent(&amp;quot;Error: Unable to load the ConsoleWindow from .layout&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright so that created the window.  And after the window was created, we Registered its handlers.  Lets look at how we go about&lt;br /&gt;
registering those handlers.  Below is the RegisterHandlers function, it will probably look familiar if you have been reading along:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void GameConsoleWindow::RegisterHandlers()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4280</id>
		<title>CEGUI In Practice - Using .layout files</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4280"/>
				<updated>2011-03-04T19:26:30Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: /* Applying our knowledge */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|5}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI InPractice 5 ==&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will introduce how to use the .layout file.  This is likely what will be used for larger scale projects, where the art team isn't going to want to wait for you to recompile the source for every change they make.&lt;br /&gt;
&lt;br /&gt;
==== Meet the Layout ====&lt;br /&gt;
&lt;br /&gt;
The Layout file (.layout) is an xml file.  There exists at least two editors for layouts.  The first one is the  [[Downloads|CEGUI LayoutEditor]] This is a fairly mature editor.  Unfortunately it is deprecated and has not received any updates in sometime.  There is a new Editor (CEGUI Layout Editor 2) which is available from the SVN.  For the usage of this tutorial tho, we will not be using an editor and will be manipulating the .layout file with a plain old text editor.&lt;br /&gt;
&lt;br /&gt;
First thing to note, is its an XML file.  So proper XML formatting is required.  Second, is that it is hierarchical just like CEGUI.  We will work towards writing a Simple Console here.  I have created a console layout, and that will be the goal of this tutorial, to make a console editor like you would find in the various MMORPG's.  This is what we'll make today:&lt;br /&gt;
&lt;br /&gt;
[[File:TutorialInPractice-Console.jpg]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Attached is the layout:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;GUILayout &amp;gt;&lt;br /&gt;
    &amp;lt;Window Type=&amp;quot;TaharezLook/FrameWindow&amp;quot; Name=&amp;quot;ConsoleRoot&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Chat Window&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarFont&amp;quot; Value=&amp;quot;DejaVuSans-10&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarEnabled&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.114991,0},{0.358182,0},{0.519469,0},{0.775455,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Editbox&amp;quot; Name=&amp;quot;ConsoleRoot/EditBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;MaxTextLength&amp;quot; Value=&amp;quot;1073741823&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.0201637,0},{0.787097,0},{0.694549,0},{0.957693,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;TextParsingEnabled&amp;quot; Value=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Button&amp;quot; Name=&amp;quot;ConsoleRoot/SendButton&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Send&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.732211,0},{0.812349,0},{0.928283,0},{0.946832,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Listbox&amp;quot; Name=&amp;quot;ConsoleRoot/ChatBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.00534809,0},{0.0131038,0},{0.949636,0},{0.762443,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
    &amp;lt;/Window&amp;gt;&lt;br /&gt;
&amp;lt;/GUILayout&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Okay, i'll admit. I cheated and used a LayoutEditor for this. But i'm allowed to, I know what I'm doing otherwise, so do don't back talk me and do your homework.&lt;br /&gt;
&lt;br /&gt;
Erm.  Anyway, lets look at the setup of the .layout file.&lt;br /&gt;
&lt;br /&gt;
the first line &amp;lt;xml..&amp;gt;  Is just the XML Declaration, and is not important for us.&lt;br /&gt;
&lt;br /&gt;
the next line &amp;lt;GUILayout &amp;gt;  begins the .layout file as far as CEGUI is concerned.&lt;br /&gt;
&lt;br /&gt;
Next up is: &amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Window Type=&amp;quot;TaharezLook/FrameWindow&amp;quot; Name=&amp;quot;ConsoleRoot&amp;quot; &amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
This is where the meat begins.  As you can see we're creating a window of type &amp;quot;TaharezLook/FrameWindow&amp;quot; with the name &amp;quot;ConsoleRoot&amp;quot; the next lines:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;      &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Chat Window&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarFont&amp;quot; Value=&amp;quot;DejaVuSans-10&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarEnabled&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.114991,0},{0.358182,0},{0.519469,0},{0.775455,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Change various PropertySets on that new framewindow.  It sets the font, Titlebar and the area.  these could also be done in code by calling:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::Window::setProperty(&amp;quot;TitlebarFont&amp;quot;,&amp;quot;DejaVuSans-10&amp;quot;);&amp;lt;/source&amp;gt;&lt;br /&gt;
So as you can see, the scripts can be very useful allowing us to change properties outside of the code.  Giving the artists a great deal of usability!&lt;br /&gt;
&lt;br /&gt;
Anyway, the next line is &amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;       &amp;lt;Window Type=&amp;quot;TaharezLook/Editbox&amp;quot; Name=&amp;quot;ConsoleRoot/EditBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;MaxTextLength&amp;quot; Value=&amp;quot;1073741823&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.0201637,0},{0.787097,0},{0.694549,0},{0.957693,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;TextParsingEnabled&amp;quot; Value=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You'll notice this is before the &amp;lt;/Window&amp;gt; of the ConsoleRoot, so it will be created as a child in of ConsoleRoot when the script is loaded in CEGUI. Can you tell what kind of window this will be? It will be an edit box. Thats the portion of the Console Window where the user will be able to type in what they want to say. I'm not going to go into detail about the rest of the windows, as they are pretty similar to the above examples. But &amp;quot;ConsoleRoot/SendButton&amp;quot; will be the send button, and &amp;quot;ConsoleRoot/ChatBox&amp;quot; will be where the chat messages will display to.&lt;br /&gt;
&lt;br /&gt;
[Note: As you can see I adopted the Naming scheme of Parent/Child window names. This is NOT required, but I think it helps make things easier to read on code side while debugging. You wouldn't want to just name it EditBox as that would be a pretty Common name, and may conflict with other windows you create later on in the application.]&lt;br /&gt;
&lt;br /&gt;
==== Applying our knowledge ====&lt;br /&gt;
&lt;br /&gt;
Now that we have gotten an introduction to the .layout file, we should learn how to implement this knowledge. How to get the layout file to show up in CEGUI.&lt;br /&gt;
&lt;br /&gt;
This code will load the layout into a new window:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *newWindow = CEGUI::WindowManager::getSingletonPtr()-&amp;gt;loadWindowLayout(&amp;quot;MyConsole&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pretty self explanetory. There is something to note tho, you can add a prefix to the names in this .layout file. This would be useful if you're going to add the same .layout multiple times, because after the first load you'd get name conflicts. It would find a previous &amp;quot;ConsoleRoot&amp;quot; for example. So by calling this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *newWindow = CEGUI::WindowManager::getSingletonPtr()-&amp;gt;loadWindowLayout(&amp;quot;MyConsole&amp;quot;,&amp;quot;second_&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
It would append &amp;quot;second_&amp;quot; to the window names (ie. &amp;quot;second_ConsoleRoot&amp;quot;); This will prevent naming errors.&lt;br /&gt;
&lt;br /&gt;
Now if we ran this right now would we be able to see the window?&lt;br /&gt;
&lt;br /&gt;
Nope. We havn't attached it to the window hierarchy have we?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::System::getSingletonPtr()-&amp;gt;getGUISheet()-&amp;gt;addChildWindow(newWindow);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
Well we showed how to load a .layout file. Sofar now we know how to Start the system with Ogre, create a window and understand properties, add input, process events, and load layouts. In the next tutorial we will apply this knowledge to create a console which actually does something! Till next time.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4043</id>
		<title>CEGUI In Practice - A Game Console</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_Game_Console&amp;diff=4043"/>
				<updated>2011-03-01T14:36:46Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: Created page with &amp;quot;== CEGUI InPractice 6 ==  Welcome back! This tutorial we will put together the knowledge from the past few chapters to create a functioning Console window.  The last few tutorial...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CEGUI InPractice 6 ==&lt;br /&gt;
&lt;br /&gt;
Welcome back! This tutorial we will put together the knowledge from the past few chapters to create a functioning Console window.  The last few tutorials have given us the basics.  Now its time to put that knowledge to use and make something we can use in our game.&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4042</id>
		<title>CEGUI In Practice - Using .layout files</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4042"/>
				<updated>2011-03-01T14:33:48Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI InPractice 5 ==&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will introduce how to use the .layout file.  This is likely what will be used for larger scale projects, where the art team isn't going to want to wait for you to recompile the source for every change they make.&lt;br /&gt;
&lt;br /&gt;
==== Meet the Layout ====&lt;br /&gt;
&lt;br /&gt;
The Layout file (.layout) is an xml file.  There exists at least two editors for layouts.  The first one is the [[Downloads | CEGUI LayoutEditor]] This is a fairly mature editor.  Unfortunately it is deprecated and has not received any updates in sometime.  There is a new Editor (CEGUI Layout Editor 2) which is available from the SVN.  For the usage of this tutorial tho, we will not be using an editor and will be manipulating the .layout file with a plain old text editor.&lt;br /&gt;
&lt;br /&gt;
First thing to note, is its an XML file.  So proper XML formatting is required.  Second, is that it is hierarchical just like CEGUI.  We will work towards writing a Simple Console here.  I have created a console layout, and that will be the goal of this tutorial, to make a console editor like you would find in the various MMORPG's.  This is what we'll make today:&lt;br /&gt;
&lt;br /&gt;
[[File:TutorialInPractice-Console.jpg]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Attached is the layout:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;GUILayout &amp;gt;&lt;br /&gt;
    &amp;lt;Window Type=&amp;quot;TaharezLook/FrameWindow&amp;quot; Name=&amp;quot;ConsoleRoot&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Chat Window&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarFont&amp;quot; Value=&amp;quot;DejaVuSans-10&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarEnabled&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.114991,0},{0.358182,0},{0.519469,0},{0.775455,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Editbox&amp;quot; Name=&amp;quot;ConsoleRoot/EditBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;MaxTextLength&amp;quot; Value=&amp;quot;1073741823&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.0201637,0},{0.787097,0},{0.694549,0},{0.957693,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;TextParsingEnabled&amp;quot; Value=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Button&amp;quot; Name=&amp;quot;ConsoleRoot/SendButton&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Send&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.732211,0},{0.812349,0},{0.928283,0},{0.946832,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Listbox&amp;quot; Name=&amp;quot;ConsoleRoot/ChatBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.00534809,0},{0.0131038,0},{0.949636,0},{0.762443,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
    &amp;lt;/Window&amp;gt;&lt;br /&gt;
&amp;lt;/GUILayout&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Okay, i'll admit. I cheated and used a LayoutEditor for this. But i'm allowed to, I know what I'm doing otherwise, so do don't back talk me and do your homework.&lt;br /&gt;
&lt;br /&gt;
Erm.  Anyway, lets look at the setup of the .layout file.&lt;br /&gt;
&lt;br /&gt;
the first line &amp;lt;xml..&amp;gt;  Is just the XML Declaration, and is not important for us.&lt;br /&gt;
&lt;br /&gt;
the next line &amp;lt;GUILayout &amp;gt;  begins the .layout file as far as CEGUI is concerned.&lt;br /&gt;
&lt;br /&gt;
Next up is: &amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Window Type=&amp;quot;TaharezLook/FrameWindow&amp;quot; Name=&amp;quot;ConsoleRoot&amp;quot; &amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
This is where the meat begins.  As you can see we're creating a window of type &amp;quot;TaharezLook/FrameWindow&amp;quot; with the name &amp;quot;ConsoleRoot&amp;quot; the next lines:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;      &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Chat Window&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarFont&amp;quot; Value=&amp;quot;DejaVuSans-10&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarEnabled&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.114991,0},{0.358182,0},{0.519469,0},{0.775455,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Change various PropertySets on that new framewindow.  It sets the font, Titlebar and the area.  these could also be done in code by calling:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::Window::setProperty(&amp;quot;TitlebarFont&amp;quot;,&amp;quot;DejaVuSans-10&amp;quot;);&amp;lt;/source&amp;gt;&lt;br /&gt;
So as you can see, the scripts can be very useful allowing us to change properties outside of the code.  Giving the artists a great deal of usability!&lt;br /&gt;
&lt;br /&gt;
Anyway, the next line is &amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;       &amp;lt;Window Type=&amp;quot;TaharezLook/Editbox&amp;quot; Name=&amp;quot;ConsoleRoot/EditBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;MaxTextLength&amp;quot; Value=&amp;quot;1073741823&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.0201637,0},{0.787097,0},{0.694549,0},{0.957693,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;TextParsingEnabled&amp;quot; Value=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You'll notice this is before the &amp;lt;/Window&amp;gt; of the ConsoleRoot, so it will be created as a child in of ConsoleRoot when the script is loaded in CEGUI.  Can you tell what kind of window this will be?  It will be an edit box.  Thats the portion of the Console Window where the user will be able to type in what they want to say.  I'm not going to go into detail about the rest of the windows, as they are pretty similar to the above examples.  But &amp;quot;ConsoleRoot/SendButton&amp;quot; will be the send button, and &amp;quot;ConsoleRoot/ChatBox&amp;quot; will be where the chat messages will display to.&lt;br /&gt;
&lt;br /&gt;
[Note: As you can see I adopted the Naming scheme of Parent/Child window names.  This is NOT required, but I think it helps make things easier to read on code side while debugging.  You wouldn't want to just name it EditBox as that would be a pretty Common name, and may conflict with other windows you create later on in the application.]&lt;br /&gt;
&lt;br /&gt;
==== Applying our knowledge ====&lt;br /&gt;
&lt;br /&gt;
Now that we have gotten an introduction to the .layout file, we should learn how to implement this knowledge.  How to get the layout file to show up in CEGUI.&lt;br /&gt;
&lt;br /&gt;
This code will load the layout into a new window:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *newWindow = CEGUI::WindowManager::getSingletonPtr()-&amp;gt;loadWindowLayout(&amp;quot;MyConsole&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pretty self explanetory.  There is something to note tho, you can add a prefix to the names in this .layout file.  This would be useful if you're going to add the same .layout multiple times, because after the first load you'd get name conflicts.  It would find a previous &amp;quot;ConsoleRoot&amp;quot; for example.  So by calling this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *newWindow = CEGUI::WindowManager::getSingletonPtr()-&amp;gt;loadWindowLayout(&amp;quot;MyConsole&amp;quot;,&amp;quot;second_&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
It would append &amp;quot;second_&amp;quot; to the window names (ie.  &amp;quot;second_ConsoleRoot&amp;quot;);  This will prevent naming errors.&lt;br /&gt;
&lt;br /&gt;
Now if we ran this right now would we be able to see the window?&lt;br /&gt;
&lt;br /&gt;
Nope.  We havn't attached it to the window hierarchy have we?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::System::getGUISheet()-&amp;gt;addChildWindow(newWindow);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
Well we showed how to load a .layout file.  Sofar now we know how to Start the system with Ogre, create a window and understand properties, add input, process events, and load layouts.  In the next tutorial we will apply this knowledge to create a console which actually does something! Till next time.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4041</id>
		<title>CEGUI In Practice - Using .layout files</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4041"/>
				<updated>2011-03-01T14:33:23Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CEGUI InPractice 5 ==&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will introduce how to use the .layout file.  This is likely what will be used for larger scale projects, where the art team isn't going to want to wait for you to recompile the source for every change they make.&lt;br /&gt;
&lt;br /&gt;
==== Meet the Layout ====&lt;br /&gt;
&lt;br /&gt;
The Layout file (.layout) is an xml file.  There exists at least two editors for layouts.  The first one is the [[Downloads | CEGUI LayoutEditor]] This is a fairly mature editor.  Unfortunately it is deprecated and has not received any updates in sometime.  There is a new Editor (CEGUI Layout Editor 2) which is available from the SVN.  For the usage of this tutorial tho, we will not be using an editor and will be manipulating the .layout file with a plain old text editor.&lt;br /&gt;
&lt;br /&gt;
First thing to note, is its an XML file.  So proper XML formatting is required.  Second, is that it is hierarchical just like CEGUI.  We will work towards writing a Simple Console here.  I have created a console layout, and that will be the goal of this tutorial, to make a console editor like you would find in the various MMORPG's.  This is what we'll make today:&lt;br /&gt;
&lt;br /&gt;
[[File:TutorialInPractice-Console.jpg]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Attached is the layout:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;GUILayout &amp;gt;&lt;br /&gt;
    &amp;lt;Window Type=&amp;quot;TaharezLook/FrameWindow&amp;quot; Name=&amp;quot;ConsoleRoot&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Chat Window&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarFont&amp;quot; Value=&amp;quot;DejaVuSans-10&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarEnabled&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.114991,0},{0.358182,0},{0.519469,0},{0.775455,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Editbox&amp;quot; Name=&amp;quot;ConsoleRoot/EditBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;MaxTextLength&amp;quot; Value=&amp;quot;1073741823&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.0201637,0},{0.787097,0},{0.694549,0},{0.957693,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;TextParsingEnabled&amp;quot; Value=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Button&amp;quot; Name=&amp;quot;ConsoleRoot/SendButton&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Send&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.732211,0},{0.812349,0},{0.928283,0},{0.946832,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Listbox&amp;quot; Name=&amp;quot;ConsoleRoot/ChatBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.00534809,0},{0.0131038,0},{0.949636,0},{0.762443,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
    &amp;lt;/Window&amp;gt;&lt;br /&gt;
&amp;lt;/GUILayout&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Okay, i'll admit. I cheated and used a LayoutEditor for this. But i'm allowed to, I know what I'm doing otherwise, so do don't back talk me and do your homework.&lt;br /&gt;
&lt;br /&gt;
Erm.  Anyway, lets look at the setup of the .layout file.&lt;br /&gt;
&lt;br /&gt;
the first line &amp;lt;xml..&amp;gt;  Is just the XML Declaration, and is not important for us.&lt;br /&gt;
&lt;br /&gt;
the next line &amp;lt;GUILayout &amp;gt;  begins the .layout file as far as CEGUI is concerned.&lt;br /&gt;
&lt;br /&gt;
Next up is: &amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Window Type=&amp;quot;TaharezLook/FrameWindow&amp;quot; Name=&amp;quot;ConsoleRoot&amp;quot; &amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
This is where the meat begins.  As you can see we're creating a window of type &amp;quot;TaharezLook/FrameWindow&amp;quot; with the name &amp;quot;ConsoleRoot&amp;quot; the next lines:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;      &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Chat Window&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarFont&amp;quot; Value=&amp;quot;DejaVuSans-10&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarEnabled&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.114991,0},{0.358182,0},{0.519469,0},{0.775455,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Change various PropertySets on that new framewindow.  It sets the font, Titlebar and the area.  these could also be done in code by calling:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::Window::setProperty(&amp;quot;TitlebarFont&amp;quot;,&amp;quot;DejaVuSans-10&amp;quot;);&amp;lt;/source&amp;gt;&lt;br /&gt;
So as you can see, the scripts can be very useful allowing us to change properties outside of the code.  Giving the artists a great deal of usability!&lt;br /&gt;
&lt;br /&gt;
Anyway, the next line is &amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;       &amp;lt;Window Type=&amp;quot;TaharezLook/Editbox&amp;quot; Name=&amp;quot;ConsoleRoot/EditBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;MaxTextLength&amp;quot; Value=&amp;quot;1073741823&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.0201637,0},{0.787097,0},{0.694549,0},{0.957693,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;TextParsingEnabled&amp;quot; Value=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You'll notice this is before the &amp;lt;/Window&amp;gt; of the ConsoleRoot, so it will be created as a child in of ConsoleRoot when the script is loaded in CEGUI.  Can you tell what kind of window this will be?  It will be an edit box.  Thats the portion of the Console Window where the user will be able to type in what they want to say.  I'm not going to go into detail about the rest of the windows, as they are pretty similar to the above examples.  But &amp;quot;ConsoleRoot/SendButton&amp;quot; will be the send button, and &amp;quot;ConsoleRoot/ChatBox&amp;quot; will be where the chat messages will display to.&lt;br /&gt;
&lt;br /&gt;
[Note: As you can see I adopted the Naming scheme of Parent/Child window names.  This is NOT required, but I think it helps make things easier to read on code side while debugging.  You wouldn't want to just name it EditBox as that would be a pretty Common name, and may conflict with other windows you create later on in the application.]&lt;br /&gt;
&lt;br /&gt;
==== Applying our knowledge ====&lt;br /&gt;
&lt;br /&gt;
Now that we have gotten an introduction to the .layout file, we should learn how to implement this knowledge.  How to get the layout file to show up in CEGUI.&lt;br /&gt;
&lt;br /&gt;
This code will load the layout into a new window:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *newWindow = CEGUI::WindowManager::getSingletonPtr()-&amp;gt;loadWindowLayout(&amp;quot;MyConsole&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pretty self explanetory.  There is something to note tho, you can add a prefix to the names in this .layout file.  This would be useful if you're going to add the same .layout multiple times, because after the first load you'd get name conflicts.  It would find a previous &amp;quot;ConsoleRoot&amp;quot; for example.  So by calling this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *newWindow = CEGUI::WindowManager::getSingletonPtr()-&amp;gt;loadWindowLayout(&amp;quot;MyConsole&amp;quot;,&amp;quot;second_&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
It would append &amp;quot;second_&amp;quot; to the window names (ie.  &amp;quot;second_ConsoleRoot&amp;quot;);  This will prevent naming errors.&lt;br /&gt;
&lt;br /&gt;
Now if we ran this right now would we be able to see the window?&lt;br /&gt;
&lt;br /&gt;
Nope.  We havn't attached it to the window hierarchy have we?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::System::getGUISheet()-&amp;gt;addChildWindow(newWindow);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
Well we showed how to load a .layout file.  Sofar now we know how to Start the system with Ogre, create a window and understand properties, add input, process events, and load layouts.  In the next tutorial we will apply this knowledge to create a console which actually does something! Till next time.&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=File:TutorialInPractice-Console.jpg&amp;diff=4039</id>
		<title>File:TutorialInPractice-Console.jpg</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=File:TutorialInPractice-Console.jpg&amp;diff=4039"/>
				<updated>2011-03-01T14:08:32Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4037</id>
		<title>CEGUI In Practice - Using .layout files</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4037"/>
				<updated>2011-03-01T13:52:28Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CEGUI InPractice 5 ==&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will introduce how to use the .layout file.  This is likely what will be used for larger scale projects, where the art team isn't going to want to wait for you to recompile the source for every change they make.&lt;br /&gt;
&lt;br /&gt;
==== Meet the Layout ====&lt;br /&gt;
&lt;br /&gt;
The Layout file (.layout) is an xml file.  There exists at least two editors for layouts.  The first one is the [[Downloads | CEGUI LayoutEditor]] This is a fairly mature editor.  Unfortunately it is deprecated and has not received any updates in sometime.  There is a new Editor (CEGUI Layout Editor 2) which is available from the SVN.  For the usage of this tutorial tho, we will not be using an editor and will be manipulating the .layout file with a plain old text editor.&lt;br /&gt;
&lt;br /&gt;
First thing to note, is its an XML file.  So proper XML formatting is required.  Second, is that it is hierarchical just like CEGUI.  We will work towards writing a Simple Console here.  I have created a console layout, and that will be the goal of this tutorial, to make a console editor like you would find in the various MMORPG's.&lt;br /&gt;
&lt;br /&gt;
Attached is the layout:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;GUILayout &amp;gt;&lt;br /&gt;
    &amp;lt;Window Type=&amp;quot;TaharezLook/FrameWindow&amp;quot; Name=&amp;quot;ConsoleRoot&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Chat Window&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarFont&amp;quot; Value=&amp;quot;DejaVuSans-10&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarEnabled&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.114991,0},{0.358182,0},{0.519469,0},{0.775455,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Editbox&amp;quot; Name=&amp;quot;ConsoleRoot/EditBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;MaxTextLength&amp;quot; Value=&amp;quot;1073741823&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.0201637,0},{0.787097,0},{0.694549,0},{0.957693,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;TextParsingEnabled&amp;quot; Value=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Button&amp;quot; Name=&amp;quot;ConsoleRoot/SendButton&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Send&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.732211,0},{0.812349,0},{0.928283,0},{0.946832,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Listbox&amp;quot; Name=&amp;quot;ConsoleRoot/ChatBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.00534809,0},{0.0131038,0},{0.949636,0},{0.762443,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
       &amp;lt;/Window&amp;gt;&lt;br /&gt;
&amp;lt;/GUILayout&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Okay, i'll admit. I cheated and used a LayoutEditor for this. But i'm allowed to, I know what I'm doing otherwise, so do don't back talk me and do your homework.&lt;br /&gt;
&lt;br /&gt;
Erm.  Anyway, lets look at the setup of the .layout file.&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4035</id>
		<title>CEGUI In Practice - Using .layout files</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4035"/>
				<updated>2011-03-01T13:46:07Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CEGUI InPractice 5 ==&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will introduce how to use the .layout file.  This is likely what will be used for larger scale projects, where the art team isn't going to want to wait for you to recompile the source for every change they make.&lt;br /&gt;
&lt;br /&gt;
==== Meet the Layout ====&lt;br /&gt;
&lt;br /&gt;
The Layout file (.layout) is an xml file.  There exists at least two editors for layouts.  the first one is the [[Downloads | CEGUI LayoutEditor]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4034</id>
		<title>CEGUI In Practice - Using .layout files</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4034"/>
				<updated>2011-03-01T13:38:16Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CEGUI InPractice 5 ==&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will introduce how to use the .layout file.  This is likely what will be used for larger scale projects, where the art team isn't going to want to wait for you to recompile the source for every change they make.&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4033</id>
		<title>CEGUI In Practice - Using .layout files</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4033"/>
				<updated>2011-03-01T13:37:32Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: Created page with &amp;quot;== CEGUI InPractice 6 ==  In this tutorial we will introduce how to use the .layout file.  This is likely what will be used for larger scale projects, where the art team isn't go...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CEGUI InPractice 6 ==&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will introduce how to use the .layout file.  This is likely what will be used for larger scale projects, where the art team isn't going to want to wait for you to recompile the source for every change they make.&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_push_button&amp;diff=4032</id>
		<title>CEGUI In Practice - A push button</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_push_button&amp;diff=4032"/>
				<updated>2011-03-01T13:34:28Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== CEGUI In-Practice 4 ==&lt;br /&gt;
&lt;br /&gt;
Hello hello, you're making good headway through these tutorials!  Alright, last lesson we got a glimpse of how to send input to CEGUI.  This is useful, because today we're going to make a button.  And not just any button, but a button which makes something happen!  I know, exciting.&lt;br /&gt;
&lt;br /&gt;
==== Some groundwork ====&lt;br /&gt;
&lt;br /&gt;
First we need to look into how CEGUI handles event control.  &lt;br /&gt;
&lt;br /&gt;
CEGUI is based around the Event/Subscriber method. Meaning, something (A button, an edit box, a list box) fires off an event (MouseClick,Text Accepted, or Selection), and something else (The Application Class, another CEGUI Widget, anything!) is informed about it.  It does this via the &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::Window::subscribeEvent(const String&amp;amp; name,Event::Subscriber subscriber) &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first argument is the Event that you wish to keep track of.  Events are static const strings.  You will find these in the respective header files for CEGUI Widget types.  (Example CEGUIPushButton contains CEGUI::PushButton::EventClicked)&lt;br /&gt;
&lt;br /&gt;
The second argument if the subscriber which will be called whenever this event occurs.  &lt;br /&gt;
&lt;br /&gt;
Lets suppose give an example of how to register our character to jump whenever a button is pressed.  First lets create our Button whcih will make our character jump.  Although this is bad coding style, we will create the button in global scope for ease of this example. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *gJumpBtnWindow = NULL;&lt;br /&gt;
&lt;br /&gt;
void CreateJumpButton()&lt;br /&gt;
{&lt;br /&gt;
  gJumpBtnWindow = CEGUI::WindowManager::getSingletonPtr()-&amp;gt;createWindow(&amp;quot;TaharezLook/Button&amp;quot;,&amp;quot;JumpPushButton&amp;quot;);  // Create Window&lt;br /&gt;
  gJumpBtnWindow-&amp;gt;setPosition(CEGUI::UVector2(CEGUI::UDim(0.75,0),CEGUI::UDim(0.50,0));&lt;br /&gt;
  gJumpBtnWindow-&amp;gt;setSize(CEGUI::UVector2(CEGUI::UDim(0,50),CEGUI::UDim(0,50));&lt;br /&gt;
  gJumpBtnWindow-&amp;gt;setText(&amp;quot;Jump!&amp;quot;);&lt;br /&gt;
  CEGUI::System::getSingletonPtr()-&amp;gt;getGUISheet()-&amp;gt;addChildWindow(gJumpBtnWindow);  &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above code Creates the button of type &amp;quot;TaharezLook/Button&amp;quot;, as exists in the .scheme file.  Then it gives it the name of &amp;quot;JumpPushButton&amp;quot;.  And sets its size and position, followed by attaching it to the root GUI Window.  this is review from two tutorials ago.  However, the setText one is new.  Its pretty Self explanetory I would assume, but it Sets the text for windows.  PushButtons, EditBoxes, FrameWindows, etc all have a spot to display text and this function will do it.&lt;br /&gt;
&lt;br /&gt;
now that we have created our button, lets create a class that will recieve this JumpPushButton's events.  Please rememeber this is an example.  In your application It likely won't be this simple! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
class OurPlayer&lt;br /&gt;
{&lt;br /&gt;
   public:&lt;br /&gt;
    OurPlayer()&lt;br /&gt;
    {&lt;br /&gt;
     RegisterForEvents();   // Call our Register function&lt;br /&gt;
    };&lt;br /&gt;
    void Jump(){};        // Jump for joy&lt;br /&gt;
   private:&lt;br /&gt;
    RegisterForEvents()&lt;br /&gt;
    {&lt;br /&gt;
       gJumpBtnWindow-&amp;gt;subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&amp;amp;OurPlayer::Jump,this));&lt;br /&gt;
    };&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&lt;br /&gt;
&lt;br /&gt;
Alright, thats a neat little class right?  I don't know how you're going to make your character jump, so you get to fill in that information, i'm just gonna show you how to interact with the GUI!   &lt;br /&gt;
&lt;br /&gt;
Alright, the really interesting line here is the RegisterForEvents() function.  You may or may not have dealt with EventSubscribers before in other applications, so I will give a very brief intro to them.  &lt;br /&gt;
&lt;br /&gt;
Basically, they work by creating a structure which is supplied to CEGUI stating what function to call, and where to get an instance of a member that has that function.  the first argument, &amp;amp;OurPlayer::Jump states that we want to use the function Jump which is a member of OurPlayer.  The problem is it doesn't know WHICH OurPlayer we want to use?  What if we are playing split screen and we have two OurPlayer classes? One for the Left player and one for the Right player?  Now we need to specify which player.  There is the second argument.  in C++ '''this''' returns a pointer to the class execution is currently in.  So since we're registering this event within a class, we tell it to use this, which will reference the class that called RegisterForEvents();   &lt;br /&gt;
&lt;br /&gt;
If we had created as follows:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
OurPlayer *leftPlayer;&lt;br /&gt;
OurPlayer *rightPlayer;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then we would call the function like this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
gJumpBtnWindow-&amp;gt;subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&amp;amp;OurPlayer::Jump,leftPlayer));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So as you can see this allows for alot of possibilities.  There are also events for:&lt;br /&gt;
&lt;br /&gt;
*MouseClicked, &lt;br /&gt;
*MouseEnters,  &lt;br /&gt;
*MouseLeaves,&lt;br /&gt;
*EventActivated,&lt;br /&gt;
*EventTextChanged,&lt;br /&gt;
*EventAlphaChanged,&lt;br /&gt;
*EventSized&lt;br /&gt;
&lt;br /&gt;
Just to name a few.  There is a Huge listing of events which all windows inherit in CEGUIWindow.h&lt;br /&gt;
&lt;br /&gt;
==== Conclusion====&lt;br /&gt;
&lt;br /&gt;
hopefully this tutorial showed you how to implement events in cegui.  They really are the mechanism which all things happen.  Once you master how to use events, the rest of the GUI becomes so easy to use, as most user interactions are event driven.  While you may not use them all, there are even events for Rotating windows and dropping windows on other windows!  Just think of the possibilities.  Until next time Happy Clicking!&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_push_button&amp;diff=4031</id>
		<title>CEGUI In Practice - A push button</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_push_button&amp;diff=4031"/>
				<updated>2011-03-01T13:34:01Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== CEGUI In-Practice 4 ==&lt;br /&gt;
&lt;br /&gt;
Hello hello, you're making good headway through these tutorials!  Alright, last lesson we got a glimpse of how to send input to CEGUI.  This is useful, because today we're going to make a button.  And not just any button, but a button which makes something happen!  I know, exciting.&lt;br /&gt;
&lt;br /&gt;
==== Some groundwork ====&lt;br /&gt;
&lt;br /&gt;
First we need to look into how CEGUI handles event control.  &lt;br /&gt;
&lt;br /&gt;
CEGUI is based around the Event/Subscriber method. Meaning, something (A button, an edit box, a list box) fires off an event (MouseClick,Text Accepted, or Selection), and something else (The Application Class, another CEGUI Widget, anything!) is informed about it.  It does this via the &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::Window::subscribeEvent(const String&amp;amp; name,Event::Subscriber subscriber) &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first argument is the Event that you wish to keep track of.  Events are static const strings.  You will find these in the respective header files for CEGUI Widget types.  (Example CEGUIPushButton contains CEGUI::PushButton::EventClicked)&lt;br /&gt;
&lt;br /&gt;
The second argument if the subscriber which will be called whenever this event occurs.  &lt;br /&gt;
&lt;br /&gt;
Lets suppose give an example of how to register our character to jump whenever a button is pressed.  First lets create our Button whcih will make our character jump.  Although this is bad coding style, we will create the button in global scope for ease of this example. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *gJumpBtnWindow = NULL;&lt;br /&gt;
&lt;br /&gt;
void CreateJumpButton()&lt;br /&gt;
{&lt;br /&gt;
  gJumpBtnWindow = CEGUI::WindowManager::getSingletonPtr()-&amp;gt;createWindow(&amp;quot;TaharezLook/Button&amp;quot;,&amp;quot;JumpPushButton&amp;quot;);  // Create Window&lt;br /&gt;
  gJumpBtnWindow-&amp;gt;setPosition(CEGUI::UVector2(CEGUI::UDim(0.75,0),CEGUI::UDim(0.50,0));&lt;br /&gt;
  gJumpBtnWindow-&amp;gt;setSize(CEGUI::UVector2(CEGUI::UDim(0,50),CEGUI::UDim(0,50));&lt;br /&gt;
  gJumpBtnWindow-&amp;gt;setText(&amp;quot;Jump!&amp;quot;);&lt;br /&gt;
  CEGUI::System::getSingletonPtr()-&amp;gt;getGUISheet()-&amp;gt;addChildWindow(gJumpBtnWindow);  &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above code Creates the button of type &amp;quot;TaharezLook/Button&amp;quot;, as exists in the .scheme file.  Then it gives it the name of &amp;quot;JumpPushButton&amp;quot;.  And sets its size and position, followed by attaching it to the root GUI Window.  this is review from two tutorials ago.  However, the setText one is new.  Its pretty Self explanetory I would assume, but it Sets the text for windows.  PushButtons, EditBoxes, FrameWindows, etc all have a spot to display text and this function will do it.&lt;br /&gt;
&lt;br /&gt;
now that we have created our button, lets create a class that will recieve this JumpPushButton's events.  Please rememeber this is an example.  In your application It likely won't be this simple! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
class OurPlayer&lt;br /&gt;
{&lt;br /&gt;
   public:&lt;br /&gt;
    OurPlayer()&lt;br /&gt;
    {&lt;br /&gt;
     RegisterForEvents();   // Call our Register function&lt;br /&gt;
    };&lt;br /&gt;
    void Jump(){};        // Jump for joy&lt;br /&gt;
   private:&lt;br /&gt;
    RegisterForEvents()&lt;br /&gt;
    {&lt;br /&gt;
       gJumpBtnWindow-&amp;gt;subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&amp;amp;OurPlayer::Jump,this));&lt;br /&gt;
    };&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&lt;br /&gt;
&lt;br /&gt;
Alright, thats a neat little class right?  I don't know how you're going to make your character jump, so you get to fill in that information, i'm just gonna show you how to interact with the GUI!   &lt;br /&gt;
&lt;br /&gt;
Alright, the really interesting line here is the RegisterForEvents() function.  You may or may not have dealt with EventSubscribers before in other applications, so I will give a very brief intro to them.  &lt;br /&gt;
&lt;br /&gt;
Basically, they work by creating a structure which is supplied to CEGUI stating what function to call, and where to get an instance of a member that has that function.  the first argument, &amp;amp;OurPlayer::Jump states that we want to use the function Jump which is a member of OurPlayer.  The problem is it doesn't know WHICH OurPlayer we want to use?  What if we are playing split screen and we have two OurPlayer classes? One for the Left player and one for the Right player?  Now we need to specify which player.  There is the second argument.  in C++ '''this''' returns a pointer to the class execution is currently in.  So since we're registering this event within a class, we tell it to use this, which will reference the class that called RegisterForEvents();   &lt;br /&gt;
&lt;br /&gt;
If we had created as follows:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
OurPlayer *leftPlayer;&lt;br /&gt;
OurPlayer *rightPlayer;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then we would call the function like this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
       gJumpBtnWindow-&amp;gt;subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&amp;amp;OurPlayer::Jump,leftPlayer));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So as you can see this allows for alot of possibilities.  There are also events for:&lt;br /&gt;
&lt;br /&gt;
*MouseClicked, &lt;br /&gt;
*MouseEnters,  &lt;br /&gt;
*MouseLeaves,&lt;br /&gt;
*EventActivated,&lt;br /&gt;
*EventTextChanged,&lt;br /&gt;
*EventAlphaChanged,&lt;br /&gt;
*EventSized&lt;br /&gt;
&lt;br /&gt;
Just to name a few.  There is a Huge listing of events which all windows inherit in CEGUIWindow.h&lt;br /&gt;
&lt;br /&gt;
==== Conclusion====&lt;br /&gt;
&lt;br /&gt;
hopefully this tutorial showed you how to implement events in cegui.  They really are the mechanism which all things happen.  Once you master how to use events, the rest of the GUI becomes so easy to use, as most user interactions are event driven.  While you may not use them all, there are even events for Rotating windows and dropping windows on other windows!  Just think of the possibilities.  Until next time Happy Clicking!&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_push_button&amp;diff=4030</id>
		<title>CEGUI In Practice - A push button</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_A_push_button&amp;diff=4030"/>
				<updated>2011-03-01T13:33:32Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: Created page with &amp;quot;{{VersionBadge|0.7}}  == CEGUI In-Practice 4 ==  Hello hello, you're making good headway through these tutorials!  Alright, last lesson we got a glimpse of how to send input to C...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI In-Practice 4 ==&lt;br /&gt;
&lt;br /&gt;
Hello hello, you're making good headway through these tutorials!  Alright, last lesson we got a glimpse of how to send input to CEGUI.  This is useful, because today we're going to make a button.  And not just any button, but a button which makes something happen!  I know, exciting.&lt;br /&gt;
&lt;br /&gt;
==== Some groundwork ====&lt;br /&gt;
&lt;br /&gt;
First we need to look into how CEGUI handles event control.  &lt;br /&gt;
&lt;br /&gt;
CEGUI is based around the Event/Subscriber method. Meaning, something (A button, an edit box, a list box) fires off an event (MouseClick,Text Accepted, or Selection), and something else (The Application Class, another CEGUI Widget, anything!) is informed about it.  It does this via the &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::Window::subscribeEvent(const String&amp;amp; name,Event::Subscriber subscriber) &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first argument is the Event that you wish to keep track of.  Events are static const strings.  You will find these in the respective header files for CEGUI Widget types.  (Example CEGUIPushButton contains CEGUI::PushButton::EventClicked)&lt;br /&gt;
&lt;br /&gt;
The second argument if the subscriber which will be called whenever this event occurs.  &lt;br /&gt;
&lt;br /&gt;
Lets suppose give an example of how to register our character to jump whenever a button is pressed.  First lets create our Button whcih will make our character jump.  Although this is bad coding style, we will create the button in global scope for ease of this example. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *gJumpBtnWindow = NULL;&lt;br /&gt;
&lt;br /&gt;
void CreateJumpButton()&lt;br /&gt;
{&lt;br /&gt;
  gJumpBtnWindow = CEGUI::WindowManager::getSingletonPtr()-&amp;gt;createWindow(&amp;quot;TaharezLook/Button&amp;quot;,&amp;quot;JumpPushButton&amp;quot;);  // Create Window&lt;br /&gt;
  gJumpBtnWindow-&amp;gt;setPosition(CEGUI::UVector2(CEGUI::UDim(0.75,0),CEGUI::UDim(0.50,0));&lt;br /&gt;
  gJumpBtnWindow-&amp;gt;setSize(CEGUI::UVector2(CEGUI::UDim(0,50),CEGUI::UDim(0,50));&lt;br /&gt;
  gJumpBtnWindow-&amp;gt;setText(&amp;quot;Jump!&amp;quot;);&lt;br /&gt;
  CEGUI::System::getSingletonPtr()-&amp;gt;getGUISheet()-&amp;gt;addChildWindow(gJumpBtnWindow);  &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above code Creates the button of type &amp;quot;TaharezLook/Button&amp;quot;, as exists in the .scheme file.  Then it gives it the name of &amp;quot;JumpPushButton&amp;quot;.  And sets its size and position, followed by attaching it to the root GUI Window.  this is review from two tutorials ago.  However, the setText one is new.  Its pretty Self explanetory I would assume, but it Sets the text for windows.  PushButtons, EditBoxes, FrameWindows, etc all have a spot to display text and this function will do it.&lt;br /&gt;
&lt;br /&gt;
now that we have created our button, lets create a class that will recieve this JumpPushButton's events.  Please rememeber this is an example.  In your application It likely won't be this simple! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
class OurPlayer&lt;br /&gt;
{&lt;br /&gt;
   public:&lt;br /&gt;
    OurPlayer()&lt;br /&gt;
    {&lt;br /&gt;
     RegisterForEvents();   // Call our Register function&lt;br /&gt;
    };&lt;br /&gt;
    void Jump(){};        // Jump for joy&lt;br /&gt;
   private:&lt;br /&gt;
    RegisterForEvents()&lt;br /&gt;
    {&lt;br /&gt;
       gJumpBtnWindow-&amp;gt;subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&amp;amp;OurPlayer::Jump,this));&lt;br /&gt;
    };&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&lt;br /&gt;
&lt;br /&gt;
Alright, thats a neat little class right?  I don't know how you're going to make your character jump, so you get to fill in that information, i'm just gonna show you how to interact with the GUI!   &lt;br /&gt;
&lt;br /&gt;
Alright, the really interesting line here is the RegisterForEvents() function.  You may or may not have dealt with EventSubscribers before in other applications, so I will give a very brief intro to them.  &lt;br /&gt;
&lt;br /&gt;
Basically, they work by creating a structure which is supplied to CEGUI stating what function to call, and where to get an instance of a member that has that function.  the first argument, &amp;amp;OurPlayer::Jump states that we want to use the function Jump which is a member of OurPlayer.  The problem is it doesn't know WHICH OurPlayer we want to use?  What if we are playing split screen and we have two OurPlayer classes? One for the Left player and one for the Right player?  Now we need to specify which player.  There is the second argument.  in C++ '''this''' returns a pointer to the class execution is currently in.  So since we're registering this event within a class, we tell it to use this, which will reference the class that called RegisterForEvents();   &lt;br /&gt;
&lt;br /&gt;
If we had created as follows:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
OurPlayer *leftPlayer;&lt;br /&gt;
OurPlayer *rightPlayer;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then we would call the function like this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
       gJumpBtnWindow-&amp;gt;subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&amp;amp;OurPlayer::Jump,leftPlayer));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So as you can see this allows for alot of possibilities.  There are also events for:&lt;br /&gt;
&lt;br /&gt;
*MouseClicked, &lt;br /&gt;
*MouseEnters,  &lt;br /&gt;
*MouseLeaves,&lt;br /&gt;
*EventActivated,&lt;br /&gt;
*EventTextChanged,&lt;br /&gt;
*EventAlphaChanged,&lt;br /&gt;
*EventSized&lt;br /&gt;
&lt;br /&gt;
Just to name a few.  There is a Huge listing of events which all windows inherit in CEGUIWindow.h&lt;br /&gt;
&lt;br /&gt;
==== Conclusion====&lt;br /&gt;
&lt;br /&gt;
hopefully this tutorial showed you how to implement events in cegui.  They really are the mechanism which all things happen.  Once you master how to use events, the rest of the GUI becomes so easy to use, as most user interactions are event driven.  While you may not use them all, there are even events for Rotating windows and dropping windows on other windows!  Just think of the possibilities.  Until next time Happy Clicking!&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Managing_input&amp;diff=4011</id>
		<title>CEGUI In Practice - Managing input</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Managing_input&amp;diff=4011"/>
				<updated>2011-02-28T19:18:12Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
&lt;br /&gt;
==CEGUI In-Practice==&lt;br /&gt;
&lt;br /&gt;
Once again Welcome back!  In this tutorial we will learn how to interact with the CEGUI System at runtime, a VERY useful feature to have for a Graphical User '''Interface'''!  &lt;br /&gt;
&lt;br /&gt;
CEGUI Has been designed to work on many systems, using many different renderers.  As such it is tied to no particular input system.  Unfortunately for us to demonstrate how to interact with CEGUI, we need to pick one and USE it don't we?  So I have decided to use OIS [http://sourceforge.net/projects/wgois/]. Although I will attempt to keep OIS Specific functions and structures seperate, if they slip in, there is the reference to the system I'm using.&lt;br /&gt;
&lt;br /&gt;
==== Input Injection ====&lt;br /&gt;
&lt;br /&gt;
The first thing to note, is that not surprisingly CEGUI has made it easy to deal with inputing user actions into CEGUI.  Whenever an action happens (User typing, hitting Escape, clicking a button) CEGUI will need to be informed about it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::System::injectKeyDown(uint key_code);    // Tells CEGUI Key has been Pressed&lt;br /&gt;
CEGUI::System::injectKeyUp(uint key_code);      // Tells CEGUI Key has been Released&lt;br /&gt;
&lt;br /&gt;
CEGUI::System::injectChar(utf32 code_point); &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Inject keydown/up are good for sending Shift, controls, enters, etc.  While the injectChar is pretty self explanatory for what it means, it injects a 'letter'.&lt;br /&gt;
&lt;br /&gt;
Handling the mouse works in a similiar method as above.  The following code shows how you would inform CEGUI about a Left Mouse Button Keypress.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::System::injectMouseButtonDown(CEGUI::MouseButton::LeftButton);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can imagine, there is a injectMouseButtonUp() as well for letting CEGUI know when the mouse is released.&lt;br /&gt;
&lt;br /&gt;
And what about when the mouse itself moves? Of course thats covered&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::System::injectMouseMove(float delta_x, float delta_y);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The delta is in Screen pixels that the mouse moved since the last CEGUI Update.  &lt;br /&gt;
&lt;br /&gt;
Up until know, we haven't actually given CEGUI any processor time.  If we're going to be moving a mouse, or clicking buttons, we're going to want CEGUI to display these actions.  So we need to let CEGUI know how much time has passed since its last render.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::System::injectTimePulse(float timeElapsed);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows you to inject a time pulse, based on the number of Seconds that have passed.  However often you update CEGUI is up to you, but most games will want to update the GUI by injectingTime pulses during every update cycle.  If you're building more of a Tool  Application you might not need constant updates.&lt;br /&gt;
&lt;br /&gt;
==== On ward! ====&lt;br /&gt;
&lt;br /&gt;
I'm going to assume that you are using OIS and are knowledgable about its uses. Here are two functions which will allow you to interact with CEGUI&lt;br /&gt;
&lt;br /&gt;
The following will input keypresses when typing.  It injects the key down and up actions (By key code) and the characters that associate with those keypresses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void InjectOISKey(bool bButtonDown, OIS::KeyEvent inKey)&lt;br /&gt;
{&lt;br /&gt;
	if (bButtonDown)&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingletonPtr()-&amp;gt;injectKeyDown(inKey.key);&lt;br /&gt;
		CEGUI::System::getSingletonPtr()-&amp;gt;injectChar(inKey.text);&lt;br /&gt;
	}&lt;br /&gt;
	else&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingletonPtr()-&amp;gt;injectKeyUp(inKey.key);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following function will handle injection of OIS Mouse Button presses and releases&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void InjectOISMouseButton(bool bButtonDown, OIS::MouseButtonID inButton)&lt;br /&gt;
{&lt;br /&gt;
	if (bButtonDown == true)&lt;br /&gt;
	{&lt;br /&gt;
		switch (inButton)&lt;br /&gt;
		{&lt;br /&gt;
		case OIS::MB_Left:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonDown(CEGUI::MouseButton::LeftButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Middle:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonDown(CEGUI::MouseButton::MiddleButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Right:&lt;br /&gt;
			mSystem-&amp;gt;injectMouseButtonDown(CEGUI::MouseButton::RightButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Button3:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonDown(CEGUI::MouseButton::X1Button);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Button4:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonDown(CEGUI::MouseButton::X2Button);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_NULL:	&lt;br /&gt;
			break;&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else // bButtonDown = false&lt;br /&gt;
	{&lt;br /&gt;
		switch (inButton)&lt;br /&gt;
		{&lt;br /&gt;
		case OIS::MB_Left:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonUp(CEGUI::MouseButton::LeftButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Middle:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonUp(CEGUI::MouseButton::MiddleButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Right:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonUp(CEGUI::MouseButton::RightButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Button3:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonUp(CEGUI::MouseButton::X1Button);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Button4:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonUp(CEGUI::MouseButton::X2Button);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_NULL:	&lt;br /&gt;
			break;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This above function will Convert a OIS Input for the mouse and change it to CEGUI.  Right now the codes match, but if they ever change it will provide an example of how to use OIS with CEGUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
Understandably this section is a little quicker.  But it gives you information about how to start interacting with CEGUI.  The next tutorial will teach us how to actually deal with keypresses and make interesting things happen.  Until then!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Managing_input&amp;diff=4010</id>
		<title>CEGUI In Practice - Managing input</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Managing_input&amp;diff=4010"/>
				<updated>2011-02-28T19:17:54Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
&lt;br /&gt;
==CEGUI In-Practice==&lt;br /&gt;
&lt;br /&gt;
Once again Welcome back!  In this tutorial we will learn how to interact with the CEGUI System at runtime, a VERY useful feature to have for a Graphical User '''Interface'''!  &lt;br /&gt;
&lt;br /&gt;
CEGUI Has been designed to work on many systems, using many different renderers.  As such it is tied to no particular input system.  Unfortunately for us to demonstrate how to interact with CEGUI, we need to pick one and USE it don't we?  So I have decided to use OIS [http://sourceforge.net/projects/wgois/]. Although I will attempt to keep OIS Specific functions and structures seperate, if they slip in, there is the reference to the system I'm using.&lt;br /&gt;
&lt;br /&gt;
==== Input Injection ====&lt;br /&gt;
&lt;br /&gt;
The first thing to note, is that not surprisingly CEGUI has made it easy to deal with inputing user actions into CEGUI.  Whenever an action happens (User typing, hitting Escape, clicking a button) CEGUI will need to be informed about it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::System::injectKeyDown(uint key_code);    // Tells CEGUI Key has been Pressed&lt;br /&gt;
CEGUI::System::injectKeyUp(uint key_code);      // Tells CEGUI Key has been Released&lt;br /&gt;
&lt;br /&gt;
CEGUI::System::injectChar(utf32 code_point); &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Inject keydown/up are good for sending Shift, controls, enters, etc.  While the injectChar is pretty self explanatory for what it means, it injects a 'letter'.&lt;br /&gt;
&lt;br /&gt;
Handling the mouse works in a similiar method as above.  The following code shows how you would inform CEGUI about a Left Mouse Button Keypress.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::System::injectMouseButtonDown(CEGUI::MouseButton::LeftButton);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can imagine, there is a injectMouseButtonUp() as well for letting CEGUI know when the mouse is released.&lt;br /&gt;
&lt;br /&gt;
And what about when the mouse itself moves? Of course thats covered&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::System::injectMouseMove(float delta_x, float delta_y);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The delta is in Screen pixels that the mouse moved since the last CEGUI Update.  &lt;br /&gt;
&lt;br /&gt;
Up until know, we haven't actually given CEGUI any processor time.  If we're going to be moving a mouse, or clicking buttons, we're going to want CEGUI to display these actions.  So we need to let CEGUI know how much time has passed since its last render.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::System::injectTimePulse(float timeElapsed);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows you to inject a time pulse, based on the number of Seconds that have passed.  However often you update CEGUI is up to you, but most games will want to update the GUI by injectingTime pulses during every update cycle.  If you're building more of a Tool  Application you might not need constant updates.&lt;br /&gt;
&lt;br /&gt;
==== On ward! ====&lt;br /&gt;
&lt;br /&gt;
I'm going to assume that you are using OIS and are knowledgable about its uses. Here are two functions which will allow you to interact with CEGUI&lt;br /&gt;
&lt;br /&gt;
The following will input keypresses when typing.  It injects the key down and up actions (By key code) and the characters that associate with those keypresses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void InjectOISKey(bool bButtonDown, OIS::KeyEvent inKey)&lt;br /&gt;
{&lt;br /&gt;
	if (bButtonDown)&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingletonPtr()-&amp;gt;injectKeyDown(inKey.key);&lt;br /&gt;
		CEGUI::System::getSingletonPtr()-&amp;gt;injectChar(inKey.text);&lt;br /&gt;
	}&lt;br /&gt;
	else&lt;br /&gt;
	{&lt;br /&gt;
		CEGUI::System::getSingletonPtr()-&amp;gt;injectKeyUp(inKey.key);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following function will handle injection of OIS Mouse Button presses and releases&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void InjectOISMouseButton(bool bButtonDown, OIS::MouseButtonID inButton)&lt;br /&gt;
{&lt;br /&gt;
	if (bButtonDown == true)&lt;br /&gt;
	{&lt;br /&gt;
		switch (inButton)&lt;br /&gt;
		{&lt;br /&gt;
		case OIS::MB_Left:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonDown(CEGUI::MouseButton::LeftButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Middle:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonDown(CEGUI::MouseButton::MiddleButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Right:&lt;br /&gt;
			mSystem-&amp;gt;injectMouseButtonDown(CEGUI::MouseButton::RightButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Button3:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonDown(CEGUI::MouseButton::X1Button);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Button4:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonDown(CEGUI::MouseButton::X2Button);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_NULL:	&lt;br /&gt;
			break;&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else // bButtonDown = false&lt;br /&gt;
	{&lt;br /&gt;
		switch (inButton)&lt;br /&gt;
		{&lt;br /&gt;
		case OIS::MB_Left:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonUp(CEGUI::MouseButton::LeftButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Middle:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonUp(CEGUI::MouseButton::MiddleButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Right:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonUp(CEGUI::MouseButton::RightButton);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Button3:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonUp(CEGUI::MouseButton::X1Button);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_Button4:&lt;br /&gt;
			CEGUI::System::getSingletonPtr()-&amp;gt;injectMouseButtonUp(CEGUI::MouseButton::X2Button);&lt;br /&gt;
			break;&lt;br /&gt;
		case OIS::MB_NULL:	&lt;br /&gt;
			break;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This above function will Convert a OIS Input for the mouse and change it to CEGUI.  Right now the codes match, but if they ever change it will provide an example of how to use OIS with CEGUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
Understandably this section is a little quicker.  But it gives you information about how to start interacting with CEGUI.  The next tutorial will teach us how to actually deal with keypresses and make interesting things happen.  Until then!&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Managing_input&amp;diff=4009</id>
		<title>CEGUI In Practice - Managing input</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Managing_input&amp;diff=4009"/>
				<updated>2011-02-28T18:43:55Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: Created page with &amp;quot;{{VersionBadge|0.7}}  ==CEGUI In-Practice==  Once again Welcome back!  In this tutorial we will learn how to interact with the CEGUI System at runtime, a VERY useful feature to h...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
&lt;br /&gt;
==CEGUI In-Practice==&lt;br /&gt;
&lt;br /&gt;
Once again Welcome back!  In this tutorial we will learn how to interact with the CEGUI System at runtime, a VERY useful feature to have for a Graphical User '''Interface'''!  &lt;br /&gt;
&lt;br /&gt;
CEGUI Has been designed to work on many systems, using many different renderers.  As such it is tied to no particular input system.  Unfortunately for us to demonstrate how to interact with CEGUI, we need to pick one and USE it don't we?  So I have decided to use OIS [http://sourceforge.net/projects/wgois/]. Although I will attempt to keep OIS Specific functions and structures seperate, if they slip in, there is the reference to the system I'm using.&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=User:Kulik&amp;diff=4008</id>
		<title>User:Kulik</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=User:Kulik&amp;diff=4008"/>
				<updated>2011-02-28T18:34:29Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: Created page with &amp;quot;Lesser Crazy Guy&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Lesser Crazy Guy&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=User:Avengre&amp;diff=4007</id>
		<title>User:Avengre</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=User:Avengre&amp;diff=4007"/>
				<updated>2011-02-28T18:34:02Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: Created page with &amp;quot;a Random CEGUI User&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;a Random CEGUI User&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Creating_widgets&amp;diff=4005</id>
		<title>CEGUI In Practice - Creating widgets</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Creating_widgets&amp;diff=4005"/>
				<updated>2011-02-28T18:31:48Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
&lt;br /&gt;
==CEGUI In-Practice 2==&lt;br /&gt;
&lt;br /&gt;
Welcome back.  This is the second installment of CEGUI In-Practice tutorial series.  In this we will build upon the previous tutorial, [[CEGUI_InPractice_1]].  We will show how to create Widgets and manage them.&lt;br /&gt;
&lt;br /&gt;
=== The Widget ===&lt;br /&gt;
&lt;br /&gt;
In the last example we showed how to bootstrap the system with Ogre, and gave a brief introduction to CEGUI's script files.  Now we will work on understanding what a widget is and how to use them.  Lets jump in and create a window which will display a box with an image in the middle of the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *myImageWindow = CEGUI::WindowManager::getSingletonPtr()-&amp;gt;createWindow(&amp;quot;TaharezLook/StaticImage&amp;quot;,&amp;quot;PrettyWindow&amp;quot; ); &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CEGUI uses numerous derived classes code-side to create windows.  The base class CEGUI::Window is the generic window. the CEGUI::WindowManager calls a factory class when creating a window which returns the windows pointer. The first argument, &amp;quot;TaharezLook/StaticImage&amp;quot; tells the factory what kind of window to make.  These windows are defined in .scheme, which are subsequently defined more depth in other .xml files. The second argument is the name which the window will have.  &lt;br /&gt;
&lt;br /&gt;
[Note: As a point to note, there is no strict requirement on naming of windows, except to avoid repeat names.  Some users tend to prefer a naming convention using ParentName/ChildName.  ie.  &amp;quot;ConsoleWindow/SendButton&amp;quot; or &amp;quot;_MasterRoot/HealthBar&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
Once we have created the window, myImageWindow will be a pointer to a CEGUI::DefaultWindow which is derived from CEGUI::Window.  If you look in the .scheme file you can see can see what a Widget is derived from via the TargetType=  tag.&lt;br /&gt;
&lt;br /&gt;
Next we need to set some properties for this window.  There are two ways of doing this.  The first is via the propertyset, or the second way by calling the function.  The latter way can be more annoying at times, as you may have to cast the window to the correct type to get access to the member functions, but may be more intuitive depending on how you think.&lt;br /&gt;
&lt;br /&gt;
=== The Unified Dimension System ===&lt;br /&gt;
&lt;br /&gt;
We created our widget, now we need to position it and define its size.  Lets do that via code shall we?&lt;br /&gt;
&lt;br /&gt;
Before we jump in too far, we need to understand how CEGUI Handles positions.  CEGUI Uses a Unified Dimension system.  &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::UDim(scale,offset)&amp;lt;/source&amp;gt;&lt;br /&gt;
The first number is the relative point on the screen between (0,1).  So if we were looking at the X axis (left to right on the screen) a UDim(0.5,0) would be Halfway across the screen with zero pixels offset.  Udim(0.0,50) would be starting at the left side of the screen +50 pixels.  You can combine them too Udim(0.75,10) would be 3/4 of the way across the screen, with an additional 10 pixels.&lt;br /&gt;
&lt;br /&gt;
A point on the screen (or a UVector2) is made up of two UDims:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::UVector2(UDim x,UDim y)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As such, a CEGUI::Rect is as you would imagine, 4 UDims&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::URect(CEGUI::Udim left,CEGUI::Udim top,CEGUI::Udim right,CEGUI::Udim bottom)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So now that we know how positions are done, lets move our created window to the middle of the screen:&lt;br /&gt;
==== The Widget in Practice ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;myImageWindow-&amp;gt;setPosition(CEGUI::UVector2(CEGUI::UDim(0.5,0),CEGUI::UDim(0.5,0)));&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That may look a little ugly but break it down.  setPosition takes a UVector2, and each UVector2 is made up of an X and Y Udim, which is made up of a Scale and Absolute float.  &lt;br /&gt;
&lt;br /&gt;
So, we have moved our window to the middle of the screen.. but CEGUI doesn't know how big to make it?  So set its size to 150 pixels by 100 pixels [Note: I dropped the namespace for this to increase readability]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;myImageWindow-&amp;gt;setSize(UVector2(UDim(0,150),UDim(0,100)));&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case we specified the Udim using 0 for scales, and the actual pixel size in the absolute argument.  The Absolute argument is additive to the scale, and in this case we didn't want to have the size be affected by the scale argument.  If we were  creating a splash screen that took up the entire window, we would likely want the size to be UVector2(UDim(1,0),UDim(1,0) with the position being at UVector2(Udim(0,0),UDim(0,0).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that we have created the window to the size we want.  We need to tell it what image to display!  That we will do by using the PropertySet as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
myImageWindow-&amp;gt;setProperty(&amp;quot;Image&amp;quot;,&amp;quot;set:TaharezLook image:full_image&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first agument is what Property we want to set, and the second argument is what value to set. The second argument is a string broken into two pieces in this example.  We need to know what ImageSet we are looking in, which is referenced following the 'set:' portion.  And then the image via the 'image:' portion.  In this case we want it to show the full_image.&lt;br /&gt;
&lt;br /&gt;
 A Listing of properties for TaharezLook is available here [http://cegui.org.uk/static/TaharezLookProperties.html]&lt;br /&gt;
&lt;br /&gt;
Now that we have created the window.  We need to attach it to the current root window.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::System::getGUISheet()-&amp;gt;addChildWindow(myImageWindow);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will allow the Window to be displayed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
So with this quick tutorial we got a very short introduction to PropertySet usage (Important!) and a little bit about how the Unified Dimension System in CEGUI Works.  While still not terribly useful, we're beginning to understand how to use some of CEGUI's faculties.  Next up, we'll learn how to get some interactivity from this thing.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Creating_widgets&amp;diff=4004</id>
		<title>CEGUI In Practice - Creating widgets</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Creating_widgets&amp;diff=4004"/>
				<updated>2011-02-28T18:30:10Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==CEGUI In-Practice 2==&lt;br /&gt;
&lt;br /&gt;
Welcome back.  This is the second installment of CEGUI In-Practice tutorial series.  In this we will build upon the previous tutorial, [[CEGUI_InPractice_1]].  We will show how to create Widgets and manage them.&lt;br /&gt;
&lt;br /&gt;
=== The Widget ===&lt;br /&gt;
&lt;br /&gt;
In the last example we showed how to bootstrap the system with Ogre, and gave a brief introduction to CEGUI's script files.  Now we will work on understanding what a widget is and how to use them.  Lets jump in and create a window which will display a box with an image in the middle of the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *myImageWindow = CEGUI::WindowManager::getSingletonPtr()-&amp;gt;createWindow(&amp;quot;TaharezLook/StaticImage&amp;quot;,&amp;quot;PrettyWindow&amp;quot; ); &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CEGUI uses numerous derived classes code-side to create windows.  The base class CEGUI::Window is the generic window. the CEGUI::WindowManager calls a factory class when creating a window which returns the windows pointer. The first argument, &amp;quot;TaharezLook/StaticImage&amp;quot; tells the factory what kind of window to make.  These windows are defined in .scheme, which are subsequently defined more depth in other .xml files. The second argument is the name which the window will have.  &lt;br /&gt;
&lt;br /&gt;
[Note: As a point to note, there is no strict requirement on naming of windows, except to avoid repeat names.  Some users tend to prefer a naming convention using ParentName/ChildName.  ie.  &amp;quot;ConsoleWindow/SendButton&amp;quot; or &amp;quot;_MasterRoot/HealthBar&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
Once we have created the window, myImageWindow will be a pointer to a CEGUI::DefaultWindow which is derived from CEGUI::Window.  If you look in the .scheme file you can see can see what a Widget is derived from via the TargetType=  tag.&lt;br /&gt;
&lt;br /&gt;
Next we need to set some properties for this window.  There are two ways of doing this.  The first is via the propertyset, or the second way by calling the function.  The latter way can be more annoying at times, as you may have to cast the window to the correct type to get access to the member functions, but may be more intuitive depending on how you think.&lt;br /&gt;
&lt;br /&gt;
=== The Unified Dimension System ===&lt;br /&gt;
&lt;br /&gt;
We created our widget, now we need to position it and define its size.  Lets do that via code shall we?&lt;br /&gt;
&lt;br /&gt;
Before we jump in too far, we need to understand how CEGUI Handles positions.  CEGUI Uses a Unified Dimension system.  &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::UDim(scale,offset)&amp;lt;/source&amp;gt;&lt;br /&gt;
The first number is the relative point on the screen between (0,1).  So if we were looking at the X axis (left to right on the screen) a UDim(0.5,0) would be Halfway across the screen with zero pixels offset.  Udim(0.0,50) would be starting at the left side of the screen +50 pixels.  You can combine them too Udim(0.75,10) would be 3/4 of the way across the screen, with an additional 10 pixels.&lt;br /&gt;
&lt;br /&gt;
A point on the screen (or a UVector2) is made up of two UDims:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::UVector2(UDim x,UDim y)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As such, a CEGUI::Rect is as you would imagine, 4 UDims&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::URect(CEGUI::Udim left,CEGUI::Udim top,CEGUI::Udim right,CEGUI::Udim bottom)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So now that we know how positions are done, lets move our created window to the middle of the screen:&lt;br /&gt;
==== The Widget in Practice ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;myImageWindow-&amp;gt;setPosition(CEGUI::UVector2(CEGUI::UDim(0.5,0),CEGUI::UDim(0.5,0)));&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That may look a little ugly but break it down.  setPosition takes a UVector2, and each UVector2 is made up of an X and Y Udim, which is made up of a Scale and Absolute float.  &lt;br /&gt;
&lt;br /&gt;
So, we have moved our window to the middle of the screen.. but CEGUI doesn't know how big to make it?  So set its size to 150 pixels by 100 pixels [Note: I dropped the namespace for this to increase readability]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;myImageWindow-&amp;gt;setSize(UVector2(UDim(0,150),UDim(0,100)));&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case we specified the Udim using 0 for scales, and the actual pixel size in the absolute argument.  The Absolute argument is additive to the scale, and in this case we didn't want to have the size be affected by the scale argument.  If we were  creating a splash screen that took up the entire window, we would likely want the size to be UVector2(UDim(1,0),UDim(1,0) with the position being at UVector2(Udim(0,0),UDim(0,0).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that we have created the window to the size we want.  We need to tell it what image to display!  That we will do by using the PropertySet as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
myImageWindow-&amp;gt;setProperty(&amp;quot;Image&amp;quot;,&amp;quot;set:TaharezLook image:full_image&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first agument is what Property we want to set, and the second argument is what value to set. The second argument is a string broken into two pieces in this example.  We need to know what ImageSet we are looking in, which is referenced following the 'set:' portion.  And then the image via the 'image:' portion.  In this case we want it to show the full_image.&lt;br /&gt;
&lt;br /&gt;
 A Listing of properties for TaharezLook is available here [http://cegui.org.uk/static/TaharezLookProperties.html]&lt;br /&gt;
&lt;br /&gt;
Now that we have created the window.  We need to attach it to the current root window.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::System::getGUISheet()-&amp;gt;addChildWindow(myImageWindow);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will allow the Window to be displayed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
So with this quick tutorial we got a very short introduction to PropertySet usage (Important!) and a little bit about how the Unified Dimension System in CEGUI Works.  While still not terribly useful, we're beginning to understand how to use some of CEGUI's faculties.  Next up, we'll learn how to get some interactivity from this thing.&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Creating_widgets&amp;diff=3992</id>
		<title>CEGUI In Practice - Creating widgets</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Creating_widgets&amp;diff=3992"/>
				<updated>2011-02-28T17:06:36Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: Created page with &amp;quot;==CEGUI In-Practice 2==  Welcome back.  This is the second installment of CEGUI In-Practice tutorial series.  In this we will build upon the previous tutorial, [[CEGUI_InPractice...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==CEGUI In-Practice 2==&lt;br /&gt;
&lt;br /&gt;
Welcome back.  This is the second installment of CEGUI In-Practice tutorial series.  In this we will build upon the previous tutorial, [[CEGUI_InPractice_1]].  We will show how to create Widgets and manage them.&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Introduction&amp;diff=3991</id>
		<title>CEGUI In Practice - Introduction</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=CEGUI_In_Practice_-_Introduction&amp;diff=3991"/>
				<updated>2011-02-28T17:01:09Z</updated>
		
		<summary type="html">&lt;p&gt;Avengre: Created page with &amp;quot;==CEGUI In-Practice==  Welcome to the first in a series of tutorials based on how to use CEGUI.  The majority of the tutorials will be done in code.  I may attempt to sprinkle in...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==CEGUI In-Practice==&lt;br /&gt;
&lt;br /&gt;
Welcome to the first in a series of tutorials based on how to use CEGUI.  The majority of the tutorials will be done in code.  I may attempt to sprinkle in uses of .layouts throughout the tutorial.  But once you understand how to use many of the Widgets in code it becomes easy to use them via script.&lt;br /&gt;
&lt;br /&gt;
[Please note, I am an Ogre3d user, so the initial setup will be how to bootstrap and start with ogre3d.]&lt;br /&gt;
&lt;br /&gt;
=== Introducing CEGUI ===&lt;br /&gt;
First notes, CEGUI uses a number of Singleton classes.  These, if not experienced with singletons, allow global access to a Class globally in the code, while ensuring only a 'single'ton instance is ever created.  The following are the Singletons we will be using&lt;br /&gt;
in this example.&lt;br /&gt;
&lt;br /&gt;
'''CEGIU::System''' - The big Kahuna.  This contains many of the functions for setting and getting defaults.  &amp;lt;br /&amp;gt;&lt;br /&gt;
'''CEGUI::WindowManager''' - Manages the windows of CEGUI.  If a new window is going to be created or Deleted WindowManager is gonna be your class.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''CEGUI::SchemeManager''' - Manages Schemes. &amp;lt;br /&amp;gt;&lt;br /&gt;
'''CEGUI::FontManager''' - Manages the different fonts you will use in your application. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Getting Started ====&lt;br /&gt;
&lt;br /&gt;
Lets jump in and get some stuff setup.  The first thing we need to do is get the system up and running.  Since I am an Ogre user, I will show the code to get the system up and running with ogre. There are methods of getting it started for numerous other Rendering systems.  Shown here [[The_Beginner_Guide_to_Getting_CEGUI_Rendering]]. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ogre3d Method is shown here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::OgreRenderer *renderer = new CEGUI::OgreRenderer::bootstrapSystem();&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Note: This is a newer method using the bootstrapSystem, this was introduced in CEGUI 0.7.1.  There are examples on this wiki using older versions of CEGUI.  Please make note of which version you are using] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above code creates an instance of the Ogre3d Render interface between Ogre3d and CEGUI.  You will not need to deal with this much after the above code has been run.  This creates the link which Ogre will use to render CEGUI.  Please note, you will want to call this if Ogre is auto-creating the render window ( pretty common ).  If you are manually creating the Ogre3d window, you will need to use the ''CEGUI::OgreRenderer::bootstrapSystem(Ogre::RenderWindow *)'' overload. &lt;br /&gt;
&lt;br /&gt;
And additional point to mention, is that the bootstrapSystem() will create an instance of CEGUI::System.  This is important as if you already have created CEGUI::System, an exception will be thrown.&lt;br /&gt;
&lt;br /&gt;
==== Oh there will be scripts ====&lt;br /&gt;
&lt;br /&gt;
Now that we've called the very meager function above.  We need to cover some very basic information about CEGUI before we proceed.&lt;br /&gt;
&lt;br /&gt;
CEGUI is a VERY heavily scripted library.  Much of what defines the artistic content of CEGUI is defined in various .xml files.  The beginning script we will mention is the '''Scheme''' (*.scheme).  Every widget you will use in your GUI will be defined in the .scheme file. It will also contain information for about subscripts which will be used, described below. Later tutorials will describe this file in greater detail. Below is an example if you run across one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
&amp;lt;GUIScheme Name=&amp;quot;TaharezLook&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Imageset Filename=&amp;quot;TaharezLook.imageset&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;Font Filename=&amp;quot;DejaVuSans-10.font&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;LookNFeel Filename=&amp;quot;TaharezLook.looknfeel&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;WindowRendererSet Filename=&amp;quot;CEGUIFalagardWRBase&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;FalagardMapping WindowType=&amp;quot;TaharezLook/Button&amp;quot;      TargetType=&amp;quot;CEGUI/PushButton&amp;quot;  Renderer=&amp;quot;Falagard/Button&amp;quot;       LookNFeel=&amp;quot;TaharezLook/Button&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;FalagardMapping WindowType=&amp;quot;TaharezLook/Checkbox&amp;quot;    TargetType=&amp;quot;CEGUI/Checkbox&amp;quot;    Renderer=&amp;quot;Falagard/ToggleButton&amp;quot; LookNFeel=&amp;quot;TaharezLook/Checkbox&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/GUIScheme&amp;gt;&amp;lt;/source&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next script we will mention is the '''Layouts''' (*.layout).  This is also an xml file, and will defines the layout (obviously!) of the window we want to display on the screen.  For example, if we wanted a to create a Chat window, we would probably have a ChatWindow.layout file somewhere. This would describe how the window looks (How big, where on the screen its displayed, etc), where the typing box would be located within this window, and where the button to 'send' the chat message would be.  Below is a quick example of what a .layout file looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;GUILayout &amp;gt;&lt;br /&gt;
    &amp;lt;Window Type=&amp;quot;TaharezLook/FrameWindow&amp;quot; Name=&amp;quot;ConsoleRoot&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Chat Window&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarFont&amp;quot; Value=&amp;quot;DejaVuSans-10&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarEnabled&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.114991,0},{0.358182,0},{0.519469,0},{0.775455,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Editbox&amp;quot; Name=&amp;quot;ConsoleRoot/EditBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;MaxTextLength&amp;quot; Value=&amp;quot;1073741823&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.0201637,0},{0.787097,0},{0.694549,0},{0.957693,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;TextParsingEnabled&amp;quot; Value=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
&amp;lt;/GUILayout&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
Another script which is useful to mention is a '''Font'''  (*.font).  This describes fonts which will be used in cegui. Below is an example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
&amp;lt;Font Name=&amp;quot;DejaVuSans-10&amp;quot; Filename=&amp;quot;DejaVuSans.ttf&amp;quot; Type=&amp;quot;FreeType&amp;quot; Size=&amp;quot;10&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;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lastly, '''LookNFeel''' (*.looknfeel).  This is a fairly evil looking file, and to save everyone from nightmarish horrors, I will not post an example (and to save space).  This is the file which determines how every widget (CEGUI speak for window/object/item) looks and acts.  For example, what it looks like when you mouse over a button, or how to build the border and background of a Window.  Each scheme will generally have its own LookNFeel to allow more customization of the basic construction of CEGUI Widgets.&lt;br /&gt;
&lt;br /&gt;
Another important script is the '''Imageset''' (*.imageset).  This is the file which determines the visuals of each widget.  In CEGUI  the visual part of a widget which the user see's is a small X/Y coordinate on a larger texture file.  For example, a basic Button will have the graphics defined in a .imageset to be a certain position on a texture image (*.png, *.bmp, *.jpg, etc) with a certain height and width.  It may be located at Pixel 100x320 and be 50x50 in size.  This will be defined in the imageset.  Below is an example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
&amp;lt;Imageset Name=&amp;quot;TaharezLook&amp;quot; Imagefile=&amp;quot;TaharezLook.tga&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;
	&amp;lt;Image Name=&amp;quot;MouseArrow&amp;quot; XPos=&amp;quot;138&amp;quot; YPos=&amp;quot;127&amp;quot; Width=&amp;quot;31&amp;quot; Height=&amp;quot;25&amp;quot; XOffset=&amp;quot;0&amp;quot; YOffset=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/Imageset&amp;gt;&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lastly, '''LookNFeel''' (*.looknfeel).  This is a fairly evil looking file, and to save everyone from nightmarish horrors, I will not post an example (and to save space).  This is the file which determines how every widget (CEGUI speak for window/object/item) looks and acts.  For example, what it looks like when you mouse over a button, or how to build the border and background of a Window.  Each scheme will generally have its own LookNFeel to allow more customization of the basic construction of CEGUI Widgets.&lt;br /&gt;
&lt;br /&gt;
==== Back to Getting Started ====&lt;br /&gt;
&lt;br /&gt;
Now that we have a minimal idea about what scripts CEGUI uses (and don't worry, they make more sense and are less intimidating as you proceede.  You will likely use .layout the most in the beginning) lets start doing something useful!&lt;br /&gt;
&lt;br /&gt;
Where we left off, CEGUI was just started.  But in and of itself, it doesn't know what you want to do.  First thing we should do is tell it what Scheme we want to use.  As mentioned above, a .Scheme contains a listing of Widget and Other scripts to include.  a Scheem can include an Imageset, looknFeel, and font to use.   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Load the scheme&lt;br /&gt;
	CEGUI::SchemeManager::getSingleton().create( &amp;quot;TaharezLook.scheme&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wanted to use an imageset or Font which is not designated in the .Scheme file its easy to do.  Simply use the associated manager to load them.  Since i'm trying my best to keep this as an introductory tutorial, I'll keep to the mission and explain these managers in a later tutorial.&lt;br /&gt;
&lt;br /&gt;
Next up, lets define a few defaults:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
	// Set the defaults&lt;br /&gt;
	CEGUI::System::getSingleton().setDefaultFont( &amp;quot;DejaVuSans-10&amp;quot; );&lt;br /&gt;
	CEGUI::System::getSingleton().setDefaultMouseCursor( &amp;quot;TaharezLook&amp;quot;, &amp;quot;MouseArrow&amp;quot; );&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These calls will summon the CEGUI::System from global scope and set the DefaultFont, and the default Mouse Cursor.  If you reference TaharezLook.scheme (located in the cegui/datafiles/schemes folder).  You will see that it loaded a font named DejaVuSans-10.font with the &amp;lt;font&amp;gt; tag in the .scheme.  The MouseArrow is found inside the imageset called &amp;quot;TharezLook&amp;quot; under the tag of &amp;quot;MouseArrow&amp;quot;.  Pretty self explanetory I'd hope.&lt;br /&gt;
&lt;br /&gt;
Alright, now CEGUI knows about some basic defaults we want to use.  Lets create a window which will be the Root window we will put everything on from here on out.&lt;br /&gt;
&lt;br /&gt;
CEGUI uses a Parent/Child system for organizing the windows.  So the first useful thing to do is create a parent which all other windows will be the child&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window* myRoot = CEGUI::WindowManager::getSingletonPtr()-&amp;gt;createWindow( &amp;quot;DefaultWindow&amp;quot;, &amp;quot;_MasterRoot&amp;quot; );&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above function calls upon the WindowManager singleton, and creates a window of type &amp;quot;DefaultWindow&amp;quot; named &amp;quot;_MasterRoot&amp;quot;.  The default window is just that. a default window, which is blank (or transparent).  You can give the root window any name you like, however, i like using _MasterRoot as its unlikely any other window I ever use will have the name.  &lt;br /&gt;
&lt;br /&gt;
Now that we have created the window, we need to set it as the root window.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::System::getSingleton().setGUISheet( myRoot );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This calls upon the system, and assigns myRoot as the default window.  Recall myRoot was created above with the name &amp;quot;_MasterRoot&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
While not a super exciting tutorial.  At this point CEGUI is now setup, and we could begin adding windows and doing such GUI shenanigans as making windows, buttons, clicking, and fun.  Later tutorials will demonstrate how to have CEGUI Recognize clicking, dragging of windows, typing, and more!  Thanks for reading!&lt;/div&gt;</summary>
		<author><name>Avengre</name></author>	</entry>

	</feed>