From c64e015ce1fd47e8078df39c80f2386a36837a5f Mon Sep 17 00:00:00 2001 From: SweetId <2630750+SweetId@users.noreply.github.com> Date: Sun, 8 Oct 2023 22:29:00 -0400 Subject: [PATCH] window now stores application pointer (remove needs for singleton) --- include/NazaraEditor/Core/UI/Window.hpp | 5 ++++- src/NazaraEditor/Core/UI/Window.cpp | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/NazaraEditor/Core/UI/Window.hpp b/include/NazaraEditor/Core/UI/Window.hpp index c53a4bc..680e2c2 100644 --- a/include/NazaraEditor/Core/UI/Window.hpp +++ b/include/NazaraEditor/Core/UI/Window.hpp @@ -8,11 +8,13 @@ namespace Nz { using ActionCallback = std::function; + class EditorBaseApplication; + class NAZARAEDITOR_CORE_API EditorWindow : private Nz::ImguiHandler { public: - EditorWindow(const std::string& name = ""); + EditorWindow(EditorBaseApplication* app, const std::string& name = ""); ~EditorWindow(); EditorWindow(const EditorWindow&) = delete; @@ -29,6 +31,7 @@ namespace Nz private: void DrawMenus(); + EditorBaseApplication* m_application; std::string m_windowName; struct MenuAction diff --git a/src/NazaraEditor/Core/UI/Window.cpp b/src/NazaraEditor/Core/UI/Window.cpp index 9d770b5..e120fa9 100644 --- a/src/NazaraEditor/Core/UI/Window.cpp +++ b/src/NazaraEditor/Core/UI/Window.cpp @@ -4,8 +4,9 @@ namespace Nz { - EditorWindow::EditorWindow(const std::string& name) - : m_windowName(name) + EditorWindow::EditorWindow(EditorBaseApplication* app, const std::string& name) + : m_application(app) + , m_windowName(name) { Nz::Imgui::Instance()->AddHandler(this); }