forked from SFML/SFML
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathTextureAtlas.hpp
More file actions
86 lines (70 loc) · 2.58 KB
/
TextureAtlas.hpp
File metadata and controls
86 lines (70 loc) · 2.58 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
82
83
84
85
86
#pragma once
// LICENSE AND COPYRIGHT (C) INFORMATION
// https://github.com/vittorioromeo/VRSFML/blob/master/license.md
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include "SFML/Graphics/Export.hpp"
#include "SFML/Graphics/Texture.hpp"
#include "SFML/System/Rect2.hpp"
#include "SFML/System/RectPacker.hpp"
#include "SFML/System/Vec2.hpp"
#include "SFML/Base/IntTypes.hpp"
#include "SFML/Base/Optional.hpp"
////////////////////////////////////////////////////////////
// Forward declarations
////////////////////////////////////////////////////////////
namespace sf
{
class Image;
} // namespace sf
namespace sf
{
////////////////////////////////////////////////////////////
/// \brief TODO P1: docs
///
////////////////////////////////////////////////////////////
class [[nodiscard]] SFML_GRAPHICS_API TextureAtlas
{
public:
////////////////////////////////////////////////////////////
/// \brief TODO P1: docs
///
////////////////////////////////////////////////////////////
[[nodiscard]] explicit TextureAtlas(Texture&& atlasTexture);
////////////////////////////////////////////////////////////
/// \brief TODO P1: docs
///
////////////////////////////////////////////////////////////
[[nodiscard]] base::Optional<Rect2f> add(const base::U8* pixels, Vec2u size, Vec2u padding = {});
[[nodiscard]] base::Optional<Rect2f> add(const Image& image, Vec2u padding = {});
[[nodiscard]] base::Optional<Rect2f> add(const Texture& texture, Vec2u padding = {});
////////////////////////////////////////////////////////////
/// \brief TODO P1: docs
///
////////////////////////////////////////////////////////////
[[nodiscard]] Texture& getTexture();
[[nodiscard]] const Texture& getTexture() const;
////////////////////////////////////////////////////////////
/// \brief TODO P1: docs
///
////////////////////////////////////////////////////////////
[[nodiscard]] RectPacker& getRectPacker();
[[nodiscard]] const RectPacker& getRectPacker() const;
private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Texture m_atlasTexture;
RectPacker m_rectPacker;
};
} // namespace sf
////////////////////////////////////////////////////////////
/// \class sf::TextureAtlas
/// \ingroup graphics
///
/// TODO P1: docs
///
/// \see sf::Texture, sf::Image, sf::RenderTexture
///
////////////////////////////////////////////////////////////