fix
This commit is contained in:
@@ -83,7 +83,7 @@ UiDocument* Assets::getLayout(std::string name) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Assets::store(UiDocument* layout, std::string name) {
|
void Assets::store(UiDocument* layout, std::string name) {
|
||||||
layouts.emplace(name, layout);
|
layouts[name] = std::shared_ptr<UiDocument>(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Assets::extend(const Assets& assets) {
|
void Assets::extend(const Assets& assets) {
|
||||||
|
|||||||
@@ -181,11 +181,13 @@ void menus::create_pause_panel(Engine* engine, LevelController* controller) {
|
|||||||
panel->add(guiutil::gotoButton(L"Settings", "settings", menu));
|
panel->add(guiutil::gotoButton(L"Settings", "settings", menu));
|
||||||
|
|
||||||
panel->add(create_button(L"Save and Quit to Menu", glm::vec4(10.f), glm::vec4(1), [=](GUI*){
|
panel->add(create_button(L"Save and Quit to Menu", glm::vec4(10.f), glm::vec4(1), [=](GUI*){
|
||||||
// save world
|
engine->postRunnable([=]() {
|
||||||
controller->saveWorld();
|
// save world
|
||||||
// destroy LevelScreen and run quit callbacks
|
controller->saveWorld();
|
||||||
engine->setScreen(nullptr);
|
// destroy LevelScreen and run quit callbacks
|
||||||
// create and go to menu screen
|
engine->setScreen(nullptr);
|
||||||
engine->setScreen(std::make_shared<MenuScreen>(engine));
|
// create and go to menu screen
|
||||||
|
engine->setScreen(std::make_shared<MenuScreen>(engine));
|
||||||
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ Screen::~Screen() {
|
|||||||
|
|
||||||
MenuScreen::MenuScreen(Engine* engine_) : Screen(engine_) {
|
MenuScreen::MenuScreen(Engine* engine_) : Screen(engine_) {
|
||||||
auto menu = engine->getGUI()->getMenu();
|
auto menu = engine->getGUI()->getMenu();
|
||||||
menus::refresh_menus(engine);
|
|
||||||
menu->reset();
|
menu->reset();
|
||||||
|
menus::refresh_menus(engine);
|
||||||
menu->setPage("main");
|
menu->setPage("main");
|
||||||
|
|
||||||
uicamera.reset(new Camera(glm::vec3(), Window::height));
|
uicamera.reset(new Camera(glm::vec3(), Window::height));
|
||||||
|
|||||||
@@ -269,13 +269,14 @@ void Menu::addSupplier(std::string name, supplier<std::shared_ptr<UINode>> pageS
|
|||||||
|
|
||||||
void Menu::setPage(std::string name, bool history) {
|
void Menu::setPage(std::string name, bool history) {
|
||||||
auto found = pages.find(name);
|
auto found = pages.find(name);
|
||||||
Page page;
|
Page page {name, nullptr};
|
||||||
if (found == pages.end()) {
|
if (found == pages.end()) {
|
||||||
auto supplier = pageSuppliers.find(name);
|
auto supplier = pageSuppliers.find(name);
|
||||||
if (supplier == pageSuppliers.end()) {
|
if (supplier == pageSuppliers.end()) {
|
||||||
throw std::runtime_error("no page found");
|
throw std::runtime_error("no page found");
|
||||||
} else {
|
} else {
|
||||||
page.panel = supplier->second();
|
page.panel = supplier->second();
|
||||||
|
// pages[name] = page;
|
||||||
// supplied pages caching is not implemented
|
// supplied pages caching is not implemented
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -319,4 +320,3 @@ void Menu::reset() {
|
|||||||
current = Page{"", nullptr};
|
current = Page{"", nullptr};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user