General progress on getting OpenGL based rendering.
This commit is contained in:
25
src/SlatedGameToolkit.Framework/Graphics/Render/Renderer.cs
Normal file
25
src/SlatedGameToolkit.Framework/Graphics/Render/Renderer.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Drawing;
|
||||
using SlatedGameToolkit.Framework.Graphics.Textures;
|
||||
|
||||
namespace SlatedGameToolkit.Framework.Graphics.Render
|
||||
{
|
||||
public class Renderer
|
||||
{
|
||||
private Batch batch;
|
||||
private Texture currentTexture;
|
||||
|
||||
public void Queue(IRenderable renderable, Color color) {
|
||||
if (renderable.Texture != currentTexture) {
|
||||
if (batch.Batching) batch.End();
|
||||
currentTexture = renderable.Texture;
|
||||
currentTexture.Use();
|
||||
batch.Begin(currentTexture);
|
||||
}
|
||||
batch.Draw(renderable, color);
|
||||
}
|
||||
|
||||
public void Render() {
|
||||
if (batch.Batching) batch.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user