add imgui support

This commit is contained in:
2024-08-07 15:01:42 +02:00
parent e0d4dd053f
commit 2df849b63e
9 changed files with 186 additions and 5 deletions

View File

@@ -7,6 +7,7 @@
#include <Nazara/Platform.hpp>
#include <Nazara/Renderer.hpp>
#include <Nazara/Widgets.hpp>
#include <NazaraImgui/NazaraImgui.hpp>
#include <client/states/MainMenuState.h>
#include <random>
@@ -36,11 +37,15 @@ ClientApp::ClientApp(Nz::ApplicationBase& app) : Nz::ApplicationComponent(app),
auto renderTarget = std::make_shared<Nz::RenderWindow>(windowSwapchain);
Nz::Imgui::Instance()->Init(*m_Window, false);
auto passList = Nz::PipelinePassList::LoadFromFile("assets/example.passlist");
entt::handle cameraEntity = world.CreateEntity();
{
cameraEntity.emplace<Nz::NodeComponent>();
auto& cameraComponent = cameraEntity.emplace<Nz::CameraComponent>(renderTarget, Nz::ProjectionType::Orthographic);
auto& cameraComponent = cameraEntity.emplace<Nz::CameraComponent>(renderTarget, passList, Nz::ProjectionType::Orthographic);
cameraComponent.UpdateClearColor(Nz::Color(0.0f, 0.f, .0f, 0.0f));
cameraComponent.UpdateRenderMask(RenderMaskUI);
@@ -52,6 +57,7 @@ ClientApp::ClientApp(Nz::ApplicationBase& app) : Nz::ApplicationComponent(app),
m_StateData->m_AppComponent = this;
m_StateData->m_RenderTarget = renderTarget;
m_StateData->m_Window = m_Window;
m_StateData->m_Swapchain = &windowSwapchain;
m_StateData->m_World = &world;
m_StateData->m_Canvas.emplace(
world.GetRegistry(), m_Window->GetEventHandler(), m_Window->GetCursorController().CreateHandle(), RenderMaskUI);