Пример #1
0
Файл: GUI.cs Проект: envy/Huddy
 /// <summary>
 /// Adds a new Panel to this GUI
 /// </summary>
 /// <param name="location"></param>
 /// <param name="size"></param>
 /// <returns></returns>
 public Panel AddPanel(Point location, Point size)
 {
     Panel p = new Panel {Location = location, Size = size};
     p.SetGUIStuff(_spriteBatch, _graphics, this);
     _container.Add(p);
     _focusList.Add(p);
     _changedFocus = true;
     return p;
 }
Пример #2
0
Файл: Main.cs Проект: 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);
        }