// Copyright (C) 2015 Jérôme Leclercq // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequesites.hpp #pragma once #ifndef NDK_WORLD_HPP #define NDK_WORLD_HPP #include #include #include #include #include #include namespace Ndk { class NDK_API World : NzNonCopyable { public: using EntityList = std::vector; World() = default; ~World(); EntityHandle CreateEntity(); EntityList CreateEntities(unsigned int count); void Clear(); EntityHandle GetEntity(Entity::Id id); void KillEntity(const EntityHandle& entity); void KillEntities(const EntityList& list); bool IsEntityValid(const EntityHandle& entity) const; bool IsEntityIdValid(Entity::Id id) const; void Update(); private: struct EntityBlock { EntityBlock(Entity&& e) : entity(std::move(e)) { } Entity entity; unsigned int aliveIndex; }; std::vector m_freeIdList; std::vector m_entities; EntityList m_aliveEntities; NzBitset m_killedEntities; }; } #include #endif // NDK_WORLD_HPP