18.09.2020

+ Textures
~ Changed 2D coordnate system to lower right as XY+
This commit is contained in:
Michel Fedde 2020-09-19 15:04:04 +02:00
parent 589d131246
commit a603ecc417
26 changed files with 267 additions and 16 deletions

View file

@ -0,0 +1,43 @@
using System.Drawing;
using OpenTK.Graphics;
using SM.Base.Contexts;
using SM.Base.Scene;
using SM.Base.Textures;
using SM2D.Types;
namespace SM2D.Drawing
{
public class DrawTexture : DrawingBasis<Transformation>
{
public Texture Texture
{
get => (Texture) _material.Texture;
set => _material.Texture = value;
}
public Color4 Tint
{
get => _material.Tint;
set => _material.Tint = value;
}
public DrawTexture(Bitmap map) : this(map, Color4.White)
{ }
public DrawTexture(Bitmap map, Color4 tint)
{
_material.Texture = new Texture(map);
_material.Tint = tint;
}
public override void Draw(DrawContext context)
{
base.Draw(context);
ApplyContext(ref context);
context.ModelMatrix = Transform.GetMatrix();
_material.Shader.Draw(context);
}
}
}