mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-24 12:06:37 +00:00
31 lines
829 B
C#
31 lines
829 B
C#
using System;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using MonoGame.Extended;
|
|
using MonoGame.Extended.BitmapFonts;
|
|
|
|
namespace Demo.Features.Screens
|
|
{
|
|
public class MenuItem
|
|
{
|
|
public MenuItem(BitmapFont font, string text)
|
|
{
|
|
Text = text;
|
|
Font = font;
|
|
Color = Color.White;
|
|
}
|
|
|
|
public BitmapFont Font { get; }
|
|
public string Text { get; set; }
|
|
public Vector2 Position { get; set; }
|
|
public Color Color { get; set; }
|
|
public RectangleF BoundingRectangle => new RectangleF(Position, Font.MeasureString(Text));
|
|
public Action Action { get; set; }
|
|
|
|
public void Draw(SpriteBatch spriteBatch)
|
|
{
|
|
spriteBatch.DrawString(Font, Text, Position, Color);
|
|
}
|
|
|
|
}
|
|
} |