Beispiel #1
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();
        }
Beispiel #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.");
            }
        }
Beispiel #3
0
 public Text(string caption)
 {
     _TextArea             = OverlayManager.Singleton.CreateOverlayElement("TextArea", TextName) as TextAreaOverlayElement;
     _TextArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
     _TextArea.SetPosition(0, 0);
     _TextArea.SetDimensions(300, 120);
     _TextArea.CharHeight = 20;
     _TextArea.FontName   = Font.Default;
     _TextArea.Caption    = caption;
     _TextArea.Colour     = ColourValue.White;
 }
Beispiel #4
0
 public Text(string caption)
 {
     _TextArea = OverlayManager.Singleton.CreateOverlayElement("TextArea", TextName) as TextAreaOverlayElement;
     _TextArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
     _TextArea.SetPosition(0, 0);
     _TextArea.SetDimensions(300, 120);
     _TextArea.CharHeight = 20;
     _TextArea.FontName = Font.Default;
     _TextArea.Caption = caption;
     _TextArea.Colour = ColourValue.White;
 }
Beispiel #5
0
        public TextLabel(
            String name, String fontName, float fontSize, ColourValue colourtop, ColourValue colourbottom)
        {
            TextArea = OverlayManager.Singleton.CreateOverlayElement("TextArea", name)
                       as TextAreaOverlayElement;
            TextArea.MetricsMode = GuiMetricsMode.GMM_RELATIVE;
            TextArea.SetDimensions(1.0f, 1.0f);
            TextArea.CharHeight   = fontSize;
            TextArea.FontName     = fontName;
            TextArea.ColourTop    = colourtop;
            TextArea.ColourBottom = colourbottom;

            TextArea.SpaceWidth = TextArea.CharHeight * 0.5f;
        }
Beispiel #6
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();
        }
 protected override void _applyDimensions()
 {
     mTextAreaOverlayElement.SetPosition(mPixelDimensions.x, mPixelDimensions.y);
     mTextAreaOverlayElement.SetDimensions(mPixelDimensions.z, mPixelDimensions.w);
     mTextAreaOverlayElement.CharHeight = mPixelDimensions.w;
 }
Beispiel #8
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();
        }