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#include <string>
7
8#include "AnimationHandler.h"
9#include "Component.h"
10#include "Direction.h"
11#include "RenderObject.h"
12
14
16{
17public:
18 int animationIndex = 0;
19
20 std::map<std::string, std::unique_ptr<Animation>>* animations = nullptr;
21
22private:
23 TransformComponent* transform;
24 SDL_Texture* texture;
25 SDL_Rect srcRect, destRect;
26
27 const char* texturePath;
28
29 bool animated = false;
30 uint8_t frames = 0;
31 uint8_t speed = 100;
32 bool flipped = false;
33
34 int textureXOffset;
35 int textureYOffset;
36
37public:
38 SpriteComponent(const char* path, int zIndex);
39 SpriteComponent(const char* path, int xOffset, int yOffset, int zIndex);
41 const char* path,
42 bool isAnimated,
43 std::map<std::string, std::unique_ptr<Animation>>* animationList,
44 std::string defaultAnimation,
45 int zIndex);
47
48 void setTexture(const char* path);
49
50 void init() override;
51 void update() override;
52 void draw() override;
53 void playAnimation(std::string type);
54 void setDirection(Direction direction);
55};
Definition Component.h:6
Definition RenderObject.h:6
Definition SpriteComponent.h:16
Definition TransformComponent.h:8