This repository was archived by the owner on Jul 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSprite2D.h
More file actions
58 lines (45 loc) · 1.46 KB
/
Copy pathSprite2D.h
File metadata and controls
58 lines (45 loc) · 1.46 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include "Rendering/WindowsTypes.h"
#include "UDim2.h"
#include "Vector2.h"
#include <SDL2/SDL.h>
#include <filesystem>
#include <string>
#include <vector>
class Texture2D;
class Sprite2D
{
#if _DEBUG
const char SIGNATURE[25] = "Sprite2D";
#endif
public:
Sprite2D() = default;
Sprite2D(std::vector<Texture2D *> textures, double delay = 1.0);
Sprite2D(std::vector<std::string> textures, double delay = 1.0);
Sprite2D(std::vector<std::filesystem::path> textures, double delay = 1.0);
Sprite2D(std::vector<SDL_Texture *> textures, double delay = 1.0);
~Sprite2D();
bool AlphaBlend;
bool FlipX = false;
bool FlipY = false;
Vector2 AnchorPoint;
UDim2 Position;
UDim2 Position2;
UDim2 Size;
void Draw(double delta, bool manual = false);
void Draw(double delta, Rect *rect, bool manual = false);
void DrawStop(double delta, bool manual = false);
void DrawOnce(double delta, bool manual = false);
Texture2D *GetTexture();
void SetFPS(double fps);
void Reset();
void SetIndex(int index) { m_currentIndex = index; }
int GetFrameCount() const { return static_cast<int>(m_textures.size()); }
double m_spritespeed = 1.0;
private:
float m_currentTime = 0;
int m_currentIndex = 0;
bool m_drawOnce = false;
std::vector<Texture2D *> m_textures;
void DrawInternal(double delta, bool playOnce, Rect* rect, bool manual);
};