Example #1
0
File: Window.cs Project: envy/Huddy
        /// <summary>
        /// Creates a new window
        /// </summary>
        public Window()
        {
            Title = "";
            Closeable = true;
            _closeButton = new Button
                            {
                                Anchor = Anchor.TopRight,
                                Location = new Point(0, -20),
                                Size = new Point(20, 19),
                                Text = "X",
                                Parent = this,
                                SpriteBatch = SpriteBatch,
                                Graphics = Graphics
                            };

            _closeButton.MouseDown += (sender, args) => Visible = false;

            MouseMove += WindowMove;
            MouseLeave += WindowMove;
        }
Example #2
0
File: Main.cs Project: envy/Huddy
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here

            _gui = new GUI(_spriteBatch, _graphics, this);
            ThemeManager.Instance.LoadDefaultTheme();

            Window w = _gui.AddWindow(new Point(10, 10), new Point(200, 200));
            Button b = new Button {Location = new Point(5, 5), Size = new Point(100, 30), Visible = true};
            b.Anchor = Anchor.BottomRight;
            b.Text = "Exit";
            b.MouseDown += (sender, args) => Exit();
            w.Title = "Test Window";
            w.Add(b);
            w.Add(new Label { Text = "Test Label", Location = new Point(5, 5)});

            Panel p = new Panel();
            p.Dock = Dock.Bottom;
            p.Size = new Point(0, 100);
            p.CanAcquireFocus = false;
            _gui.Add(p);
        }