Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SDL_Texture * newTexture = NULL;
- SDL_Surface * loadedSurface = IMG_Load(file.c_str());
- if (!loadedSurface)
- printf("Unable to load image %s! SDL_image Error: %s\n", file.c_str(), IMG_GetError());
- else
- {
- newTexture = SDL_CreateTextureFromSurface(SDLDevice::Instance()->GetRenderer(), loadedSurface);
- if (!newTexture)
- printf("Unable to create texture from %s! SDL Error: %s\n", file.c_str(), SDL_GetError());
- else
- {
- _width = loadedSurface->w;
- _height = loadedSurface->h;
- }
- SDL_FreeSurface(loadedSurface);
- }
- _texture = newTexture;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement