public void DrawEndedGood(GameTime currentTime) // Winner screen { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); spriteBatch.Draw(Background, Vector2.Zero, Color.White); string FinalScore = String.Format("Final score = {0}", Score); Vector2 StringDimensions = Font1.MeasureString(FinalScore); int XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font1, FinalScore, new Vector2(XPos, 250), Color.LimeGreen); StringDimensions = Font1.MeasureString("PRESS 'ESC' TO EXIT GAME"); XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font1, "PRESS 'ESC' TO EXIT GAME", new Vector2(XPos, 350), Color.LimeGreen); StringDimensions = Font2.MeasureString("YOU WIN"); XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font2, "YOU WIN", new Vector2(XPos, 140), Color.LimeGreen); StringDimensions = Font3.MeasureString("Free for public use Earth photo, credit: NASA"); XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font3, "Free for public use Earth photo, credit: NASA", new Vector2(XPos, 630), Color.White); spriteBatch.End(); }
public void DrawControls(GameTime currentTime) // Controls screen { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); spriteBatch.Draw(Background, Vector2.Zero, Color.White); Vector2 StringDimensions = Font1.MeasureString("LEFT ARROW KEY = MOVE LEFT"); int XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font1, "LEFT ARROW KEY = MOVE LEFT", new Vector2(XPos, 200), Color.LimeGreen); StringDimensions = Font1.MeasureString("RIGHT ARROW KEY = MOVE RIGHT"); XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font1, "RIGHT ARROW KEY = MOVE RIGHT", new Vector2(XPos, 250), Color.LimeGreen); StringDimensions = Font1.MeasureString("SPACEBAR = SHOOT"); XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font1, "SPACEBAR = SHOOT", new Vector2(XPos, 300), Color.LimeGreen); StringDimensions = Font2.MeasureString("CONTROLS"); XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font2, "CONTROLS", new Vector2(XPos, 90), Color.LimeGreen); StringDimensions = Font1.MeasureString("PRESS BACKSPACE TO RETURN TO START SCREEN"); XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font1, "PRESS BACKSPACE TO RETURN TO START SCREEN", new Vector2(XPos, 400), Color.LimeGreen); StringDimensions = Font3.MeasureString("Free for public use Earth photo, credit: NASA"); XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font3, "Free for public use Earth photo, credit: NASA", new Vector2(XPos, 630), Color.White); spriteBatch.End(); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> // DRAWING CODE public void DrawStarted(GameTime gameTime) // Start screen { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); spriteBatch.Draw(Background, Vector2.Zero, Color.White); Vector2 StringDimensions = Font2.MeasureString("SPACE"); int XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font2, "SPACE", new Vector2(XPos, 100), Color.LimeGreen); StringDimensions = Font2.MeasureString("INVADERS"); XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font2, "INVADERS", new Vector2(XPos, 230), Color.LimeGreen); StringDimensions = Font1.MeasureString("PRESS ENTER TO START GAME"); XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font1, "PRESS ENTER TO START GAME", new Vector2(XPos, 350), Color.LimeGreen); StringDimensions = Font1.MeasureString("PRESS 'C' TO VIEW CONTROLS"); XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font1, "PRESS 'C' TO VIEW CONTROLS", new Vector2(XPos, 385), Color.LimeGreen); StringDimensions = Font3.MeasureString("Free for public use Earth photo, credit: NASA"); XPos = (900 - (int)StringDimensions.X) / 2; spriteBatch.DrawString(Font3, "Free for public use Earth photo, credit: NASA", new Vector2(XPos, 630), Color.White); spriteBatch.End(); }