summaryrefslogtreecommitdiff
path: root/source/ui/elements/game/tooltips/ItemDisplay.cs
blob: d3b1524a558235438df6a6210b93b4ee98aad0f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using Celesteia.Resources.Types;
using Celesteia.UI.Properties;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MonoGame.Extended.TextureAtlases;

namespace Celesteia.UI.Elements.Game.Tooltips {
    public class ItemDisplay : Element {
        public ItemType Item;
        public int Amount;
        public TextProperties Text;

        public ItemDisplay(Rect rect) => SetRect(rect);

        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(Item.Sprite, GetRectangle(), Color.White, null);
            if (Amount > 1) TextUtilities.DrawAlignedText(spriteBatch, GetRectangle(), Text);
        }
    }
}