Add function to delete current texture

This commit is contained in:
Romain Vimont
2026-02-01 15:56:18 +01:00
parent 162f192ea8
commit ec565384fa
2 changed files with 11 additions and 0 deletions

View File

@@ -225,3 +225,11 @@ sc_texture_set_from_surface(struct sc_texture *tex, SDL_Surface *surface) {
return true;
}
void
sc_texture_reset(struct sc_texture *tex) {
if (tex->texture) {
SDL_DestroyTexture(tex->texture);
tex->texture = NULL;
}
}

View File

@@ -41,4 +41,7 @@ sc_texture_set_from_frame(struct sc_texture *tex, const AVFrame *frame);
bool
sc_texture_set_from_surface(struct sc_texture *tex, SDL_Surface *surface);
void
sc_texture_reset(struct sc_texture *tex);
#endif