Update for EnTT 3.9
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_CORE_ECS_HPP
|
||||
#define NAZARA_CORE_ECS_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Core.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class CameraComponent;
|
||||
class GraphicsComponent;
|
||||
class NodeComponent;
|
||||
class RigidBody3DComponent;
|
||||
|
||||
class ECS : public ModuleBase<ECS>
|
||||
{
|
||||
friend ModuleBase;
|
||||
friend class Audio;
|
||||
friend class Graphics;
|
||||
friend class Physics2D;
|
||||
friend class Physics3D;
|
||||
friend class Utility;
|
||||
friend class Widgets;
|
||||
|
||||
public:
|
||||
using Dependencies = TypeList<Core>;
|
||||
|
||||
struct Config {};
|
||||
|
||||
inline ECS(Config /*config*/);
|
||||
~ECS() = default;
|
||||
|
||||
private:
|
||||
static inline void RegisterComponents();
|
||||
|
||||
NAZARA_CORE_API static ECS* s_instance;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Core/ECS.inl>
|
||||
|
||||
#endif // NAZARA_CORE_ECS_HPP
|
||||
@@ -1,42 +0,0 @@
|
||||
// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/ECS.hpp>
|
||||
#include <stdexcept>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
namespace Detail
|
||||
{
|
||||
template<typename T>
|
||||
struct RegisterComponent
|
||||
{
|
||||
void operator()(entt::id_type& expectedId)
|
||||
{
|
||||
if (entt::type_seq<T>() != expectedId++)
|
||||
throw std::runtime_error(std::string(entt::type_name<T>::value()) + " has wrong index, please initialize Nazara ECS before instancing your own components");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/*!
|
||||
* \ingroup core
|
||||
* \class Nz::ECS
|
||||
* \brief Core class that represents the ECS module
|
||||
*/
|
||||
inline ECS::ECS(Config /*config*/) :
|
||||
ModuleBase("ECS", this)
|
||||
{
|
||||
RegisterComponents();
|
||||
}
|
||||
|
||||
inline void ECS::RegisterComponents()
|
||||
{
|
||||
entt::id_type expectedId = 0;
|
||||
TypeListApply<TypeList<NodeComponent, CameraComponent, GraphicsComponent, RigidBody3DComponent>, Detail::RegisterComponent>(expectedId);
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
@@ -8,9 +8,9 @@
|
||||
#define NAZARA_GRAPHICS_COMPONENTS_GRAPHICSCOMPONENT_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/ECS.hpp>
|
||||
#include <Nazara/Graphics/InstancedRenderable.hpp>
|
||||
#include <Nazara/Graphics/WorldInstance.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#define NAZARA_GRAPHICS_COMPONENTS_LIGHTCOMPONENT_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/ECS.hpp>
|
||||
#include <Nazara/Graphics/Light.hpp>
|
||||
#include <Nazara/Graphics/WorldInstance.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#define NAZARA_GRAPHICS_SYSTEMS_RENDERSYSTEM_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/ECS.hpp>
|
||||
#include <Nazara/Graphics/Graphics.hpp>
|
||||
#include <Nazara/Graphics/Components/GraphicsComponent.hpp>
|
||||
#include <Nazara/Graphics/Components/LightComponent.hpp>
|
||||
#include <Nazara/Utility/Node.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#define NAZARA_PHYSICS3D_SYSTEMS_PHYSICS3DSYSTEM_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/ECS.hpp>
|
||||
#include <Nazara/Physics3D/PhysWorld3D.hpp>
|
||||
#include <Nazara/Physics3D/Components/RigidBody3DComponent.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#define NAZARA_UTILITY_COMPONENTS_NODECOMPONENT_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/ECS.hpp>
|
||||
#include <Nazara/Utility/Node.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#define NAZARA_WIDGETS_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/ECS.hpp>
|
||||
#include <Nazara/Core/ModuleBase.hpp>
|
||||
#include <Nazara/Graphics/Graphics.hpp>
|
||||
#include <Nazara/Widgets/Config.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -23,7 +23,7 @@ namespace Nz
|
||||
friend ModuleBase;
|
||||
|
||||
public:
|
||||
using Dependencies = TypeList<ECS, Graphics>;
|
||||
using Dependencies = TypeList<Graphics>;
|
||||
|
||||
struct Config;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user