summaryrefslogtreecommitdiff
path: root/texturesdl.cpp
blob: 716ea0369b6b906842ea43900d3edd451526c7f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <stdexcept>
#include <SDL_image/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);
}