bit of renaming
This commit is contained in:
parent
d04860ed4b
commit
a15e5e823d
|
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
#include <NazaraEditor/Core/UI/Window.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARAEDITOR_CORE_API EditorMainWindow
|
||||
: public EditorWindow
|
||||
{
|
||||
public:
|
||||
EditorMainWindow(EditorBaseApplication* app, const std::string& name = "");
|
||||
virtual ~EditorMainWindow() = default;
|
||||
|
||||
protected:
|
||||
virtual void OnRenderImgui() override;
|
||||
};
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ namespace Nz
|
|||
{
|
||||
public:
|
||||
EditorWindow(EditorBaseApplication* app, const std::string& name = "");
|
||||
~EditorWindow();
|
||||
virtual ~EditorWindow();
|
||||
|
||||
EditorWindow(const EditorWindow&) = delete;
|
||||
EditorWindow& operator=(const EditorWindow&) = delete;
|
||||
|
|
@ -26,10 +26,13 @@ namespace Nz
|
|||
void AddMenuSeparator(const std::string& path);
|
||||
|
||||
protected:
|
||||
void DrawMenus();
|
||||
|
||||
virtual void OnEditorGUI() {};
|
||||
|
||||
virtual ImGuiWindowFlags GetCustomWindowFlags() const { return ImGuiWindowFlags_None; }
|
||||
|
||||
private:
|
||||
void DrawMenus();
|
||||
|
||||
EditorBaseApplication* m_application;
|
||||
std::string m_windowName;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
#include <NazaraEditor/Core.hpp>
|
||||
|
||||
class EditorApplication
|
||||
: public Nz::EditorBaseApplication
|
||||
namespace NzEditor
|
||||
{
|
||||
class Application
|
||||
: public Nz::EditorBaseApplication
|
||||
{
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
#include <NazaraEditor/Core/UI/Window.hpp>
|
||||
|
||||
namespace Nz
|
||||
namespace NzEditor
|
||||
{
|
||||
class EditorAssetsWindow
|
||||
class AssetsWindow
|
||||
: public Nz::EditorWindow
|
||||
{
|
||||
public:
|
||||
EditorAssetsWindow(EditorBaseApplication* app);
|
||||
AssetsWindow(Nz::EditorBaseApplication* app);
|
||||
|
||||
void ImportAsset();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
#include <entt/entt.hpp>
|
||||
|
||||
namespace Nz
|
||||
namespace NzEditor
|
||||
{
|
||||
class EditorInspectorWindow
|
||||
class InspectorWindow
|
||||
: public Nz::EditorWindow
|
||||
{
|
||||
public:
|
||||
EditorInspectorWindow(EditorBaseApplication* app);
|
||||
InspectorWindow(Nz::EditorBaseApplication* app);
|
||||
|
||||
virtual void OnEditorGUI() override;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
#include <NazaraEditor/Core/UI/Window.hpp>
|
||||
#include <NazaraEditor/Core.hpp>
|
||||
|
||||
#include <Nazara/Core.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
|
||||
namespace Nz
|
||||
namespace NzEditor
|
||||
{
|
||||
class EditorLevelWindow
|
||||
class LevelWindow
|
||||
: public Nz::EditorWindow
|
||||
{
|
||||
public:
|
||||
EditorLevelWindow(EditorBaseApplication* app);
|
||||
LevelWindow(Nz::EditorBaseApplication* app);
|
||||
|
||||
virtual void OnEditorGUI() override;
|
||||
|
||||
protected:
|
||||
void RefreshEntities();
|
||||
|
||||
Nz::EnttWorld* m_currentWorld;
|
||||
Nz::Level& m_currentLevel;
|
||||
bool m_dirty;
|
||||
|
||||
std::vector<Nz::Node*> m_rootNodes;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#include <NazaraEditor/Core/UI/Window.hpp>
|
||||
#include <NazaraEditor/Core/UI/MainWindow.h>
|
||||
|
||||
namespace Nz
|
||||
namespace NzEditor
|
||||
{
|
||||
class EditorMainWindow
|
||||
: public Nz::EditorWindow
|
||||
class MainWindow
|
||||
: public Nz::EditorMainWindow
|
||||
{
|
||||
public:
|
||||
EditorMainWindow(EditorBaseApplication* app);
|
||||
MainWindow(Nz::EditorBaseApplication* app);
|
||||
|
||||
bool Quit();
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
#include <NazaraEditor/Core/UI/MainWindow.h>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
EditorMainWindow::EditorMainWindow(EditorBaseApplication* app, const std::string& name)
|
||||
: EditorWindow(app, name)
|
||||
{ }
|
||||
|
||||
void EditorMainWindow::OnRenderImgui()
|
||||
{
|
||||
if (ImGui::BeginMainMenuBar())
|
||||
{
|
||||
DrawMenus();
|
||||
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
// Create docks everywhere in the main area
|
||||
ImGui::DockSpaceOverViewport();
|
||||
}
|
||||
}
|
||||
|
|
@ -20,10 +20,13 @@ namespace Nz
|
|||
{
|
||||
bool bNeedsMenu = !m_root.entries.empty();
|
||||
ImGuiWindowFlags flags = (bNeedsMenu ? ImGuiWindowFlags_MenuBar : 0);
|
||||
|
||||
if (ImGui::Begin(m_windowName.c_str(), nullptr, flags))
|
||||
{
|
||||
DrawMenus();
|
||||
if (ImGui::BeginMenuBar())
|
||||
{
|
||||
DrawMenus();
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
OnEditorGUI();
|
||||
|
||||
|
|
@ -80,12 +83,8 @@ namespace Nz
|
|||
}, menu);
|
||||
};
|
||||
|
||||
if (ImGui::BeginMenuBar())
|
||||
{
|
||||
for (auto& menu : m_root.entries)
|
||||
visitor(menu);
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
for (auto& menu : m_root.entries)
|
||||
visitor(menu);
|
||||
}
|
||||
|
||||
EditorWindow::MenuList& EditorWindow::GetOrCreateMenuHierarchy(const std::vector<std::string_view>& hierarchy)
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
#include <NazaraEditor/Editor/UI/AssetsWindow.hpp>
|
||||
|
||||
namespace Nz
|
||||
namespace NzEditor
|
||||
{
|
||||
EditorAssetsWindow::EditorAssetsWindow(EditorBaseApplication* app)
|
||||
AssetsWindow::AssetsWindow(Nz::EditorBaseApplication* app)
|
||||
: Nz::EditorWindow(app, "Assets Browser")
|
||||
{
|
||||
BuildMenuBar();
|
||||
}
|
||||
|
||||
void EditorAssetsWindow::ImportAsset()
|
||||
void AssetsWindow::ImportAsset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void EditorAssetsWindow::BuildMenuBar()
|
||||
void AssetsWindow::BuildMenuBar()
|
||||
{
|
||||
AddMenuAction("Import", "Ctrl+I", [this]() { ImportAsset(); });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
#include <NazaraEditor/Editor/Application.hpp>
|
||||
|
||||
namespace Nz
|
||||
namespace NzEditor
|
||||
{
|
||||
EditorInspectorWindow::EditorInspectorWindow(EditorBaseApplication* app)
|
||||
InspectorWindow::InspectorWindow(Nz::EditorBaseApplication* app)
|
||||
: Nz::EditorWindow(app, "Inspector")
|
||||
{
|
||||
app->OnEntitySelected.Connect(this, &EditorInspectorWindow::OnEntitySelected);
|
||||
app->OnEntitySelected.Connect(this, &InspectorWindow::OnEntitySelected);
|
||||
}
|
||||
|
||||
void EditorInspectorWindow::OnEditorGUI()
|
||||
void InspectorWindow::OnEditorGUI()
|
||||
{
|
||||
if (!m_currentEntity)
|
||||
return;
|
||||
|
|
@ -20,12 +20,12 @@ namespace Nz
|
|||
ImGui::End();
|
||||
}
|
||||
|
||||
void EditorInspectorWindow::OnEntitySelected(entt::handle entity)
|
||||
void InspectorWindow::OnEntitySelected(entt::handle entity)
|
||||
{
|
||||
m_currentEntity = entity;
|
||||
}
|
||||
|
||||
void EditorInspectorWindow::OnEntityDeselected(entt::handle)
|
||||
void InspectorWindow::OnEntityDeselected(entt::handle)
|
||||
{
|
||||
m_currentEntity = {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
#include <NazaraEditor/Editor/Application.hpp>
|
||||
|
||||
namespace Nz
|
||||
namespace NzEditor
|
||||
{
|
||||
EditorLevelWindow::EditorLevelWindow(EditorBaseApplication* app)
|
||||
LevelWindow::LevelWindow(Nz::EditorBaseApplication* app)
|
||||
: Nz::EditorWindow(app, "Level")
|
||||
, m_currentWorld(app->GetCurrentWorld())
|
||||
, m_dirty(true)
|
||||
|
|
@ -15,7 +15,7 @@ namespace Nz
|
|||
app->OnEntityParentChanged.Connect([this](entt::handle) { m_dirty = true; });
|
||||
}
|
||||
|
||||
void EditorLevelWindow::OnEditorGUI()
|
||||
void LevelWindow::OnEditorGUI()
|
||||
{
|
||||
RefreshEntities();
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ namespace Nz
|
|||
drawHierarchy(node);
|
||||
}
|
||||
|
||||
void EditorLevelWindow::RefreshEntities()
|
||||
void LevelWindow::RefreshEntities()
|
||||
{
|
||||
if (!m_dirty)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
#include <NazaraEditor/Editor/UI/MainWindow.hpp>
|
||||
|
||||
namespace Nz
|
||||
namespace NzEditor
|
||||
{
|
||||
EditorMainWindow::EditorMainWindow(EditorBaseApplication* app)
|
||||
: Nz::EditorWindow(app, "MainWindow")
|
||||
MainWindow::MainWindow(Nz::EditorBaseApplication* app)
|
||||
: Nz::EditorMainWindow(app, "MainWindow")
|
||||
{
|
||||
BuildMenuBar();
|
||||
}
|
||||
|
||||
void EditorMainWindow::BuildMenuBar()
|
||||
void MainWindow::BuildMenuBar()
|
||||
{
|
||||
AddMenuAction("File|Project|New", "Ctrl+Shift+N", [this]() { NewProject(); });
|
||||
AddMenuAction("File|Project|Open", "Ctrl+Shift+O", [this]() { OpenProject(); });
|
||||
|
|
@ -20,37 +20,37 @@ namespace Nz
|
|||
AddMenuAction("File|Quit", "Ctrl+W", [this]() { Quit(); });
|
||||
}
|
||||
|
||||
bool EditorMainWindow::Quit()
|
||||
bool MainWindow::Quit()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EditorMainWindow::NewLevel()
|
||||
bool MainWindow::NewLevel()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EditorMainWindow::OpenLevel()
|
||||
bool MainWindow::OpenLevel()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EditorMainWindow::SaveLevel()
|
||||
bool MainWindow::SaveLevel()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EditorMainWindow::NewProject()
|
||||
bool MainWindow::NewProject()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EditorMainWindow::OpenProject()
|
||||
bool MainWindow::OpenProject()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EditorMainWindow::SaveProject()
|
||||
bool MainWindow::SaveProject()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,14 +25,14 @@ int WinMain(int argc, char* argv[])
|
|||
NazaraUnused(argc);
|
||||
NazaraUnused(argv);
|
||||
|
||||
EditorApplication app;
|
||||
NzEditor::Application app;
|
||||
|
||||
ImGui::EnsureContextOnThisThread();
|
||||
|
||||
app.RegisterWindow<Nz::EditorMainWindow>();
|
||||
app.RegisterWindow<Nz::EditorAssetsWindow>();
|
||||
app.RegisterWindow<Nz::EditorLevelWindow>();
|
||||
app.RegisterWindow<Nz::EditorInspectorWindow>();
|
||||
app.RegisterWindow<NzEditor::MainWindow>();
|
||||
app.RegisterWindow<NzEditor::AssetsWindow>();
|
||||
app.RegisterWindow<NzEditor::LevelWindow>();
|
||||
app.RegisterWindow<NzEditor::InspectorWindow>();
|
||||
|
||||
entt::meta<Nz::NodeComponent>()
|
||||
.type(entt::type_hash<Nz::NodeComponent>::value())
|
||||
|
|
|
|||
Loading…
Reference in New Issue