instantiate EditorCameraSystem and add EditorCameraComponent to main camera

This commit is contained in:
SweetId 2023-11-20 15:01:13 +05:30
parent 47490ed586
commit 00d1c0089c
1 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,7 @@
#include <NazaraEditor/Core/Application/BaseApplication.hpp>
#include <NazaraEditor/Core/Components/CameraComponent.hpp>
#include <NazaraEditor/Core/Components/NameComponent.hpp>
#include <NazaraEditor/Core/Systems/CameraSystem.hpp>
namespace Nz
{
@ -84,6 +86,8 @@ namespace Nz
bool bRes = m_level.CreateNewLevel();
if (bRes)
{
m_level.GetEnttWorld()->AddSystem<EditorCameraSystem>();
// configure camera
m_mainCamera = CreateEntity("MainCamera");
auto& cmp = m_mainCamera.get<Nz::EditorNameComponent>();
@ -93,6 +97,8 @@ namespace Nz
cameraComponent.UpdateFOV(70.f);
cameraComponent.UpdateClearColor(Nz::Color(0.46f, 0.48f, 0.84f, 1.f));
auto& editorcam = m_mainCamera.emplace<Nz::EditorCameraComponent>();
OnLevelChanged(m_level);
}
return bRes;