mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix: pause menu on hudVisible=false (#512)
* fix: pause menu on hudVisible=false
This commit is contained in:
parent
568e2185dd
commit
1d37f299cc
1 changed files with 7 additions and 8 deletions
|
|
@ -311,7 +311,8 @@ void Hud::updateWorldGenDebug() {
|
||||||
|
|
||||||
void Hud::update(bool visible) {
|
void Hud::update(bool visible) {
|
||||||
const auto& chunks = *player.chunks;
|
const auto& chunks = *player.chunks;
|
||||||
const auto& menu = gui.getMenu();
|
auto& menu = *gui.getMenu();
|
||||||
|
bool is_menu_open = menu.hasOpenPage();
|
||||||
|
|
||||||
debugPanel->setVisible(
|
debugPanel->setVisible(
|
||||||
debug && visible && !(inventoryOpen && inventoryView == nullptr)
|
debug && visible && !(inventoryOpen && inventoryView == nullptr)
|
||||||
|
|
@ -320,13 +321,13 @@ void Hud::update(bool visible) {
|
||||||
if (!visible && inventoryOpen) {
|
if (!visible && inventoryOpen) {
|
||||||
closeInventory();
|
closeInventory();
|
||||||
}
|
}
|
||||||
if (pause && !menu->hasOpenPage()) {
|
if (pause && !is_menu_open) {
|
||||||
setPause(false);
|
setPause(false);
|
||||||
}
|
}
|
||||||
if (!gui.isFocusCaught()) {
|
if (!gui.isFocusCaught()) {
|
||||||
processInput(visible);
|
processInput(visible);
|
||||||
}
|
}
|
||||||
if ((menu->hasOpenPage() || inventoryOpen) == Events::isCursorLocked()) {
|
if ((is_menu_open || inventoryOpen) == Events::isCursorLocked()) {
|
||||||
Events::toggleCursor();
|
Events::toggleCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -346,6 +347,8 @@ void Hud::update(bool visible) {
|
||||||
contentAccessPanel->setSize(glm::vec2(caSize.x, Window::height));
|
contentAccessPanel->setSize(glm::vec2(caSize.x, Window::height));
|
||||||
contentAccess->setMinSize(glm::vec2(1, Window::height));
|
contentAccess->setMinSize(glm::vec2(1, Window::height));
|
||||||
hotbarView->setVisible(visible && !(secondUI && !inventoryView));
|
hotbarView->setVisible(visible && !(secondUI && !inventoryView));
|
||||||
|
darkOverlay->setVisible(is_menu_open);
|
||||||
|
menu.setVisible(is_menu_open);
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
for (auto& element : elements) {
|
for (auto& element : elements) {
|
||||||
|
|
@ -357,7 +360,7 @@ void Hud::update(bool visible) {
|
||||||
}
|
}
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
debugMinimap->setVisible(debug && showGeneratorMinimap);
|
debugMinimap->setVisible(debug && showGeneratorMinimap && visible);
|
||||||
if (debug && showGeneratorMinimap) {
|
if (debug && showGeneratorMinimap) {
|
||||||
updateWorldGenDebug();
|
updateWorldGenDebug();
|
||||||
}
|
}
|
||||||
|
|
@ -592,10 +595,6 @@ void Hud::draw(const DrawContext& ctx){
|
||||||
const uint height = viewport.getHeight();
|
const uint height = viewport.getHeight();
|
||||||
auto menu = gui.getMenu();
|
auto menu = gui.getMenu();
|
||||||
|
|
||||||
bool is_menu_open = menu->hasOpenPage();
|
|
||||||
darkOverlay->setVisible(is_menu_open);
|
|
||||||
menu->setVisible(is_menu_open);
|
|
||||||
|
|
||||||
updateElementsPosition(viewport);
|
updateElementsPosition(viewport);
|
||||||
|
|
||||||
uicamera->setFov(height);
|
uicamera->setFov(height);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue