SDL_Texture_Ptr CreateTextureFromSurface( const SDL_Renderer_Ptr &renderer, const SDL_Surface_Ptr &surface ) { if( !renderer ) { dbg( D_ERROR ) << "Tried to create texture with a null renderer"; return SDL_Texture_Ptr(); } if( !surface ) { dbg( D_ERROR ) << "Tried to create texture from a null surface"; return SDL_Texture_Ptr(); } SDL_Texture_Ptr result( SDL_CreateTextureFromSurface( renderer.get(), surface.get() ) ); printErrorIf( !result, "SDL_CreateTextureFromSurface failed" ); return result; }
SDL_Texture_Ptr Memory::wrap(SDL_Texture* texture) { return SDL_Texture_Ptr(texture, SDL_DestroyTexture); }