grabbed item fix
This commit is contained in:
parent
32e6ec2fb8
commit
d4999901c2
@ -317,7 +317,7 @@ void HudRenderer::update(bool visible) {
|
||||
menu->visible(pause);
|
||||
|
||||
if (!visible && inventoryOpen) {
|
||||
inventoryOpen = false;
|
||||
closeInventory();
|
||||
}
|
||||
if (pause && menu->current().panel == nullptr) {
|
||||
pause = false;
|
||||
@ -327,7 +327,7 @@ void HudRenderer::update(bool visible) {
|
||||
pause = false;
|
||||
menu->reset();
|
||||
} else if (inventoryOpen) {
|
||||
inventoryOpen = false;
|
||||
closeInventory();
|
||||
} else {
|
||||
pause = true;
|
||||
menu->set("pause");
|
||||
@ -335,7 +335,11 @@ void HudRenderer::update(bool visible) {
|
||||
}
|
||||
if (visible && Events::jactive(BIND_HUD_INVENTORY)) {
|
||||
if (!pause) {
|
||||
inventoryOpen = !inventoryOpen;
|
||||
if (inventoryOpen) {
|
||||
closeInventory();
|
||||
} else {
|
||||
inventoryOpen = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
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) {
|
||||
if (pause) {
|
||||
Shader* uishader = assets->getShader("ui");
|
||||
|
||||
@ -63,6 +63,8 @@ public:
|
||||
|
||||
bool isInventoryOpen() const;
|
||||
bool isPause() const;
|
||||
|
||||
void closeInventory();
|
||||
};
|
||||
|
||||
#endif /* SRC_HUD_H_ */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user