diff options
author | jjesswan <jessica_wan@brown.edu> | 2024-04-22 21:56:26 -0400 |
---|---|---|
committer | jjesswan <jessica_wan@brown.edu> | 2024-04-22 21:56:26 -0400 |
commit | a556b45abf18f1bd509daaf63b66b7d55e9fd291 (patch) | |
tree | bc9b8a2d184c12aee236e7f9f276a34b84ca552d /engine-ocean/Game/Systems/Inventory/inventorysystem.h | |
parent | cd7c76017a12bb548036571c1ff13e551369d06d (diff) |
add engine version
Diffstat (limited to 'engine-ocean/Game/Systems/Inventory/inventorysystem.h')
-rw-r--r-- | engine-ocean/Game/Systems/Inventory/inventorysystem.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/engine-ocean/Game/Systems/Inventory/inventorysystem.h b/engine-ocean/Game/Systems/Inventory/inventorysystem.h new file mode 100644 index 0000000..4305f68 --- /dev/null +++ b/engine-ocean/Game/Systems/Inventory/inventorysystem.h @@ -0,0 +1,78 @@ +#ifndef INVENTORYSYSTEM_H +#define INVENTORYSYSTEM_H + + +#include "Game/GameWorld.h" +#include <map> +#include "inventoryitem.h" + +//struct InventoryItem{ +// TextureData lootLabelUI; +// TextureData lootInventoryUI; +// int inventoryCount = 0; + +// InventoryItem(TextureData label, TextureData inventory): +// lootLabelUI(label), +// lootInventoryUI(inventory) +// {} +//}; + +class InventorySystem : public System +{ +public: + InventorySystem(std::map<std::string, std::shared_ptr<GameObject>>& gameobjects, + std::map<std::string, std::shared_ptr<GameObject>>& all_gameobjects, + std::map<std::string, std::vector<std::shared_ptr<GameObject>>>& lootables, + std::map<int, Input>& input_map, + std::shared_ptr<Camera>& camera, + std::set<std::string>& m_shownScreens); + ~InventorySystem(); + void draw() override; + void update(double deltaTime) override; + void scrollEvent(double distance) override; + void mousePosEvent(double xpos, double ypos) override; + void drawUIText(); + void onWindowResize(int width, int height); + + + +private: + void addToInventory(std::shared_ptr<GameObject> &go); + bool withinPlayerReach(const std::shared_ptr<GameObject> &go); + void initializeInventory(std::string itemName, const char* label_filename, const char* inventory_filename); + + + + + + int m_bamboo_count = 0; + std::map<std::string, std::shared_ptr<GameObject>>& m_dynamic_gameobjects; + + // maps loot id to game objects/associated textures + std::map<std::string, std::vector<std::shared_ptr<GameObject>>>& m_lootables; // holds position + std::map<std::string, std::shared_ptr<InventoryItem>> m_inventoryItems; + + std::map<int, Input>& m_input_map; + std::shared_ptr<Camera>& m_camera; + + //std::set<std::string> m_inventoryScreens; // stores ids of all scenes in which inventory is rendered + std::set<std::string>& m_shownScreens; + + std::vector<float> m_quadPos = { + -1.0f, 1.0f, + -1.0f, -1.0f, + 1.0f, 1.0f, + 1.0f, -1.0f + }; + + GLuint m_screenVAO; + GLuint m_texID; + + glm::vec2 m_offset = glm::vec2(.2f); + + std::shared_ptr<UIDisplay> m_sparkle; + + std::map<std::string, std::shared_ptr<GameObject>>& m_all_gameobjects; +}; + +#endif // INVENTORYSYSTEM_H |