clang warnings fix
This commit is contained in:
@@ -71,7 +71,7 @@ Content* ContentBuilder::build() {
|
|||||||
|
|
||||||
// Generating runtime info
|
// Generating runtime info
|
||||||
def->rt.id = blockDefsIndices.size();
|
def->rt.id = blockDefsIndices.size();
|
||||||
def->rt.emissive = *((uint32_t*)def->emission);
|
def->rt.emissive = *reinterpret_cast<uint32_t*>(def->emission);
|
||||||
def->rt.solid = def->model == BlockModel::block;
|
def->rt.solid = def->model == BlockModel::block;
|
||||||
|
|
||||||
if (def->rotatable) {
|
if (def->rotatable) {
|
||||||
@@ -95,7 +95,7 @@ Content* ContentBuilder::build() {
|
|||||||
|
|
||||||
// Generating runtime info
|
// Generating runtime info
|
||||||
def->rt.id = itemDefsIndices.size();
|
def->rt.id = itemDefsIndices.size();
|
||||||
def->rt.emissive = *((uint32_t*)def->emission);
|
def->rt.emissive = *reinterpret_cast<uint32_t*>(def->emission);
|
||||||
itemDefsIndices.push_back(def);
|
itemDefsIndices.push_back(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ std::shared_ptr<Button> guiutil::gotoButton(
|
|||||||
) {
|
) {
|
||||||
text = langs::get(text, L"menu");
|
text = langs::get(text, L"menu");
|
||||||
return std::make_shared<Button>(text, vec4(10.f), [=](GUI* gui) {
|
return std::make_shared<Button>(text, vec4(10.f), [=](GUI* gui) {
|
||||||
menu->set(page);
|
menu->setPage(page);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiutil::alert(GUI* gui, const std::wstring& text, runnable on_hidden) {
|
void guiutil::alert(GUI* gui, const std::wstring& text, runnable on_hidden) {
|
||||||
auto menu = gui->getMenu();
|
auto menu = gui->getMenu();
|
||||||
Panel* panel = new Panel(vec2(500, 200), vec4(8.0f), 8.0f);
|
auto panel = std::make_shared<Panel>(vec2(500, 200), vec4(8.0f), 8.0f);
|
||||||
panel->setColor(vec4(0.0f, 0.0f, 0.0f, 0.5f));
|
panel->setColor(vec4(0.0f, 0.0f, 0.0f, 0.5f));
|
||||||
|
|
||||||
// TODO: implement built-in text wrapping
|
// TODO: implement built-in text wrapping
|
||||||
@@ -63,8 +63,8 @@ void guiutil::alert(GUI* gui, const std::wstring& text, runnable on_hidden) {
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
panel->refresh();
|
panel->refresh();
|
||||||
menu->add("<alert>", panel);
|
menu->addPage("<alert>", panel);
|
||||||
menu->set("<alert>");
|
menu->setPage("<alert>");
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiutil::confirm(
|
void guiutil::confirm(
|
||||||
@@ -96,6 +96,6 @@ void guiutil::confirm(
|
|||||||
panel->add(subpanel);
|
panel->add(subpanel);
|
||||||
|
|
||||||
panel->refresh();
|
panel->refresh();
|
||||||
menu->add("<confirm>", panel);
|
menu->addPage("<confirm>", panel);
|
||||||
menu->set("<confirm>");
|
menu->setPage("<confirm>");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,8 +213,6 @@ void Panel::refresh() {
|
|||||||
node->setCoord(vec2(x, y+margin.y));
|
node->setCoord(vec2(x, y+margin.y));
|
||||||
x += nodesize.x + margin.z + interval;
|
x += nodesize.x + margin.z + interval;
|
||||||
|
|
||||||
float height = size.y - padding.y - padding.w - margin.y - margin.w;
|
|
||||||
//node->setSize(vec2(nodesize.x, height));
|
|
||||||
node->refresh();
|
node->refresh();
|
||||||
maxh = fmax(maxh, y+margin.y+node->getSize().y+margin.w+padding.w);
|
maxh = fmax(maxh, y+margin.y+node->getSize().y+margin.w+padding.w);
|
||||||
}
|
}
|
||||||
@@ -243,15 +241,11 @@ bool PagesControl::has(std::string name) {
|
|||||||
return pages.find(name) != pages.end();
|
return pages.find(name) != pages.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PagesControl::add(std::string name, std::shared_ptr<UINode> panel) {
|
void PagesControl::addPage(std::string name, std::shared_ptr<UINode> panel) {
|
||||||
pages[name] = Page{panel};
|
pages[name] = Page{panel};
|
||||||
}
|
}
|
||||||
|
|
||||||
void PagesControl::add(std::string name, UINode* panel) {
|
void PagesControl::setPage(std::string name, bool history) {
|
||||||
add(name, std::shared_ptr<UINode>(panel));
|
|
||||||
}
|
|
||||||
|
|
||||||
void PagesControl::set(std::string name, bool history) {
|
|
||||||
auto found = pages.find(name);
|
auto found = pages.find(name);
|
||||||
if (found == pages.end()) {
|
if (found == pages.end()) {
|
||||||
throw std::runtime_error("no page found");
|
throw std::runtime_error("no page found");
|
||||||
@@ -273,7 +267,7 @@ void PagesControl::back() {
|
|||||||
return;
|
return;
|
||||||
std::string name = pageStack.top();
|
std::string name = pageStack.top();
|
||||||
pageStack.pop();
|
pageStack.pop();
|
||||||
set(name, false);
|
setPage(name, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Page& PagesControl::current() {
|
Page& PagesControl::current() {
|
||||||
|
|||||||
@@ -93,9 +93,8 @@ namespace gui {
|
|||||||
PagesControl();
|
PagesControl();
|
||||||
|
|
||||||
bool has(std::string name);
|
bool has(std::string name);
|
||||||
void set(std::string name, bool history=true);
|
void setPage(std::string name, bool history=true);
|
||||||
void add(std::string name, std::shared_ptr<UINode> panel);
|
void addPage(std::string name, std::shared_ptr<UINode> panel);
|
||||||
void add(std::string name, UINode* panel);
|
|
||||||
void back();
|
void back();
|
||||||
void clearHistory();
|
void clearHistory();
|
||||||
void reset();
|
void reset();
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ std::shared_ptr<UINode> HudRenderer::createDebugPanel(Engine* engine) {
|
|||||||
});
|
});
|
||||||
panel->setCoord(vec2(10, 10));
|
panel->setCoord(vec2(10, 10));
|
||||||
panel->add(create_label([this](){ return L"fps: "+this->fpsString;}));
|
panel->add(create_label([this](){ return L"fps: "+this->fpsString;}));
|
||||||
panel->add(create_label([this](){
|
panel->add(create_label([](){
|
||||||
return L"meshes: " + std::to_wstring(Mesh::meshesCount);
|
return L"meshes: " + std::to_wstring(Mesh::meshesCount);
|
||||||
}));
|
}));
|
||||||
panel->add(create_label([=](){
|
panel->add(create_label([=](){
|
||||||
@@ -336,7 +336,7 @@ void HudRenderer::update(bool visible) {
|
|||||||
closeInventory();
|
closeInventory();
|
||||||
} else {
|
} else {
|
||||||
pause = true;
|
pause = true;
|
||||||
menu->set("pause");
|
menu->setPage("pause");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (visible && Events::jactive(BIND_HUD_INVENTORY)) {
|
if (visible && Events::jactive(BIND_HUD_INVENTORY)) {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ static std::shared_ptr<Panel> create_page(
|
|||||||
vec2(width, 200), vec4(8.0f), interval
|
vec2(width, 200), vec4(8.0f), interval
|
||||||
);
|
);
|
||||||
panel->setColor(vec4(0.0f, 0.0f, 0.0f, opacity));
|
panel->setColor(vec4(0.0f, 0.0f, 0.0f, opacity));
|
||||||
menu->add(name, panel);
|
menu->addPage(name, panel);
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ static void show_content_missing(
|
|||||||
menu->back();
|
menu->back();
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
menu->set("missing-content");
|
menu->setPage("missing-content");
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_convert_request(
|
void show_convert_request(
|
||||||
@@ -372,8 +372,8 @@ void create_content_panel(Engine* engine) {
|
|||||||
engine->setScreen(std::make_shared<MenuScreen>(engine));
|
engine->setScreen(std::make_shared<MenuScreen>(engine));
|
||||||
open_world(wname, engine);
|
open_world(wname, engine);
|
||||||
});
|
});
|
||||||
menu->add("content-packs", panel);
|
menu->addPage("content-packs", panel);
|
||||||
menu->set("content-packs");
|
menu->setPage("content-packs");
|
||||||
}));
|
}));
|
||||||
mainPanel->add(guiutil::backButton(menu));
|
mainPanel->add(guiutil::backButton(menu));
|
||||||
}
|
}
|
||||||
@@ -611,7 +611,7 @@ void create_pause_panel(Engine* engine) {
|
|||||||
}));
|
}));
|
||||||
panel->add(create_button(L"Content", vec4(10.0f), vec4(1), [=](GUI*) {
|
panel->add(create_button(L"Content", vec4(10.0f), vec4(1), [=](GUI*) {
|
||||||
create_content_panel(engine);
|
create_content_panel(engine);
|
||||||
menu->set("content");
|
menu->setPage("content");
|
||||||
}));
|
}));
|
||||||
panel->add(guiutil::gotoButton(L"Settings", "settings", menu));
|
panel->add(guiutil::gotoButton(L"Settings", "settings", menu));
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ MenuScreen::MenuScreen(Engine* engine_) : Screen(engine_) {
|
|||||||
auto menu = engine->getGUI()->getMenu();
|
auto menu = engine->getGUI()->getMenu();
|
||||||
menus::refresh_menus(engine);
|
menus::refresh_menus(engine);
|
||||||
menu->reset();
|
menu->reset();
|
||||||
menu->set("main");
|
menu->setPage("main");
|
||||||
|
|
||||||
uicamera.reset(new Camera(glm::vec3(), Window::height));
|
uicamera.reset(new Camera(glm::vec3(), Window::height));
|
||||||
uicamera->perspective = false;
|
uicamera->perspective = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user