wip
This commit is contained in:
parent
5bc79c8a77
commit
793fd82b90
@ -362,9 +362,17 @@ void create_new_world_panel(Engine* engine) {
|
||||
auto seedstr = std::to_wstring(randU64());
|
||||
auto seedInput = std::make_shared<TextBox>(seedstr, glm::vec4(6.0f));
|
||||
panel->add(seedInput);
|
||||
|
||||
|
||||
panel->add(guiutil::gotoButton(langs::get(L"World generator", L"world"), "world_generators", engine->getGUI()->getMenu()));
|
||||
|
||||
panel->add(menus::create_button(L"Content", glm::vec4(10), glm::vec4(1), [=](GUI* gui) {
|
||||
engine->loadAllPacks();
|
||||
auto panel = menus::create_packs_panel(engine->getContentPacks(), engine, false, nullptr, nullptr);
|
||||
auto menu = gui->getMenu();
|
||||
menu->addPage("content-packs", panel);
|
||||
menu->setPage("content-packs");
|
||||
}));
|
||||
|
||||
panel->add(menus::create_button(L"Create World", glm::vec4(10), glm::vec4(1, 20, 1, 1),
|
||||
[=](GUI*) {
|
||||
if (!nameInput->validate())
|
||||
|
||||
@ -2,16 +2,34 @@
|
||||
#define FRONTEND_MENU_MENU_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include "../../content/ContentPack.h"
|
||||
|
||||
|
||||
namespace gui {
|
||||
class Panel;
|
||||
}
|
||||
|
||||
class Engine;
|
||||
class LevelController;
|
||||
|
||||
using packconsumer = std::function<void(const ContentPack& pack)>;
|
||||
|
||||
namespace menus {
|
||||
// implemented in menu_settings.cpp
|
||||
extern void create_settings_panel(Engine* engine);
|
||||
|
||||
// implemented in menu_pause.cpp
|
||||
extern void create_pause_panel(Engine* engine, LevelController* controller);
|
||||
extern std::shared_ptr<gui::Panel> create_packs_panel(
|
||||
const std::vector<ContentPack>& packs,
|
||||
Engine* engine,
|
||||
bool backbutton,
|
||||
packconsumer callback,
|
||||
packconsumer remover
|
||||
);
|
||||
|
||||
/// @brief Load world, convert if required and set to LevelScreen.
|
||||
/// @param name world name
|
||||
|
||||
@ -16,9 +16,7 @@
|
||||
|
||||
using namespace gui;
|
||||
|
||||
using packconsumer = std::function<void(const ContentPack& pack)>;
|
||||
|
||||
std::shared_ptr<Panel> create_packs_panel(
|
||||
std::shared_ptr<Panel> menus::create_packs_panel(
|
||||
const std::vector<ContentPack>& packs,
|
||||
Engine* engine,
|
||||
bool backbutton,
|
||||
@ -39,7 +37,7 @@ std::shared_ptr<Panel> create_packs_panel(
|
||||
callback(pack);
|
||||
});
|
||||
}
|
||||
auto runtime = engine->getContent()->getPackRuntime(pack.id);
|
||||
auto runtime = engine->getContent() ? engine->getContent()->getPackRuntime(pack.id) : nullptr;
|
||||
auto idlabel = std::make_shared<Label>(
|
||||
(runtime && runtime->getStats().hasSavingContent())
|
||||
? "*["+pack.id+"]"
|
||||
@ -121,7 +119,7 @@ void create_content_panel(Engine* engine, LevelController* controller) {
|
||||
}
|
||||
}
|
||||
|
||||
auto panel = create_packs_panel(
|
||||
auto panel = menus::create_packs_panel(
|
||||
engine->getContentPacks(), engine, false, nullptr,
|
||||
[=](const ContentPack& pack) {
|
||||
auto world = level->getWorld();
|
||||
@ -143,7 +141,7 @@ void create_content_panel(Engine* engine, LevelController* controller) {
|
||||
mainPanel->add(panel);
|
||||
mainPanel->add(menus::create_button(
|
||||
langs::get(L"Add", L"content"), glm::vec4(10.0f), glm::vec4(1), [=](GUI* gui) {
|
||||
auto panel = create_packs_panel(scanned, engine, true,
|
||||
auto panel = menus::create_packs_panel(scanned, engine, true,
|
||||
[=](const ContentPack& pack) {
|
||||
auto world = level->getWorld();
|
||||
auto worldFolder = paths->getWorldFolder();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user