blob: e84219227cf6b7582316f409df28d314ba6c0d1d (
plain) (
blame)
| 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
 | #ifndef SPRITE_H_70503825
#define SPRITE_H_70503825
#include <map>
#include <string_view>
#include <vector>
#include "direction.h"
#include "renderer.h"
#include "vector.h"
struct SpriteFrame {
  SDL_Rect srcRect;
  vec2i center;
  vec2i size;
};
class Sprite {
public:
  // Transform
  vec2i loc { 0, 0 };
  // Animation
  bool isAnimated = false;
  int textureId;
  Direction dir = Direction::down;
  std::string animationName;
  int animationId = 0;
  int animationFrame = 0;
  std::vector<SpriteFrame> frames;
  std::vector<std::vector<int>> animations;
  std::map<std::string, std::map<Direction, int>> nameDirToAnim;
};
#endif /* end of include guard: SPRITE_H_70503825 */
 |