コード例 #1
0
ファイル: GameOver.cs プロジェクト: WishnusArmy/Game
    public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(Sprites.SPR_GAMEOVERBACKGROUND, new Vector2(0, 0), Color.White);
        MainMenu.AddNoise(spriteBatch, 5);

        base.Draw(gameTime, spriteBatch);

        //All gamestats can be written here
        spriteBatch.DrawString(FNT_GAMEOVER, "KILLED ENEMIES: " + GameStats.TotalEnemiesKilled.ToString(), new Vector2((SCREEN_SIZE.X - FNT_GAMEOVER.MeasureString("KILLED ENEMIES: " + GameStats.TotalEnemiesKilled.ToString()).X) / 2, SCREEN_SIZE.Y - 700), Color.Black);
        spriteBatch.DrawString(FNT_GAMEOVER, "WAVES CONQUERED: " + (GameStats.Wave - 1).ToString(), new Vector2((SCREEN_SIZE.X - FNT_GAMEOVER.MeasureString("WAVES CONQUERED: " + GameStats.Wave.ToString()).X) / 2, SCREEN_SIZE.Y - 600), Color.Black);
        spriteBatch.DrawString(FNT_GAMEOVER, "RESOURCES GATHERED: " + GameStats.totalResourcesGathered.ToString(), new Vector2((SCREEN_SIZE.X - FNT_GAMEOVER.MeasureString("RESOURCES GATHERED: " + GameStats.EcResources.ToString()).X) / 2, SCREEN_SIZE.Y - 500), Color.Black);
        spriteBatch.DrawString(FNT_GAMEOVER, "SCORE: " + GameStats.FinalScore, new Vector2((SCREEN_SIZE.X - FNT_GAMEOVER.MeasureString("SCORE: " + GameStats.FinalScore).X) / 2, SCREEN_SIZE.Y - 400), Color.Black);

        handler.Draw(gameTime, spriteBatch);
    }
コード例 #2
0
ファイル: PopupScreen.cs プロジェクト: WishnusArmy/Game
    public static void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        //Plain popup background
        //DrawRectangleFilled(new Rectangle(position.X - (size.X/2)*center.ToInt(), position.Y - (size.Y/2)*center.ToInt(), size.X, size.Y), spriteBatch, backgroundColor);

        DrawRectangleFilled(new Rectangle(position.X - (size.X / 2) * center.ToInt() - edgeSize, position.Y - (size.Y / 2) * center.ToInt() - edgeSize, size.X + 2 * edgeSize, size.Y + 2 * edgeSize), spriteBatch, edgeColor);
        spriteBatch.Draw(SPR_POPUP, new Vector2(position.X - (size.X / 2) * center.ToInt(), position.Y - (size.Y / 2) * center.ToInt()), Color.White);

        int     buttonHeight = (int)buttonFont.MeasureString("#").Y + 2 * BUTTON_MARGIN.Y + 20;
        Vector2 offset       = new Vector2(20, -200);

        spriteBatch.DrawString(FNT_GAMEOVER, "GAME PAUSED", position.toVector() - new Vector2(FNT_GAMEOVER.MeasureString("GAME PAUSED").X / 2, size.Y * 0.38f), Color.Black);
        for (int i = 0; i < buttons.Count; ++i)
        {
            buttons[i].Position = position.toVector() + new Vector2(0, -size.Y / 2 + size.Y * 0.38f) + new Vector2(0, buttonHeight * i);
            buttons[i].Draw(gameTime, spriteBatch);
        }
    }