10 #include <Nazara/Core/Bitset.hpp> 11 #include <Nazara/Core/HandledObject.hpp> 12 #include <NDK/Entity.hpp> 13 #include <NDK/EntityList.hpp> 14 #include <NDK/System.hpp> 25 class NDK_API
World :
public Nz::HandledObject<World>
31 using EntityVector = std::vector<EntityHandle>;
33 inline World(
bool addDefaultSystems =
true);
38 void AddDefaultSystems();
40 inline BaseSystem& AddSystem(std::unique_ptr<BaseSystem>&& system);
41 template<
typename SystemType,
typename... Args> SystemType& AddSystem(Args&&... args);
44 inline EntityVector CreateEntities(
unsigned int count);
46 void Clear() noexcept;
51 inline BaseSystem& GetSystem(SystemIndex index);
52 template<
typename SystemType> SystemType& GetSystem();
54 inline bool HasSystem(SystemIndex index)
const;
55 template<
typename SystemType>
bool HasSystem()
const;
57 inline void KillEntity(
Entity* entity);
58 inline void KillEntities(
const EntityVector& list);
60 inline bool IsEntityValid(
const Entity* entity)
const;
61 inline bool IsEntityIdValid(EntityId
id)
const;
63 inline void RemoveAllSystems();
64 inline void RemoveSystem(SystemIndex index);
65 template<
typename SystemType>
void RemoveSystem();
68 inline void Update(
float elapsedTime);
71 inline World& operator=(
World&& world) noexcept;
74 inline void Invalidate();
75 inline void Invalidate(EntityId
id);
76 inline void InvalidateSystemOrder();
77 void ReorderSystems();
87 EntityBlock(EntityBlock&& block) =
default;
93 std::vector<std::unique_ptr<BaseSystem>> m_systems;
94 std::vector<BaseSystem*> m_orderedSystems;
95 std::vector<EntityBlock> m_entities;
96 std::vector<EntityBlock*> m_entityBlocks;
97 std::vector<std::unique_ptr<EntityBlock>> m_waitingEntities;
98 std::vector<EntityId> m_freeIdList;
102 bool m_orderedSystemsUpdated;
106 #include <NDK/World.inl> 108 #endif // NDK_WORLD_HPP TODO: For now is unable to display different color in the history, it needs a RichTextDrawer to do so...
Definition: Algorithm.hpp:12
NDK class that represents an entity in a world.
Definition: Entity.hpp:28
NDK class that represents the common base of all systems.
Definition: BaseSystem.hpp:17
NDK class that represents a set of entities to help performing batch operations.
Definition: EntityList.hpp:16
NDK class that represents a world.
Definition: World.hpp:25