Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
PhysicsSystem2D.hpp
1 // Copyright (C) 2017 Jérôme Leclercq
2 // This file is part of the "Nazara Development Kit"
3 // For conditions of distribution and use, see copyright notice in Prerequesites.hpp
4 
5 #pragma once
6 
7 #ifndef NDK_SYSTEMS_PHYSICSSYSTEM2D_HPP
8 #define NDK_SYSTEMS_PHYSICSSYSTEM2D_HPP
9 
10 #include <Nazara/Physics2D/PhysWorld2D.hpp>
11 #include <NDK/EntityList.hpp>
12 #include <NDK/System.hpp>
13 #include <memory>
14 
15 namespace Ndk
16 {
17  class NDK_API PhysicsSystem2D : public System<PhysicsSystem2D>
18  {
19  public:
21  PhysicsSystem2D(const PhysicsSystem2D& system);
22  ~PhysicsSystem2D() = default;
23 
24  Nz::PhysWorld2D& GetWorld();
25  const Nz::PhysWorld2D& GetWorld() const;
26 
27  static SystemIndex systemIndex;
28 
29  private:
30  void CreatePhysWorld() const;
31  void OnEntityValidation(Entity* entity, bool justAdded) override;
32  void OnUpdate(float elapsedTime) override;
33 
34  EntityList m_dynamicObjects;
35  EntityList m_staticObjects;
36  mutable std::unique_ptr<Nz::PhysWorld2D> m_world;
37  };
38 }
39 
40 #include <NDK/Systems/PhysicsSystem2D.inl>
41 
42 #endif // NDK_SYSTEMS_PHYSICSSYSTEM2D_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 a two-dimensional physics system.
Definition: PhysicsSystem2D.hpp:17
NDK class that represents a set of entities to help performing batch operations.
Definition: EntityList.hpp:16