window now stores application pointer (remove needs for singleton)

This commit is contained in:
SweetId 2023-10-08 22:29:00 -04:00
parent efadea76ae
commit c64e015ce1
2 changed files with 7 additions and 3 deletions

View File

@ -8,11 +8,13 @@ namespace Nz
{ {
using ActionCallback = std::function<void(void)>; using ActionCallback = std::function<void(void)>;
class EditorBaseApplication;
class NAZARAEDITOR_CORE_API EditorWindow class NAZARAEDITOR_CORE_API EditorWindow
: private Nz::ImguiHandler : private Nz::ImguiHandler
{ {
public: public:
EditorWindow(const std::string& name = ""); EditorWindow(EditorBaseApplication* app, const std::string& name = "");
~EditorWindow(); ~EditorWindow();
EditorWindow(const EditorWindow&) = delete; EditorWindow(const EditorWindow&) = delete;
@ -29,6 +31,7 @@ namespace Nz
private: private:
void DrawMenus(); void DrawMenus();
EditorBaseApplication* m_application;
std::string m_windowName; std::string m_windowName;
struct MenuAction struct MenuAction

View File

@ -4,8 +4,9 @@
namespace Nz namespace Nz
{ {
EditorWindow::EditorWindow(const std::string& name) EditorWindow::EditorWindow(EditorBaseApplication* app, const std::string& name)
: m_windowName(name) : m_application(app)
, m_windowName(name)
{ {
Nz::Imgui::Instance()->AddHandler(this); Nz::Imgui::Instance()->AddHandler(this);
} }