using System.Collections.Generic;
using OpenTK;
using OpenTK.Graphics;
using SM.Base.Drawing;
using SM.Base.Shaders;
using SM.Base.Textures;
using SM.Base.Window;
using SM2D.Object;
using SM2D.Types;
namespace SM2D.Drawing
{
///
public class DrawObject2D : DrawingBasis
{
///
/// The texture the object should use.
///
public Texture Texture
{
get => (Texture) Material.Texture;
set => Material.Texture = value;
}
///
/// The color or tint the object should use.
///
public Color4 Color
{
get => Material.Tint;
set => Material.Tint = value;
}
///
protected override void DrawContext(ref DrawContext context)
{
base.DrawContext(ref context);
context.Shader.Draw(context);
}
///
/// Applies a polygon to the object.
///
///
///
public Polygon ApplyPolygon(ICollection vertices)
{
Polygon polygon = new Polygon(vertices);
Mesh = polygon;
return polygon;
}
///
/// Applies a polygon to the object.
///
///
///
public Polygon ApplyPolygon(ICollection vertices)
{
Polygon polygon = new Polygon(vertices);
Mesh = polygon;
return polygon;
}
///
/// Applies a polygon to the object.
///
public void ApplyPolygon(Polygon polygon)
{
Mesh = polygon;
}
///
/// This applies a circle.
///
///
///
public Polygon ApplyCircle(int segments = 32)
{
Polygon pol = Polygon.GenerateCircle(segments);
Mesh = pol;
return pol;
}
}
}