Added the <source> tag to the tiles file.
[potpourri.git] / src / Sprite.h
blobcf834ca83e6d0b4bf7929b52f5ed482574fa58aa
1 // Copyright 2008 Brian Caine
3 // This file is part of Potpourri.
5 // Potpourri is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // Potpourri is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTIBILITY of FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Potpourri. If not, see <http://www.gnu.org/licenses/>.
19 // NOTES:
21 // This is the Sprite class
23 // The Sprite class represents a static image or an animation. It has a
24 // position, orientation, and a focal point.
26 #ifndef __SPRITE_H
27 #define __SPRITE_H
29 #include <vector>
31 #include "ImageLoader.h"
33 namespace fragrant
35 struct Frame
37 int frame;
38 int duration;
41 struct SpriteParams
43 std::vector<Frame> frames;
44 bool repeat;
46 std::vector<int> position; // render to this location
48 std::vector<int> focal_point;
49 // this is the point around which
50 // the sprite is rotated, measured relatively from the upper left
52 int angle; // don't fiddle with this until we've got image
53 // rotation functions going
56 class Sprite
58 public:
59 Sprite();
60 Sprite(std::vector<SDL_Surface*> dframes, SpriteParams dparams);
62 void draw(SDL_Surface* dest);
66 private:
67 std::vector<SDL_Surface*> frames;
68 SpriteParams sequence;
72 #endif