Update for EnTT 3.9
This commit is contained in:
parent
6c35b0be57
commit
f466a7494b
|
|
@ -1,5 +1,4 @@
|
||||||
#include <Nazara/Core.hpp>
|
#include <Nazara/Core.hpp>
|
||||||
#include <Nazara/Core/ECS.hpp>
|
|
||||||
#include <Nazara/Platform.hpp>
|
#include <Nazara/Platform.hpp>
|
||||||
#include <Nazara/Graphics.hpp>
|
#include <Nazara/Graphics.hpp>
|
||||||
#include <Nazara/Graphics/TextSprite.hpp>
|
#include <Nazara/Graphics/TextSprite.hpp>
|
||||||
|
|
@ -38,7 +37,7 @@ int main()
|
||||||
|
|
||||||
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
||||||
|
|
||||||
Nz::Modules<Nz::Graphics, Nz::Physics3D, Nz::ECS, Nz::Widgets> nazara(rendererConfig);
|
Nz::Modules<Nz::Graphics, Nz::Physics3D, Nz::Widgets> nazara(rendererConfig);
|
||||||
|
|
||||||
Nz::RenderWindow window;
|
Nz::RenderWindow window;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
#include <Nazara/Core.hpp>
|
#include <Nazara/Core.hpp>
|
||||||
#include <Nazara/Core/ECS.hpp>
|
|
||||||
#include <Nazara/Platform.hpp>
|
#include <Nazara/Platform.hpp>
|
||||||
#include <Nazara/Graphics.hpp>
|
#include <Nazara/Graphics.hpp>
|
||||||
#include <Nazara/Graphics/TextSprite.hpp>
|
#include <Nazara/Graphics/TextSprite.hpp>
|
||||||
|
|
@ -38,7 +37,7 @@ int main()
|
||||||
|
|
||||||
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
||||||
|
|
||||||
Nz::Modules<Nz::Graphics, Nz::Physics3D, Nz::ECS, Nz::Widgets> nazara(rendererConfig);
|
Nz::Modules<Nz::Graphics, Nz::Physics3D, Nz::Widgets> nazara(rendererConfig);
|
||||||
|
|
||||||
Nz::RenderWindow window;
|
Nz::RenderWindow window;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
#define NAZARA_GRAPHICS_COMPONENTS_GRAPHICSCOMPONENT_HPP
|
||||||
|
|
||||||
#include <Nazara/Prerequisites.hpp>
|
#include <Nazara/Prerequisites.hpp>
|
||||||
#include <Nazara/Core/ECS.hpp>
|
|
||||||
#include <Nazara/Graphics/InstancedRenderable.hpp>
|
#include <Nazara/Graphics/InstancedRenderable.hpp>
|
||||||
#include <Nazara/Graphics/WorldInstance.hpp>
|
#include <Nazara/Graphics/WorldInstance.hpp>
|
||||||
|
#include <entt/entt.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@
|
||||||
#define NAZARA_GRAPHICS_COMPONENTS_LIGHTCOMPONENT_HPP
|
#define NAZARA_GRAPHICS_COMPONENTS_LIGHTCOMPONENT_HPP
|
||||||
|
|
||||||
#include <Nazara/Prerequisites.hpp>
|
#include <Nazara/Prerequisites.hpp>
|
||||||
#include <Nazara/Core/ECS.hpp>
|
|
||||||
#include <Nazara/Graphics/Light.hpp>
|
#include <Nazara/Graphics/Light.hpp>
|
||||||
#include <Nazara/Graphics/WorldInstance.hpp>
|
#include <Nazara/Graphics/WorldInstance.hpp>
|
||||||
|
#include <entt/entt.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@
|
||||||
#define NAZARA_GRAPHICS_SYSTEMS_RENDERSYSTEM_HPP
|
#define NAZARA_GRAPHICS_SYSTEMS_RENDERSYSTEM_HPP
|
||||||
|
|
||||||
#include <Nazara/Prerequisites.hpp>
|
#include <Nazara/Prerequisites.hpp>
|
||||||
#include <Nazara/Core/ECS.hpp>
|
|
||||||
#include <Nazara/Graphics/Graphics.hpp>
|
#include <Nazara/Graphics/Graphics.hpp>
|
||||||
#include <Nazara/Graphics/Components/GraphicsComponent.hpp>
|
#include <Nazara/Graphics/Components/GraphicsComponent.hpp>
|
||||||
#include <Nazara/Graphics/Components/LightComponent.hpp>
|
#include <Nazara/Graphics/Components/LightComponent.hpp>
|
||||||
#include <Nazara/Utility/Node.hpp>
|
#include <Nazara/Utility/Node.hpp>
|
||||||
|
#include <entt/entt.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@
|
||||||
#define NAZARA_PHYSICS3D_SYSTEMS_PHYSICS3DSYSTEM_HPP
|
#define NAZARA_PHYSICS3D_SYSTEMS_PHYSICS3DSYSTEM_HPP
|
||||||
|
|
||||||
#include <Nazara/Prerequisites.hpp>
|
#include <Nazara/Prerequisites.hpp>
|
||||||
#include <Nazara/Core/ECS.hpp>
|
|
||||||
#include <Nazara/Physics3D/PhysWorld3D.hpp>
|
#include <Nazara/Physics3D/PhysWorld3D.hpp>
|
||||||
#include <Nazara/Physics3D/Components/RigidBody3DComponent.hpp>
|
#include <Nazara/Physics3D/Components/RigidBody3DComponent.hpp>
|
||||||
|
#include <entt/entt.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
#define NAZARA_UTILITY_COMPONENTS_NODECOMPONENT_HPP
|
#define NAZARA_UTILITY_COMPONENTS_NODECOMPONENT_HPP
|
||||||
|
|
||||||
#include <Nazara/Prerequisites.hpp>
|
#include <Nazara/Prerequisites.hpp>
|
||||||
#include <Nazara/Core/ECS.hpp>
|
|
||||||
#include <Nazara/Utility/Node.hpp>
|
#include <Nazara/Utility/Node.hpp>
|
||||||
|
#include <entt/entt.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@
|
||||||
#define NAZARA_WIDGETS_HPP
|
#define NAZARA_WIDGETS_HPP
|
||||||
|
|
||||||
#include <Nazara/Prerequisites.hpp>
|
#include <Nazara/Prerequisites.hpp>
|
||||||
#include <Nazara/Core/ECS.hpp>
|
|
||||||
#include <Nazara/Core/ModuleBase.hpp>
|
#include <Nazara/Core/ModuleBase.hpp>
|
||||||
#include <Nazara/Graphics/Graphics.hpp>
|
#include <Nazara/Graphics/Graphics.hpp>
|
||||||
#include <Nazara/Widgets/Config.hpp>
|
#include <Nazara/Widgets/Config.hpp>
|
||||||
|
#include <entt/entt.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
|
@ -23,7 +23,7 @@ namespace Nz
|
||||||
friend ModuleBase;
|
friend ModuleBase;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Dependencies = TypeList<ECS, Graphics>;
|
using Dependencies = TypeList<Graphics>;
|
||||||
|
|
||||||
struct Config;
|
struct Config;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +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 <Nazara/Core/Debug.hpp>
|
|
||||||
|
|
||||||
namespace Nz
|
|
||||||
{
|
|
||||||
NAZARA_CORE_API ECS* ECS::s_instance = nullptr;
|
|
||||||
}
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Graphics/Graphics.hpp>
|
#include <Nazara/Graphics/Graphics.hpp>
|
||||||
#include <Nazara/Core/ECS.hpp>
|
|
||||||
#include <Nazara/Graphics/GuillotineTextureAtlas.hpp>
|
#include <Nazara/Graphics/GuillotineTextureAtlas.hpp>
|
||||||
#include <Nazara/Graphics/MaterialPipeline.hpp>
|
#include <Nazara/Graphics/MaterialPipeline.hpp>
|
||||||
#include <Nazara/Graphics/PredefinedShaderStructs.hpp>
|
#include <Nazara/Graphics/PredefinedShaderStructs.hpp>
|
||||||
|
|
@ -29,8 +28,6 @@ namespace Nz
|
||||||
ModuleBase("Graphics", this),
|
ModuleBase("Graphics", this),
|
||||||
m_preferredDepthStencilFormat(PixelFormat::Undefined)
|
m_preferredDepthStencilFormat(PixelFormat::Undefined)
|
||||||
{
|
{
|
||||||
ECS::RegisterComponents();
|
|
||||||
|
|
||||||
Renderer* renderer = Renderer::Instance();
|
Renderer* renderer = Renderer::Instance();
|
||||||
|
|
||||||
const std::vector<RenderDeviceInfo>& renderDeviceInfo = renderer->QueryRenderDevices();
|
const std::vector<RenderDeviceInfo>& renderDeviceInfo = renderer->QueryRenderDevices();
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include <Nazara/Physics3D/Physics3D.hpp>
|
#include <Nazara/Physics3D/Physics3D.hpp>
|
||||||
#include <Nazara/Core/Core.hpp>
|
#include <Nazara/Core/Core.hpp>
|
||||||
#include <Nazara/Core/ECS.hpp>
|
|
||||||
#include <Nazara/Core/Error.hpp>
|
#include <Nazara/Core/Error.hpp>
|
||||||
#include <Nazara/Core/Log.hpp>
|
#include <Nazara/Core/Log.hpp>
|
||||||
#include <Nazara/Physics3D/Collider3D.hpp>
|
#include <Nazara/Physics3D/Collider3D.hpp>
|
||||||
|
|
@ -17,7 +16,6 @@ namespace Nz
|
||||||
Physics3D::Physics3D(Config /*config*/) :
|
Physics3D::Physics3D(Config /*config*/) :
|
||||||
ModuleBase("Physics3D", this)
|
ModuleBase("Physics3D", this)
|
||||||
{
|
{
|
||||||
ECS::RegisterComponents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Physics3D::GetMemoryUsed()
|
unsigned int Physics3D::GetMemoryUsed()
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
#include <Nazara/Utility/Utility.hpp>
|
#include <Nazara/Utility/Utility.hpp>
|
||||||
#include <Nazara/Core/CallOnExit.hpp>
|
#include <Nazara/Core/CallOnExit.hpp>
|
||||||
#include <Nazara/Core/Core.hpp>
|
#include <Nazara/Core/Core.hpp>
|
||||||
#include <Nazara/Core/ECS.hpp>
|
|
||||||
#include <Nazara/Core/Error.hpp>
|
#include <Nazara/Core/Error.hpp>
|
||||||
#include <Nazara/Utility/Animation.hpp>
|
#include <Nazara/Utility/Animation.hpp>
|
||||||
#include <Nazara/Utility/Buffer.hpp>
|
#include <Nazara/Utility/Buffer.hpp>
|
||||||
|
|
@ -40,8 +39,6 @@ namespace Nz
|
||||||
Utility::Utility(Config /*config*/) :
|
Utility::Utility(Config /*config*/) :
|
||||||
ModuleBase("Utility", this)
|
ModuleBase("Utility", this)
|
||||||
{
|
{
|
||||||
ECS::RegisterComponents();
|
|
||||||
|
|
||||||
if (!Font::Initialize())
|
if (!Font::Initialize())
|
||||||
throw std::runtime_error("failed to initialize fonts");
|
throw std::runtime_error("failed to initialize fonts");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,9 @@ namespace Nz
|
||||||
* \class Nz::Widgets
|
* \class Nz::Widgets
|
||||||
* \brief Widgets class that represents the module initializer of Widgets
|
* \brief Widgets class that represents the module initializer of Widgets
|
||||||
*/
|
*/
|
||||||
Widgets::Widgets(Config config) :
|
Widgets::Widgets(Config /*config*/) :
|
||||||
ModuleBase("Widgets", this)
|
ModuleBase("Widgets", this)
|
||||||
{
|
{
|
||||||
ECS::RegisterComponents();
|
|
||||||
|
|
||||||
CreateDefaultMaterials();
|
CreateDefaultMaterials();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ set_xmakever("2.6.3")
|
||||||
|
|
||||||
add_repositories("local-repo xmake-repo")
|
add_repositories("local-repo xmake-repo")
|
||||||
|
|
||||||
add_requires("chipmunk2d", "dr_wav", "entt", "kiwisolver", "libflac", "libsdl", "minimp3", "stb")
|
add_requires("chipmunk2d", "dr_wav", "entt >=3.9", "kiwisolver", "libflac", "libsdl", "minimp3", "stb")
|
||||||
add_requires("freetype", { configs = { bzip2 = true, png = true, woff2 = true, zlib = true, debug = is_mode("debug") } })
|
add_requires("freetype", { configs = { bzip2 = true, png = true, woff2 = true, zlib = true, debug = is_mode("debug") } })
|
||||||
add_requires("libvorbis", { configs = { with_vorbisenc = false } })
|
add_requires("libvorbis", { configs = { with_vorbisenc = false } })
|
||||||
add_requires("openal-soft", { configs = { shared = true }})
|
add_requires("openal-soft", { configs = { shared = true }})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue