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 pathTexture2D.h
More file actions
81 lines (65 loc) · 1.97 KB
/
Copy pathTexture2D.h
File metadata and controls
81 lines (65 loc) · 1.97 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#pragma once
#include <SDL2/SDL.h>
#include <filesystem>
#include <string>
#include "../Rendering/WindowsTypes.h"
#include "Color3.h"
#include "Rendering/Vulkan/VulkanEngine.h"
#include "Texture/Bitmap.h"
#include "UDim2.h"
#include "Vector2.h"
struct Texture2D_Vulkan;
class Texture2D
{
#if _DEBUG
const char SIGNATURE[25] = "Texture2D";
#endif
public:
Texture2D();
Texture2D(const std::string& fileName);
Texture2D(int width, int height);
Texture2D(const std::filesystem::path& path);
Texture2D(const uint8_t *fileData, size_t size);
Texture2D(SDL_Texture *texture);
Texture2D(Texture2D_Vulkan *texture);
~Texture2D();
void Draw();
void Draw(bool manualDraw);
void Draw(Rect *clipRect);
void Draw(Rect *clipRect, bool manualDraw);
void CalculateSize();
void UpdateTexture(uint8_t* buffer, int width, int height, int pitch);
float Transparency;
float Rotation;
bool FlipX = false;
bool FlipY = false;
bool AlphaBlend;
bool m_ready = false;
UDim2 Size;
UDim2 Position;
UDim2 Position2;
Color3 TintColor;
Vector2 AnchorPoint;
Vector2 AbsoluteSize;
Vector2 AbsolutePosition;
Rect GetOriginalRECT();
void SetOriginalRECT(Rect size);
// static Texture2D *FromTexture2D(Texture2D *tex);
static Texture2D *FromBMP(uint8_t *fileData, size_t size);
static Texture2D *FromBMP(std::string fileName);
static Texture2D *FromJPEG(uint8_t *fileData, size_t size);
static Texture2D *FromJPEG(std::string fileName);
static Texture2D *FromPNG(uint8_t *fileData, size_t size);
static Texture2D *FromPNG(std::string fileName);
protected:
void LoadImageResources(uint8_t *buffer, size_t size);
bool m_bDisposeTexture;
Rect m_calculatedSize;
Rect m_preAnchoredSize;
RectF m_calculatedSizeF;
RectF m_preAnchoredSizeF;
Rect m_actualSize;
SDL_Texture *m_sdl_tex;
SDL_Surface *m_sdl_surface;
Texture2D_Vulkan *m_vk_tex;
};