Added basic project property UI

This commit is contained in:
Antoine Pilote
2024-08-17 12:08:37 -04:00
parent a09a826732
commit 2047b3f150
4 changed files with 122 additions and 14 deletions

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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();

View File

@@ -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<ProjectSettingsCategoryWindow> CategoryWindows;
public:
ProjectSettingsWindow(Ref<Nuake::Project> project);
~ProjectSettingsWindow();
void Draw();
};