mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 22:41:49 +00:00
grabbed item fix
This commit is contained in:
parent
32e6ec2fb8
commit
d4999901c2
2 changed files with 15 additions and 3 deletions
|
|
@ -317,7 +317,7 @@ void HudRenderer::update(bool visible) {
|
||||||
menu->visible(pause);
|
menu->visible(pause);
|
||||||
|
|
||||||
if (!visible && inventoryOpen) {
|
if (!visible && inventoryOpen) {
|
||||||
inventoryOpen = false;
|
closeInventory();
|
||||||
}
|
}
|
||||||
if (pause && menu->current().panel == nullptr) {
|
if (pause && menu->current().panel == nullptr) {
|
||||||
pause = false;
|
pause = false;
|
||||||
|
|
@ -327,7 +327,7 @@ void HudRenderer::update(bool visible) {
|
||||||
pause = false;
|
pause = false;
|
||||||
menu->reset();
|
menu->reset();
|
||||||
} else if (inventoryOpen) {
|
} else if (inventoryOpen) {
|
||||||
inventoryOpen = false;
|
closeInventory();
|
||||||
} else {
|
} else {
|
||||||
pause = true;
|
pause = true;
|
||||||
menu->set("pause");
|
menu->set("pause");
|
||||||
|
|
@ -335,7 +335,11 @@ void HudRenderer::update(bool visible) {
|
||||||
}
|
}
|
||||||
if (visible && Events::jactive(BIND_HUD_INVENTORY)) {
|
if (visible && Events::jactive(BIND_HUD_INVENTORY)) {
|
||||||
if (!pause) {
|
if (!pause) {
|
||||||
inventoryOpen = !inventoryOpen;
|
if (inventoryOpen) {
|
||||||
|
closeInventory();
|
||||||
|
} else {
|
||||||
|
inventoryOpen = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((pause || inventoryOpen) == Events::_cursor_locked) {
|
if ((pause || inventoryOpen) == Events::_cursor_locked) {
|
||||||
|
|
@ -366,6 +370,12 @@ void HudRenderer::update(bool visible) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HudRenderer::closeInventory() {
|
||||||
|
inventoryOpen = false;
|
||||||
|
ItemStack& grabbed = interaction->getGrabbedItem();
|
||||||
|
grabbed.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void HudRenderer::drawOverlay(const GfxContext& ctx) {
|
void HudRenderer::drawOverlay(const GfxContext& ctx) {
|
||||||
if (pause) {
|
if (pause) {
|
||||||
Shader* uishader = assets->getShader("ui");
|
Shader* uishader = assets->getShader("ui");
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,8 @@ public:
|
||||||
|
|
||||||
bool isInventoryOpen() const;
|
bool isInventoryOpen() const;
|
||||||
bool isPause() const;
|
bool isPause() const;
|
||||||
|
|
||||||
|
void closeInventory();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SRC_HUD_H_ */
|
#endif /* SRC_HUD_H_ */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue