diff --git a/Editor/src/EditorLayer.cpp b/Editor/src/EditorLayer.cpp index 7d5fba31..f986319e 100644 --- a/Editor/src/EditorLayer.cpp +++ b/Editor/src/EditorLayer.cpp @@ -46,25 +46,16 @@ void EditorLayer::OnUpdate() if (m_EditorInterface->ShouldDrawAxis()) { m_GizmoDrawer->DrawAxis(currentScene, false); - glDepthFunc(GL_GREATER); - - m_GizmoDrawer->DrawAxis(currentScene, true); - glDepthFunc(GL_LESS); } if (m_EditorInterface->ShouldDrawNavMesh()) { - m_GizmoDrawer->DrawNavMesh(currentScene, true); } if (m_EditorInterface->ShouldDrawCollision()) { m_GizmoDrawer->DrawGizmos(currentScene, false); - //glDepthFunc(GL_GREATER); - - //m_GizmoDrawer->DrawGizmos(currentScene, true); - //glDepthFunc(GL_LESS); } diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index 94a7d179..a8b31d33 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -2231,6 +2231,93 @@ namespace Nuake { ImGui::End(); } + void EditorInterface::DrawProjectSettings() + { + static int settingCategoryIndex = 0; + if (ImGui::Begin("Project Settings", &m_ShowProjectSettings, ImGuiWindowFlags_NoDocking)) + { + ImVec4* colors = ImGui::GetStyle().Colors; + ImGui::PushStyleColor(ImGuiCol_ChildBg, colors[ImGuiCol_TitleBgCollapsed]); + ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 8); + ImGui::BeginChild("ProjectSettingsLeft", { 200, ImGui::GetContentRegionAvail().y }, true); + { + ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_DefaultOpen | ImGuiTreeNodeFlags_FramePadding; + + bool is_selected = settingCategoryIndex == FileSystem::RootDirectory; + if (is_selected) + base_flags |= ImGuiTreeNodeFlags_Selected; + + ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(0, 0)); + ImGui::PushFont(FontManager::GetFont(Bold)); + ImGui::TreeNodeEx("General", base_flags); + if (ImGui::IsItemClicked()) + { + settingCategoryIndex = 0; + } + + ImGui::TreePop(); + + ImGui::TreeNodeEx("Viewport", base_flags); + if (ImGui::IsItemClicked()) + { + settingCategoryIndex = 1; + } + + ImGui::TreePop(); + ImGui::TreeNodeEx("Rendering", base_flags); + if (ImGui::IsItemClicked()) + { + settingCategoryIndex = 2; + } + + ImGui::TreePop(); + ImGui::TreeNodeEx("Audio", base_flags); + if (ImGui::IsItemClicked()) + { + settingCategoryIndex = 3; + } + + ImGui::TreePop(); + ImGui::TreeNodeEx("C#", base_flags); + if (ImGui::IsItemClicked()) + { + settingCategoryIndex = 4; + } + + ImGui::TreePop(); + ImGui::TreeNodeEx("Trenchbroom", base_flags); + if (ImGui::IsItemClicked()) + { + settingCategoryIndex = 5; + } + + ImGui::TreePop(); + ImGui::TreeNodeEx("Plugins", base_flags); + if (ImGui::IsItemClicked()) + { + settingCategoryIndex = 6; + } + + ImGui::PopStyleVar(); + ImGui::TreePop(); + ImGui::PopFont(); + } + ImGui::PopStyleVar(); + ImGui::PopStyleColor(); + + ImGui::EndChild(); + + ImGui::SameLine(); + + ImGui::BeginChild("ProjectSettingsRight", ImGui::GetContentRegionAvail(), ImGuiChildFlags_Border); + { + ImGui::Text("Right side"); + } + ImGui::EndChild(); + } + ImGui::End(); + } + void EditorInterface::Overlay() { // FIXME-VIEWPORT: Select a default viewport @@ -2384,7 +2471,7 @@ namespace Nuake { Selection = EditorSelection(); } - if (ImGui::MenuItem("Save", "CTRL+S")) + if (ImGui::MenuItem("Save Project", "CTRL+S")) { PushCommand(SaveProjectCommand(Engine::GetProject())); @@ -2393,7 +2480,7 @@ namespace Nuake { SetStatusMessage("Project saved."); } - if (ImGui::MenuItem("Save as...", "CTRL+SHIFT+S")) + if (ImGui::MenuItem("Save Project as...", "CTRL+SHIFT+S")) { std::string savePath = FileDialog::SaveFile("*.project"); Engine::GetProject()->SaveAs(savePath); @@ -2439,9 +2526,10 @@ namespace Nuake { if (ImGui::MenuItem("Undo", "CTRL+Z")) {} if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item ImGui::Separator(); - if (ImGui::MenuItem("Cut", "CTRL+X")) {} - if (ImGui::MenuItem("Copy", "CTRL+C")) {} - if (ImGui::MenuItem("Paste", "CTRL+V")) {} + if (ImGui::MenuItem("Project Settings", "")) + { + m_ShowProjectSettings = true; + } ImGui::EndMenu(); } if (ImGui::BeginMenu("View")) @@ -2667,6 +2755,11 @@ namespace Nuake { SelectionPanel.Draw(Selection); DrawLogger(); + if (m_ShowProjectSettings) + { + DrawProjectSettings(); + } + filesystem->Draw(); filesystem->DrawDirectoryExplorer(); diff --git a/Editor/src/Windows/EditorInterface.h b/Editor/src/Windows/EditorInterface.h index 6762ffef..2f0b78cb 100644 --- a/Editor/src/Windows/EditorInterface.h +++ b/Editor/src/Windows/EditorInterface.h @@ -42,6 +42,7 @@ namespace Nuake bool m_IsRenaming = false; bool m_ShouldUnfoldEntityTree = false; bool m_ShowTrenchbroomConfigurator = false; + bool m_ShowProjectSettings = false; bool m_ShowMapImporter = false; Vector2 m_ViewportPos = {0, 0}; @@ -80,6 +81,7 @@ namespace Nuake void DrawEntityTree(Entity ent); void DrawSceneTree(); void DrawLogger(); + void DrawProjectSettings(); bool EntityContainsItself(Entity ent1, Entity ent2); void Overlay(); diff --git a/Editor/src/Windows/ProjectSettingsWindow.h b/Editor/src/Windows/ProjectSettingsWindow.h new file mode 100644 index 00000000..5f3d6c64 --- /dev/null +++ b/Editor/src/Windows/ProjectSettingsWindow.h @@ -0,0 +1,22 @@ +#pragma once +#include "src/Core/Core.h" +#include "src/Resource/Project.h" + +class ProjectSettingsCategoryWindow +{ +public: + + void Draw(); +}; + +class ProjectSettingsWindow +{ +private: + std::vector CategoryWindows; + +public: + ProjectSettingsWindow(Ref project); + ~ProjectSettingsWindow(); + + void Draw(); +}; \ No newline at end of file