Пример #1
0
        public void Draw(SpriteBatch spriteBatch)
        {
            float     uiScale      = Game1.Scale.X;
            Rectangle topRectangle = new Rectangle(0, 0, window.ClientBounds.Width, topHeight);

            Vector2 topHalfPosition = new Vector2((topRectangle.Width / 2) - ((HighscoreSprite.SpriteSize.X * uiScale) / 2), topRectangle.X + 15);

            HighscoreSprite.Draw(spriteBatch, topHalfPosition, Game1.Scale);

            float   scoreWidth        = 6.0f * 7.0f * uiScale + 6.0f;
            float   scoreHeight       = 7.0f * uiScale;
            Vector2 highscorePosition = new Vector2(topHalfPosition.X + (HighscoreSprite.SpriteSize.X * uiScale) - scoreWidth, topHalfPosition.Y + ((HighscoreSprite.SpriteSize.Y * uiScale)) + 10);

            DrawScore(spriteBatch, Highscore, highscorePosition, new Vector2(uiScale));

            Vector2 scorePosition = new Vector2(scoreWidth, highscorePosition.Y);

            DrawScore(spriteBatch, Score, scorePosition, new Vector2(uiScale));


            Rectangle bottomRectangle = new Rectangle(0, window.ClientBounds.Height - bottomHeight, window.ClientBounds.Width, bottomHeight);
            Vector2   lifePosition    = new Vector2(window.ClientBounds.Width - (lifeSprite.SpriteSize.X * uiScale * 5) - 50, topRectangle.Y + 15);

            DrawLives(spriteBatch, Player.Health, lifePosition, new Vector2(uiScale));
        }
Пример #2
0
        public void Draw(SpriteBatch spriteBatch)
        {
            float     uiScale      = Game1.Scale.X * 2.0f;
            Rectangle topRectangle = new Rectangle(0, 0, window.ClientBounds.Width, topHeight);

            Vector2 topHalfPosition = new Vector2((topRectangle.Width / 2) - ((HighscoreSprite.SpriteSize.X * uiScale) / 2), topRectangle.X + 15);

            HighscoreSprite.Draw(spriteBatch, topHalfPosition, Game1.Scale * uiScale);

            float   scoreWidth        = 6.0f * 7.0f * uiScale + 6.0f;
            float   scoreHeight       = 7.0f * uiScale;
            Vector2 highscorePosition = new Vector2(topHalfPosition.X + (HighscoreSprite.SpriteSize.X * uiScale) - scoreWidth, topHalfPosition.Y + ((HighscoreSprite.SpriteSize.Y * uiScale)) + 10);

            DrawScore(spriteBatch, Highscore, highscorePosition, new Vector2(uiScale));

            Vector2 scorePosition = new Vector2(scoreWidth, highscorePosition.Y);

            DrawScore(spriteBatch, Pacman.Score, scorePosition, new Vector2(uiScale));


            Rectangle bottomRectangle = new Rectangle(0, window.ClientBounds.Height - bottomHeight, window.ClientBounds.Width, bottomHeight);

            DrawLives(spriteBatch, Pacman.Lives, new Vector2(bottomRectangle.X, bottomRectangle.Y) + new Vector2(14, (bottomRectangle.Height / 2) - ((lifeSprite.SpriteSize.Y * uiScale) / 2)), new Vector2(uiScale));

            foreach (GainedScore gainedScore in gainedScores)
            {
                string  scoreString       = gainedScore.Score.ToString();
                float   gainedScoreWidth  = scoreString.Length * 7.0f * Game1.Scale.X + scoreString.Length;
                float   gainedScoreHeight = 7.0f * Game1.Scale.X;
                Vector2 position          = new Vector2(0, topRectangle.Height) + gainedScore.Tile.Position + (new Vector2(gainedScore.Tile.Size) * 0.5f) - (new Vector2(gainedScoreWidth, gainedScoreHeight) * 0.5f);
                DrawGainedScore(spriteBatch, gainedScore.Score, Game1.Scale, position, 0);
            }
        }