Rework EnTT integration

- Update EnTT to 3.11.1
- Moved EnTT wrapper to EnTTWorld, inheriting EntityWorld
- AppEntitySystemComponent can now handles multiple EntityWorld
- Headers relying on EnTT are now automatically included if NAZARA_ENTT is defined
- Renamed SystemGraph to EnttSystemGraph (as it depends on it for now)
This commit is contained in:
SirLynix
2023-01-28 18:16:10 +01:00
committed by Jérôme Leclercq
parent d5f281a768
commit 97fa4d98be
52 changed files with 361 additions and 191 deletions

View File

@@ -1,15 +1,10 @@
// Sources pour https://github.com/NazaraEngine/NazaraEngine/wiki/(FR)-Tutoriel:-%5B02%5D-Gestion-des-événements
#include <Nazara/Core/Application.hpp>
#include <Nazara/Core/AppEntitySystemComponent.hpp>
#include <Nazara/Core/Systems.hpp>
#include <Nazara/Core.hpp>
#include <Nazara/Graphics.hpp>
#include <Nazara/Graphics/Components.hpp>
#include <Nazara/Graphics/Systems.hpp>
#include <Nazara/Platform/AppWindowingComponent.hpp>
#include <Nazara/Renderer.hpp>
#include <Nazara/Utility.hpp>
#include <Nazara/Utility/Components.hpp>
#include <iostream>
int main()
@@ -20,11 +15,12 @@ int main()
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1280, 720), "Tut02 - Hello world");
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
auto& world = ecs.AddWorld<Nz::EnttWorld>();
Nz::RenderSystem& renderSystem = ecs.AddSystem<Nz::RenderSystem>();
Nz::RenderSystem& renderSystem = world.AddSystem<Nz::RenderSystem>();
auto& windowSwapchain = renderSystem.CreateSwapchain(mainWindow);
entt::handle cameraEntity = ecs.CreateEntity();
entt::handle cameraEntity = world.CreateEntity();
{
cameraEntity.emplace<Nz::NodeComponent>();
@@ -40,7 +36,7 @@ int main()
std::shared_ptr<Nz::TextSprite> textSprite = std::make_shared<Nz::TextSprite>();
textSprite->Update(textDrawer);
entt::handle textEntity = ecs.CreateEntity();
entt::handle textEntity = world.CreateEntity();
{
auto& nodeComponent = textEntity.emplace<Nz::NodeComponent>();
auto& gfxComponent = textEntity.emplace<Nz::GraphicsComponent>();