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
52
53
54
55
56
57
58
59
60
61
62
/*
*
* sprite.h
*
* 19th March 2009: Created sprite.h from parts of level.h
* 26th July 2009: Created anim.h from parts of sprite.h
*
* Part of the OpenJazz project
*
*
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
* the GNU General Public License, version 2.0
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef _SPRITE_H
#define _SPRITE_H
#include <SDL/SDL.h>
// Constant
#define SKEY 254 /* Sprite colour key */
// Class
class Sprite {
private:
SDL_Surface* pixels;
public:
unsigned char xOffset;
unsigned char yOffset;
Sprite ();
~Sprite ();
void clearPixels ();
void setPixels (unsigned char* data, int width, int height);
int getWidth ();
int getHeight ();
void draw (int x, int y);
void setPalette (SDL_Color* palette, int start, int amount);
void flashPalette (int index);
void restorePalette ();
};
#endif