20#ifndef DL_DISABLE_RENDER
70 _panelRoot =
new Panel;
71 _panelRoot->_node = _allPanel.AddRoot(_panelRoot);
86 p->_node = _allPanel.Add(p, parent);
97 const std::source_location location = std::source_location::current())
103 p->_node = _allPanel.Add(p, parent);
106 p->_debugName = fmt::format(
"{}({},{}):",
107 String::CvtPathSeparator(location.file_name()),
108 location.line(), location.column());
128 auto vec = panel->_node->GetChild();
129 for(
auto& iter : vec)
135 _allPanel.Del(panel->_node);
144 auto vec = panel->_node->GetChild();
145 for (
auto& iter : vec)
155 _allPanel.SetParent(panel->_node, parent->_node);
157 panel->_refresh_order();
248 _sizeStandard = size;
249 _refresh_standard_size();
254 g_system->GetWindowSize() : _sizeStandard;
271 for (
auto& node : _allPanel)
273 node->GetValue()->_refresh_lang();
316 for (
auto& node : _allPanel)
318 delete node->GetValue();
356 std::unordered_map<std::string, Text*, string_hash, std::equal_to<>> _allText;
357 std::unordered_map<std::string, MsgBox*, string_hash, std::equal_to<>> _allMsgBox;
358 std::unordered_map<std::string, ButtonSprite*, string_hash, std::equal_to<>> _allBtnSprite;
359 std::unordered_map<std::string, Background*, string_hash, std::equal_to<>> _allBackground;
360 std::unordered_map<std::string, Locator::SL, string_hash, std::equal_to<>> _allLocator;
361 std::unordered_map<std::string, ListBox*, string_hash, std::equal_to<>> _allListBox;
371 bool operator<(
const RegKey& b)
const
373 return _type < b._type;
376 std::list<RegKey> _allReg;
378 void _reg_text(
json& j,
const std::string& name);
379 void _reg_msg_box(
json& j,
const std::string& name);
380 void _reg_button(
json& j,
const std::string& name);
381 void _reg_background(
json& j,
const std::string& name);
382 void _reg_locator(
json& j, std::string_view name);
383 void _reg_list_box(
json& j, std::string_view name);
387 for (
auto& iter : _allText)
389 for (
auto& iter : _allMsgBox)
391 for (
auto& iter : _allBtnSprite)
393 for (
auto& iter : _allBackground)
395 for (
auto& iter : _allListBox)
399 void _refresh_scale()
401 _panelRoot->_coor->
SetScale(_uiScale);
404 void _refresh_standard_size();
406 void _debug_render();
void SetParent(Coor *coor)
void SetScale(const Position &scale)
MsgBox * CreateMsgBox(std::string_view name)
创建一个MsgBox
ListBox * CreateListBox(std::string_view name)
创建一个ListBox
UI::Text * CreateText(std::string_view name)
创建一个UI::Text
const NTree< Panel * > & GetPanelAll()
EditBox * GetFocusEditBox()
Background * CreateBackground(std::string_view name)
创建一个Background
void SetStandardSize(const Size &size)
设置ui标准大小,窗口缩放后,ui会自动缩放
void SetPanelParent(Panel *panel, Panel *parent)
设置panel的父panel
EditBox * CreateEditBoxDefault(bool single_line=true)
void DeletePanelChild(Panel *panel, bool recursion=true)
删除一个Panel的子节点
void _on_char(char32_t ch)
输入时调用
void _update_pre()
system调用
void SetHide(bool hide)
Components克隆
void RegisterAll(std::string_view path)
注册多个,传入目录。会调用RegisterEnd
void DeletePanel(Panel *panel, bool del_child=false)
删除一个Panel
void _on_key(int action, bool ctrl)
按键操作
ListBox * CreateListBoxDefault(bool add_text=false)
void SetScale(float s)
设置ui缩放
Menu * CreateMenuDefault()
Panel * lua_CreatePanel()
Panel * CreatePanel(Panel *parent, const std::source_location location=std::source_location::current())
创建一个Panel
Background * CreateBackgroundDefault()
Panel * CreatePanel(const std::source_location location=std::source_location::current())
void RenderDebugElementData(Coor *coor, const Cpt::ElementData &elem_data)
gcText CreateTextOnly(std::string_view name)
创建一个Text,忽略UI::Text的额外的信息
void Register(std::string_view json_path)
注册一个东西
ButtonSprite * CreateButtonSprite(std::string_view name)
创建一个ButtonSprite
void SetFocusEditBox(EditBox *edt, bool focus=true)
设置激活输入框
MsgBox * CreateMsgBoxDefault()
Locator::SL CreateLocator(std::string_view name)
创建一个Locator
ButtonSprite * CreateButtonSpriteDefault(ButtonStyle style=ButtonStyle::NORMAL)
void _resize_panel_root()
Tree * CreateTreeDefault()
UI::Text * CreateTextDefault()
bool Zero(const C &container)