lxgui
gui_sdl_atlas.hpp
1 #ifndef LXGUI_GUI_SDL_ATLAS_HPP
2 #define LXGUI_GUI_SDL_ATLAS_HPP
3 
4 #include "lxgui/gui_atlas.hpp"
5 #include "lxgui/gui_material.hpp"
6 #include "lxgui/impl/gui_sdl_material.hpp"
7 #include "lxgui/utils.hpp"
8 
9 #include <memory>
10 #include <variant>
11 #include <vector>
12 
13 struct SDL_Renderer;
14 struct SDL_Surface;
15 struct SDL_Texture;
16 
17 namespace lxgui::gui::sdl {
18 
19 class renderer;
20 
26 class atlas_page final : public gui::atlas_page {
27 public:
29  explicit atlas_page(renderer& rdr, material::filter filt);
30 
32  ~atlas_page() override;
33 
34 protected:
41  std::shared_ptr<gui::material>
42  add_material_(const gui::material& mat, const bounds2f& location) override;
43 
48  float get_width_() const override;
49 
54  float get_height_() const override;
55 
56 private:
57  renderer& renderer_;
58  SDL_Texture* texture_ = nullptr;
59  std::size_t size_ = 0u;
60 };
61 
68 class atlas final : public gui::atlas {
69 public:
75  explicit atlas(renderer& rdr, material::filter filt);
76 
77  atlas(const atlas& tex) = delete;
78  atlas(atlas&& tex) = delete;
79  atlas& operator=(const atlas& tex) = delete;
80  atlas& operator=(atlas&& tex) = delete;
81 
82 protected:
87  std::unique_ptr<gui::atlas_page> create_page_() override;
88 
89 private:
90  renderer& sdl_renderer_;
91 };
92 
93 } // namespace lxgui::gui::sdl
94 
95 #endif
A single texture holding multiple materials for efficient rendering.
Definition: gui_atlas.hpp:25
A class that holds multiple materials for efficient rendering.
Definition: gui_atlas.hpp:126
A class that holds rendering data.
A single texture holding multiple materials for efficient rendering This is an abstract class that mu...
~atlas_page() override
Destructor.
float get_width_() const override
Return the width of this page (in pixels).
float get_height_() const override
Return the height of this page (in pixels).
std::shared_ptr< gui::material > add_material_(const gui::material &mat, const bounds2f &location) override
Adds a new material to this page, at the provided location.
atlas_page(renderer &rdr, material::filter filt)
Constructor.
A class that holds rendering data This implementation can contain either a plain color or a real SDL_...
atlas & operator=(atlas &&tex)=delete
atlas(renderer &rdr, material::filter filt)
Constructor for textures.
std::unique_ptr< gui::atlas_page > create_page_() override
Create a new page in this atlas.
atlas(const atlas &tex)=delete
atlas(atlas &&tex)=delete
atlas & operator=(const atlas &tex)=delete
SDL implementation of rendering.