summaryrefslogtreecommitdiff
path: root/texturesdl.cpp
blob: 8e112ef06f0aa35069d310d3fa073d2eb2426834 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <stdexcept>
#include <SDL/SDL_image.h>
#include "texturesdl.h"

TextureSDL::TextureSDL(const char* filename) {
	SDL_Surface* image = IMG_Load(filename);
	
	width = image->w;
	height = image->h;
	byte_per_pixel = image->format->BytesPerPixel;
	data = (unsigned char*)image->pixels;
	
	build();
	
	SDL_FreeSurface(image);
}