#pragma once #include #include #include #include namespace Game::State { class GameState { public: static GameState& getInstance() { static GameState instance; return instance; } // Retrieve a COPY of the entities - Only used by renderer, use getAtIndex() for generic access const std::vector& getEntities(); // Retrieve a REFERENCE of the entities; DANGEROUS! std::vector* getEntitiesRef(); // Update entity at index, by REFERENCE Object::Entity* getAtIndex(size_t at); private: mutable std::shared_mutex mMutex; std::vector mEntities; }; }