More refinement of the UIStack.
This commit is contained in:
parent
543928eb36
commit
1179d6eb43
2 changed files with 13 additions and 5 deletions
|
|
@ -49,8 +49,8 @@ namespace gui {
|
||||||
$main_ui.init();
|
$main_ui.init();
|
||||||
$loot_ui.init();
|
$loot_ui.init();
|
||||||
|
|
||||||
for(auto& name : $screens.screens.keys()) {
|
for(auto& name : $screens.names()) {
|
||||||
$screens.screens[name]->init();
|
$screens.at(name)->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// BUG: maybe this is a function on main_ui?
|
// BUG: maybe this is a function on main_ui?
|
||||||
|
|
@ -584,7 +584,7 @@ namespace gui {
|
||||||
|
|
||||||
if(level.index < levels_to_win) {
|
if(level.index < levels_to_win) {
|
||||||
show_scene("NEXT_LEVEL");
|
show_scene("NEXT_LEVEL");
|
||||||
$screens.current_ui()->set_text(fmt::format("ENTERING\nLEVEL\n{}", level.index+2));
|
$screens.active_ui()->set_text(fmt::format("ENTERING\nLEVEL\n{}", level.index+2));
|
||||||
state(State::NEXT_LEVEL_SCENE);
|
state(State::NEXT_LEVEL_SCENE);
|
||||||
} else {
|
} else {
|
||||||
show_scene("WIN");
|
show_scene("WIN");
|
||||||
|
|
|
||||||
|
|
@ -77,14 +77,22 @@ namespace gui {
|
||||||
update_active(screens.end() - 1);
|
update_active(screens.end() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& current_name() {
|
const std::string& active_name() {
|
||||||
dbc::check($active != nullptr, "you didn't set active");
|
dbc::check($active != nullptr, "you didn't set active");
|
||||||
return (*$current).first;
|
return (*$current).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SCREEN_TYPE> current_ui() {
|
std::shared_ptr<SCREEN_TYPE> active_ui() {
|
||||||
dbc::check($active != nullptr, "you didn't set active");
|
dbc::check($active != nullptr, "you didn't set active");
|
||||||
return (*$current).second;
|
return (*$current).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<SCREEN_TYPE> at(const std::string& name) {
|
||||||
|
return screens.at(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
const UIStackMap::key_container_type& names() {
|
||||||
|
return screens.keys();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue