From 2e73c4151978a4a867ad1d287fdebfd38cb76d42 Mon Sep 17 00:00:00 2001 From: maka70vv <25.makarovv@gmail.com> Date: Mon, 3 Mar 2025 01:25:41 +0600 Subject: [PATCH] added inventory icon to objects --- ActiveObject.h | 2 ++ GameObjectManager.cpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ActiveObject.h b/ActiveObject.h index fe7abaf..3a1c60d 100644 --- a/ActiveObject.h +++ b/ActiveObject.h @@ -16,6 +16,8 @@ struct ActiveObject { ZL::VertexDataStruct activeObjectScreenMesh; ZL::VertexRenderStruct activeObjectScreenMeshMutable; + std::shared_ptr inventoryItemTexturePtr; + ZL::Vector3f objectPos; bool highlighted = false; }; diff --git a/GameObjectManager.cpp b/GameObjectManager.cpp index 6426c9c..ef5bf2f 100644 --- a/GameObjectManager.cpp +++ b/GameObjectManager.cpp @@ -94,6 +94,7 @@ void GameObjectManager::initialize() { ao1.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5); ao1.activeObjectScreenMeshMutable.AssignFrom(ao1.activeObjectScreenMesh); ao1.activeObjectScreenMeshMutable.RefreshVBO(); + ao1.inventoryItemTexturePtr = std::make_shared(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_T_icon.bmp32")); /* ActiveObject ao2; @@ -259,7 +260,7 @@ void GameObjectManager::handleEvent(const SDL_Event& event) { continue; } - AddItemToInventory(ao->name, ao->activeObjectTexturePtr, objects_in_inventory+1); + AddItemToInventory(ao->name, ao->inventoryItemTexturePtr, objects_in_inventory+1); objects_in_inventory++; rooms[current_room_index].removeByPtr(ao);