Sdk: Add automatic system update

Former-commit-id: ce129cc945e7373ac5b9f48960894712d66b097a
This commit is contained in:
Lynix
2015-06-22 00:58:46 +02:00
parent 4b5c08e739
commit 90363406a6
12 changed files with 101 additions and 58 deletions

View File

@@ -33,10 +33,15 @@ namespace Ndk
inline const std::vector<EntityHandle>& GetEntities() const;
inline SystemIndex GetIndex() const;
inline float GetUpdateRate() const;
inline World& GetWorld() const;
inline bool HasEntity(const Entity* entity) const;
inline void SetUpdateRate(float updatePerSecond);
inline void Update(float elapsedTime);
BaseSystem& operator=(const BaseSystem&) = delete;
BaseSystem& operator=(BaseSystem&&) noexcept = default;
@@ -55,6 +60,8 @@ namespace Ndk
template<typename ComponentType1, typename ComponentType2, typename... Rest> void RequiresAny();
inline void RequiresAnyComponent(ComponentIndex index);
virtual void OnUpdate(float elapsedTime) = 0;
private:
inline void AddEntity(Entity* entity);
@@ -79,6 +86,8 @@ namespace Ndk
NzBitset<> m_requiredComponents;
SystemIndex m_systemIndex;
World* m_world;
float m_updateCounter;
float m_updateRate;
static SystemIndex s_nextIndex;
};