29 #include "nomlib/SDL_helpers.hpp"
33 SDL_bool SDL_BOOL (
bool value )
45 SDL_Rect SDL_RECT (
const Coords& coords )
57 SDL_Color SDL_COLOR (
const Color& color )
69 const Color pixel ( uint32 pixel,
const SDL_PixelFormat* fmt )
73 SDL_GetRGB ( pixel, fmt, &c.red, &c.green, &c.blue );
78 const Color alpha_pixel ( uint32 pixel,
const SDL_PixelFormat* fmt )
82 SDL_GetRGBA ( pixel, fmt, &c.red, &c.green, &c.blue, &c.alpha );
87 uint32 RGB (
const Color& color,
const SDL_PixelFormat* fmt )
89 return SDL_MapRGB ( fmt, color.red, color.green, color.blue );
92 uint32 RGB (
const Color& color, uint32 fmt )
94 return SDL_MapRGB ( SDL_AllocFormat(fmt), color.red, color.green, color.blue );
97 uint32 RGBA (
const Color& color,
const SDL_PixelFormat* fmt )
99 return SDL_MapRGBA ( fmt, color.red, color.green, color.blue, color.alpha );
102 uint32 RGBA (
const Color& color, uint32 fmt )
104 return SDL_MapRGBA ( SDL_AllocFormat(fmt), color.red, color.green, color.blue, color.alpha );
107 uint32 ticks (
void )
109 return SDL_GetTicks();
112 const std::string hint (
const std::string& name )
116 result = SDL_GetHint ( name.c_str() );
120 bool set_hint (
const std::string& name,
const std::string& value )
122 if ( SDL_SetHint ( name.c_str(), value.c_str() ) ==
false )
return false;
129 void FreeWindow ( SDL_Window* handle )
131 SDL_DestroyWindow ( handle );
134 void FreeRenderTarget ( SDL_Renderer* handle )
136 SDL_DestroyRenderer ( handle );
139 void FreeTexture ( SDL_Texture* video_buffer )
141 SDL_DestroyTexture ( video_buffer );
144 void FreeSurface ( SDL_Surface* video_buffer )
146 SDL_FreeSurface ( video_buffer );
149 void TTF_FreeFont ( TTF_Font* font )
151 TTF_CloseFont ( font );
154 void Free_Joystick ( SDL_Joystick* joy )
156 if ( joy !=
nullptr )
158 if ( SDL_JoystickGetAttached ( joy ) )
160 SDL_JoystickClose ( joy );