From 1cedfc04193eb64bbb909a2bcee3bfbb9cfb8752 Mon Sep 17 00:00:00 2001 From: SweetId <2630750+SweetId@users.noreply.github.com> Date: Sun, 8 Oct 2023 22:32:28 -0400 Subject: [PATCH] remove application code since it migrated in Core --- include/NazaraEditor/Editor/Application.hpp | 48 +------------ src/NazaraEditor/Editor/Application.cpp | 76 --------------------- 2 files changed, 3 insertions(+), 121 deletions(-) diff --git a/include/NazaraEditor/Editor/Application.hpp b/include/NazaraEditor/Editor/Application.hpp index 67e2ac6..85404d4 100644 --- a/include/NazaraEditor/Editor/Application.hpp +++ b/include/NazaraEditor/Editor/Application.hpp @@ -1,51 +1,9 @@ #pragma once -#include -#include -#include -#include -#include - #include -#include -namespace Nz +class EditorApplication + : public Nz::EditorBaseApplication { - class EditorApplication - : public Nz::Application - { - public: - NazaraSignal(OnWorldChanged, Nz::EnttWorld*); - // Entity lifetime events - NazaraSignal(OnEntityCreated, entt::handle); - NazaraSignal(OnEntityDestroyed, entt::handle); - NazaraSignal(OnEntityParentChanged, entt::handle); - - // Entity selection events - NazaraSignal(OnEntitySelected, entt::handle); - NazaraSignal(OnEntityDeselected, entt::handle); - - static EditorApplication& Instance(); - - void NewWorld(); - Nz::EnttWorld* GetCurrentWorld(); - - entt::handle CreateEntity(); - - template - void RegisterWindow() - { - static_assert(std::is_base_of::value, "Register Window should be called with a subclass of Nz::EditorWindow"); - m_windows.push_back(std::make_unique()); - } - - private: - EditorApplication(); - - std::unique_ptr m_windowSwapchain; - Nz::EnttWorld* m_world; - - std::vector> m_windows; - }; -} \ No newline at end of file +}; \ No newline at end of file diff --git a/src/NazaraEditor/Editor/Application.cpp b/src/NazaraEditor/Editor/Application.cpp index e61f79e..e69de29 100644 --- a/src/NazaraEditor/Editor/Application.cpp +++ b/src/NazaraEditor/Editor/Application.cpp @@ -1,76 +0,0 @@ -#include - -namespace Nz -{ - EditorApplication::EditorApplication() - : m_world(nullptr) - { - auto& windowing = AddComponent(); - - std::shared_ptr device = Nz::Graphics::Instance()->GetRenderDevice(); - - std::string windowTitle = "Nazara Editor"; - Nz::Window& window = windowing.CreateWindow(Nz::VideoMode(1280, 720, 32), windowTitle); - m_windowSwapchain = std::make_unique(device, window); - - // connect basic handler - window.GetEventHandler().OnQuit.Connect([&window](const auto* handler) { - NazaraUnused(handler); - window.Close(); - }); - - AddComponent(); - - Nz::Imgui::Instance()->Init(window); - ImGui::EnsureContextOnThisThread(); - - NewWorld(); - - AddUpdaterFunc(Interval{ Nz::Time::Milliseconds(16) }, [&](Nz::Time elapsed) { - if (!window.IsOpen()) - return; - - window.ProcessEvents(); - - Nz::RenderFrame frame = m_windowSwapchain->AcquireFrame(); - if (!frame) - return; - - Nz::Imgui::Instance()->Update(window, elapsed.AsSeconds()); - - Nz::Imgui::Instance()->Render(m_windowSwapchain.get(), frame); - - frame.Present(); - }); - } - - EditorApplication& EditorApplication::Instance() - { - static EditorApplication e; - return e; - } - - Nz::EnttWorld* EditorApplication::GetCurrentWorld() - { - return m_world; - } - - entt::handle EditorApplication::CreateEntity() - { - if (m_world == nullptr) - return {}; - - entt::handle entity = m_world->CreateEntity(); - entity.emplace(); - - OnEntityCreated(entity); - OnEntitySelected(entity); - return entity; - } - - void EditorApplication::NewWorld() - { - auto& ecs = GetComponent(); - m_world = &ecs.AddWorld(); - } -} \ No newline at end of file