grabbed item fix
This commit is contained in:
+13
-3
@@ -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_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user