MenuComponent menuComponent; // The menu component contains the options that the player can choose from. #endregion Fields #region Constructors public StartScreen(Game game, SpriteBatch spriteBatch, SpriteFont spriteFont, Texture2D image) : base(game, spriteBatch) { // Add the menu options to the menu component, and then add the component to the list of components. string[] menuItems = { "New Game", "Load Game", "Exit Game" }; menuComponent = new MenuComponent(game, spriteBatch, spriteFont, menuItems); Components.Add(menuComponent); this.image = image; // The start screen will take up the entire game window. imageRectangle = new Rectangle(0, 0, Game.Window.ClientBounds.Width, Game.Window.ClientBounds.Height); }
public QuitScreen(Game game, SpriteBatch spriteBatch, SpriteFont spriteFont, Texture2D image, ActionScreen actionScreen) : base(game, spriteBatch) { // Adds the two options to the menu component, which is then added to the list of components in GameScreen. string[] menuItems = { "Yes", "No" }; menuComponent = new MenuComponent(game, spriteBatch, spriteFont, menuItems); Components.Add(menuComponent); this.image = image; imageRectangle = new Rectangle((Game.Window.ClientBounds.Width - this.image.Width) / 2, (Game.Window.ClientBounds.Height - this.image.Height) / 2, this.image.Width, this.image.Height); this.actionScreen = actionScreen; }
MenuComponent menuComponent; // Provides the selection menu. #endregion Fields #region Constructors public PauseScreen(Game game, SpriteBatch spriteBatch, SpriteFont spriteFont, Texture2D image, ActionScreen actionScreen) : base(game, spriteBatch) { // Initialize the menu options and add them to the menu component. string[] menuItems = { "Resume", "Player Stats", "Save", "Return to Main Menu" }; menuComponent = new MenuComponent(game, spriteBatch, spriteFont, menuItems); Components.Add(menuComponent); // Set the image and calculate its size. this.image = image; imageRectangle = new Rectangle((Game.Window.ClientBounds.Width - this.image.Width) / 2, (Game.Window.ClientBounds.Height - this.image.Height) / 2, this.image.Width, this.image.Height); this.actionScreen = actionScreen; }