コード例 #1
0
 public void LoadContent(GameLoop gameLoop)
 {
     scoreFont           = new Font(SCORE_FONT_PATH);
     scoreText           = new Text(score.ToString(), scoreFont, 80);
     scoreText.Origin    = new Vector2f(scoreText.CharacterSize / 2, scoreText.CharacterSize / 2 + 7);
     scoreText.Position  = new Vector2f(gameLoop.window.Size.X / 2, gameLoop.window.Size.Y / 2);
     scoreText.FillColor = Color.White;
 }
コード例 #2
0
        public static void DrawPerformaceData(GameLoop gameLoop, Color fontColor, float delay, int velocity)
        {
            if (consoleFont == null)
            {
                return;
            }

            string totalTimeElapsed = gameLoop.gameTime.totalTimeElapsed.ToString("0.000");
            string deltaTime        = gameLoop.gameTime.deltaTime.ToString("0.00000");
            float  fps    = 1f / gameLoop.gameTime.deltaTime;
            string fprStr = fps.ToString("0.00");

            Text text1 = new Text(totalTimeElapsed, consoleFont, 14);

            text1.Position  = new Vector2f(4f, 8f);
            text1.FillColor = fontColor;

            Text text2 = new Text(deltaTime, consoleFont, 14);

            text2.Position  = new Vector2f(4f, 28f);
            text2.FillColor = fontColor;

            Text text3 = new Text(fprStr, consoleFont, 14);

            text3.Position  = new Vector2f(4f, 48f);
            text3.FillColor = fontColor;

            Text text4 = new Text(delay.ToString(), consoleFont, 14);

            text4.Position  = new Vector2f(4f, 68f);
            text4.FillColor = fontColor;

            Text text5 = new Text(velocity.ToString(), consoleFont, 14);

            text5.Position  = new Vector2f(4f, 88f);
            text5.FillColor = fontColor;

            gameLoop.window.Draw(text1);
            gameLoop.window.Draw(text2);
            gameLoop.window.Draw(text3);
            gameLoop.window.Draw(text4);
            gameLoop.window.Draw(text5);
        }
コード例 #3
0
        public void DrawScore(GameLoop gameLoop)
        {
            if (scoreFont == null)
            {
                return;
            }

            scoreText.DisplayedString = score.ToString();

            if (score >= 10)
            {
                scoreText.CharacterSize = 50;
                scoreText.Origin        = new Vector2f(scoreText.CharacterSize / 2 + 25, scoreText.CharacterSize / 2 + 7);
            }
            else
            {
                scoreText.CharacterSize = 80;
                scoreText.Origin        = new Vector2f(scoreText.CharacterSize / 2, scoreText.CharacterSize / 2 + 7);
            }

            gameLoop.window.Draw(scoreText);
        }