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; }
SpriteFont spriteFont; // The Sprite Font used to draw the text to the screen. #endregion Fields #region Constructors public DialogueScreen(Game game, SpriteBatch spriteBatch, SpriteFont spriteFont, Texture2D image, ActionScreen actionScreen) : base(game, spriteBatch) { // 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), this.image.Width, this.image.Height); location = new Vector2(100, (Game.Window.ClientBounds.Height - this.image.Height / 2 - 20)); this.spriteFont = spriteFont; this.actionScreen = actionScreen; isComplete = true; index = 0; }
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; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Load the content for the start screen, add it to the components, and hide it. startScreen = new StartScreen(this, spriteBatch, Content.Load<SpriteFont>("menufont"), Content.Load<Texture2D>("Menus/StartScreen")); Components.Add(startScreen); startScreen.Hide(); // Load the content for the loading screen. splashScreen = new SplashScreen(this, spriteBatch, Content.Load<Texture2D>("Menus/SampleSplashScreen")); Components.Add(splashScreen); splashScreen.Hide(); // Load the content for the action screen, where most of the gameplay will occur. actionScreen = new ActionScreen(this, spriteBatch); Components.Add(actionScreen); actionScreen.Hide(); // Load the content for the pause screen. pauseScreen = new PauseScreen(this, spriteBatch, Content.Load<SpriteFont>("menufont"), Content.Load<Texture2D>("Menus/PauseScreen"), actionScreen); Components.Add(pauseScreen); pauseScreen.Hide(); // Load the content for the quit screen. quitScreen = new QuitScreen(this, spriteBatch, Content.Load<SpriteFont>("menufont"), Content.Load<Texture2D>("Menus/QuitScreen"), actionScreen); Components.Add(quitScreen); quitScreen.Hide(); // Load the content for the dialogue screen. dialogueScreen = new DialogueScreen(this, spriteBatch, Content.Load<SpriteFont>("menufont"), Content.Load<Texture2D>("Menus/DialogueScreen"), actionScreen); Components.Add(dialogueScreen); dialogueScreen.Hide(); // When the game starts, the active screen is the start screen. activeScreen = startScreen; activeScreen.Show(); }