graphics/06-monogame/GUI/UI/Drawable.cs

49 lines
1.1 KiB
C#
Raw Normal View History

using System;
using System.Data;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace GUI.UIElements;
public class DrawableData
{
public Texture2D texture;
public Vector2 position = Vector2.Zero;
2023-12-15 20:43:42 +00:00
private Vector2 scale_multiplier = Vector2.One;
public Vector2 scale
{
get { return scale_multiplier * new Vector2(texture.Width, texture.Height); }
set
{
scale_multiplier = value;
}
}
public float rotation = 0.0f;
2023-12-15 20:43:42 +00:00
public DrawableData(string? texture)
{
if (texture is not null)
{
2023-12-15 20:43:42 +00:00
this.texture = Scene.content.Load<Texture2D>(texture);
return;
}
this.texture = Scene.content.Load<Texture2D>("button-default-texture");
}
}
public enum DrawableType
{
Container,
Text,
Button,
}
public abstract class Drawable
{
public DrawableType drawableType;
public abstract void Initialize();
public abstract void Update(GameTime gameTime);
public abstract void Draw(GameTime gameTime);
}