Using PLSM with CEGUI

EagleEye

22-12-2005 20:42:50

Okay, the OgreNet.Cegui project should be nice and complete...

I have finally got it working, so here's how to do it if you're interested.

First, declare your GUI variables:

Protected GUI As OgreCEGUIRenderer
Protected GUISys As GuiSystem
Protected WithEvents Desktop As Window

And of course, you have your Root, Window, and Scene objects:

Public Root As New Root("plugins.cfg", "config.cfg", "vermund.log")
Public Window As RenderWindow
Public Scene As SceneManager = Nothing

The names of the files are up to you...

When creating your Scene:


Initialiser.SetupResources("resources.cfg")
Window = Root.Initialise(True, "Vermund : A Matter of Life and Death")
ResourceGroupManager.getSingleton().initialiseAllResourceGroups()
Scene = New SceneManager
Scene = Root.GetSceneManager(SceneType.ExteriorRealFar)



Then, you can go ahead and create your GUI:

GUI = New OgreCEGUIRenderer(Window)
GUI.Initialise()
GUI.setTargetSceneManager(Scene)
GUISys = GuiSystem.CreateGuiSystemSpecial(GUI)
SchemeManager.Instance.LoadScheme("TaharezLook.scheme")
GUISys.SetDefaultMouseCursor("TaharezLook", "MouseArrow")
GUISys.DefaultFontName = "Tahoma-12"
Desktop = WindowManager.Instance.CreateWindow("DefaultWindow", "Desktop")
GUISys.GUISheet = Desktop
''' Create your other windows here...


Then you can create your scene:

Scene.SetSkyDome(True, "Examples/CloudySky", 10, 1)
Scene.AmbientLightColor = Color.FromArgb(125, 125, 125, 125)
Scene.SetWorldGeometry("paginglandscape2.cfg")
WorldNode = Scene.RootSceneNode.CreateChildSceneNode("WorldNode")
''' Etc, etc...


And it all works! :)

The trick is in the CEGUIRenderer... when you create it, you have to tell it to use a different scene manager other than the Generic one, because you're using a different scene manager and scene type.

There are two overloads for the "SetTargetSceneManager" function. One takes the SceneType enum value, the other is where you pass in your scene manager object. The scenetype enum WILL NOT WORK! Pass in your scene manager object ("scene" in the above example).

EagleEye

22-12-2005 20:49:02

Here's a screen shot of it in action. :)