Covellite++  Version: 2.3.0 Revision: 2580 Platform: x64 Build: 15:23 16.10.2020
Кроссплатформенный фреймворк для разработки приложений на С++
Renderer.hpp
1 
2 #pragma once
3 #include <vector>
4 #include <functional>
5 #include <alicorn/std/string.forward.hpp>
6 #include <alicorn/std.memory/unique-ptr.hpp>
7 #include <Covellite/Predefined.hpp>
8 #include <Covellite/Api/Component.hpp>
9 
10 namespace covellite
11 {
12 
13 namespace api { namespace renderer { class Renderer; } }
14 
15 namespace gui
16 {
17 
42 class Renderer final :
43  public CovelliteGui::Core::RenderInterface
44 {
45  using String_t = ::alicorn::extension::std::String;
46  using Render_t = ::std::function<void(void)>;
47  using Renders_t = ::std::vector<Render_t>;
49  using RendersPtr_t = ::std::shared_ptr<Component_t::Renders>;
50  using ComponentPtr_t = ::std::shared_ptr<Component_t>;
51  using Object_t = ::std::vector<ComponentPtr_t>;
52 
53 public:
54  // Интерфейс CovelliteGui::Core::RenderererInterface
55  void RenderGeometry(CovelliteGui::Core::Vertex *, int, int *, int,
56  CovelliteGui::Core::TextureHandle, const CovelliteGui::Core::Vector2f &) override;
57  CovelliteGui::Core::CompiledGeometryHandle CompileGeometry(CovelliteGui::Core::Vertex *,
58  int, int *, int, CovelliteGui::Core::TextureHandle) override;
59  void RenderCompiledGeometry(CovelliteGui::Core::CompiledGeometryHandle,
60  const CovelliteGui::Core::Vector2f &) override;
61  void ReleaseCompiledGeometry(CovelliteGui::Core::CompiledGeometryHandle) override;
62  void EnableScissorRegion(bool) override;
63  void SetScissorRegion(int, int, int, int) override;
64  bool LoadTexture(CovelliteGui::Core::TextureHandle &, CovelliteGui::Core::Vector2i &,
65  const CovelliteGui::Core::String &) override;
66  bool GenerateTexture(CovelliteGui::Core::TextureHandle &,
67  const CovelliteGui::Core::byte *, const CovelliteGui::Core::Vector2i &) override;
68  void ReleaseTexture(CovelliteGui::Core::TextureHandle) override;
69 
70 public:
71  void RenderScene(void);
72 
73 private:
74  const RendersPtr_t m_pRenders;
75 
76 private:
77  const Renders_t m_DefaultRenders;
78  ComponentPtr_t m_pScissorRect;
79 
80  class Object
81  {
82  public:
83  ComponentPtr_t pPosition;
84  Renders_t Renders;
85  };
86 
87  ::std::map<size_t, Object> m_Objects;
88 
89  Renders_t m_RenderQueue;
90 
91 public:
92  explicit Renderer(const RendersPtr_t &);
93 
94 private:
95  friend ::covellite::api::renderer::Renderer;
96 };
97 
98 } // namespace gui
99 
100 } // namespace covellite
covellite::api::Component::Make
static ComponentPtr_t Make(const SourceParams_t &)
Функция создания объектов компонентов.
Definition: Component.inl:29
covellite::api::Component
Класс входит в проект Covellite.Api Класс компонента.
Definition: Component.hpp:35
covellite::gui::Renderer::LoadTexture
bool LoadTexture(CovelliteGui::Core::TextureHandle &, CovelliteGui::Core::Vector2i &, const CovelliteGui::Core::String &) override
Definition: Renderer.cpp:254
covellite::gui::Renderer
Класс входит в проект Covellite.Gui Класс обобщенной логики рендеринга GUI.
Definition: Renderer.hpp:44