KisaragiLibrary
 
読み取り中…
検索中…
一致する文字列を見つけられません
Kisaragi_Lib::ImgComponent::LayerFacade クラス

#include <ImgComponent.hpp>

公開メンバ関数

 LayerFacade ()
 
 ~LayerFacade ()
 
Result AddLayer (string _key)
 レイヤーを追加する.
 
void RemoveLayer (string _key)
 レイヤーを削除する
 
void ClearLayer ()
 レイヤーを全て消去する.
 
vector< stringLayerName ()
 レイヤー名を取得する
 
map< string, Layer * > Layers ()
 
void SwapLayer (string _key1, string _key2)
 レイヤー順を交換する
 
void Draw ()
 
void ImgPush (string _layerName, ImgBase *_drawData, bool ifCreate=false)
 
void ImgPop (string _layerName, string _id)
 
void ImgClear (string _layerName)
 

非公開変数類

map< string, Layer * > layers
 
vector< stringlayerName
 

構築子と解体子

◆ LayerFacade()

Kisaragi_Lib::ImgComponent::LayerFacade::LayerFacade ( )
inline
288 {
289 AddLayer("Default");
290 }
Result AddLayer(string _key)
レイヤーを追加する.
Definition ImgComponent.cpp:36

◆ ~LayerFacade()

Kisaragi_Lib::ImgComponent::LayerFacade::~LayerFacade ( )
inline
293 {
294 ClearLayer();
295 }
void ClearLayer()
レイヤーを全て消去する.
Definition ImgComponent.cpp:75

関数詳解

◆ AddLayer()

Result Kisaragi_Lib::ImgComponent::LayerFacade::AddLayer ( string _key)

レイヤーを追加する.

引数
_keyレイヤー名
戻り値
追加に成功したかどうか
37 {
38 if (layers.count(_key))
39 {
40 return FAIL;
41 }
42
43 auto tmp = layers.emplace(_key, new Layer());
44
45 if (tmp.second)
46 {
47 layerName.push_back(_key);
48 }
49
50 return (Result)tmp.second;
51 }
Result
成否を表す.
Definition Const.h:8
@ FAIL
Definition Const.h:9
map< string, Layer * > layers
Definition ImgComponent.hpp:283
vector< string > layerName
Definition ImgComponent.hpp:284

参照元 ImgPush(), LayerFacade().

◆ RemoveLayer()

void Kisaragi_Lib::ImgComponent::LayerFacade::RemoveLayer ( string _key)

レイヤーを削除する

引数
_key削除したいレイヤー名
58 {
59 if (layers.count(_key))
60 {
61 //存在しないKeyを削除しようとしています。
62 assert(layers.count(_key));
63 return;
64 }
65
66 layers[_key]->Clear();
67 delete layers[_key];
68 layers.erase(_key);
69
70 }

◆ ClearLayer()

void Kisaragi_Lib::ImgComponent::LayerFacade::ClearLayer ( )

レイヤーを全て消去する.

76 {
77 for (auto& l : layers)
78 {
79 l.second->Clear();
80 delete l.second;
81 }
82
83 layers.clear();
84 layerName.clear();
85 }

参照元 ~LayerFacade().

◆ LayerName()

vector< string > Kisaragi_Lib::ImgComponent::LayerFacade::LayerName ( )

レイヤー名を取得する

戻り値
92 {
93 return layerName;
94 }

参照元 Kisaragi_Lib::RenderSystem::Drawing().

◆ Layers()

map< string, Layer * > Kisaragi_Lib::ImgComponent::LayerFacade::Layers ( )
inline
322 {
323 return layers;
324 }

参照元 Kisaragi_Lib::RenderSystem::Drawing().

◆ SwapLayer()

void Kisaragi_Lib::ImgComponent::LayerFacade::SwapLayer ( string _key1,
string _key2 )

レイヤー順を交換する

引数
_key1交換したいレイヤー名1
_key2交換したいレイヤー名2
102 {
103 auto tmp = std::find(layerName.begin(), layerName.end(), _key1);
104
105 if (tmp == layerName.end())
106 {
107 return;
108 }
109
110 auto tmp2 = std::find(layerName.begin(), layerName.end(), _key2);
111
112 if (tmp == layerName.end())
113 {
114 return;
115 }
116
117 std::iter_swap(tmp, tmp2);
118
119 }

参照元 BG::Start().

◆ Draw()

void Kisaragi_Lib::ImgComponent::LayerFacade::Draw ( )
123 {
124 ClearDrawScreen(); //画面をクリアする
125
126 for (auto& v : layerName)
127 {
128 for (unsigned int i = 0; i < layers[v]->Cnt(); i++)
129 {
130 layers[v]->Draw();
131 }
132
133 }
134 ScreenFlip(); //裏画面の内容を表画面に反映
135
136 }

◆ ImgPush()

void Kisaragi_Lib::ImgComponent::LayerFacade::ImgPush ( string _layerName,
ImgBase * _drawData,
bool ifCreate = false )
139 {
140 if (layers.count(_layerName) == 0)
141 {
142 if (!ifCreate)
143 {
144 return;
145 }
146 if (AddLayer(_layerName) == FAIL)
147 {
148 return;
149 }
150 }
151
152 layers[_layerName]->Push(_drawData->ID(), _drawData);
153 }

参照元 Kisaragi_Lib::ImgComponent::ImgBase::ChangeLayer(), Kisaragi_Lib::ImgComponent::ImgBase::Start().

◆ ImgPop()

void Kisaragi_Lib::ImgComponent::LayerFacade::ImgPop ( string _layerName,
string _id )
156 {
157 if (layers.count(_layerName) == 0)
158 {
159 return;
160 }
161
162 layers[_layerName]->Pop(_id);
163 }

参照元 Kisaragi_Lib::ImgComponent::ImgBase::ChangeLayer(), Kisaragi_Lib::ImgComponent::ImgBase::~ImgBase().

◆ ImgClear()

void Kisaragi_Lib::ImgComponent::LayerFacade::ImgClear ( string _layerName)
166 {
167 if (layers.count(_layerName) == 0)
168 {
169 return;
170 }
171
172 layers[_layerName]->Clear();
173 }

メンバ詳解

◆ layers

map<string, Layer*> Kisaragi_Lib::ImgComponent::LayerFacade::layers
private

◆ layerName

vector<string> Kisaragi_Lib::ImgComponent::LayerFacade::layerName
private

このクラス詳解は次のファイルから抽出されました: