Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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();
        }