renderiranje - nazaj na singlethreaded ker me SDL ne mara :(
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <shared_mutex>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <utils.hpp>
|
||||
#include <object/entity.hpp>
|
||||
|
||||
@@ -10,15 +10,14 @@ namespace Game::State {
|
||||
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<Object::Entity>& getEntities();
|
||||
// Retrieve a REFERENCE of the entities; DANGEROUS!
|
||||
std::vector<Object::Entity>* getEntitiesRef();
|
||||
std::vector<std::unique_ptr<Object::Entity>>* getEntitiesRef();
|
||||
// Update entity at index, by REFERENCE
|
||||
Object::Entity* getAtIndex(size_t at);
|
||||
|
||||
void addEntity(std::unique_ptr<Object::Entity> entity);
|
||||
|
||||
private:
|
||||
mutable std::shared_mutex mMutex;
|
||||
std::vector<Object::Entity> mEntities;
|
||||
std::vector<std::unique_ptr<Object::Entity>> mEntities;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user