Last modules fixes

This commit is contained in:
Jérôme Leclercq
2020-09-17 18:54:33 +02:00
parent 631aeb77a2
commit 98e20ecbb7
15 changed files with 95 additions and 163 deletions

View File

@@ -23,11 +23,6 @@ namespace Ndk
{
NazaraAssert(s_application == nullptr, "You can create only one application instance per program");
s_application = this;
Nz::ErrorFlags errFlags(Nz::ErrorFlag_ThrowException, true);
// Initialisation du SDK
Sdk::Initialize();
}
/*!
@@ -42,9 +37,6 @@ namespace Ndk
m_windows.clear();
#endif
// Free of SDK
Sdk::Uninitialize();
// Automatic free of modules
s_application = nullptr;
}

View File

@@ -7,22 +7,41 @@
#ifndef NDK_SDK_HPP
#define NDK_SDK_HPP
#include <Nazara/Core/ModuleBase.hpp>
#include <Nazara/Core/TypeList.hpp>
#include <NazaraSDK/Prerequisites.hpp>
#include <Nazara/Network/Network.hpp>
#include <Nazara/Physics2D/Physics2D.hpp>
#include <Nazara/Physics3D/Physics3D.hpp>
#include <Nazara/Shader/Shader.hpp>
#include <Nazara/Utility/Utility.hpp>
#ifndef NDK_SERVER
#include <Nazara/Audio/Audio.hpp>
#include <Nazara/Renderer/Renderer.hpp>
#endif
namespace Ndk
{
class NDK_API Sdk
class NDK_API Sdk : public Nz::ModuleBase<Sdk>
{
public:
Sdk() = delete;
~Sdk() = delete;
friend ModuleBase;
static bool Initialize();
static bool IsInitialized();
static void Uninitialize();
public:
using CommonDependencies = Nz::TypeList<Nz::Network, Nz::Physics2D, Nz::Physics3D, Nz::Utility>;
#ifdef NDK_SERVER
using Dependencies = CommonDependencies;
#else
using ClientDependencies = Nz::TypeList<Nz::Audio, Nz::Renderer>;
using Dependencies = Nz::TypeListConcat<CommonDependencies, ClientDependencies>;
#endif
Sdk();
~Sdk();
private:
static unsigned int s_referenceCounter;
static Sdk* s_instance;
};
}

View File

@@ -4,13 +4,4 @@
namespace Ndk
{
/*!
* \brief Checks whether the module is initialized
* \return true if module is initialized
*/
inline bool Sdk::IsInitialized()
{
return s_referenceCounter != 0;
}
}