Last active
August 29, 2015 14:02
-
-
Save lheckemann/f26acef9789934135641 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <SDL.h> | |
#include <SDL_image.h> | |
SDL_Texture * load_image(SDL_Renderer* renderer, std::string path) { | |
SDL_Texture * result; | |
SDL_Surface * surf = IMG_Load(path.c_str()); | |
if (!surf) { | |
return NULL; | |
} | |
result = SDL_CreateTextureFromImage(renderer, surf); | |
SDL_FreeSurface(surf); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment