Botcraft 1.21.4
Loading...
Searching...
No Matches
Atlas.hpp
Go to the documentation of this file.
1#include <string>
2#include <vector>
3#include <unordered_map>
4
6
7namespace Botcraft
8{
9 namespace Renderer
10 {
12 {
13 /// @brief <Width, Height>
14 std::pair<int, int> size;
15 /// @brief <Col, Row>
16 std::pair<int, int> position;
19 };
20
21 class Atlas
22 {
23 public:
24 Atlas();
25 ~Atlas();
26
27 void Reset(const int height_, const int width_);
28
29 // Load data
30 void LoadData(const std::vector<std::pair<std::string, std::string> >& textures_path);
31
32 int GetWidth() const;
33 int GetHeight() const;
34
35 const TextureData& GetData(const std::string& name) const;
36
37 const unsigned char* Get(const int row = 0, const int col = 0, const int depth = 0) const;
38
39 private:
40 unsigned char* Get(const int row = 0, const int col = 0, const int depth = 0);
41
42 private:
43
44 std::vector<unsigned char> data;
45 std::unordered_map<std::string, TextureData> textures_map;
46
47 int height;
48 int width;
49 };
50 } // Renderer
51} // Botcraft
const unsigned char * Get(const int row=0, const int col=0, const int depth=0) const
Definition Atlas.cpp:248
std::vector< unsigned char > data
Definition Atlas.hpp:44
void Reset(const int height_, const int width_)
Definition Atlas.cpp:47
std::unordered_map< std::string, TextureData > textures_map
Definition Atlas.hpp:45
void LoadData(const std::vector< std::pair< std::string, std::string > > &textures_path)
Definition Atlas.cpp:71
const TextureData & GetData(const std::string &name) const
Definition Atlas.cpp:237
Animation
Animation status of a texture.
Definition Enums.hpp:17
Transparency
Transparency values for textures.
Definition Enums.hpp:9
std::pair< int, int > position
<Col, Row>
Definition Atlas.hpp:16
std::pair< int, int > size
<Width, Height>
Definition Atlas.hpp:14