diff options
author | P. J. McDermott <pjm@nac.net> | 2013-02-14 18:03:09 (EST) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-02-14 18:03:09 (EST) |
commit | 80191b41352ad20493fb62e8f3683d69133d0d24 (patch) | |
tree | cb77e93dfe476d9535ca48e732a98aae9a780ba4 /src/image.c | |
download | overworld-rpg-80191b41352ad20493fb62e8f3683d69133d0d24.zip overworld-rpg-80191b41352ad20493fb62e8f3683d69133d0d24.tar.gz overworld-rpg-80191b41352ad20493fb62e8f3683d69133d0d24.tar.bz2 |
Initial commit.
Diffstat (limited to 'src/image.c')
-rw-r--r-- | src/image.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/image.c b/src/image.c new file mode 100644 index 0000000..557e1de --- /dev/null +++ b/src/image.c @@ -0,0 +1,22 @@ +#include <SDL.h> +#include <SDL_image.h> +#include "logging.h" +#include "image.h" + +SDL_Surface * +load_png(const char *path) +{ + SDL_RWops *rwops; + SDL_Surface *img; + + debug("Loading PNG image \"%s\"...", path); + + rwops = SDL_RWFromFile(path, "rb"); + img = IMG_LoadPNG_RW(rwops); + if (!img) { + err(1, "Failed to load image \"%s\" (%s)", + path, IMG_GetError()); + } + + return img; +} |