protected virtual void CreateGUI()
{
// Next, we need a renderer. CeGui is not bound to any graphics API and
// the renderers are the glue that let CeGui interface with a graphics API
// like OpenGL (in this case) or a 3D engine like Axiom.
guiRenderer = new CeGui.Renderers.Axiom.Renderer( window, RenderQueueGroupID.Overlay, false, scene );
// Initialize the CeGui system. This should be the first method called before
// using any of the CeGui routines.
CeGui.GuiSystem.Initialize( guiRenderer );
// All graphics used by any CeGui themes are stored in image files that are mapped
// by a special XML description which tells CeGui what can be found where on the
// images. Obviously, we need to load these resources
//
// Note that it is possible, and even usual, for these steps to
// be done automatically via a "scheme" definition, or even from the
// cegui.conf configuration file, however for completeness, and as an
// example, virtually everything is being done manually in this example
// code.
// Widget sets are collections of widgets that provide the widget classes defined
// in CeGui (like PushButton, CheckBox and so on) with their own distinctive look
// (like a theme) and possibly even custom behavior.
//
// Here we load all compiled widget sets we can find in the current directory. This
// is done to demonstrate how you could add widget set dynamically to your
// application. Other possibilities would be to hardcode the widget set an
// application uses or determining the assemblies to load from a configuration file.
string[] assemblyFiles = System.IO.Directory.GetFiles(
System.IO.Directory.GetCurrentDirectory(), "CeGui.WidgetSets.*.dll"
);
foreach ( string assemblyFile in assemblyFiles )
{
CeGui.WindowManager.Instance.AttachAssembly(
System.Reflection.Assembly.LoadFile( assemblyFile )
);
}
// Imagesets area a collection of named areas within a texture or image file. Each
// area becomes an Image, and has a unique name by which it can be referenced. Note
// that an Imageset would normally be specified as part of a scheme file, although
// as this example is demonstrating, it is not a requirement.
//
// Again, we load all image sets we can find, this time searching the resources folder.
string[] imageSetFiles = System.IO.Directory.GetFiles(
System.IO.Directory.GetCurrentDirectory() + "\\Resources", "*.imageset"
);
foreach ( string imageSetFile in imageSetFiles )
CeGui.ImagesetManager.Instance.CreateImageset( imageSetFile );
// When the gui imagery side of thigs is set up, we should load in a font.
// You should always load in at least one font, this is to ensure that there
// is a default available for any gui element which needs to draw text.
// The first font you load is automatically set as the initial default font,
// although you can change the default later on if so desired. Again, it is
// possible to list fonts to be automatically loaded as part of a scheme, so
// this step may not usually be performed explicitly.
//
// Fonts are loaded via the FontManager singleton.
CeGui.FontManager.Instance.CreateFont( "Default", "Arial", 9, CeGui.FontFlags.None );
CeGui.FontManager.Instance.CreateFont( "WindowTitle", "Arial", 12, CeGui.FontFlags.Bold );
CeGui.GuiSystem.Instance.SetDefaultFont( "Default" );
// The next thing we do is to set a default mouse cursor image. This is
// not strictly essential, although it is nice to always have a visible
// cursor if a window or widget does not explicitly set one of its own.
//
// This is a bit hacky since we're assuming the SuaveLook image set, referenced
// below, will always be available.
CeGui.GuiSystem.Instance.SetDefaultMouseCursor(
CeGui.ImagesetManager.Instance.GetImageset( "SuaveLook" ).GetImage( "Mouse-Arrow" )
);
// Now that the system is initialised, we can actually create some UI elements,
// for this first example, a full-screen 'root' window is set as the active GUI
// sheet, and then a simple frame window will be created and attached to it.
//
// All windows and widgets are created via the WindowManager singleton.
CeGui.WindowManager winMgr = CeGui.WindowManager.Instance;
// Here we create a "DefaultWindow". This is a native type, that is, it does not
// have to be loaded via a scheme, it is always available. One common use for the
// DefaultWindow is as a generic container for other windows. Its size defaults
// to 1.0f x 1.0f using the relative metrics mode, which means when it is set as
// the root GUI sheet window, it will cover the entire display. The DefaultWindow
// does not perform any rendering of its own, so is invisible.
//
// Create a DefaultWindow called 'Root'.
rootGuiSheet = winMgr.CreateWindow( "DefaultWindow", "Root" ) as CeGui.GuiSheet;
// Set the GUI root window (also known as the GUI "sheet"), so the gui we set up
// will be visible.
CeGui.GuiSystem.Instance.GuiSheet = rootGuiSheet;
// Add the dialog as child to the root gui sheet. The root gui sheet is the desktop
// and we've just added a window to it, so the window will appear on the desktop.
// Logical, right?
rootGuiSheet.AddChild( new Gui.DebugRTTWindow(
//new CeGui.WidgetSets.Suave.SuaveGuiBuilder()
//new CeGui.WidgetSets.Taharez.TLGuiBuilder()
new CeGui.WidgetSets.Windows.WLGuiBuilder()
));
}
#endif