protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            _guiManager.LoadContent();
            Textbox textbox = new Textbox();

            textbox.Name     = "Test Textbox";
            textbox.Position = new Vector2(10, 10);
            textbox.Width    = 200;
            textbox.Height   = 25;
            textbox.Text     = "Hello, world!";
            _guiManager.AddControl(textbox);
            Button button = new Button();

            button.Text        = "btn!";
            button.Position    = new Vector2(220, 10);
            button.Width       = 100;
            button.Height      = 100;
            button.Click      += new EventHandler(button_Click);
            button.MousePress += new EventHandler(button_MousePress);
            _guiManager.AddControl(button);
            Panel panel = new Panel();

            panel.Position = new Vector2(330, 10);
            panel.Width    = 200;
            panel.Height   = 200;
            _guiManager.AddControl(panel);
            Button panel_Button = new Button();

            panel_Button.Text        = "child btn!";
            panel_Button.Position    = Vector2.Zero;
            panel_Button.Width       = 100;
            panel_Button.Height      = 100;
            panel_Button.MousePress += new EventHandler(button_MousePress);
            panel_Button.Click      += new EventHandler(button_Click);
            panel.AddControl(panel_Button);
            TabControl tabControl = new TabControl();

            tabControl.Position = new Vector2(10, 120);
            tabControl.Width    = 300;
            tabControl.Height   = 300;
            _guiManager.AddControl(tabControl);
            Panel  tabPage1        = new Panel();
            Button tabPage1_Button = new Button();

            tabPage1_Button.Text        = "child btn! (1)";
            tabPage1_Button.Position    = Vector2.Zero;
            tabPage1_Button.Width       = 100;
            tabPage1_Button.Height      = 100;
            tabPage1_Button.MousePress += new EventHandler(button_MousePress);
            tabPage1_Button.Click      += new EventHandler(button_Click);
            Panel  tabPage2        = new Panel();
            Button tabPage2_Button = new Button();

            tabPage2_Button.Text        = "child btn! (2)";
            tabPage2_Button.Position    = Vector2.Zero;
            tabPage2_Button.Width       = 100;
            tabPage2_Button.Height      = 100;
            tabPage2_Button.MousePress += new EventHandler(button_MousePress);
            tabPage2_Button.Click      += new EventHandler(button_Click);
            tabControl.AddPage("test", tabPage1);
            tabControl.AddPage("test2", tabPage2);
            tabPage1.AddControl(tabPage1_Button);
            tabPage2.AddControl(tabPage2_Button);

            fpsCounter = new FPSCounter(this, _guiManager.ContentLibrary.UIFont_Small);
            fpsCounter.LoadContent();
        }
Beispiel #2
0
        public override void OnInitialise()
        {
            base.OnInitialise();

            GUIManager guiManager = SystemCore.GetSubsystem <GUIManager>();

            //panel
            p = new Panel(new Rectangle(0, 0, GUIManager.ScreenRatioX(0.1f), GUIManager.ScreenRatioY(0.1f)), GUITexture.Textures["blank"]);
            p.HighlightAlpha = 0.3f;
            p.MainColor      = SystemCore.ActiveColorScheme.Color4;
            p.Anchor(AnchorPoint.middle, GUIManager.ScreenPoint.midpoint, new Vector2(0, 0));
            guiManager.AddControl(p);



            //button
            Button b = new Button(new Rectangle(0, 0, GUIManager.ScreenRatioX(0.1f), GUIManager.ScreenRatioY(0.05f)), GUITexture.Textures["blank"]);

            b.HighlightAlpha = 0.4f;
            b.MainColor      = SystemCore.ActiveColorScheme.Color3;
            b.HighlightColor = SystemCore.ActiveColorScheme.Color4;
            b.Anchor(AnchorPoint.topMid, GUIManager.ScreenPoint.topMiddle, Vector2.Zero);
            guiManager.AddControl(b);



            //label attached to button
            Label l = new Label(GUIFonts.Fonts["test"], "Button");

            l.TextOutline = false;
            l.TextColor   = SystemCore.ActiveColorScheme.Color1;
            b.AttachLabel(l);



            //bordered button
            Button c = new Button(new Rectangle(700, 10, 100, 40), GUITexture.Textures["blank"]);

            c.MainAlpha       = 0.4f;
            c.MainColor       = SystemCore.ActiveColorScheme.Color3;
            c.HighlightColor  = SystemCore.ActiveColorScheme.Color4;
            c.Border          = true;
            c.BorderColor     = SystemCore.ActiveColorScheme.Color5;
            c.BorderThickness = 1;
            guiManager.AddControl(c);


            FadeTransition fadeTest = new FadeTransition(1, 0, 500, 5000);

            p.ApplyTransition(fadeTest);

            //needs work
            ListBox listBox = new ListBox(new Rectangle(200, 200, 200, 200), GUITexture.Textures["blank"]);

            for (int i = 0; i < 100; i++)
            {
                listBox.AddItem(i.ToString());
            }
            guiManager.AddControl(listBox);

            //f****d
            ItemCarousel itemCarousel = new ItemCarousel(new Vector2(700, 500), true, 50, 50);

            for (int i = 0; i < 5; i++)
            {
                itemCarousel.Add(GUITexture.Textures["blank"], i.ToString());
            }
            guiManager.AddControl(itemCarousel);



            SetCameraMovement(false);
        }