29 #ifndef NOMLIB_SDL2_HELPERS_HPP
30 #define NOMLIB_SDL2_HELPERS_HPP
37 #include "nomlib/config.hpp"
38 #include "nomlib/math/Color.hpp"
39 #include "nomlib/math/Coords.hpp"
40 #include "nomlib/math/Rect-inl.hpp"
41 #include "nomlib/math/Point2-inl.hpp"
48 typedef std::unique_ptr<SDL_Window, void (*)(SDL_Window*)> UniquePtr;
49 typedef SDL_Window* RawPtr;
53 namespace SDL_RENDERER
55 typedef std::unique_ptr<SDL_Renderer, void(*)(SDL_Renderer*)> UniquePtr;
56 typedef SDL_Renderer* RawPtr;
60 namespace SDL_PIXELFORMAT
62 typedef SDL_PixelFormat* RawPtr;
68 typedef std::unique_ptr<SDL_Surface, void(*) (SDL_Surface*)> UniquePtr;
69 typedef std::shared_ptr<SDL_Surface> SharedPtr;
70 typedef SDL_Surface* RawPtr;
76 typedef std::shared_ptr<SDL_Texture> SharedPtr;
77 typedef SDL_Texture* RawPtr;
83 SDL_bool SDL_BOOL (
bool value );
88 SDL_Rect SDL_RECT (
const Coords& coords );
96 SDL_Rect SDL_RECT (
const Rect<T>& )
107 template <
typename T>
108 SDL_Point SDL_POINT (
const Point2<T>& )
117 SDL_Color SDL_COLOR (
const Color& color );
122 const Color pixel ( uint32 pixel,
const SDL_PixelFormat* fmt );
127 const Color alpha_pixel ( uint32 pixel,
const SDL_PixelFormat* fmt );
135 uint32 RGB (
const Color& color,
const SDL_PixelFormat* fmt );
143 uint32 RGB (
const Color& color, uint32 fmt );
151 uint32 RGBA (
const Color& color,
const SDL_PixelFormat* fmt );
159 uint32 RGBA (
const Color& color, uint32 fmt );
164 uint32 ticks (
void );
173 const std::string hint (
const std::string& name );
184 bool set_hint (
const std::string& name,
const std::string& value );
189 void FreeWindow ( SDL_Window* );
192 void FreeRenderTarget ( SDL_Renderer* );
195 void FreeTexture ( SDL_Texture* );
198 void FreeSurface ( SDL_Surface* );
201 void TTF_FreeFont ( TTF_Font* );
204 void Free_Joystick ( SDL_Joystick* );
209 #endif // include guard defined
Rectangle class container (template version)
Coordinate values (x, y, z, width, height ) wrapper.