using SDL2; namespace KumiScript.Renderer { public class SDLTexture : IDisposable { internal readonly nint id; public SDLTexture(string path, SDLRenderer renderer) { nint surface = SDL_image.IMG_Load(path); if (surface == 0) throw new Exception(SDL_image.IMG_GetError()); nint texture = SDL.SDL_CreateTextureFromSurface(renderer.id, surface); if (texture == 0) throw new Exception(SDL.SDL_GetError()); SDL.SDL_FreeSurface(surface); id = texture; } public void Dispose() { SDL.SDL_DestroyTexture(id); } } }