-
Notifications
You must be signed in to change notification settings - Fork 0
/
CFrame.h
35 lines (34 loc) · 987 Bytes
/
CFrame.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef CFRAME_INCLUDED
#define CFRAME_INCLUDED
/// Cframe Class Declaration
class CFrame{
public:
//Main Variables
SDL_Surface *img;
//Main Functions
void load (char *);
void load (char *,int,int,int);
void unload () {SDL_FreeSurface(img);}
};
/// Cframe Class Implementation
void CFrame::load (char *path){
img = IMG_Load(path);
if ( img == NULL )
{
printf("No pude cargar gráfico: %s\n", SDL_GetError());
exit(12);
}
SDL_SetColorKey(img,SDL_SRCCOLORKEY|SDL_RLEACCEL, SDL_MapRGB(img->format,255,0,255));
img = SDL_DisplayFormat(img);
}
void CFrame::load (char *path, int r, int g, int b){
img = IMG_Load(path);
if ( img == NULL )
{
printf("No pude cargar gráfico: %s\n", SDL_GetError());
exit(11);
}
SDL_SetColorKey(img,SDL_SRCCOLORKEY|SDL_RLEACCEL, SDL_MapRGB(img->format,r,g,b));
img = SDL_DisplayFormat(img);
}
#endif // CFRAME_HPP_INCLUDED