Sdk/PhysicsSystem: Create PhysWorld only if required by entities

This commit is contained in:
Lynix
2016-10-13 05:29:48 +02:00
parent 9f771f8c01
commit debf87e739
3 changed files with 13 additions and 6 deletions

View File

@@ -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?)
};
}

View File

@@ -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;
}
}