Advertisement
Guest User

Untitled

a guest
Dec 31st, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1.         SDL_Texture * newTexture = NULL;
  2.         SDL_Surface * loadedSurface = IMG_Load(file.c_str());
  3.        
  4.         if (!loadedSurface)
  5.             printf("Unable to load image %s! SDL_image Error: %s\n", file.c_str(), IMG_GetError());
  6.         else
  7.         {  
  8.             newTexture = SDL_CreateTextureFromSurface(SDLDevice::Instance()->GetRenderer(), loadedSurface);
  9.             if (!newTexture)
  10.                 printf("Unable to create texture from %s! SDL Error: %s\n", file.c_str(), SDL_GetError());
  11.             else
  12.             {
  13.                 _width = loadedSurface->w;
  14.                 _height = loadedSurface->h;
  15.             }
  16.            
  17.            
  18.             SDL_FreeSurface(loadedSurface);
  19.         }
  20.  
  21.         _texture = newTexture;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement