Sdk: Add server-side module
Former-commit-id: 4df27d1e44d791aad234d095af08ae3c19660fba
This commit is contained in:
parent
4c72e27784
commit
cfe7c79991
|
|
@ -13,64 +13,80 @@
|
|||
#include <Nazara/Utility/Utility.hpp>
|
||||
#include <NDK/Algorithm.hpp>
|
||||
#include <NDK/BaseSystem.hpp>
|
||||
#include <NDK/Components/CameraComponent.hpp>
|
||||
#include <NDK/Components/CollisionComponent.hpp>
|
||||
#include <NDK/Components/LightComponent.hpp>
|
||||
#include <NDK/Components/ListenerComponent.hpp>
|
||||
#include <NDK/Components/GraphicsComponent.hpp>
|
||||
#include <NDK/Components/NodeComponent.hpp>
|
||||
#include <NDK/Components/PhysicsComponent.hpp>
|
||||
#include <NDK/Components/VelocityComponent.hpp>
|
||||
#include <NDK/Systems/ListenerSystem.hpp>
|
||||
#include <NDK/Systems/PhysicsSystem.hpp>
|
||||
#include <NDK/Systems/RenderSystem.hpp>
|
||||
#include <NDK/Systems/VelocitySystem.hpp>
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
#include <NDK/Components/CameraComponent.hpp>
|
||||
#include <NDK/Components/LightComponent.hpp>
|
||||
#include <NDK/Components/ListenerComponent.hpp>
|
||||
#include <NDK/Components/GraphicsComponent.hpp>
|
||||
#include <NDK/Systems/ListenerSystem.hpp>
|
||||
#include <NDK/Systems/RenderSystem.hpp>
|
||||
#endif
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
bool Sdk::Initialize()
|
||||
{
|
||||
if (s_referenceCounter++ > 0)
|
||||
return true; // Déjà initialisé
|
||||
return true; // Already initialized
|
||||
|
||||
try
|
||||
{
|
||||
Nz::ErrorFlags errFlags(Nz::ErrorFlag_ThrowException, true);
|
||||
|
||||
// Initialisation du moteur
|
||||
// Initialize the engine first
|
||||
|
||||
// Modules clients
|
||||
Nz::Audio::Initialize();
|
||||
Nz::Graphics::Initialize();
|
||||
|
||||
// Modules serveurs
|
||||
// Shared modules
|
||||
Nz::Lua::Initialize();
|
||||
Nz::Noise::Initialize();
|
||||
Nz::Physics::Initialize();
|
||||
Nz::Utility::Initialize();
|
||||
|
||||
// Initialisation du SDK
|
||||
#ifndef NDK_SERVER
|
||||
// Client modules
|
||||
Nz::Audio::Initialize();
|
||||
Nz::Graphics::Initialize();
|
||||
#endif
|
||||
|
||||
// Initialisation des composants et systèmes
|
||||
// SDK Initialization
|
||||
|
||||
// Components
|
||||
BaseComponent::Initialize();
|
||||
BaseSystem::Initialize();
|
||||
|
||||
// Composants
|
||||
InitializeComponent<CameraComponent>("NdkCam");
|
||||
// Shared components
|
||||
InitializeComponent<CollisionComponent>("NdkColli");
|
||||
InitializeComponent<LightComponent>("NdkLight");
|
||||
InitializeComponent<ListenerComponent>("NdkList");
|
||||
InitializeComponent<GraphicsComponent>("NdkGfx");
|
||||
InitializeComponent<NodeComponent>("NdkNode");
|
||||
InitializeComponent<PhysicsComponent>("NdkPhys");
|
||||
InitializeComponent<VelocityComponent>("NdkVeloc");
|
||||
|
||||
// Systèmes
|
||||
InitializeSystem<ListenerSystem>();
|
||||
#ifndef NDK_SERVER
|
||||
// Client components
|
||||
InitializeComponent<CameraComponent>("NdkCam");
|
||||
InitializeComponent<LightComponent>("NdkLight");
|
||||
InitializeComponent<ListenerComponent>("NdkList");
|
||||
InitializeComponent<GraphicsComponent>("NdkGfx");
|
||||
#endif
|
||||
|
||||
// Systems
|
||||
|
||||
BaseSystem::Initialize();
|
||||
|
||||
// Shared systems
|
||||
InitializeSystem<PhysicsSystem>();
|
||||
InitializeSystem<RenderSystem>();
|
||||
InitializeSystem<VelocitySystem>();
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
// Client systems
|
||||
InitializeSystem<ListenerSystem>();
|
||||
InitializeSystem<RenderSystem>();
|
||||
#endif
|
||||
|
||||
NazaraNotice("Initialized: SDK");
|
||||
return true;
|
||||
}
|
||||
|
|
@ -86,23 +102,25 @@ namespace Ndk
|
|||
{
|
||||
if (s_referenceCounter != 1)
|
||||
{
|
||||
// Le module est soit encore utilisé, soit pas initialisé
|
||||
// Either the module is not initialized, either it was initialized multiple times
|
||||
if (s_referenceCounter > 1)
|
||||
s_referenceCounter--;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Libération du SDK
|
||||
// Uninitialize the SDK
|
||||
s_referenceCounter = 0;
|
||||
|
||||
// Libération du moteur
|
||||
// Uninitialize the engine
|
||||
|
||||
// Modules clients
|
||||
#ifndef NDK_SERVER
|
||||
// Client modules
|
||||
Nz::Audio::Uninitialize();
|
||||
Nz::Graphics::Uninitialize();
|
||||
#endif
|
||||
|
||||
// Modules serveurs
|
||||
// Shared modules
|
||||
Nz::Lua::Uninitialize();
|
||||
Nz::Noise::Uninitialize();
|
||||
Nz::Physics::Uninitialize();
|
||||
|
|
|
|||
|
|
@ -4,11 +4,14 @@
|
|||
|
||||
#include <NDK/World.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <NDK/Systems/ListenerSystem.hpp>
|
||||
#include <NDK/Systems/PhysicsSystem.hpp>
|
||||
#include <NDK/Systems/RenderSystem.hpp>
|
||||
#include <NDK/Systems/VelocitySystem.hpp>
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
#include <NDK/Systems/ListenerSystem.hpp>
|
||||
#include <NDK/Systems/RenderSystem.hpp>
|
||||
#endif
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
World::~World()
|
||||
|
|
@ -19,10 +22,13 @@ namespace Ndk
|
|||
|
||||
void World::AddDefaultSystems()
|
||||
{
|
||||
AddSystem<ListenerSystem>();
|
||||
AddSystem<PhysicsSystem>();
|
||||
AddSystem<RenderSystem>();
|
||||
AddSystem<VelocitySystem>();
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
AddSystem<ListenerSystem>();
|
||||
AddSystem<RenderSystem>();
|
||||
#endif
|
||||
}
|
||||
|
||||
const EntityHandle& World::CreateEntity()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
TOOL.Name = "SDKServer"
|
||||
|
||||
TOOL.Directory = "../SDK/lib"
|
||||
TOOL.Kind = "Library"
|
||||
|
||||
TOOL.Defines = {
|
||||
"NDK_BUILD",
|
||||
"NDK_SERVER"
|
||||
}
|
||||
|
||||
TOOL.Includes = {
|
||||
"../SDK/include"
|
||||
}
|
||||
|
||||
TOOL.Files = {
|
||||
"../SDK/include/NDK/**.hpp",
|
||||
"../SDK/include/NDK/**.inl",
|
||||
"../SDK/src/NDK/**.hpp",
|
||||
"../SDK/src/NDK/**.inl",
|
||||
"../SDK/src/NDK/**.cpp"
|
||||
}
|
||||
|
||||
-- Exlude client-only files
|
||||
TOOL.FilesExclusion = {
|
||||
"../SDK/**/CameraComponent.*",
|
||||
"../SDK/**/GraphicsComponent.*",
|
||||
"../SDK/**/LightComponent.*",
|
||||
"../SDK/**/ListenerComponent.*",
|
||||
"../SDK/**/ListenerSystem.*",
|
||||
"../SDK/**/RenderSystem.*",
|
||||
"../SDK/**/LuaInterface_Audio.*"
|
||||
}
|
||||
|
||||
TOOL.Libraries = {
|
||||
"NazaraCore",
|
||||
"NazaraLua",
|
||||
"NazaraNoise",
|
||||
"NazaraPhysics",
|
||||
"NazaraUtility"
|
||||
}
|
||||
Loading…
Reference in New Issue