2023-12-06 21:15:20 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-06 21:15:20 +00:00
|
|
|
public float rotation = 0.0f;
|
|
|
|
|
2023-12-15 20:43:42 +00:00
|
|
|
public DrawableData(string? texture)
|
2023-12-06 21:15:20 +00:00
|
|
|
{
|
|
|
|
if (texture is not null)
|
|
|
|
{
|
2023-12-15 20:43:42 +00:00
|
|
|
this.texture = Scene.content.Load<Texture2D>(texture);
|
2023-12-06 21:15:20 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.texture = Scene.content.Load<Texture2D>("button-default-texture");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public enum DrawableType
|
|
|
|
{
|
|
|
|
Container,
|
|
|
|
Text,
|
|
|
|
Button,
|
|
|
|
}
|
|
|
|
|
|
|
|
public abstract class Drawable
|
|
|
|
{
|
|
|
|
public DrawableType drawableType;
|
2023-12-06 22:38:38 +00:00
|
|
|
public abstract void Initialize();
|
2023-12-06 21:15:20 +00:00
|
|
|
public abstract void Update(GameTime gameTime);
|
|
|
|
public abstract void Draw(GameTime gameTime);
|
|
|
|
}
|