public override void Init(Game1 game)
        {
            Color = Color.White;

            var skin = new Skin(game.GreyImageMap, game.GreyMap);
            var text = new Text(game.GreySpriteFont, Color.Black);

            //Simply subscribe to the events demonstrated below
            _gui = new Gui(game, skin, text);
            _gui.CharEntered += CharEntered;
            _gui.KeyDown += KeyDown;
            _gui.KeyUp += KeyUp;
            _gui.MouseDoubleClick += MouseDoubleClick;
            _gui.MouseDown += MouseDown;
            _gui.MouseHover += MouseHover;
            _gui.MouseUp += MouseUp;
            _gui.MouseWheel += MouseWheel;

            _gui.AddWidget(_hasMouse = new Label(100, 10 + 30 * 0, "Test1"));
            _gui.AddWidget(_charEntered = new Label(100, 10 + 30 * 1, "Test2"));
            _gui.AddWidget(_keyDown = new Label(100, 10 + 30 * 2, "Test3"));
            _gui.AddWidget(_keyUp = new Label(100, 10 + 30 * 3, "Test3"));
            _gui.AddWidget(_doubleClick = new Label(100, 10 + 30 * 4, "Test4"));
            _gui.AddWidget(_mouseDown = new Label(100, 10 + 30 * 5, "Test5"));
            _gui.AddWidget(_mouseHover = new Label(100, 10 + 30 * 6, "Test6"));
            _gui.AddWidget(_mouseUp = new Label(100, 10 + 30 * 7, "Test7"));
            _gui.AddWidget(_mouseWheel = new Label(100, 10 + 30 * 8, "Test7"));
        }
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
        public override void Init(Game1 game)
        {
            Color = Color.White;

            var skin = new Skin(game.GreyImageMap, game.GreyMap);
            var text = new Text(game.GreySpriteFont, Color.Black);

            var testSkin = new Skin(game.TestImageMap, game.TestMap);
            var testText = new Text(game.TestSpriteFont, Color.Black);

            var testSkins = new[] { new Tuple<string, Skin>("testSkin", testSkin) };
            var testTexts = new[] { new Tuple<string, Text>("testText", testText) };

            _gui = new Gui(game, skin, text, testSkins, testTexts) {
                Widgets = new Widget[] {
                    new Button(10, 10 + (40 * 0), "Button"),
                    new Button(10, 10 + (40 * 1), "Skin") { Skin = "testSkin", Text = "testText" },

                    new Button(10, 10 + (40 * 2), "Change Label", buttonEvent: delegate(Widget widget) {
                        ((Button)widget).Label = _label.Value;
                    }),
                    _label = new SingleLineTextBox(220, 10 + (40 * 2), 100, 10),

                    new Button(10, 10 + (40 * 4), "TextPadding = 25", 25),
                    new Button(10, 10 + (40 * 5), "TextPadding = 25") { TextPadding = 25 },
                    new Button(10, 10 + (40 * 6), "Change TextPadding", buttonEvent: delegate(Widget widget) {
                        int value;
                        if (int.TryParse(_padding.Value, out value)) {
                            ((Button)widget).TextPadding = value;
                        }
                    }),
                    _padding = new SingleLineTextBox(220, 10 + (40 * 6), 100, 10),

                    new Button(10, 10 + (40 * 8), 200, "Width = 200"),
                    new Button(10, 10 + (40 * 9), "Width = 200") { Width = 200 },
                    new Button(10, 10 + (40 * 10), "Change Width", buttonEvent: delegate(Widget widget) {
                        int value;
                        if (int.TryParse(_width.Value, out value)) {
                            ((Button)widget).Width = value;
                        }
                    }),
                    _width = new SingleLineTextBox(220, 10 + (40 * 10), 100, 10)
                }
            };
        }
 public DeferredRenderer(Game1 game)
     : base(game)
 {
     m_scene = new Scene(game);
     m_camera = new Camera(Game);
 }
 public abstract void Init(Game1 game);
        public override void Init(Game1 game)
        {
            Color = Color.White;

            var beaker = game.Content.Load<Texture2D>("beaker");

            var skin = new Skin(game.GreyImageMap, game.GreyMap);
            var text = new Text(game.GreySpriteFont, Color.Black);

            var testSkin = new Skin(game.TestImageMap, game.TestMap);
            var testText = new Text(game.TestSpriteFont, Color.Black);

            var testSkins = new[] { new Tuple<string, Skin>("testSkin", testSkin) };
            var testTexts = new[] { new Tuple<string, Text>("testText", testText) };

            _gui = new Gui(game, skin, text, testSkins, testTexts) {
                Widgets = new Widget[] {
                    //By default the Button is as wide as the width of the label plus the edge of the button graphic
                    new Button(10, 10 + (40 * 0), "Button") { Skin = "testSkin", Text = "testText" },
                    new Button(10, 10 + (40 * 1), "Wide Button"),
                    new Button(10, 10 + (40 * 2), "T"),
                    new Button(10, 10 + (40 * 3), 120, "Width 120"),
                    //Button will resized to fit if the specified width is smaller than the width of the text
                    new Button(10, 10 + (40 * 4), 20, "Width 20"),
                    //The optional padding argument causes the button to be as wide as the label + (padding * 2)
                    new Button(10, 10 + (40 * 5), "5 Padding", 5),
                    new Button(10, 10 + (40 * 6), "10 Padding", 10),

                    //The ToggleButton behaves similarly to the Button but toggles between being
                    //pressed or released each time its clicked.
                    new ToggleButton(150, 10 + (40 * 0), "Button"),
                    new ToggleButton(150, 10 + (40 * 1), "Wide Button"),
                    new ToggleButton(150, 10 + (40 * 2), "T"),
                    new ToggleButton(150, 10 + (40 * 3), 120, "Width 120"),
                    new ToggleButton(150, 10 + (40 * 4), 20, "Width 20"),
                    new ToggleButton(150, 10 + (40 * 5), "5 Padding", 5),
                    new ToggleButton(150, 10 + (40 * 6), "10 Padding", 10),

                    //Standard old checkbox
                    new CheckBox(300, 10, "Check Box"),

                    //Standard old radio button
                    //Only one radio buttons in the same group can have a value of true
                    new RadioButton(300, 40, "GRP", "Group GRP"),
                    new RadioButton(300, 70, "GRP", "Group GRP"),
                    new RadioButton(300, 100, "GRP", "Group GRP"),

                    //Slider allowing anologue selection. Value is the percent selected between 0 and 1 inclusive.
                    _slider = new Slider(300, 130, 200, delegate(Widget slider) {
                        _sliderLabel.Value = "Value = " + ((Slider)slider).Value;
                    }),
                    _sliderLabel = new Label(300, 160, "Value = 0"),

                    _singleLineTextBox = new SingleLineTextBox(300, 180, 100, 10),
                    new Button(410, 177, 100, "Change", delegate {
                        var result = 0.0f;
                        if (float.TryParse(_singleLineTextBox.Value, out result)) {
                            _slider.Value = result;
                        }
                    }),

                    //Combo box allowing that expands to allow the user to select one of the items in the DropDownItem List.
                    new ComboBox(300, 210, "Pick a Color", 2, CardinalDirection.North, new List<ComboBox.DropDownItem> { //The padding argument behaves the same as for the Button
                        new ComboBox.DropDownItem("Violet", null, delegate { Color = Color.Violet; }),
                        new ComboBox.DropDownItem("Tomato", null, delegate { Color = Color.Tomato; }),
                        new ComboBox.DropDownItem("YellowGreen", null, delegate { Color = Color.YellowGreen; }),
                        new ComboBox.DropDownItem("LightSkyBlue", null, delegate { Color = Color.LightSkyBlue; })
                    }),
                    new ComboBox(300, 250, 131, "Holder Text", CardinalDirection.South, new List<ComboBox.DropDownItem> {
                        new ComboBox.DropDownItem("Test 1"),
                        new ComboBox.DropDownItem("Test 2"),
                        new ComboBox.DropDownItem("Test 3"),
                        new ComboBox.DropDownItem("Test 4"),
                        new ComboBox.DropDownItem("Test 5")
                    }),

                    //For labels with icons the label is centered in the height of the icon
                    new Label(450, 10, "Research"),
                    new Label(450, 40, beaker, "Research"),
                    new Label(450, 70, beaker, "Research", 4), //Use the optional field for padding

                    //ScrollBars no longer have borders so nest them in panels if you need them.
                    //Panels have a min size of twice the renderers border width.
                    new Panel(10, 300, 220, 220) {
                        Children = new Widget[] {
                            new ScrollBars {
                                Children = new Widget[] {
                                    new CheckBox(10, 10, "Button"),
                                    new CheckBox(210, 10, "Button"),
                                    new CheckBox(10, 210, "Button"),
                                    new CheckBox(210, 210, "Button")
                                }
                            }
                        }
                    },

                    //TextBoxs no longer have borders so nest them in panels if you need them.
                    new Panel(240, 300, 400, 400) {
                        Children = new Widget[] {
                            new TextBox(2, 800) { Value = "This is a textbox!" }
                        }
                    },

                    new SingleLineTextBox(10, 525, 120, 10), //Basic Test
                    new SingleLineTextBox(10, 550, 120, 10) { Value = "0123456789" }, //Test with default value
                    new SingleLineTextBox(10, 575, 120, 10) { Value = "0123456789", Text = "testText" } //Test with specified font
                }
            };
        }
        public override void Init(Game1 game)
        {
            Color = Color.White;

            _beaker = game.Content.Load<Texture2D>("beaker");

            var skin = new Skin(game.GreyImageMap, game.GreyMap);
            var text = new Text(game.GreySpriteFont, Color.LightGray);

            _gui = new Gui(game, skin, text) {
                Widgets = new Widget[] {
                    new ScrollBars {
                        Children = new Widget[] {
                            new Panel(10, 10, 1000, 1000) {
                                Children = new Widget[] {
                                    new ScrollBars {
                                        Children = new Widget[] {
                                            new Button(10, 10, "Test 1"),
                                            new Button(10, 50, "Test 2"),
                                            new Button(10, 90, "Test 3"),
                                            new Button(10, 130, "Test 4"),
                                            new Button(10, 170, "Test 5"),
                                            new Button(10, 210, "Test 6"),
                                            new Button(10, 250, "Test 7"),
                                            new Button(10, 290, "Test 8"),
                                            new Button(10, 330, "Test 9"),
                                            new Button(10, 370, "Test 10"),
                                            new Button(10, 410, "Test 11"),
                                            new Button(10, 450, "Test 12"),
                                            new Button(10, 490, "Test 13"),
                                            new Button(10, 530, "Test 14"),
                                            new Button(10, 570, "Test 15"),
                                            new Button(10, 610, "Test 16"),
                                            new Panel(100, 10, 200, 200) {
                                                Children = new Widget[] {
                                                    new Button(10, 10, "Test 1"),
                                                    new Button(10, 50, "Test 2"),
                                                    new Button(10, 90, "Test 3")
                                                }
                                            },
                                            new Panel(100, 230, 400, 400) {
                                                Children = new Widget[] {
                                                    new ScrollBars {
                                                        Children = new Widget[] {
                                                            new Button(10, 10, "Test 1"),
                                                            new Button(10, 50, "Test 2"),
                                                            new Button(10, 90, "Test 3"),
                                                            new Button(10, 130, "Test 4"),
                                                            new Button(10, 170, "Test 5"),
                                                            new Button(10, 210, "Test 6"),
                                                            new Button(10, 250, "Test 7"),
                                                            new Button(10, 290, "Test 8"),
                                                            new Button(10, 330, "Test 9"),
                                                            new Button(10, 370, "Test 10"),
                                                            new Button(10, 410, "Test 11"),
                                                            new Button(10, 450, "Test 12"),
                                                            new Button(10, 490, "Test 13"),
                                                            new Button(10, 530, "Test 14"),
                                                            new Button(10, 570, "Test 15"),
                                                            new Button(10, 610, "Test 16"),
                                                            new Panel(100, 10, 600, 600) {
                                                                Children = new Widget[] {
                                                                    new ScrollBars {
                                                                        Children = new Widget[] {
                                                                            new Button(10, 10, "Button"),
                                                                            new ToggleButton(10, 50, "Toggle Button"),
                                                                            new Panel(10, 90, 120, 120),
                                                                            new CheckBox(10, 215, "Check Box"),
                                                                            new RadioButton(10, 255, "GRP", "Radio 1"),
                                                                            new RadioButton(10, 285, "GRP", "Radio 2"),
                                                                            new RadioButton(10, 315, "GRP", "Radio 3"),
                                                                            new Label(10, 340, "Research"),
                                                                            new Label(10, 365, _beaker, "Research"),
                                                                            new Panel(140, 90, 220, 220) {
                                                                                Children = new Widget[] {
                                                                                    new TextBox(2, 600)
                                                                                }
                                                                            },
                                                                            new Panel(370, 70, 220, 220) {
                                                                                Children = new Widget[] {
                                                                                    new ScrollBars {
                                                                                        Children = new Widget[] {
                                                                                            new CheckBox(10, 10, "Button"),
                                                                                            new CheckBox(210, 10, "Button"),
                                                                                            new CheckBox(10, 210, "Button"),
                                                                                            new CheckBox(210, 210, "Button"),
                                                                                            new Panel(10, 230, 300, 300) {
                                                                                                Children = new Widget[] {
                                                                                                    new TextBox(2, 300)
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };
        }