VEGO-Engine  0.1
Loading...
Searching...
No Matches
SpriteComponent.h
1#pragma once
2
3#include <map>
4#include <SDL_render.h>
5#include <memory>
6
7#include "AnimationHandler.h"
8#include "Component.h"
9#include "Direction.h"
10
12
14{
15public:
16 int animationIndex = 0;
17
18 std::map<AnimationType, std::unique_ptr<Animation>> animations;
19
20private:
21 TransformComponent* transform;
22 SDL_Texture* texture;
23 SDL_Rect srcRect, destRect;
24
25 bool animated = false;
26 uint8_t frames = 0;
27 uint8_t speed = 100;
28 bool flipped = false;
29
30public:
31 SpriteComponent() = default;
32 SpriteComponent(const char* path);
33 SpriteComponent(const char* path, bool isAnimated);
35
36 void setTexture(const char* path);
37
38 void init() override;
39 void update() override;
40 void draw() override;
41 void playAnimation(AnimationType type);
42 void setDirection(Direction direction);
43};
Definition Component.h:6
Definition SpriteComponent.h:14
Definition TransformComponent.h:8