yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
sdl_deleter.h
Go to the documentation of this file.
1#ifndef YAZE_UTIL_SDL_DELETER_H_
2#define YAZE_UTIL_SDL_DELETER_H_
3
4#ifdef YAZE_USE_SDL3
5#include <SDL3/SDL.h>
6#else
8#endif
9
10namespace yaze {
11namespace util {
12
20 void operator()(SDL_Window* p) const {
21 if (p) SDL_DestroyWindow(p);
22 }
23 void operator()(SDL_Renderer* p) const {
24 if (p) SDL_DestroyRenderer(p);
25 }
26};
27
35 void operator()(SDL_Surface* p) const {
36 if (p) {
37#ifdef YAZE_USE_SDL3
38 SDL_DestroySurface(p);
39#else
40 SDL_FreeSurface(p);
41#endif
42 }
43 }
44};
45
52 void operator()(SDL_Texture* p) const {
53 if (p) {
54 SDL_DestroyTexture(p);
55 }
56 }
57};
58
59} // namespace util
60} // namespace yaze
61
62#endif // YAZE_UTIL_SDL_DELETER_H_
SDL2/SDL3 compatibility layer.
Deleter for SDL_Window and SDL_Renderer.
Definition sdl_deleter.h:19
void operator()(SDL_Renderer *p) const
Definition sdl_deleter.h:23
void operator()(SDL_Window *p) const
Definition sdl_deleter.h:20
Custom deleter for SDL_Surface.
Definition sdl_deleter.h:34
void operator()(SDL_Surface *p) const
Definition sdl_deleter.h:35
Custom deleter for SDL_Texture.
Definition sdl_deleter.h:51
void operator()(SDL_Texture *p) const
Definition sdl_deleter.h:52