/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); // TODO: Add your drawing code here spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.Transform); player.Draw(spriteBatch); base.Draw(gameTime); camera.Draw(spriteBatch); button.Draw(spriteBatch); spriteBatch.End(); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); exitDoor.Draw(gameTime, spriteBatch); serverButtonList.ForEach((x) => x.Draw(gameTime, spriteBatch)); }
public override void Draw() { spriteBatch.Begin(); spriteBatch.Draw(background, new Rectangle(0, 0, ScreenUtils.ScreenWidth, ScreenUtils.ScreenHeight), Color.White); mainMenuButton.Draw(spriteBatch); Color scoreColor = Constans.MENU_SELECTED_BUTTON_BACKGROUND_COLOR; Color levelColor = Constans.MAIN_SPRITE_COLOR; String scoreString; String highScoreString; String highScoreNumberString; if (GameState.Instance.Score == GameState.Instance.HighScore) { scoreString = ResourceManager.Instance.GetString(ResourceManager.StringKey.NEW_HIGHSCORE_SUMMARY); highScoreString = ResourceManager.Instance.GetString(ResourceManager.StringKey.PREVIOUS_HIGHSCORE_SUMMARY); int lastHighScore = GameState.Instance.LastHighScore > 1 ? GameState.Instance.LastHighScore : 0; highScoreNumberString = "" + lastHighScore.ToString("000000"); } else { scoreString = ResourceManager.Instance.GetString(ResourceManager.StringKey.SCORE_SUMMARY); highScoreString = ResourceManager.Instance.GetString(ResourceManager.StringKey.HIGHSCORE_SUMMARY); highScoreNumberString = "" + GameState.Instance.HighScore.ToString("000000"); } String scoreNumberString = "" + GameState.Instance.Score.ToString("000000"); Vector2 scoreSize = font.MeasureString(scoreString); Vector2 scoreNumberSize = font.MeasureString(scoreNumberString); Vector2 scorePosition = new Vector2(ScreenUtils.ScreenWidth, 0) / 2f - scoreSize / 2f; Vector2 scoreNumberPosition = new Vector2(ScreenUtils.ScreenWidth, 0) / 2f - scoreNumberSize / 2f; scorePosition.Y = 300; scoreNumberPosition.Y = scorePosition.Y + scoreNumberSize.Y * 1.1f; spriteBatch.DrawString(font, scoreString, scorePosition, scoreColor); spriteBatch.DrawString(font, scoreNumberString, scoreNumberPosition, levelColor); Vector2 highScoreNumberSize = font.MeasureString(highScoreNumberString); Vector2 highScoreSize = font.MeasureString(highScoreString); Vector2 highScorePosition = new Vector2(ScreenUtils.ScreenWidth, 0) / 2f - highScoreSize / 2f; Vector2 highScoreNumberPosition = new Vector2(ScreenUtils.ScreenWidth, 0) / 2f - highScoreNumberSize / 2f; highScorePosition.Y = 500; highScoreNumberPosition.Y = highScorePosition.Y + highScoreSize.Y * 1.1f; spriteBatch.DrawString(font, highScoreString, highScorePosition, scoreColor); spriteBatch.DrawString(font, highScoreNumberString, highScoreNumberPosition, levelColor); spriteBatch.Draw(fadeOutOverlay, new Rectangle(0, 0, ScreenUtils.ScreenWidth, ScreenUtils.ScreenHeight), fadeoutColor); spriteBatch.End(); }