clang warnings fix
This commit is contained in:
parent
0e2fc14dc8
commit
537a0ca358
@ -71,7 +71,7 @@ Content* ContentBuilder::build() {
|
||||
|
||||
// Generating runtime info
|
||||
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;
|
||||
|
||||
if (def->rotatable) {
|
||||
@ -95,7 +95,7 @@ Content* ContentBuilder::build() {
|
||||
|
||||
// Generating runtime info
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -26,13 +26,13 @@ std::shared_ptr<Button> guiutil::gotoButton(
|
||||
) {
|
||||
text = langs::get(text, L"menu");
|
||||
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) {
|
||||
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));
|
||||
|
||||
// TODO: implement built-in text wrapping
|
||||
@ -63,8 +63,8 @@ void guiutil::alert(GUI* gui, const std::wstring& text, runnable on_hidden) {
|
||||
}
|
||||
));
|
||||
panel->refresh();
|
||||
menu->add("<alert>", panel);
|
||||
menu->set("<alert>");
|
||||
menu->addPage("<alert>", panel);
|
||||
menu->setPage("<alert>");
|
||||
}
|
||||
|
||||
void guiutil::confirm(
|
||||
@ -96,6 +96,6 @@ void guiutil::confirm(
|
||||
panel->add(subpanel);
|
||||
|
||||
panel->refresh();
|
||||
menu->add("<confirm>", panel);
|
||||
menu->set("<confirm>");
|
||||
menu->addPage("<confirm>", panel);
|
||||
menu->setPage("<confirm>");
|
||||
}
|
||||
|
||||
@ -213,8 +213,6 @@ void Panel::refresh() {
|
||||
node->setCoord(vec2(x, y+margin.y));
|
||||
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();
|
||||
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();
|
||||
}
|
||||
|
||||
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};
|
||||
}
|
||||
|
||||
void PagesControl::add(std::string name, UINode* panel) {
|
||||
add(name, std::shared_ptr<UINode>(panel));
|
||||
}
|
||||
|
||||
void PagesControl::set(std::string name, bool history) {
|
||||
void PagesControl::setPage(std::string name, bool history) {
|
||||
auto found = pages.find(name);
|
||||
if (found == pages.end()) {
|
||||
throw std::runtime_error("no page found");
|
||||
@ -273,7 +267,7 @@ void PagesControl::back() {
|
||||
return;
|
||||
std::string name = pageStack.top();
|
||||
pageStack.pop();
|
||||
set(name, false);
|
||||
setPage(name, false);
|
||||
}
|
||||
|
||||
Page& PagesControl::current() {
|
||||
|
||||
@ -93,9 +93,8 @@ namespace gui {
|
||||
PagesControl();
|
||||
|
||||
bool has(std::string name);
|
||||
void set(std::string name, bool history=true);
|
||||
void add(std::string name, std::shared_ptr<UINode> panel);
|
||||
void add(std::string name, UINode* panel);
|
||||
void setPage(std::string name, bool history=true);
|
||||
void addPage(std::string name, std::shared_ptr<UINode> panel);
|
||||
void back();
|
||||
void clearHistory();
|
||||
void reset();
|
||||
|
||||
@ -68,7 +68,7 @@ std::shared_ptr<UINode> HudRenderer::createDebugPanel(Engine* engine) {
|
||||
});
|
||||
panel->setCoord(vec2(10, 10));
|
||||
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);
|
||||
}));
|
||||
panel->add(create_label([=](){
|
||||
@ -336,7 +336,7 @@ void HudRenderer::update(bool visible) {
|
||||
closeInventory();
|
||||
} else {
|
||||
pause = true;
|
||||
menu->set("pause");
|
||||
menu->setPage("pause");
|
||||
}
|
||||
}
|
||||
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
|
||||
);
|
||||
panel->setColor(vec4(0.0f, 0.0f, 0.0f, opacity));
|
||||
menu->add(name, panel);
|
||||
menu->addPage(name, panel);
|
||||
return panel;
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ static void show_content_missing(
|
||||
menu->back();
|
||||
}
|
||||
));
|
||||
menu->set("missing-content");
|
||||
menu->setPage("missing-content");
|
||||
}
|
||||
|
||||
void show_convert_request(
|
||||
@ -372,8 +372,8 @@ void create_content_panel(Engine* engine) {
|
||||
engine->setScreen(std::make_shared<MenuScreen>(engine));
|
||||
open_world(wname, engine);
|
||||
});
|
||||
menu->add("content-packs", panel);
|
||||
menu->set("content-packs");
|
||||
menu->addPage("content-packs", panel);
|
||||
menu->setPage("content-packs");
|
||||
}));
|
||||
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*) {
|
||||
create_content_panel(engine);
|
||||
menu->set("content");
|
||||
menu->setPage("content");
|
||||
}));
|
||||
panel->add(guiutil::gotoButton(L"Settings", "settings", menu));
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ MenuScreen::MenuScreen(Engine* engine_) : Screen(engine_) {
|
||||
auto menu = engine->getGUI()->getMenu();
|
||||
menus::refresh_menus(engine);
|
||||
menu->reset();
|
||||
menu->set("main");
|
||||
menu->setPage("main");
|
||||
|
||||
uicamera.reset(new Camera(glm::vec3(), Window::height));
|
||||
uicamera->perspective = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user