25 lines
565 B
C#
25 lines
565 B
C#
|
using SDL2;
|
||
|
|
||
|
namespace KumiScript.Renderer
|
||
|
{
|
||
|
public class SDLRenderer
|
||
|
{
|
||
|
internal readonly nint id;
|
||
|
internal SDLRenderer(SDLWindow window)
|
||
|
{
|
||
|
id = SDL.SDL_CreateRenderer(window.Id, -1, SDL.SDL_RendererFlags.SDL_RENDERER_ACCELERATED);
|
||
|
if (id == 0)
|
||
|
throw new Exception("Failed to create renderer!");
|
||
|
}
|
||
|
|
||
|
public void Clear()
|
||
|
{
|
||
|
SDL.SDL_RenderClear(id);
|
||
|
}
|
||
|
|
||
|
public void SwapBuffers()
|
||
|
{
|
||
|
SDL.SDL_RenderPresent(id);
|
||
|
}
|
||
|
}
|
||
|
}
|