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
5
#include "
botcraft/Renderer/Enums.hpp
"
6
7
namespace
Botcraft
8
{
9
namespace
Renderer
10
{
11
struct
TextureData
12
{
13
/// @brief <Width, Height>
14
std::pair<int, int>
size
;
15
/// @brief <Col, Row>
16
std::pair<int, int>
position
;
17
Transparency
transparency
;
18
Animation
animation
;
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
Enums.hpp
Botcraft::Renderer::Atlas
Definition
Atlas.hpp:22
Botcraft::Renderer::Atlas::Get
const unsigned char * Get(const int row=0, const int col=0, const int depth=0) const
Definition
Atlas.cpp:248
Botcraft::Renderer::Atlas::~Atlas
~Atlas()
Definition
Atlas.cpp:42
Botcraft::Renderer::Atlas::data
std::vector< unsigned char > data
Definition
Atlas.hpp:44
Botcraft::Renderer::Atlas::Atlas
Atlas()
Definition
Atlas.cpp:36
Botcraft::Renderer::Atlas::GetHeight
int GetHeight() const
Definition
Atlas.cpp:232
Botcraft::Renderer::Atlas::height
int height
Definition
Atlas.hpp:47
Botcraft::Renderer::Atlas::Reset
void Reset(const int height_, const int width_)
Definition
Atlas.cpp:47
Botcraft::Renderer::Atlas::textures_map
std::unordered_map< std::string, TextureData > textures_map
Definition
Atlas.hpp:45
Botcraft::Renderer::Atlas::width
int width
Definition
Atlas.hpp:48
Botcraft::Renderer::Atlas::LoadData
void LoadData(const std::vector< std::pair< std::string, std::string > > &textures_path)
Definition
Atlas.cpp:71
Botcraft::Renderer::Atlas::GetData
const TextureData & GetData(const std::string &name) const
Definition
Atlas.cpp:237
Botcraft::Renderer::Atlas::GetWidth
int GetWidth() const
Definition
Atlas.cpp:227
Botcraft::Renderer::Animation
Animation
Animation status of a texture.
Definition
Enums.hpp:17
Botcraft::Renderer::Transparency
Transparency
Transparency values for textures.
Definition
Enums.hpp:9
Botcraft
Definition
BaseNode.hpp:6
Botcraft::Renderer::TextureData
Definition
Atlas.hpp:12
Botcraft::Renderer::TextureData::position
std::pair< int, int > position
<Col, Row>
Definition
Atlas.hpp:16
Botcraft::Renderer::TextureData::animation
Animation animation
Definition
Atlas.hpp:18
Botcraft::Renderer::TextureData::transparency
Transparency transparency
Definition
Atlas.hpp:17
Botcraft::Renderer::TextureData::size
std::pair< int, int > size
<Width, Height>
Definition
Atlas.hpp:14
botcraft
private_include
botcraft
Renderer
Atlas.hpp
Generated by
1.9.8