Sdk/PhysicsSystem: Create PhysWorld only if required by entities
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <Nazara/Physics/PhysWorld.hpp>
|
||||
#include <NDK/EntityList.hpp>
|
||||
#include <NDK/System.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
@@ -31,7 +32,7 @@ namespace Ndk
|
||||
|
||||
EntityList m_dynamicObjects;
|
||||
EntityList m_staticObjects;
|
||||
Nz::PhysWorld m_world;
|
||||
std::unique_ptr<Nz::PhysWorld> m_world; ///TODO: std::optional (Should I make a Nz::Optional class?)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Ndk
|
||||
|
||||
inline Nz::PhysWorld& PhysicsSystem::GetWorld()
|
||||
{
|
||||
return m_world;
|
||||
return *m_world;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -21,6 +21,6 @@ namespace Ndk
|
||||
|
||||
inline const Nz::PhysWorld& PhysicsSystem::GetWorld() const
|
||||
{
|
||||
return m_world;
|
||||
return *m_world;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user