Init.
This commit is contained in:
25
Source/Entities/Sprite2d.cs
Executable file
25
Source/Entities/Sprite2d.cs
Executable file
@@ -0,0 +1,25 @@
|
||||
using System.Drawing;
|
||||
|
||||
using DaggerFramework.Rendering;
|
||||
|
||||
namespace DaggerFramework
|
||||
{
|
||||
public class Sprite2d : Drawable2d
|
||||
{
|
||||
public Texture2d Texture { get => _texture; set => _texture = value; }
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
var renderer = Layer.Scene.Renderer;
|
||||
_texId = renderer.LoadTexture(Texture.Path);
|
||||
}
|
||||
|
||||
public override void OnDraw(ref Renderer renderer)
|
||||
{
|
||||
renderer.DrawTexture(_texId, Color.White);
|
||||
}
|
||||
|
||||
private Texture2d _texture;
|
||||
private int _texId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user