-
Notifications
You must be signed in to change notification settings - Fork 2
/
CImage.h
51 lines (36 loc) · 876 Bytes
/
CImage.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
50
51
/*
* This file is distributed under the MIT License.
* See LICENSE file for details.
*/
#pragma once
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#include <SDL2/SDL.h>
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
#define RMASK32 0xff000000
#define GMASK32 0x00ff0000
#define BMASK32 0x0000ff00
#define AMASK32 0x000000ff
#else
#define RMASK32 0x000000ff
#define GMASK32 0x0000ff00
#define BMASK32 0x00ff0000
#define AMASK32 0xff000000
#endif
class CImage{
protected:
SDL_Texture *texture;
void destroy();
int mWidth,mHeight;
static SDL_Texture * SurfaceToTexture(SDL_Surface *srf);
static SDL_Surface * createSurface(int width, int height);
public:
CImage();
bool load(const char *file);
SDL_Texture *getTexture();
int getWidth();
int getHeight();
~CImage();
};