コード例 #1
0
ファイル: HUD.cs プロジェクト: harryovers/platformer-engine
        public void Draw()
        {
            SpriteRender.ResetView(800, 600);
            SpriteRender.DrawRect(10, 10, 0.0f, healthBarWidth, 15, Color4.DarkRed);
            SpriteRender.DrawRect(10, 10, 0.0f, (health / 100) * healthBarWidth, 15, Color4.Red);

            if (score != 0)
            {
                TextRender.Draw(350f, 10f, 0.0f, score.ToString(), Fonts.Standard, Color4.White, 2f);
            }

            TextRender.Draw(500f, 10f, 0.0f, lives + "", Fonts.Standard, Color4.Yellow, 2f);
            TextRender.Draw(550f, 10f, 0.0f, tokens + "", Fonts.Standard, Color4.Yellow, 2f);

            if ((int)(inventory & InventoryItem.Key1) > 0)
            {
                SpriteRender.Draw(170, 5, 0, 20, 20, Textures.Key);
            }
            if ((int)(inventory & InventoryItem.Key2) > 0)
            {
                SpriteRender.Draw(200, 5, 0, 20, 20, Textures.Key);
            }
            if ((int)(inventory & InventoryItem.Key3) > 0)
            {
                SpriteRender.Draw(230, 5, 0, 20, 20, Textures.Key);
            }
            if ((int)(inventory & InventoryItem.Key4) > 0)
            {
                SpriteRender.Draw(260, 5, 0, 20, 20, Textures.Key);
            }
        }