-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImage.h
49 lines (41 loc) · 1000 Bytes
/
Image.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/****************************************************************************
Yihsiang Liow
Copyright
****************************************************************************/
#ifndef IMAGE_H
#define IMAGE_H
#include "SDL.h"
#include "SDL_image.h"
//#include "SingletonSurface.h"
#include "Rect.h"
class Image
{
public:
Image(const char * filename)
: image(IMG_Load(filename))
{
if (image == NULL)
{
printf("Error in Image::Image(): No image file %s\n", filename);
exit(1);
}
rect = image->clip_rect;
//surface = SingletonSurface::getInstance();
}
Image(SDL_Surface * s) // Used by text surfaces
: image(s)
{}
~Image()
{
SDL_FreeSurface(image);
}
Rect getRect()
{
return Rect(image->clip_rect);
}
//private:
//Surface * surface;
SDL_Surface * image;
SDL_Rect rect;
};
#endif