add updatefunc to slot, which will be emited every interaction with it
This commit is contained in:
@@ -145,7 +145,7 @@ std::shared_ptr<InventoryView> Hud::createContentAccess() {
|
||||
accessInventory->getSlot(id-1).set(ItemStack(id, 1));
|
||||
}
|
||||
|
||||
SlotLayout slotLayout(-1, glm::vec2(), false, true,
|
||||
SlotLayout slotLayout(-1, glm::vec2(), false, true, nullptr,
|
||||
[=](uint, ItemStack& item) {
|
||||
auto copy = ItemStack(item);
|
||||
inventory->move(copy, indices);
|
||||
@@ -165,7 +165,7 @@ std::shared_ptr<InventoryView> Hud::createContentAccess() {
|
||||
std::shared_ptr<InventoryView> Hud::createHotbar() {
|
||||
auto inventory = player->getInventory();
|
||||
|
||||
SlotLayout slotLayout(-1, glm::vec2(), false, false, nullptr, nullptr);
|
||||
SlotLayout slotLayout(-1, glm::vec2(), false, false, nullptr, nullptr, nullptr);
|
||||
InventoryBuilder builder;
|
||||
builder.addGrid(10, 10, glm::vec2(), 4, true, slotLayout);
|
||||
auto view = builder.build();
|
||||
@@ -185,7 +185,7 @@ Hud::Hud(Engine* engine, LevelFrontend* frontend, Player* player)
|
||||
{
|
||||
interaction = std::make_unique<InventoryInteraction>();
|
||||
grabbedItemView = std::make_shared<SlotView>(
|
||||
SlotLayout(-1, glm::vec2(), false, false, nullptr, nullptr)
|
||||
SlotLayout(-1, glm::vec2(), false, false, nullptr, nullptr, nullptr)
|
||||
);
|
||||
grabbedItemView->bind(
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user