protected override void CreateScene() { base.mSceneManager.AmbientLight = Color.FromArgb(125, 125, 125, 125); base.mSceneManager.SetSkyDome(true, "Examples/CloudySky", 5, 8); mGuiRenderer = new OgreCEGUIRenderer(base.mRenderWindow, (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY, false, 3000, mSceneManager); mGuiRenderer.Initialise(); mGuiSystem = new GuiSystem(mGuiRenderer); Logger.Instance.setLoggingLevel(LoggingLevel.Informative); SchemeManager.Instance.LoadScheme("TaharezLookSkin.scheme"); mGuiSystem.SetDefaultMouseCursor("TaharezLook", "MouseArrow"); mGuiSystem.DefaultFontName = "BlueHighway-12"; mBackgroundWindow = WindowManager.Instance.CreateWindow("DefaultWindow", "BackgroundWindow"); mGuiSystem.GUISheet = mBackgroundWindow; mTestWindow = WindowManager.Instance.CreateWindow("TaharezLook/FrameWindow", "TestWindow"); mBackgroundWindow.AddChildWindow(mTestWindow); mTestWindow.SetSize(0.3f, 0.6f); mTestWindow.SetPosition(0.7f, 0.2f); mTestWindow.Text = "Test Window"; mTestWindow.SubscribeEvents(); mQuitButton = WindowManager.Instance.CreatePushButton("TaharezLook/Button", "QuitButton"); mQuitButton.Text = "Quit"; mQuitButton.SetPosition(0.1f, 0.1f); mQuitButton.SetSize(0.8f, 0.2f); mQuitButton.SubscribeEvents(); mQuitButton.Clicked += new WindowEventDelegate(QuitClicked); mTestWindow.AddChildWindow(mQuitButton); mEditbox = WindowManager.Instance.CreateEditbox("TaharezLook/Editbox", "Editbox"); mEditbox.Text = "Editbox"; mEditbox.SetPosition(0.1f, 0.4f); mEditbox.SetSize(0.8f, 0.2f); mTestWindow.AddChildWindow(mEditbox); Menubar menuBar = WindowManager.Instance.CreateMenubar("TaharezLook/Menubar", "Main menubar"); menuBar.SetPosition(0.0f, 0.0f); menuBar.SetSize(1.0f, 0.04f); mBackgroundWindow.AddChildWindow(menuBar); MenuItem mnuFile = WindowManager.Instance.CreateMenuItem("TaharezLook/MenubarItem", "mnuFile"); mnuFile.setText("File"); menuBar.addItem(mnuFile); PopupMenu mnuFilePopup = WindowManager.Instance.CreatePopupMenu("TaharezLook/PopupMenu", "mnuFilePopup"); mnuFile.AddChildWindow(mnuFilePopup); MenuItem mnuFileNew = WindowManager.Instance.CreateMenuItem("TaharezLook/MenuItem", "mnuFileNew"); mnuFileNew.setText("New"); mnuFilePopup.AddChildWindow(mnuFileNew); MenuItem mnuFileOpen = WindowManager.Instance.CreateMenuItem("TaharezLook/MenuItem", "mnuFileOpen"); mnuFileOpen.setText("Open"); mnuFilePopup.AddChildWindow(mnuFileOpen); MenuItem mnuFileClose = WindowManager.Instance.CreateMenuItem("TaharezLook/MenuItem", "mnuFileClose"); mnuFileClose.setText("Close"); mnuFileClose.setEnabled(false); mnuFilePopup.AddChildWindow(mnuFileClose); MenuItem mnuFileSave = WindowManager.Instance.CreateMenuItem("TaharezLook/MenuItem", "mnuFileSave"); mnuFileSave.setText("Save"); mnuFileSave.setEnabled(false); mnuFilePopup.AddChildWindow(mnuFileSave); MenuItem mnuFileSaveAs = WindowManager.Instance.CreateMenuItem("TaharezLook/MenuItem", "mnuFileSaveAs"); mnuFileSaveAs.setText("Save As"); mnuFileSaveAs.setEnabled(false); mnuFilePopup.AddChildWindow(mnuFileSaveAs); MenuItem mnuFileExit = WindowManager.Instance.CreateMenuItem("TaharezLook/MenuItem", "mnuFileExit"); mnuFileExit.setText("Exit"); mnuFileExit.SubscribeEvents(); mnuFileExit.Clicked += new WindowEventDelegate(QuitClicked); mnuFilePopup.AddChildWindow(mnuFileExit); mTestWindow.Show(); }
protected override void CreateScene() { mLog = LogManager.Singleton.createLog("DemoCEGUI.log", false, true); mLog.LogMessage("My new Log. Hells yeah!"); base.mSceneManager.AmbientLight = Color.FromArgb(125, 125, 125, 125); base.mSceneManager.SetSkyDome(true, "Examples/CloudySky", 5, 8); mGuiRenderer = new OgreCEGUIRenderer(base.mRenderWindow, (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY, false, 3000, mSceneManager); mGuiRenderer.Initialise(); mGuiSystem = new GuiSystem(mGuiRenderer); //mGuiSystem = GuiSystem.CreateGuiSystemSpecial(mGuiRenderer); Logger.Instance.setLoggingLevel(LoggingLevel.Informative); SchemeManager.Instance.LoadScheme("TaharezLookSkin.scheme"); mGuiSystem.SetDefaultMouseCursor("TaharezLook", "MouseArrow"); mGuiSystem.DefaultFontName = "BlueHighway-12"; mBackgroundWindow = WindowManager.Instance.CreateWindow("DefaultWindow", "BackgroundWindow"); mGuiSystem.GUISheet = mBackgroundWindow; mEditorWindow = WindowManager.Instance.CreateWindow("TaharezLook/FrameWindow", "TestWindow"); mBackgroundWindow.AddChildWindow(mEditorWindow); mEditorWindow.SetSize(0.9f, 0.9f); mEditorWindow.SetPosition(0.05f, 0.05f); mEditorWindow.Text = "CeguiDotNet Demo"; mEditorWindow.SubscribeEvents(); mQuitButton = WindowManager.Instance.CreatePushButton("TaharezLook/Button", "QuitButton"); mQuitButton.Text = "Quit"; mQuitButton.SetPosition(0.1f, 0.15f); mQuitButton.SetSize(0.8f, 0.15f); mQuitButton.SubscribeEvents(); mQuitButton.Clicked += new WindowEventDelegate(QuitClicked); mEditorWindow.AddChildWindow(mQuitButton); mEditbox = WindowManager.Instance.CreateEditbox("TaharezLook/Editbox", "Editbox"); mEditbox.Text = "Editbox"; mEditbox.SetPosition(0.1f, 0.32f); mEditbox.SetSize(0.8f, 0.15f); mEditbox.setReadOnly(false); mEditbox.SubscribeEvents(); mEditbox.KeyDown += new CeguiDotNet.KeyEventDelegate(this.UsernameCharacterKey); mEditorWindow.AddChildWindow(mEditbox); mCombobox = WindowManager.Instance.CreateCombobox("TaharezLook/Combobox", "Combobox"); mCombobox.SetPosition(0.1f, 0.49f); mCombobox.SetSize(0.8f, 0.25f); mCombobox.setReadOnly(false); mCombobox.SubscribeEvents(); mCombobox.ListSelectionChanged += new WindowEventDelegate(this.combobox_SelectionChanged); mCombobox.TextAccepted += new WindowEventDelegate(this.combobox_TextAccepted); mEditorWindow.AddChildWindow(mCombobox); mCboItem1 = new ListboxTextItem("Item 1", 0, IntPtr.Zero, false, true); mCboItem1.setAutoDeleted(false); mCombobox.addItem(mCboItem1); mCboItem2 = new ListboxTextItem("Item 2", 1, IntPtr.Zero, false, true); mCboItem2.setAutoDeleted(false); mCombobox.addItem(mCboItem2); mCboItem3 = new ListboxTextItem("Item 3", 2, IntPtr.Zero, false, true); mCboItem3.setAutoDeleted(false); mCombobox.addItem(mCboItem3); mCboItem4 = new ListboxTextItem("Item 4", 3, IntPtr.Zero, false, true); mCboItem4.setAutoDeleted(false); mCombobox.addItem(mCboItem4); mEditorWindow.Show(); }
protected override void CreateScene() { mLog = LogManager.Singleton.createLog("DemoCompositor.log", false, true); mLog.LogMessage(string.Format("DemoCompositor log {0}", System.DateTime.Now)); this.DebugOverlayVisible = false; mSceneManager.SetShadowTechnique(ShadowTechnique.ShadowTypeTextureModulative); mSceneManager.SetShadowFarDistance(1000.0f); // setup GUI system mGuiRenderer = new OgreCEGUIRenderer(mRenderWindow, (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY, false, 3000, mSceneManager); mGuiRenderer.Initialise(); //tell the CeguiNet proxy class the IntPtr to the CPP object // load scheme and set up defaults mGuiSystem = new GuiSystem(mGuiRenderer, (CeguiDotNet.ScriptModule)null, (CeguiDotNet.ResourceProvider)null, "CompositorDemoCegui.config"); mGuiSystem.SetDefaultMouseCursor("TaharezLook", "MouseArrow"); OgreDotNet.MovableObject.setDefaultVisibilityFlags(0x00000001); // Set ambient light mSceneManager.SetAmbientLight(Converter.GetColor(0.3f, 0.3f, 0.2f)); Light l = mSceneManager.CreateLight("Light2"); Vector3 dir = new Vector3(-1.0f, -1.0f, 0.0f); dir.Normalize(); l.Type = Light.LightTypes.Directional; l.Direction = dir; l.SetDiffuseColour(1.0f, 1.0f, 0.8f); l.SetSpecularColour(1.0f, 1.0f, 1.0f); Entity pEnt; // House pEnt = mSceneManager.CreateEntity("1", "tudorhouse.mesh"); SceneNode n1 = mSceneManager.GetRootSceneNode().CreateChildSceneNode(new Vector3(350.0f, 450.0f, -200.0f)); n1.AttachObject(pEnt); pEnt = mSceneManager.CreateEntity("2", "tudorhouse.mesh"); SceneNode n2 = mSceneManager.GetRootSceneNode().CreateChildSceneNode(new Vector3(-350.0f, 450.0f, -200.0f)); n2.AttachObject(pEnt); pEnt = mSceneManager.CreateEntity("3", "knot.mesh"); mSpinny = mSceneManager.GetRootSceneNode().CreateChildSceneNode(new Vector3(0.0f, 0.0f, 300.0f)); mSpinny.AttachObject(pEnt); pEnt.SetMaterialName("Examples/MorningCubeMap"); mSceneManager.SetSkyBox(true, "Examples/MorningSkyBox"); Plane plane = new Plane(); plane.Normal = OgreVector3.FromVector3(Math3D.Vector3.UnitY); plane.D = 100.0f; MeshPtr m = MeshManager.Instance.CreatePlane("Myplane", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, plane, 1500.0f, 1500.0f, 10, 10, true, 1, 5.0f, 5.0f, Vector3.UnitZ); Entity pPlaneEnt = mSceneManager.CreateEntity("plane", "Myplane"); pPlaneEnt.SetMaterialName("Examples/Rockwall"); pPlaneEnt.SetCastShadows(false); mSceneManager.GetRootSceneNode().CreateChildSceneNode().AttachObject(pPlaneEnt); m.SetNull(); m = null; mCamera.SetPosition(-400.0f, 50.0f, 900.0f); mCamera.LookAt = new Vector3(0.0f, 80.0f, 0.0f); connectMainEventHandlers(); /// Create a couple of hard coded postfilter effects as an example of how to do it /// but the preferred method is to use compositor scripts. createEffects(); }