MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
include
mgl
render
mgl_renderer_set.h
[詳解]
1
// SPDX-License-Identifier: Zlib
2
/* ------------------------------------------------------------------------- */
9
/* ------------------------------------------------------------------------- */
10
11
#ifndef INCGUARD_MGL_RENDERER_SET_H_1606564400
12
#define INCGUARD_MGL_RENDERER_SET_H_1606564400
13
14
#include <
mgl/initialize/mgl_initializer_delegate.h
>
15
#include <
mgl/mgl_environment.h
>
16
#include <
mgl/render/mgl_renderer_2d_delegate.h
>
17
#include <
mgl/render/mgl_texture_storage.h
>
18
#include <
mgl/stl/mgl_stl_memory.h
>
19
20
namespace
MGL::Render
21
{
23
class
RendererSet
final :
public
SharedSingleton
<RendererSet>
24
{
25
public
:
26
static
STL::unique_ptr<RendererSet>
&
GetInstanceRef
()
noexcept
;
27
28
/* ------------------------------------------------------------------------- */
32
/* ------------------------------------------------------------------------- */
33
RendererSet
() noexcept = default;
34
35
/* ------------------------------------------------------------------------- */
42
/* ------------------------------------------------------------------------- */
43
bool
Initialize
(const
InitializerDelegate
&initializer) noexcept
44
{
45
auto
textureGenerator = initializer.MakeTextureGenerator();
46
if
(textureGenerator ==
nullptr
)
47
{
48
return
false
;
49
}
50
51
_textureStorage = STL::make_unique<TextureStorage>(std::move(textureGenerator));
52
if
(_textureStorage ==
nullptr
)
53
{
54
return
false
;
55
}
56
57
auto
renderer2D = initializer.MakeRenderer2D();
58
if
(renderer2D ==
nullptr
)
59
{
60
return
false
;
61
}
62
_renderer2D = std::move(renderer2D);
63
64
initializer.MakeTextureLoader(*(_textureStorage.get()));
65
66
return
true
;
67
}
68
69
/* ------------------------------------------------------------------------- */
75
/* ------------------------------------------------------------------------- */
76
[[nodiscard]]
bool
CanInitializeRenderer
() const noexcept
77
{
78
return
_renderer2D->CanInitialize();
79
}
80
81
[[nodiscard]]
bool
InitializeRenderer() const noexcept
82
{
83
if
(_renderer2D ==
nullptr
)
84
{
85
return
false
;
86
}
87
88
return
_renderer2D->Initialize();
89
}
90
91
/* ------------------------------------------------------------------------- */
96
/* ------------------------------------------------------------------------- */
97
TextureStorage
&
GetTextureStorage
() noexcept
98
{
99
return
*(_textureStorage.get());
100
}
101
102
/* ------------------------------------------------------------------------- */
107
/* ------------------------------------------------------------------------- */
108
Renderer2DDelegate
&
GetRenderer2D
() noexcept
109
{
110
return
*_renderer2D;
111
}
112
113
private
:
114
STL::unique_ptr<TextureStorage>
_textureStorage;
115
STL::unique_ptr<Renderer2DDelegate>
_renderer2D;
116
};
117
118
}
// namespace MGL::Render
119
#endif
// INCGUARD_MGL_RENDERER_SET_H_1606564400
120
121
// vim: et ts=4 sw=4 sts=4
MGL::InitializerDelegate
イニシャライザデリゲート
Definition
mgl_initializer_delegate.h:60
MGL::Render::Renderer2DDelegate
MGL 2Dレンダラデリゲート
Definition
mgl_renderer_2d_delegate.h:25
MGL::Render::RendererSet
MGL レンダラセット
Definition
mgl_renderer_set.h:24
MGL::Render::RendererSet::CanInitializeRenderer
bool CanInitializeRenderer() const noexcept
レンダラが初期化可能かを取得
Definition
mgl_renderer_set.h:76
MGL::Render::RendererSet::Initialize
bool Initialize(const InitializerDelegate &initializer) noexcept
初期化処理
Definition
mgl_renderer_set.h:43
MGL::Render::RendererSet::RendererSet
RendererSet() noexcept=default
コンストラクタ
MGL::Render::RendererSet::GetInstanceRef
static STL::unique_ptr< RendererSet > & GetInstanceRef() noexcept
インスタンスの取得
Definition
mgl_renderer_set.cc:21
MGL::Render::RendererSet::GetTextureStorage
TextureStorage & GetTextureStorage() noexcept
テクスチャストレージの取得
Definition
mgl_renderer_set.h:97
MGL::Render::RendererSet::GetRenderer2D
Renderer2DDelegate & GetRenderer2D() noexcept
2Dレンダラの取得
Definition
mgl_renderer_set.h:108
MGL::Render::TextureStorage
テクスチャストレージ
Definition
mgl_texture_storage.h:48
MGL::SharedSingleton
シングルトンテンプレート(共有ライブラリ用)
Definition
mgl_singleton.h:44
mgl_environment.h
MGL 環境定義
mgl_initializer_delegate.h
MGL イニシャライザデリゲート
mgl_renderer_2d_delegate.h
MGL 2Dレンダラ デリゲート
mgl_stl_memory.h
MGL STLのメモリ関連の代替
MGL::STL::unique_ptr
std::unique_ptr< T, Deleter > unique_ptr
MGLのアロケータを利用するユニークポインタ
Definition
mgl_stl_memory.h:247
mgl_texture_storage.h
MGL テクスチャストレージ
構築:
1.12.0