private void CreateButtons() { /* * ContentManager content = Game.Content; * * Texture2D buttonTexture = content.Load<Texture2D>(@"GUI\Buttons\Start"); * Texture2D selectedButtonTexture = content.Load<Texture2D>(@"GUI\Buttons\SelectedButton"); * * startGameButton = new AnimatedButton(buttonTexture, selectedButtonTexture); * startGameButton.Selected += new EventHandler(MenuItemOnSelected); * * buttonTexture = content.Load<Texture2D>(@"GUI\Buttons\Load"); * * loadGameButton = new AnimatedButton(buttonTexture, selectedButtonTexture); * loadGameButton.Selected += new EventHandler(MenuItemOnSelected); * * buttonTexture = content.Load<Texture2D>(@"GUI\Buttons\Exit"); * * exitGameButton = new AnimatedButton(buttonTexture, selectedButtonTexture); * exitGameButton.Selected += new EventHandler(MenuItemOnSelected); * * controlManager.Add(startGameButton); * controlManager.Add(loadGameButton); * controlManager.Add(exitGameButton); */ simpleNewGameButton = ComponentFactory.CreateSimpleButton("New Game"); simpleNewGameButton.Selected += MenuItemOnSelected; controlManager.Add(simpleNewGameButton); simpleLoadGameButton = ComponentFactory.CreateSimpleButton("Load Game"); //TODO: priskirti eventa kai pasirenki Load Game //controlManager.Add(simpleLoadGameButton); simpleOptionsButton = ComponentFactory.CreateSimpleButton("Options"); //TODO: priskirti eventa kai pasirenki Options //controlManager.Add(simpleOptionsButton); simpleQuitButton = ComponentFactory.CreateSimpleButton("Quit Game"); simpleQuitButton.Selected += MenuItemOnSelected; controlManager.Add(simpleQuitButton); controlManager.NextControl(); controlManager.FocusChanged += new EventHandler(ControlManagerOnFocusChanged); //TODO: hardcoded position Vector2 position = new Vector2(350, 500); foreach (Control control in controlManager) { if (control is SimpleButton) { SimpleButton button = control as SimpleButton; button.Position = position; position.Y += button.Size.Y + 5f; } } }
public PopupComponent(SpriteFont font, ContentManager content, string text) : base(font, content) { this.yesButton = ComponentFactory.CreateSimpleButton("Yes"); this.noButton = ComponentFactory.CreateSimpleButton("No"); this.textLabel = new Label(); this.textLabel.Text = text; this.textLabel.Size = font.MeasureString(this.textLabel.Text); controlManager.Add(this.textLabel); controlManager.Add(yesButton); controlManager.Add(noButton); controlManager.NextControl(); }
public override void LoadContent() { //buttons = new List<AnimatedButton>(); simpleButtons = new List <SimpleButton>(); /* * Texture2D buttonTexture = content.Load<Texture2D>(@"GUI\Buttons\Exit"); * Texture2D buttonSelectedTexture = content.Load<Texture2D>(@"GUI\Buttons\SelectedButton"); * exitGameButton = new AnimatedButton(buttonTexture, buttonSelectedTexture); * controlManager.Add(exitGameButton); * * buttonTexture = content.Load<Texture2D>(@"GUI\Buttons\Start"); * resumeGameButton = new AnimatedButton(buttonTexture, buttonSelectedTexture); * controlManager.Add(resumeGameButton); * * buttons.Add(resumeGameButton); * buttons.Add(exitGameButton); */ simpleResumeGameButton = ComponentFactory.CreateSimpleButton("Resume"); controlManager.Add(simpleResumeGameButton); simpleLoadGameButton = ComponentFactory.CreateSimpleButton("Load Game"); //controlManager.Add(simpleLoadGameButton); simpleSaveGameButton = ComponentFactory.CreateSimpleButton("Save Game"); //controlManager.Add(simpleSaveGameButton); simpleExitGameButton = ComponentFactory.CreateSimpleButton("Exit"); controlManager.Add(simpleExitGameButton); simpleButtons.Add(simpleResumeGameButton); //simpleButtons.Add(simpleLoadGameButton); //simpleButtons.Add(simpleSaveGameButton); simpleButtons.Add(simpleExitGameButton); controlManager.NextControl(); }