public override void Initialize() { base.Initialize(); gui_manager = game.GuiManager; form = new DForm(gui_manager, "test", null); form.Size = new Vector2(800, 600); form.Position = new Vector2(0, 0); form.Alpha = 0; form.Initialize(); gui_manager.AddControl(form); DLayoutFlow layout = new DLayoutFlow(2, 2, 60, 20, DLayoutFlow.DLayoutFlowStyle.Vertically); layout.Position = new Vector2(10, 10); button1 = new DButton(gui_manager); layout.Add(button1); button1.Text = "test"; button1.Initialize(); form.AddPanel(button1); button1.OnClick += new DButtonEventHandler(button_OnClick); check1 = new DCheckbox(gui_manager); layout.Add(check1); check1.Text = "Enable Fog"; check1.FontColor = Color.White; check1.FillColor = Color.Wheat; check1.Checked = true; check1.Initialize(); form.AddPanel(check1); check1.OnToggle += new CheckboxEventHandler(check_OnCheck); }
public DForm(DGuiManager guiManager, string formName, DForm parent) : base(guiManager) { _isForm = true; name = formName; parentForm = parent; childForms = new Dictionary<string,DForm>(); Size = new Vector2(FORM_WIDTH, FORM_HEIGHT); // Center by default this.Position = new Vector2((guiManager.Game.Window.ClientBounds.Width - Size.X) / 2f, (guiManager.Game.Window.ClientBounds.Height - Size.Y) / 2f); }
protected override void LoadContent() { base.LoadContent(); guiManager = new DGuiManager(game, game.spriteBatch); layout = new DLayoutFlow(1, 12, DLayoutFlow.DLayoutFlowStyle.Vertically); layout.Position = new Vector2(10, 10); form = new DForm(guiManager, "Gunbound", null); form.Size = new Vector2(800, 600); form.Position = new Vector2(0, 0); form.Initialize(); guiManager.AddControl(form); }