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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
*
* @file anim.h
*
* Part of the OpenJazz project
*
* @section History
* 26th July 2009: Created anim.h from parts of sprite.h
*
* @section Licence
* 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 _ANIM_H
#define _ANIM_H
#include "OpenJazz.h"
#include <SDL/SDL.h>
// Classes
class Sprite;
/// Animation
class Anim {
private:
Sprite** sprites; ///< Sprite images
signed char* xOffsets; ///< Horizontal offsets for each frame
signed char* yOffsets; ///< Vertical offsets for each frame
bool ignoreDefaultYOffset;
signed char shootX; ///< Bullet generation x-coordinate
signed char shootY; ///< Bullet generation y-coordinate
signed char accessoryX; ///< Accessory animation x-coordinate
signed char accessoryY; ///< Accessory animation y-coordinate
signed char yOffset; ///< Vertical offset
unsigned char frames; ///< Number of frames
unsigned char frame; ///< Current frame
unsigned char accessory; ///< Number of an animation that is an accessory to this animation
///< Most of the time accessories are used with guardians.
public:
Anim ();
~Anim ();
void setData (int length, signed char sX, signed char sY, signed char aX, signed char aY, unsigned char a, signed char y);
void setFrame (int nextFrame, bool looping);
void setFrameData (Sprite *frameSprite, signed char x, signed char y);
int getWidth ();
int getHeight ();
int getLength ();
fixed getShootX ();
fixed getShootY ();
fixed getAccessoryX ();
fixed getAccessoryY ();
fixed getAccessoryShootX ();
fixed getAccessoryShootY ();
fixed getOffset ();
Anim* getAccessory ();
void draw (fixed x, fixed y);
void drawScaled (fixed x, fixed y, fixed scale);
void disableDefaultOffset ();
void setPalette (SDL_Color *palette, int start, int amount);
void flashPalette (int index);
void restorePalette ();
};
#endif