summaryrefslogtreecommitdiffstats
path: root/src/image.c
blob: 557e1deffd02a939dfdd680d0cba25fd44d4fa25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
}