Exemplo n.º 1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            this.Engine = new GuiEngine(this.Content, this.GraphicsDevice, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

            /* Window 1 */
            this.win = new Window(this.Engine);

            /* Button */
            this.button1 = new UI.Button(this.win, 30, 200, 200, 24, "Leave Program");
            this.button1.Enabled = false;
            this.button1.OnMouseClick += button1_OnMouseClick;

            /* Label */
            this.label1 = new UI.Label(this.win, 55, 10, "Welcome to MonoGame.UI");

            /* CheckBox */
            this.checkBox1 = new UI.CheckBox(this.win, 20, 75, "Active leave button", true);
            this.checkBox1.OnCheckChange += checkBox1_OnCheckChange;

            /* Window 2 */
            this.win2 = new Window(this.Engine, 350, 10, 250, 150, "Gui Stats");
            this.win2.ShowCloseButton = false;
            this.label2 = new UI.Label(this.win2, 25, 10, "GuiEngine Stats :");

            this.win3 = new Window(this.Engine, 350, 200, 300, 225, "RadioButton tests");

            /* RadioButton 1 */
            this.radioGroup1 = new RadioGroup(this.win3);
            this.radioGroup1.Placement = RadioButtonPlacement.Horizontal;
            this.radioGroup1.SetPosition(20, 20);
            UI.RadioButton _r1 = new UI.RadioButton(this.radioGroup1);
            _r1.Text = "Power --";
            UI.RadioButton _r2 = new UI.RadioButton(this.radioGroup1);
            _r2.Text = "Power ++";
            this.radioGroup1.AddRadioButton(_r1);
            this.radioGroup1.AddRadioButton(_r2);

            /* RadioButton 2 */
            this.radioGroup2 = new RadioGroup(this.win3);
            this.radioGroup2.SetPosition(20, 50);

            UI.RadioButton _r3 = new UI.RadioButton(this.radioGroup2);
            _r3.Text = "XNA";
            UI.RadioButton _r4 = new UI.RadioButton(this.radioGroup2);
            _r4.Text = "MonoGame";

            this.radioGroup2.AddRadioButton(_r3);
            this.radioGroup2.AddRadioButton(_r4);

            this.Engine.AddWindow(this.win);
            this.Engine.AddWindow(this.win2);
            this.Engine.AddWindow(this.win3);

            base.Initialize();
        }
Exemplo n.º 2
0
 public Window(GuiEngine engine, Int32 left, Int32 top, Int32 width, Int32 height, String title)
     : base()
 {
     this.Engine = engine;
     this.Text = title;
     this.Visible = true;
     this.Enabled = true;
     this.ShowCloseButton = true;
     // Set position ans size
     this.SetPosition(left, top);
     this.SetSize(width, height);
     this.lstControl = new List<Control>();
 }
Exemplo n.º 3
0
 public Window(GuiEngine engine)
     : base()
 {
     this.Engine = engine;
     this.Text = "MonoGame.UI Window";
     this.Visible = true;
     this.Enabled = true;
     this.ShowCloseButton = true;
     // Set position ans size
     this.SetPosition(10, 10);
     this.SetSize(300, 300);
     this.lstControl = new List<Control>();
 }