The GUI engine

Published:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

GRAPHICAL USER INTERFACES (GUI):

A GUI is a user interface that makes human interaction with computer a bit easier where in user can interact with the system just by moving an input device such as mouse rather than typing the commands. These GUI's actually provide instant visual feedback to the users about the effect of each action. Out of the several available GUI engines, CEGUI engine was chosen for the game application at first instance. But this GUI engine has to be swapped out with QUICKGUI engine due to its compatibility and complex coding issues being faced during its integration into OGRE. Another reason for its swapping was because of its less features availability.

        Before even creating a GUI application first we need to create a simple but basic ogre rendering window where in the GUI is visible. At first the basic ogre rendering window has been created using the tutorials from the website but later on it has been swapped by OGRE SDK application which is actually embedded of all the features required to render the basic Ogre rendering window. After creation of basic rendering system the GUI application is embedded into it.

QUICKGUI:

        The GUI engine used for this game application is QUICKGUI. It is powerful and efficient GUI designed specifically for OGRE 3d with no complex coding issues. The QUICKGUI version being used in this application is QUICKGUI 9.09. Before even creating a QUICKGUI application the following files are needed to be included in ogre rendering application window and those files are QUICKGUI_d.lib (library file), QUICKGUI.h (header file) and qgui.core (rar file). After solving all the linking compatibility issues the GUI application is being started.

        This GUI supports the following widgets:

  • CheckBox
  • ContextMenu
  • ComboBox
  • Button
  • Console
  • Label
  • Menu
  • List
  • Image
  • Panel
  • Property Grid
  • ModelWindow
  • ProgressBar
  • Radio Button
  • TextArea
  • Tab Control
  • Textbox
  • Sheet
  • TreeView
  • Toolbar
  • Window
  • Vertical/Horizontal Scroll Bar

Before even starting up creating a sheet for the GUI application first the QUICKGUI application needs to be initialised. To begin the usage of QUICKGUI in our applications first QUICKGUI.h header file is needed to be included. After including a header file a configuration parser is needed to be registered with OGRE application before their resource groups have been embedded into the Ogre framework. QUICKGUI has its own parser and this has to be called before the call to Ogre::ResourceGroupManager::intialiseResourceGroups (). This call of parser is being done because to interpret the QUICKGUI configuration skin files properly and this call should be done inside the void setupResources (void) function. This parser is called in the following way:

QuickGUI::registerScriptReader ();

        After registering the configuration parser of QUICKGUI a root class needs to be created which is actually a Singleton class and this call can be anywhere. This root class is created in order to manage the access, destruction and creation of GUI managers which in-turn manages the other required managers of QUICKGUI. The programmer must make sure that he destructs the root class when quitting the application as part of the cleanup process. The root class is called in the following way:

        Once we have done with the creation of root class a SkinType Manager has been created itself which in-turn consists of all *.SkinType files and in order to use these files we need to create a skin type objects, which is being done by the following call

        QuickGUI::SkinTypeManager::getSingleton().loadTypes();

This call creates SkinType definitions by iterating through all the previously loaded script definitions which allows the user to get their widgets drawn correctly according to their skin definitions. Once the entire above mentioned process has been completed, QuickGUI GUI Manager has to be created and used. The creation of manager involves a GUI manager description (GUIManagerDesc) object and it is called in the following way

        QuickGUI::GUIManagerDesc* p;

This description object consists of GUIManager configurable properties and once the user posses a specific SceneManager and viewport it can be rendered in the following way:

        p.sceneManager = ourSceneManager;

        p.viewport = ourCamera->getViewport ();

After the description object has been configured according to the user needs, use the description object to create the QUICKGUI GUIManager and it is done in the following way

QuickGUI::GUIManager* OurGuiManager=QuickGUI::Root::getSingletonPtr()->createGUIManager(p);

CREATION OF SHEET:

        Once completed with the creation of GUIManager a user interface needs to be created and this user interface is created by using the Sheet widget of QUICKGUI. Sheets in QUICKGUI are created by using a SheetManager class and this creation can be done in three ways:

  • Using a sheet description object (SheetDesc).
  • By passing a string ( which consists of script defining the sheet)
  • By providing a file name ( with .sheet extension)

An example for creating a sheet using a sheet description object is as follows

QuickGUI::SheetDesc* osd = QuickGUI::DescManager::getSingleton().getDefaultSheetDesc();

osd->resetToDefault();

osd->widget_dimensions.size = QuickGUI::Size(1024,768);

QuickGUI::Sheet* UserSheet = QuickGUI::SheetManager::getSingleton().createSheet(osd);

An example for creating a sheet using a .sheet extension is as follows

QuickGUI::Sheet* UserSheet = QuickGUI::SheetManager::getSingleton().createSheet("Usheet.sheet",true);

If the Boolean value is set to false instead of true, the passed in string in the sheet is treated as the data used to create the sheet. Displaying of the sheet after its creation in the user interface is done as follows:

OurGuiManager-> setActiveSheet (UserSheet);

INJECTION OF INPUTS:

Once we have created our sheet the GUI will be rendered but the rendered GUI will be irresponsive until and unless we create an input for it. The injection of inputs used in this application is based on OIS call backs of ogre and we use them to inject inputs into a GUIManager object of QUICKGUI. The following OIS call backs are being used in this

After the injection of these inputs we need to make sure we clean our application and it is important to delete the QUICKGUI application, this should be done before deleting Ogre application and its deletion process is done in the following way.

delete QuickGUI::Root::getSingletonPtr ();

delete Ogre::Root::getSingletonPtr ();

Once the user gets his basic rendering window with a user interfacial sheet on it then he just needs to embed all the basic widgets stuff needed by him in his game application. The widgets being used in this application are buttons, windows and toolbars. Event handlers play an important role in QuickGUI and these are used in order to perform our desired actions for a specific widget.

CREATION OF A BUTTON:

Firstly we need to define where we actually want to integrate this button and need to call it in the following way:

QuickGUI::Sheet * UserSheet = OurGUIManager->getActiveSheet ();

For creating every widget a Description (Desc) object is used just as in the case of GUIManager. So in order to create a button widget we need to call in this way:

QuickGUI::ButtonDesc * Button= QuickGUI::DescManager::getSingleton().getDefaultButtonDesc();

This description object usage has many benefits, using this objects we can set and change the properties of widgets before and after creation of the widgets. Button widget is created in the following way:

Button->textDesc.segments.clear(); (this is been used only when we are using description object to create multiple objects)

Button>textDesc.segments.push_back(QuickGUI::TextSegment("micross.12",QuickGUI::ColourValue::Black,"PLAYMODES")); (in this we are adding text to the button as PLAYMODES with a color value as black using font micross.12)

Button->widget_skinTypeName = "Blind";(name of the material being used which is embedded in qGui.core rar file which actually defines the skin being used)

Button->widget_name = "MyButton";

Button->widget_dimensions.size = QuickGUI::Size(100,25); (size of the button)

Button->widget_dimensions.position = QuickGUI::Point(50,150); (position of the button)

QuickGUI::Button* myButton = UserSheet->createButton(Button); (it creates the button)

myButton->setDragable(false); (this call actually makes the button to stay at the same position and if we are mentioning the boolean value as false then we cannot move the button)

On executing the above code the user would be able to see a button on his sheet with no action being performed on clicking it.

CREATION OF WINDOW:

Creation of a window widget is done in the same way as we did while creating a button widget. Firstly we need create a window desc object for it and it is done in the following way:

QuickGUI::WindowDesc* Window= QuickGUI::DescManager::getSingleton().getDefaultWindowDesc();

Window->textDesc.segments.clear(); (this is been used only when we are using description object to create multiple objects)

Window>textDesc.segments.push_back(QuickGUI::TextSegment("micross.12",QuickGUI::ColourValue::Black,"IPHONE")); (in this we are adding text to the Window as IPHONE with a color value as black using font micross.12)

Window->widget_skinTypeName = "ipod";(name of the material being used which is embedded in qGui.core rar file which actually defines the skin being used)

Window->widget_name = "MyWindow";

Window->window_titleBar = false; ( this line displays the window without a title bar)

Window->widget_dimensions.size = QuickGUI::Size(100,25); (size of the Window)

Window->widget_dimensions.position = QuickGUI::Point(50,150); (position of the Window)

QuickGUI::Window* myWindow = UserSheet->createWindow(Window); (it creates the Window)

QuickGUI::ButtonDesc * Button1= QuickGUI::DescManager::getSingleton().getDefaultButtonDesc();

Button1->textDesc.segments.clear(); (this is been used only when we are using description object to create multiple objects)

Button1>textDesc.segments.push_back(QuickGUI::TextSegment("micross.12",QuickGUI::ColourValue::Black,"PLAYMODES")); (in this we are adding text to the button as PLAYMODES with a color value as black using font micross.12)

Button1->widget_skinTypeName = "Blind";(name of the material being used which is embedded in qGui.core rar file which actually defines the skin being used)

Button1->widget_name = "MyButton";

Button1->widget_dimensions.size = QuickGUI::Size(100,25); (size of the button)

Button1->widget_dimensions.position = QuickGUI::Point(50,150); (position of the button)

QuickGUI::Button* myButton = Window->createButton(Button1); (it creates the button)

myButton->setDragable(false); (this call actually makes the button to stay at the same position and if we are mentioning the boolean value as false then we cannot move the button)

myWindow->setDragable(false); (this call actually makes the Window to stay at the same position and if we are mentioning the boolean value as false then we cannot move the Window)

On executing above code the user would be able to see a window without a title bar but with a button inside it. Toolbars are created in the same way.

EVENT HANDLERS:

Event Handlers play a vital role in QuickGUI. In these event handlers we describes the actions needed to be performed while clicking a button in the sheet or a button in the window and the calling of event handler is done in the following way:

"this" in the above line refers to an object instance which will call the funtion and MenuClass instance is registering the event handler inside one of its function where as B is called whenever the mouse button moves towards up.

CONCLUSION:

Developing the gui for this game application has made me to learn quite a few interesting GUI's and those are CEGUI and QUICKGUI. Learning experience of CEGUI is been interesting but the implementation of it has been hard but I am still trying out the ways to implement it where as the expereince of learning QUICKGUI was quiet bit more interesting because I was able to implement it successfully in my gaming application. This GUI application has been successful because of my team who has always been supporting me and helping me in what way they can.

REFERENCES:

  • The Linux Information Project (Anon., 2004) [Online] (updated on 200?) http://www.linfo.org/gui.html [Accessed on 16th March 2010]
  • KungfooMasta., 2007 QuickGUI .[Online] (Updated on 2010) (http://www.ogre3d.org/wiki/index.php/QuickGUI[Accessed on 16th December 2009]

Writing Services

Essay Writing
Service

Find out how the very best essay writing service can help you accomplish more and achieve higher marks today.

Assignment Writing Service

From complicated assignments to tricky tasks, our experts can tackle virtually any question thrown at them.

Dissertation Writing Service

A dissertation (also known as a thesis or research project) is probably the most important piece of work for any student! From full dissertations to individual chapters, we’re on hand to support you.

Coursework Writing Service

Our expert qualified writers can help you get your coursework right first time, every time.

Dissertation Proposal Service

The first step to completing a dissertation is to create a proposal that talks about what you wish to do. Our experts can design suitable methodologies - perfect to help you get started with a dissertation.

Report Writing
Service

Reports for any audience. Perfectly structured, professionally written, and tailored to suit your exact requirements.

Essay Skeleton Answer Service

If you’re just looking for some help to get started on an essay, our outline service provides you with a perfect essay plan.

Marking & Proofreading Service

Not sure if your work is hitting the mark? Struggling to get feedback from your lecturer? Our premium marking service was created just for you - get the feedback you deserve now.

Exam Revision
Service

Exams can be one of the most stressful experiences you’ll ever have! Revision is key, and we’re here to help. With custom created revision notes and exam answers, you’ll never feel underprepared again.