コード例 #1
0
        /// <summary>
        /// call create4LineDebugOverLay to create an Overlay with 4 text lines at the top left corrner
        /// </summary>
        protected virtual void create4LineDebugOverLay()
        {
            if (mPanel != null)
            {
                return;
            }
            // Create a panel
            // WTF I keep getting segmentfault when i use PanelOverlayElement, at the panel.addChild line.
            //   prob in mono somewhere not reconizeing it derives from container? but HTF?
            //mPanel = OverlayManager.Instance.CreatePanelElement("Status/Panel");
            OverlayElement el = OverlayManager.Instance.CreateOverlayElement("Panel", "DebugStatus/Panel");

            mPanel = new OverlayContainer(OverlayElement.getCPtr(el).Handle, false);

            mPanel.setMetricsMode(GuiMetricsMode.GMM_PIXELS);
            mPanel.setPosition(10, 10);
            mPanel.setDimensions(500, 100);
            //mPanel->setMaterialName("MaterialName"); // Optional background material

            // Create a text area
            mODebugText1 = OverlayManager.Instance.CreateTextAreaElement("DebugStatus/DebugText1");
            mPanel.addChild(mODebugText1);
            mODebugText1.setMetricsMode(GuiMetricsMode.GMM_PIXELS);
            mODebugText1.setPosition(0, 0);
            mODebugText1.setDimensions(100, 100);
            mODebugText1.setCaption("");
            mODebugText1.setCharHeight(16);
            mODebugText1.setFontName("BlueHighway");
            mODebugText1.setColourBottom(Converter.GetColor(0.3f, 0.5f, 0.3f));
            mODebugText1.setColourTop(Converter.GetColor(0.5f, 0.7f, 0.5f));


            // Create a text area
            mODebugText2 = OverlayManager.Instance.CreateTextAreaElement("DebugStatus/DebugText2");
            mODebugText2.setMetricsMode(GuiMetricsMode.GMM_PIXELS);
            mODebugText2.setPosition(0, 20);
            mODebugText2.setDimensions(100, 100);
            mODebugText2.setCaption("");
            mODebugText2.setCharHeight(16);
            mODebugText2.setFontName("BlueHighway");
            mODebugText2.setColourBottom(Converter.GetColor(0.3f, 0.5f, 0.3f));
            mODebugText2.setColourTop(Converter.GetColor(0.5f, 0.7f, 0.5f));
            mPanel.addChild(mODebugText2);


            // Create a text area
            mODebugText3 = OverlayManager.Instance.CreateTextAreaElement("DebugStatus/DebugText3");
            mODebugText3.setMetricsMode(GuiMetricsMode.GMM_PIXELS);
            mODebugText3.setPosition(0, 40);
            mODebugText3.setDimensions(100, 100);
            mODebugText3.setCaption("");
            mODebugText3.setCharHeight(16);
            mODebugText3.setFontName("BlueHighway");
            mODebugText3.setColourBottom(Converter.GetColor(0.3f, 0.5f, 0.3f));
            mODebugText3.setColourTop(Converter.GetColor(0.5f, 0.7f, 0.5f));
            mPanel.addChild(mODebugText3);


            // Create a text area
            mODebugText4 = OverlayManager.Instance.CreateTextAreaElement("DebugStatus/DebugText4");
            mODebugText4.setMetricsMode(GuiMetricsMode.GMM_PIXELS);
            mODebugText4.setPosition(0, 60);
            mODebugText4.setDimensions(100, 100);
            mODebugText4.setCaption("");
            mODebugText4.setCharHeight(16);
            mODebugText4.setFontName("BlueHighway");
            mODebugText4.setColourBottom(Converter.GetColor(0.3f, 0.5f, 0.3f));
            mODebugText4.setColourTop(Converter.GetColor(0.5f, 0.7f, 0.5f));
            mPanel.addChild(mODebugText4);

            // Create an overlay, and add the panel
            mOverlay = OverlayManager.Instance.create("Status/Overlay");
            mOverlay.add2D(mPanel);
        }