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

	<entry>
		<id>http://cegui.org/wiki/index.php?title=CEGUI_In_Practice_-_A_push_button&amp;diff=4400</id>
		<title>CEGUI In Practice - A push button</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=CEGUI_In_Practice_-_A_push_button&amp;diff=4400"/>
				<updated>2011-04-26T19:55:46Z</updated>
		
		<summary type="html">&lt;p&gt;Kiwibonga: /* Some groundwork */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|4}}&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 is the subscriber which will be called whenever this event occurs. &lt;br /&gt;
&lt;br /&gt;
Let's give an example of how to register our character to jump whenever a button is pressed. First, let's create our Button, which 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::getSingleton().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::getSingleton().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. It's pretty Self explanatory 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, let's create a class that will receive this JumpPushButton's events. Please remember 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;
    bool Jump(const CEGUI::EventArgs&amp;amp; /*e*/){};        // 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&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright, that's 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 a lot 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;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Kiwibonga</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=CEGUI_In_Practice_-_A_push_button&amp;diff=4399</id>
		<title>CEGUI In Practice - A push button</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=CEGUI_In_Practice_-_A_push_button&amp;diff=4399"/>
				<updated>2011-04-26T19:48:50Z</updated>
		
		<summary type="html">&lt;p&gt;Kiwibonga: /* Some groundwork */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|4}}&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 is the subscriber which will be called whenever this event occurs. &lt;br /&gt;
&lt;br /&gt;
Let's give an example of how to register our character to jump whenever a button is pressed. First, let's create our Button, which 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::getSingleton().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::getSingleton().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. It's pretty Self explanatory 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, let's create a class that will receive this JumpPushButton's events. Please remember 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;
    bool Jump(const CEGUI::EventArgs&amp;amp; /*e*/){};        // 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&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright, that's 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 a lot 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;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Kiwibonga</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=CEGUI_In_Practice_-_Introduction&amp;diff=4398</id>
		<title>CEGUI In Practice - Introduction</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=CEGUI_In_Practice_-_Introduction&amp;diff=4398"/>
				<updated>2011-04-26T19:46:25Z</updated>
		
		<summary type="html">&lt;p&gt;Kiwibonga: /* Getting Started */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|1}}&lt;br /&gt;
&lt;br /&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;
'''CEGUI::{{DoxygenClass|System|0.7}}''' - The big Kahuna.  This contains many of the functions for setting and getting defaults.  &amp;lt;br /&amp;gt;&lt;br /&gt;
'''CEGUI::{{DoxygenClass|WindowManager|0.7}}''' - 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::{{DoxygenClass|SchemeManager|0.7}}''' - Manages Schemes. &amp;lt;br /&amp;gt;&lt;br /&gt;
'''CEGUI::{{DoxygenClass|FontManager|0.7}}''' - 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;
Let's 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;
===== Including necessary headers =====&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;CEGUI.h&amp;quot;&lt;br /&gt;
#include &amp;quot;RendererModules/Ogre/CEGUIOgreRenderer.h&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import PyCEGUI&lt;br /&gt;
import PyCEGUIOgreRenderer&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Bootstrapping CEGUI =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::OgreRenderer* renderer = &amp;amp;CEGUI::OgreRenderer::bootstrapSystem();&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;renderer = PyCEGUIOgreRenderer.OgreRenderer.bootstrapSystem()&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&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;
An 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;&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;/GUILayout&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&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;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;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;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Load the scheme&lt;br /&gt;
PyCEGUI.SchemeManager.getSingleton().create( &amp;quot;TaharezLook.scheme&amp;quot; )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&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;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;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;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Set the defaults&lt;br /&gt;
PyCEGUI.System.getSingleton().setDefaultFont( &amp;quot;DejaVuSans-10&amp;quot; )&lt;br /&gt;
PyCEGUI.System.getSingleton().setDefaultMouseCursor( &amp;quot;TaharezLook&amp;quot;, &amp;quot;MouseArrow&amp;quot; )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&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;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window* myRoot = CEGUI::WindowManager::getSingleton().createWindow( &amp;quot;DefaultWindow&amp;quot;, &amp;quot;_MasterRoot&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
myRoot = PyCEGUI.WindowManager.getSingleton().createWindow( &amp;quot;DefaultWindow&amp;quot;, &amp;quot;_MasterRoot&amp;quot; )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&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;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;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;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyCEGUI.System.getSingleton().setGUISheet( myRoot )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&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;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Kiwibonga</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=CEGUI_In_Practice_-_A_push_button&amp;diff=4397</id>
		<title>CEGUI In Practice - A push button</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=CEGUI_In_Practice_-_A_push_button&amp;diff=4397"/>
				<updated>2011-04-26T19:43:54Z</updated>
		
		<summary type="html">&lt;p&gt;Kiwibonga: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|4}}&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 is the subscriber which will be called whenever this event occurs. &lt;br /&gt;
&lt;br /&gt;
Let's give an example of how to register our character to jump whenever a button is pressed. First, let's create our Button, which 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::getSingleton().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::getSingleton().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. It's 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, let's create a class that will receive this JumpPushButton's events. Please remember 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;
    bool Jump(const CEGUI::EventArgs&amp;amp; /*e*/){};        // 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&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright, that's 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 a lot 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;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Kiwibonga</name></author>	</entry>

	</feed>