menu_commons deleted
This commit is contained in:
@@ -35,11 +35,25 @@
|
|||||||
#include "../../content/ContentPack.h"
|
#include "../../content/ContentPack.h"
|
||||||
#include "../locale/langs.h"
|
#include "../locale/langs.h"
|
||||||
|
|
||||||
#include "menu_commons.h"
|
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
using namespace gui;
|
using namespace gui;
|
||||||
|
|
||||||
|
std::shared_ptr<Panel> create_page(
|
||||||
|
Engine* engine,
|
||||||
|
std::string name,
|
||||||
|
int width,
|
||||||
|
float opacity,
|
||||||
|
int interval
|
||||||
|
) {
|
||||||
|
auto menu = engine->getGUI()->getMenu();
|
||||||
|
auto panel = std::make_shared<Panel>(
|
||||||
|
glm::vec2(width, 200), glm::vec4(8.0f), interval
|
||||||
|
);
|
||||||
|
panel->setColor(glm::vec4(0.0f, 0.0f, 0.0f, opacity));
|
||||||
|
menu->addPage(name, panel);
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
void menus::create_version_label(Engine* engine) {
|
void menus::create_version_label(Engine* engine) {
|
||||||
auto gui = engine->getGUI();
|
auto gui = engine->getGUI();
|
||||||
auto vlabel = std::make_shared<gui::Label>(
|
auto vlabel = std::make_shared<gui::Label>(
|
||||||
@@ -60,7 +74,7 @@ static void show_content_missing(
|
|||||||
) {
|
) {
|
||||||
auto* gui = engine->getGUI();
|
auto* gui = engine->getGUI();
|
||||||
auto menu = gui->getMenu();
|
auto menu = gui->getMenu();
|
||||||
auto panel = menus::create_page(engine, "missing-content", 500, 0.5f, 8);
|
auto panel = create_page(engine, "missing-content", 500, 0.5f, 8);
|
||||||
|
|
||||||
panel->add(std::make_shared<Label>(langs::get(L"menu.missing-content")));
|
panel->add(std::make_shared<Label>(langs::get(L"menu.missing-content")));
|
||||||
|
|
||||||
@@ -91,7 +105,7 @@ static void show_content_missing(
|
|||||||
|
|
||||||
void show_process_panel(Engine* engine, std::shared_ptr<Task> task, std::wstring text=L"") {
|
void show_process_panel(Engine* engine, std::shared_ptr<Task> task, std::wstring text=L"") {
|
||||||
auto menu = engine->getGUI()->getMenu();
|
auto menu = engine->getGUI()->getMenu();
|
||||||
auto panel = menus::create_page(engine, "process", 400, 0.5f, 1);
|
auto panel = create_page(engine, "process", 400, 0.5f, 1);
|
||||||
|
|
||||||
if (!text.empty()) {
|
if (!text.empty()) {
|
||||||
panel->add(std::make_shared<Label>(langs::get(text)));
|
panel->add(std::make_shared<Label>(langs::get(text)));
|
||||||
|
|||||||
@@ -17,14 +17,6 @@ class LevelController;
|
|||||||
using packconsumer = std::function<void(const ContentPack& pack)>;
|
using packconsumer = std::function<void(const ContentPack& pack)>;
|
||||||
|
|
||||||
namespace menus {
|
namespace menus {
|
||||||
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.
|
/// @brief Load world, convert if required and set to LevelScreen.
|
||||||
/// @param name world name
|
/// @param name world name
|
||||||
/// @param engine engine instance
|
/// @param engine engine instance
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
#include "menu_commons.h"
|
|
||||||
|
|
||||||
#include "../../engine.h"
|
|
||||||
#include "../../graphics/ui/elements/containers.h"
|
|
||||||
#include "../locale/langs.h"
|
|
||||||
|
|
||||||
using namespace gui;
|
|
||||||
|
|
||||||
std::shared_ptr<Label> menus::create_label(wstringsupplier supplier) {
|
|
||||||
auto label = std::make_shared<Label>(L"-");
|
|
||||||
label->textSupplier(supplier);
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<Panel> menus::create_page(
|
|
||||||
Engine* engine,
|
|
||||||
std::string name,
|
|
||||||
int width,
|
|
||||||
float opacity,
|
|
||||||
int interval
|
|
||||||
) {
|
|
||||||
auto menu = engine->getGUI()->getMenu();
|
|
||||||
auto panel = std::make_shared<Panel>(
|
|
||||||
glm::vec2(width, 200), glm::vec4(8.0f), interval
|
|
||||||
);
|
|
||||||
panel->setColor(glm::vec4(0.0f, 0.0f, 0.0f, opacity));
|
|
||||||
menu->addPage(name, panel);
|
|
||||||
return panel;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<Button> menus::create_button(
|
|
||||||
std::wstring text,
|
|
||||||
glm::vec4 padding,
|
|
||||||
glm::vec4 margin,
|
|
||||||
gui::onaction action
|
|
||||||
) {
|
|
||||||
auto btn = std::make_shared<Button>(
|
|
||||||
langs::get(text, L"menu"), padding, action
|
|
||||||
);
|
|
||||||
btn->setMargin(margin);
|
|
||||||
return btn;
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#ifndef FRONTEND_MENU_MENU_COMMONS_H_
|
|
||||||
#define FRONTEND_MENU_MENU_COMMONS_H_
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <memory>
|
|
||||||
#include <glm/glm.hpp>
|
|
||||||
|
|
||||||
#include "../../graphics/ui/elements/controls.h"
|
|
||||||
|
|
||||||
class Engine;
|
|
||||||
|
|
||||||
namespace menus {
|
|
||||||
extern std::shared_ptr<gui::Label> create_label(wstringsupplier supplier);
|
|
||||||
extern std::shared_ptr<gui::Panel> create_page(
|
|
||||||
Engine* engine,
|
|
||||||
std::string name,
|
|
||||||
int width,
|
|
||||||
float opacity,
|
|
||||||
int interval
|
|
||||||
);
|
|
||||||
extern std::shared_ptr<gui::Button> create_button(
|
|
||||||
std::wstring text,
|
|
||||||
glm::vec4 padding,
|
|
||||||
glm::vec4 margin,
|
|
||||||
gui::onaction action
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // FRONTEND_MENU_MENU_COMMONS_H_
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "menu_commons.h"
|
|
||||||
|
|
||||||
// TODO: move functions to EngineController
|
// TODO: move functions to EngineController
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user