Ejemplo n.º 1
0
        public OverlayScene(Vector screenSize)
        {
            m_ScreenSize = screenSize;

            //note we need to load a font if we want to use a font
            var font = FontManager.Singleton.Create("Arial", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);

            font.SetParameter("type", "truetype");
            font.SetParameter("source", "Arial.ttf");
            font.SetParameter("size", "16");
            font.SetParameter("resolution", "96");
            font.Load();
            m_Container = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement("Panel", "PanelName");

            //note positions and sizes are in relative screen space
            m_Container.SetPosition(0.35, 0.3);
            m_Container.SetDimensions(0.3, 0.5);
            m_Container.MaterialName = "triangle/red";


            m_Overlay = OverlayManager.Singleton.Create("bob");

            m_Overlay.Add2D(m_Container);

            m_Overlay.Show();
        }
Ejemplo n.º 2
0
        public static void AddTextBox(String id, String text, float x, float y, float width, float height, ColourValue colorTop, ColourValue colorBot)
        {
            try {
                OverlayManager   overlayMgr = OverlayManager.Singleton;
                OverlayContainer panel      = (OverlayContainer)overlayMgr.CreateOverlayElement("Panel", "_panel_" + id);
                panel.MetricsMode = GuiMetricsMode.GMM_PIXELS;
                panel.SetPosition(x, y);
                panel.SetDimensions(width, height);

                TextAreaOverlayElement textArea = (TextAreaOverlayElement)overlayMgr.CreateOverlayElement("TextArea", "_area_" + id);
                textArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
                textArea.SetPosition(0, 0);
                textArea.SetDimensions(width, height);
                textArea.Caption      = text;
                textArea.CharHeight   = 16;
                textArea.FontName     = "Verdana";
                textArea.ColourTop    = colorTop;
                textArea.ColourBottom = colorBot;
                Overlay overlay = overlayMgr.Create("_overlay_" + id);
                overlay.Add2D(panel);
                panel.AddChild(textArea);
                overlay.Show();
            }
            catch (Exception e) {
                Util.Log("Unable to create text area.");
            }
        }
Ejemplo n.º 3
0
        // Create text area for SkyX parameters
        private void CreateTextArea()
        {
            // Create a panel
            OverlayContainer panel = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement("Panel", "SkyXParametersPanel");

            panel.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            panel.SetPosition(10, 10);
            panel.SetDimensions(400, 400);

            // Create a text area
            textArea             = (TextAreaOverlayElement)OverlayManager.Singleton.CreateOverlayElement("TextArea", "SkyXParametersTextArea");
            textArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            textArea.SetPosition(0, 0);
            textArea.SetDimensions(100, 100);
            textArea.Caption      = "SkyX plugin demo";
            textArea.CharHeight   = 16;
            textArea.FontName     = "BlueHighway";
            textArea.ColourBottom = new ColourValue(0.3f, 0.5f, 0.3f);
            textArea.ColourTop    = new ColourValue(0.5f, 0.7f, 0.7f);


            // Create an overlay, and add the panel
            Overlay overlay = OverlayManager.Singleton.Create("OverlayName");

            overlay.Add2D(panel);

            // Add the text area to the panel
            panel.AddChild(textArea);

            // Show the overlay
            overlay.Show();
        }
Ejemplo n.º 4
0
        // Create text area for SkyX parameters
        private void _createTextArea()
        {
            // Create a panel
            OverlayContainer panel = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement("Panel", "SkyXParametersPanel");

            panel.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            panel.SetPosition(10, 10);
            panel.SetDimensions(400, 400);

            // Create a text area
            _textArea             = OverlayManager.Singleton.CreateOverlayElement("TextArea", "SkyXParametersTextArea");
            _textArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            _textArea.SetPosition(0, 0);
            _textArea.SetDimensions(100, 100);
            // _textArea.Text = "MogreLib SkyX plugin demo";
            _textArea._setHeight(16);
            //_textArea.FontName = "BlueHighway";
            // _textArea.ColorBottom = new ColorEx(0.3f, 0.5f, 0.3f);
            //_textArea.ColorTop = new ColorEx(0.5f, 0.7f, 0.5f);

            // Create an overlay, and add the panel
            Overlay overlay = OverlayManager.Singleton.Create("OverlayName");

            overlay.Add2D(panel);

            // Add the text area to the panel
            panel.AddChild(_textArea);

            // Show the overlay
            overlay.Show();
        }
Ejemplo n.º 5
0
        public OverlayContainer createOverlay(String N, Vector2 P, Vector2 D,
                                              String M, String C, bool A, Overlay target)
        {
            String t = "Panel";

            if (C != "")
            {
                t = "TextArea";
            }
            OverlayElement e = OverlayManager.Singleton.CreateOverlayElement(t, N + this.name + DateTime.Now.Ticks);

            e.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            e.SetDimensions(D.x, D.y);
            e.SetPosition(0, 0);


            //if (M != "")
            //    e.MaterialName = M;

            if (C != "")
            {
                if (A)
                {
                    e.Top  = OVERLAY_TITLE_MARGIN;
                    e.Left = OVERLAY_TITLE_MARGIN;
                }

                e.Caption = C;
                e.SetParameter("font_name", mFont);
                e.SetParameter("char_height", StringConverter.ToString(mFontSize));
            }


            OverlayContainer c =
                (OverlayContainer)
                OverlayManager.Singleton.CreateOverlayElement("Panel", name + "ContainerHack" + (oc++).ToString());

            c.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            c.SetDimensions(D.x, D.y);
            c.SetPosition(P.x, P.y);

            if (M != "")
            {
                c.MaterialName = M;
            }
            c.AddChild(e);
            if (A)
            {
                target.Add2D(c);
                c.Show();
            }
            return(c);
        }
Ejemplo n.º 6
0
        private void ConfigureContainer(OverlayContainer container, OverlayElement element, int width, int height,
                                        int posX, int posY)
        {
            container.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            container.SetDimensions(minimapViewport.ActualWidth, minimapViewport.ActualHeight);
            container.SetPosition(posX,
                                  posY);

            container.AddChild(element);
            hudOverlay.Add2D(container);
            container.Show();
        }
Ejemplo n.º 7
0
 public CursorOverlay(ushort zOrder)
 {
     Overlay = OverlayManager.Singleton.Create("CursorOverlay" + Guid.NewGuid().ToString());
     Cursor = (PanelOverlayElement)OverlayManager.Singleton.CreateOverlayElement("Panel", "Cursor" + Guid.NewGuid().ToString());
     Cursor.MetricsMode = GuiMetricsMode.GMM_PIXELS;
     Cursor.Width = 32;
     Cursor.Height = 32;
     Cursor.MaterialName = "Cursor";
     // Set Material
     CursorKind = Kind.Default;
     Overlay.Add2D(Cursor);
     Overlay.ZOrder = zOrder;
     Overlay.Show();
 }
Ejemplo n.º 8
0
        public OutputManager()
        {
            alphaSinceLastFrame = 1;
            textElements        = new List <OverlayElement>();
            container           = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement("BorderPanel", "msgContainer");
            o        = OverlayManager.Singleton.Create("msgOverlay");
            o.ZOrder = 254;
            o.Show();

            container.MetricsMode = GuiMetricsMode.GMM_RELATIVE;
            container._setPosition(0, 0);
            container.Width  = 0.2f;
            container.Height = 0.1f;
            o.Add2D(container);

            buffer   = new StringVector();
            instance = this;
        }
Ejemplo n.º 9
0
        private void CreateMessageContainer()
        {
            // BetaGUI.GUI gui = new GUI();
            // Window w = gui.createWindow();
            // w.createStaticImage()

            backgroundElement.Hide();
            iconOverlay             = OverlayManager.Singleton.GetByName("Wof/MessageBar");
            iconElement             = OverlayManager.Singleton.GetOverlayElement("Wof/MessageBarIcon");
            iconElement.MetricsMode = GuiMetricsMode.GMM_RELATIVE;
            iconElement.SetDimensions(radioIconWidth, radioIconWidth);
            iconElement.Show();
            iconOverlay.Hide();     // zewnetrzny kontener ukryje wszystko


            iconDefaultDimesions.x = Mogre.StringConverter.ParseReal(iconElement.GetParameter("width"));
            iconDefaultDimesions.y = Mogre.StringConverter.ParseReal(iconElement.GetParameter("height"));

            messageElement = OverlayManager.Singleton.CreateOverlayElement(
                "TextArea", "messageElement " + DateTime.Now.Ticks);
            messageContainer = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement(
                "Panel", "messageContainer " + DateTime.Now.Ticks);

            messageElement.SetDimensions(mainViewport.ActualWidth, mainViewport.ActualHeight);
            messageElement.MetricsMode = GuiMetricsMode.GMM_PIXELS;

            messageElement.SetParameter("font_name", FontManager.CurrentFont);

            messageElement.MetricsMode = GuiMetricsMode.GMM_RELATIVE;
            messageElement.SetParameter("char_height", StringConverter.ToString(EngineConfig.CurrentFontSize));
            messageElement.SetParameter("colour_top", "0.1 0.1 0.1");
            messageElement.SetParameter("colour_bottom", "0.5 0.1 0.1");
            messageElement.Caption = "";


            messageContainer.MetricsMode = GuiMetricsMode.GMM_RELATIVE;
            messageContainer.SetDimensions(1.0f, 0.05f);
            // messageContainer.SetPosition(0.055f, 0.015f);

            messageContainer.AddChild(messageElement);
            messageOverlay.Add2D(messageContainer);
            messageContainer.Show();
        }
Ejemplo n.º 10
0
        /** Constructor
         *  @param
         *      name The name to be given to the widget (must be unique).
         *  @note
         *      If you want a transparent background, pass "" as the material.
         */
        public Sheet(string name, string material)
            : base(name, new Vector4(0, 0, 1, 1), QGuiMetricsMode.QGUI_GMM_RELATIVE, QGuiMetricsMode.QGUI_GMM_RELATIVE, material, null, null)
        {
            mDefaultCharacterHeight = 1;
            mDefaultTextColor       = ColourValue.White;
            mDefaultSkin            = "qgui";
            mAutoNameWindowCounter  = 0;
            mMenuOverlayZOrder      = 600;

            mVerticalAlignment = GuiVerticalAlignment.GVA_BOTTOM;

            mWidgetType = Widget.WidgetType.QGUI_TYPE_SHEET;
            mWindows.Clear();
            // Sheets are always at zOrder 0.
            mOverlay        = OverlayManager.Singleton.Create(mInstanceName + ".Overlay");
            mOverlay.ZOrder = 0;
            mOverlay.Show();
            mOverlay.Add2D(mOverlayContainer);

            FontManager fm = FontManager.Singleton;

            ResourceManager.ResourceMapIterator rmi = fm.GetResourceIterator();
            if (rmi.MoveNext())
            {
                mDefaultFont = rmi.Current.Name;
            }
            else
            {
                mDefaultFont = string.Empty;
            }

            // Create menu overlay and container
            mMenuOverlay = OverlayManager.Singleton.Create(mInstanceName + ".MenuOverlay");
            mMenuOverlay.Show();
            mMenuContainer = createOverlayContainer(mInstanceName + ".MenuContainer", "");
            mMenuOverlay.Add2D(mMenuContainer);
            mMenuContainer.Show();

            // Set zOrder very high, but leave room for containers and mouse cursor to show up correctly.
            mMenuOverlay.ZOrder = (ushort)mMenuOverlayZOrder;
        }
Ejemplo n.º 11
0
        private void Initalize()
        {
            // Create the font resources
            // add the path to your resources.cfg
            // for example:
            // Default   | ../../../Media/fonts     | ../../../Media/fonts.zip
            Load("LiberationSans-Regular.ttf", Font.Default, 10);
            Load("LiberationSans-Bold.ttf", Font.DefaultBold, 15);
            Load("LiberationSans-Italic.ttf", Font.DefaultItalic, 10);
            //Load("LiberationMono-Regular.ttf", Font.Console, 26);

            // Create the overlay panel
            _OverlayPanel             = OverlayManager.Singleton.CreateOverlayElement("Panel", new Guid().ToString()) as OverlayContainer;
            _OverlayPanel.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            _OverlayPanel.SetPosition(0, 0);
            _OverlayPanel.SetDimensions(300, 120);

            _TextOverlay = OverlayManager.Singleton.Create(new Guid().ToString());

            _TextOverlay.Add2D(_OverlayPanel);
        }
Ejemplo n.º 12
0
        public void Init(string name, Mogre.RenderWindow window, InputContext inputContext, UIListener listener)
        {
            Name              = name;
            this.window       = window;
            this.inputContext = inputContext;
            this.listener     = listener;
            cursorWasVisible  = false;

            OverlayManager om       = Mogre.OverlayManager.Singleton;
            string         nameBase = Name + "/";

            cursorLayer        = om.Create(nameBase + "CursorLayer");
            cursorLayer.ZOrder = 1;

            // make backdrop and cursor overlay containers
            cursor = (Mogre.OverlayContainer)om.CreateOverlayElementFromTemplate("SdkTrays/Cursor", "Panel", nameBase + "Cursor");
            cursorLayer.Add2D(cursor);
            cursorLayer.ZOrder = 400;

            ShowCursor();
            gameCursor = new GameCursor();
        }
Ejemplo n.º 13
0
        public Window(string name, Vector4 dimensions, QGuiMetricsMode positionMode, QGuiMetricsMode sizeMode, string material, Widget parentWidget) : base(name, dimensions, positionMode, sizeMode, material, null, parentWidget)
        {
            mTitleBar       = null;
            mTitleBarHidden = false;


            mWidgetType     = Widget.WidgetType.QGUI_TYPE_WINDOW;
            mOverlay        = OverlayManager.Singleton.Create(mInstanceName + ".Overlay");
            mOverlay.ZOrder = 0;
            mOverlay.Show();
            mZOrderValues.Add(0);

            // mChildrenContainer already created in Widget constructor
            mTitleBarContainer = createOverlayContainer(mInstanceName + ".TitleBarContainer", "");

            mOverlay.Add2D(mOverlayContainer);
            mChildrenContainer.AddChildImpl(mTitleBarContainer);

            mOverlayContainer.Show();
            mChildrenContainer.Show();
            mTitleBarContainer.Show();

            // Create TitleBar - tradition titlebar dimensions: across the top of the window
            Vector4 defaultTitleBarDimensions = new Vector4(0f, 0f, 1f, 0.05f / getSize(QGuiMetricsMode.QGUI_GMM_ABSOLUTE).y);

            mTitleBar = new TitleBar(mInstanceName + ".Titlebar", defaultTitleBarDimensions, QGuiMetricsMode.QGUI_GMM_RELATIVE, QGuiMetricsMode.QGUI_GMM_RELATIVE, mWidgetMaterial + ".titlebar", mTitleBarContainer, this);
            mTitleBar.enableDragging(true);
            mTitleBar.setDraggingWidget(this);
            mTitleBar.getTextWidget().enableDragging(true);
            mTitleBar.getTextWidget().setDraggingWidget(this);
            mTitleBar.setZOrderOffset(1);
            _addChildWidget(mTitleBar);

            // Now that mOverlayContainer has been created (via _init() function) we can create the borders
            _createBorders();

            OnActivate += new ActivateEventHandler(Window_OnActivate);
        }
        public OverlayScene(Vector screenSize)
        {
            m_ScreenSize = screenSize;

            //note we need to load a font if we want to use a font
            var font = FontManager.Singleton.Create("Arial", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
            font.SetParameter("type", "truetype");
            font.SetParameter("source", "Arial.ttf");
            font.SetParameter("size", "16");
            font.SetParameter("resolution", "96");
            font.Load();
            m_Container = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement("Panel", "PanelName");

            //note positions and sizes are in relative screen space
            m_Container.SetPosition(0.35, 0.3);
            m_Container.SetDimensions(0.3, 0.5);
            m_Container.MaterialName = "triangle/red";

            m_Overlay = OverlayManager.Singleton.Create("bob");

            m_Overlay.Add2D(m_Container);

            m_Overlay.Show();
        }
Ejemplo n.º 15
0
        internal MouseCursor(Vector2 dimensions, string material, int RenderWidthInPixels, int RenderHeightInPixels)
        {
            instance  = this;
            mMaterial = material;
            mRelativeCursorDimensions = dimensions;
            mRenderWidthInPixels      = RenderWidthInPixels;
            mRenderHeightInPixels     = RenderHeightInPixels;
            mVisible           = true;
            mHideWhenOffScreen = true;
            mOnTopBorder       = false;
            mOnBotBorder       = false;
            mOnLeftBorder      = false;
            mOnRightBorder     = false;

            mPixelCursorDimensions.x = mRelativeCursorDimensions.x; // *RenderWidthInPixels; // GDZ: Prefiero al cursor en pixels
            mPixelCursorDimensions.y = mRelativeCursorDimensions.y; // *RenderHeightInPixels; // GDZ: Prefiero al cursor en pixels
            mConstraints.x           = RenderWidthInPixels;
            mConstraints.y           = RenderHeightInPixels;
            mPosition.x = mConstraints.x / 2;
            mPosition.y = mConstraints.y / 2;

            // Create Mouse Overlay
            mMouseOverlay        = OverlayManager.Singleton.Create("simpleGUI_Mouse_Overlay");
            mMouseOverlay.ZOrder = 649;
            mMouseOverlay.Show();

            // Create Mouse Overlay Container
            mMousePointerContainer             = (OverlayContainer)(OverlayManager.Singleton.CreateOverlayElement("Panel", "simpleGUI_Mouse_Container"));
            mMousePointerContainer.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            mMousePointerContainer.SetPosition(mPosition.x, mPosition.y);
            mMousePointerContainer.SetDimensions(Mogre.Math.Ceil(mPixelCursorDimensions.x), Mogre.Math.Ceil(mPixelCursorDimensions.y));
            mMousePointerContainer.MaterialName = mMaterial;

            mMouseOverlay.Add2D(mMousePointerContainer);
            mMousePointerContainer.Show();
        }
Ejemplo n.º 16
0
        public OverlayGUI()
        {
            //setup the colours
            top = new ColourValue(0.9f, 0.9f, 0.9f);
            bot = new ColourValue(0.8f, 0.8f, 0.8f);
            seltop = new ColourValue(0.9f, 0.7f, 0.7f);
            selbot = new ColourValue(0.8f, 0.6f, 0.6f);

            //Overlay
            overlayManager = OverlayManager.Singleton;
            // Create a panel
            panel = (OverlayContainer)overlayManager.CreateOverlayElement("Panel", "PanelName");
            panel.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            panel.SetPosition(0, 0);
            panel.SetDimensions(Program.Instance.rWindow.Width, Program.Instance.rWindow.Height);

            panel.MaterialName = "fsO/Blank";  // Optional background material

            // Create a text area
            messageArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "TextArea");
            messageArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            messageArea.SetPosition(0, 0);
            messageArea.SetDimensions(Program.Instance.rWindow.Width, 100);
            messageArea.CharHeight = 24;
            messageArea.FontName = "damn";
            messageArea.ColourTop = top;
            messageArea.ColourBottom = bot;
            messageArea.Caption = "";

            // Status text area
            statArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "StatTextArea");
            statArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            statArea.SetPosition(0, Program.Instance.rWindow.Height - 50);
            statArea.SetDimensions(Program.Instance.rWindow.Width, 50);
            statArea.CharHeight = 24;
            statArea.FontName = "damn";
            statArea.ColourTop = top;
            statArea.ColourBottom = bot;
            statArea.Caption = "this is a test" + Environment.NewLine + "This is the test's second line";

            //Menus Text Areas
            titleArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "TitleTextArea");
            titleArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            titleArea.SetPosition(64, 16);
            titleArea.SetDimensions(Program.Instance.rWindow.Width, 32);
            titleArea.CharHeight = 32;
            titleArea.FontName = "damn";
            titleArea.ColourTop = top;
            titleArea.ColourBottom = bot;
            titleArea.Caption = "Title";

            for (int i = 0; i < 10; i++)
            {
                optionAreas[i] = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", i+"TextArea");
                optionAreas[i].MetricsMode = GuiMetricsMode.GMM_PIXELS;
                optionAreas[i].SetPosition(32, 64 + (i*26));
                optionAreas[i].SetDimensions(Program.Instance.rWindow.Width, 24);
                optionAreas[i].CharHeight = 24;
                optionAreas[i].FontName = "damn";
                optionAreas[i].ColourTop = top;
                optionAreas[i].ColourBottom = bot;
                optionAreas[i].Caption = "Option " + i.ToString();
            }

            maxOptions = 10;

            // Create an overlay, and add the panel
            overlay = overlayManager.Create("OverlayName");

            overlay.Add2D(panel);
            // Add the text area to the panel
            panel.AddChild(messageArea);
            panel.AddChild(titleArea);
            panel.AddChild(statArea);
            for (int i = 0; i < 10; i++)
            {
                panel.AddChild(optionAreas[i]);
            }

            // Show the overlay
            overlay.Show();
        }
Ejemplo n.º 17
0
 public override void AddToOverlay(Overlay overlay)
 {
     overlay.Add2D(Container);
 }
Ejemplo n.º 18
0
 public override void AddToOverlay(Overlay overlay)
 {
     Panel.AddChild(TextArea);
     overlay.Add2D(Panel);
 }
Ejemplo n.º 19
0
 public override void AddToOverlay(Overlay overlay)
 {
     overlay.Add2D(Panel);
 }
Ejemplo n.º 20
0
        public SdkTrayManager(string name)
        {
            Name = name;
            string nameBase = Name + "/";

            nameBase = nameBase.Replace(" ", "_");

            for (var i = 0; i < _widgets.Length; i++)
            {
                _widgets[i] = new List <Widget>();
            }

            OverlayManager om = OverlayManager.Singleton;

            _backdropLayer        = om.Create(nameBase + "BackdropLayer");
            _traysLayer           = om.Create(nameBase + "WidgetsLayer");
            _priorityLayer        = om.Create(nameBase + "PriorityLayer");
            _cursorLayer          = om.Create(nameBase + "CursorLayer");
            _backdropLayer.ZOrder = 100;;
            _traysLayer.ZOrder    = 200;
            _priorityLayer.ZOrder = 300;
            _cursorLayer.ZOrder   = 400;

            // make backdrop and cursor overlay containers
            _cursor = (OverlayContainer)om.CreateOverlayElementFromTemplate("SdkTrays/Cursor", "Panel", nameBase + "Cursor");
            _cursorLayer.Add2D(_cursor);
            _backdrop = (OverlayContainer)om.CreateOverlayElement("Panel", nameBase + "Backdrop");
            _backdropLayer.Add2D(_backdrop);
            _dialogShade = (OverlayContainer)om.CreateOverlayElement("Panel", nameBase + "DialogShade");
            _dialogShade.MaterialName = "SdkTrays/Shade";
            _dialogShade.Hide();
            _priorityLayer.Add2D(_dialogShade);

            string[] trayNames = new[]
            {
                "TopLeft", "Top", "TopRight", "Left", "Center", "Right", "BottomLeft", "Bottom", "BottomRight"
            };

            for (var i = 0; i < 9; i++)                // make the real trays
            {
                _trays[i] = (OverlayContainer)om.CreateOverlayElementFromTemplate
                                ("SdkTrays/Tray", "BorderPanel", nameBase + trayNames[i] + "Tray");
                _traysLayer.Add2D(_trays[i]);

                _trayWidgetAlign[i] = GuiHorizontalAlignment.GHA_CENTER;

                // align trays based on location
                if (i == (int)TrayLocation.Top || i == (int)TrayLocation.Center || i == (int)TrayLocation.Bottom)
                {
                    _trays[i].HorizontalAlignment = GuiHorizontalAlignment.GHA_CENTER;
                }

                if (i == (int)TrayLocation.Left || i == (int)TrayLocation.Center || i == (int)TrayLocation.Right)
                {
                    _trays[i].VerticalAlignment = GuiVerticalAlignment.GVA_CENTER;
                }

                if (i == (int)TrayLocation.TopRight || i == (int)TrayLocation.Right || i == (int)TrayLocation.BottomRight)
                {
                    _trays[i].HorizontalAlignment = GuiHorizontalAlignment.GHA_RIGHT;
                }

                if (i == (int)TrayLocation.BottomLeft || i == (int)TrayLocation.Bottom || i == (int)TrayLocation.BottomRight)
                {
                    _trays[i].VerticalAlignment = GuiVerticalAlignment.GVA_BOTTOM;
                }
            }

            // create the null tray for free-floating widgets
            _trays[9]           = (OverlayContainer)om.CreateOverlayElement("Panel", nameBase + "NullTray");
            _trayWidgetAlign[9] = GuiHorizontalAlignment.GHA_LEFT;
            _traysLayer.Add2D(_trays[9]);
            AdjustTrays();

            ShowTrays();
            ShowCursor();
        }
Ejemplo n.º 21
0
        private void Initalize()
        {
            // Create the font resources
            // add the path to your resources.cfg
            // for example:
            // Default   | ../../../Media/fonts     | ../../../Media/fonts.zip
            Load("LiberationSans-Regular.ttf", Font.Default, 10);
            Load("LiberationSans-Bold.ttf", Font.DefaultBold, 15);
            Load("LiberationSans-Italic.ttf", Font.DefaultItalic, 10);
            //Load("LiberationMono-Regular.ttf", Font.Console, 26);

            // Create the overlay panel
            _OverlayPanel = OverlayManager.Singleton.CreateOverlayElement("Panel", new Guid().ToString()) as OverlayContainer;
            _OverlayPanel.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            _OverlayPanel.SetPosition(0, 0);
            _OverlayPanel.SetDimensions(300, 120);

            _TextOverlay = OverlayManager.Singleton.Create(new Guid().ToString());

            _TextOverlay.Add2D(_OverlayPanel);
        }