A quick roadmap to CEGUI
A Quick Road Map to CEGUI
OK, when you see the DIVA main window. There is a information window on the bottom-left. And there are buttons on the botton-right. You may need to add buttons or change buttons. These GUI are called CEGUI. Read the following introduction carefully. The GUI is not specified by code. It is created by a Layout Editor and this Editor create a XML to load.
For more detailed see OgreWiki? Basic Tutorial 7 http://www.ogre3d.org/tikiwiki/Tutorials
Introduction
CEGUI is very different from most GUI systems. In CEGUI, everything that is displayed is a subclass of the CEGUI::Window class, and a window can have any number of children windows. This means that when you create a frame to contain multiple buttons, that frame is a Window. This also leads to some strange things to happen. You can place a button inside another button, though that would really never happen in practice. The reason that I mention all of this is when you are looking for a particular widget that you have placed in the application, they are all called Windows, and are accessed by functions which call them as such.
In most practical uses of CEGUI, you will not create each individual object through code. Instead you create a GUI layout for your application in an editor such as the CEGUI Layout Editor. After placing all of your windows, buttons, and other widgets onto the screen as you like them, the editor saves the layout into a text file. You may later load this layout into what CEGUI calls a GUI sheet (which is also a subclass of CEGUI::Window).
Lastly, know that CEGUI contains a large number of widgets that you can use in your application. We will not cover them in this tutorial, so if you decide to use CEGUI, be sure to take a good look at their website for more information.
Some Useful Facts in DIVA
- The CEGUI Layout in DIVA is stored in media/gui/ This is a CEGUI sheet.
- CEGUI is initialized in DIVA_Application::setup -> DIVA_application::initCEGUI()
- mouseInjection of CEGUI is done in DIVA_FrameListener::DIVA_FrameListener()
- DIVA_frameListener::setupEventHandler() contains the event handler of each button
To add a button
So, to add a CEGUI button,
- add a button in the Diva.layout
- add code to register an handler for the button in DIVA_frameListener::setupEventHandler()
- Write the handler
back to DIVA