public Button(Game1 game, Rectangle rectangle, String name, GameStateManager.NextGameState nextGameState) : base(game.Content.Load <Texture2D>("button"), rectangle, 1f) { this.name = name; textPosition = new Vector2(rectangle.X + rectangle.Width / 10, rectangle.Y + rectangle.Height / 10); this.nextGameState = nextGameState; }
public GameState(Game1 game, Texture2D background, GameStateManager.NextGameState nextGameState) { this.background = background; buttonList = new List <Button>(); screen = game.screen; font = game.Content.Load <SpriteFont>("font"); this.nextGameState = nextGameState; }
public virtual void Update(GameTime gameTime, InputHandler inputHandler) { //if a button is clicked, gets what the game state needs to be from that button foreach (Button b in buttonList) { b.Update(gameTime, inputHandler); if (b.IsButtonClicked) { nextGameState = b.NextGameState; } } }