1 /******************************
2 ** Tsunagari Tile Engine **
4 ** Copyright 2011 OmegaSDG **
5 ******************************/
14 #include <Gosu/Gosu.hpp>
15 #include <libxml/parser.h>
22 * Sprite is an image model for displaying 2D video game entities.
24 * Each Sprite represents one 'thing' that will be rendered to the screen.
25 * Sprite can handle animated images that cycle through their frames over time.
26 * It also has the capacity to switch between a couple different images on
29 * For example, you might have a Sprite for a player character with animated
30 * models for walking in each possible movement direction (up, down, left,
31 * right) along with static standing-still images for each direction. This
32 * would all be handled by one Sprite.
37 //! Sprite Constructor
38 Sprite(Resourcer
* rc
, const std::string descriptor
);
43 //! Sprite Initializer
49 coord_t
getCoordsByPixel();
50 coord_t
getCoordsByTile();
53 void moveByPixel(coord_t deltac
);
54 void moveByTile(coord_t deltac
);
55 void setCoordsByPixel(coord_t c
);
56 void setCoordsByTile(coord_t c
);
59 bool processDescriptor();
60 bool processPhases(xmlNode
* phases
);
61 bool processPhase(xmlNode
* phase
);
64 const Gosu::Image
* img
;
67 const std::string descriptor
;
69 //! SpriteValues XML Storage Struct
71 Main XML storage struct for Sprite.
75 coord_t tilesize
; // z-coord not used
76 std::map
<std::string
, uint32_t> phases
;