smrendererv3/SMCode/SM2D/Drawing/DrawBackground.cs
Michel Fedde c4a0847567 20.09.2020
+ Instance Drawing
+ Text and Font

~ Made "DrawBackground" forced Background for 2D

- DrawEmpty
2020-09-20 18:29:09 +02:00

58 lines
No EOL
1.4 KiB
C#

using System.Drawing;
using OpenTK;
using OpenTK.Graphics;
using SM.Base.Contexts;
using SM.Base.Scene;
using SM.Base.StaticObjects;
using SM.Base.Textures;
using SM.OGL.Texture;
using SM2D.Types;
namespace SM2D.Drawing
{
public class DrawBackground : IBackgroundItem
{
private Material _material = new Material();
public Color4 Color
{
get => _material.Tint;
set => _material.Tint = value;
}
public TextureBase Texture
{
get => _material.Texture;
set => _material.Texture = value;
}
public DrawBackground(Color4 color)
{
Color = color;
}
public DrawBackground(Bitmap texture)
{
Texture = (Texture)texture;
}
public DrawBackground(Bitmap texture, Color4 tint)
{
Color = tint;
Texture = (Texture) texture;
}
public void Update(UpdateContext context)
{
throw new System.NotImplementedException();
}
public void Draw(DrawContext context)
{
context.Material = _material;
context.Mesh = Plate.Object;
context.Instances[0].ModelMatrix = Matrix4.CreateScale(context.WorldScale.X, context.WorldScale.Y, 1);
_material.Shader.Draw(context);
}
}
}