-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sprite.h
47 lines (38 loc) · 1.17 KB
/
Sprite.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
/** @file Sprite.h */
#ifndef KQ_SPRITE_H
#define KQ_SPRITE_H
#include "Common.h"
#include "Drawable.h"
#include <map>
/**
* @brief Represents an animated sprite.
*
* A sprite is represented as a set of animations
* (i.e. an instance of SpriteAnimationSet),
* a current animation,
* a current direction and a current frame.
* Several sprites can have the same animation set (i.e. they share
* the same SpriteAnimationSet object).
*
* A sprite can be drawn directly on a surface, or it can
* be attached to a map entity.
*/
class Sprite: public Drawable
{
public:
static void initialize();
static void quit();
Sprite(const std::string& id);
~Sprite();
//update and draw
void update();
void raw_draw(Surface& dst_surfaace, const Rectangle& dst_position);
private:
LuaContext* lua_context; /**< The Solarus Lua API (NULL means no callbacks for this sprite).
* TODO move this to ExportableToLua */
// animation set
static std::map<std::string, SpriteAnimationSet*> all_animation_sets;
const std::string animation_set_id; /**< id of this sprite's animation set */
SpriteAnimationSet& animation_set; /**< animation set of this sprite */
};
#endif