mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
add ctrl-interaction with content access
This commit is contained in:
parent
91540791e5
commit
4d290a58fc
2 changed files with 11 additions and 5 deletions
|
|
@ -106,6 +106,7 @@ std::shared_ptr<UINode> HudElement::getNode() const {
|
|||
std::shared_ptr<InventoryView> Hud::createContentAccess() {
|
||||
auto& content = frontend.getLevel().content;
|
||||
auto& indices = *content.getIndices();
|
||||
auto& input = this->input;
|
||||
auto inventory = player.getInventory();
|
||||
|
||||
size_t itemsCount = indices.items.count();
|
||||
|
|
@ -115,12 +116,19 @@ std::shared_ptr<InventoryView> Hud::createContentAccess() {
|
|||
}
|
||||
|
||||
SlotLayout slotLayout(-1, glm::vec2(), false, true, nullptr,
|
||||
[inventory, &indices](uint, ItemStack& item) {
|
||||
[inventory, &indices, &input](uint, ItemStack& item) {
|
||||
auto copy = ItemStack(item);
|
||||
if (input.pressed(Keycode::LEFT_CONTROL)) {
|
||||
copy.maximizeCount(indices);
|
||||
}
|
||||
inventory->move(copy, indices);
|
||||
},
|
||||
[this, inventory](uint, ItemStack& item) {
|
||||
inventory->getSlot(player.getChosenSlot()).set(item);
|
||||
[this, inventory, &indices, &input](uint, ItemStack& item) {
|
||||
auto copy = ItemStack(item);
|
||||
if (input.pressed(Keycode::LEFT_CONTROL)) {
|
||||
copy.maximizeCount(indices);
|
||||
}
|
||||
inventory->getSlot(player.getChosenSlot()).set(copy);
|
||||
});
|
||||
|
||||
InventoryBuilder builder(gui);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#include "InventoryView.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <utility>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue