From 1ecaea469e86ef3f5d18122c8b2cc187286e27f7 Mon Sep 17 00:00:00 2001 From: hachem Date: Sun, 17 Aug 2025 22:38:29 +0200 Subject: Add World builder state --- src/Core/Application.cpp | 21 +++++++++++++++------ src/Core/SettingsManager.cpp | 2 ++ 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'src/Core') diff --git a/src/Core/Application.cpp b/src/Core/Application.cpp index b879535..62f1faa 100644 --- a/src/Core/Application.cpp +++ b/src/Core/Application.cpp @@ -5,9 +5,10 @@ #include "States/SimulationState.h" #include "States/ConfigState.h" +#include "States/WorldBuilderState.h" #include - +#include namespace Donut { @@ -88,6 +89,12 @@ namespace Donut event.Handled = true; return true; } + else if (e.GetKeyCode() == GLFW_KEY_3) + { + m_StateManager->SwitchToState("WorldBuilder"); + event.Handled = true; + return true; + } return true; }); @@ -99,10 +106,8 @@ namespace Donut { Logger::Init(); - // Initialize settings manager first SettingsManager::Initialize(); - // Apply loaded settings const auto& settings = SettingsManager::GetSettingsConst(); RendererAPI::API api = (settings.graphics.renderAPI == "Vulkan") ? RendererAPI::API::Vulkan : RendererAPI::API::OpenGL; RendererAPI::SetAPI(api); @@ -114,8 +119,9 @@ namespace Donut RenderCommand::SetFaceCulling(false); m_StateManager = CreateScope(); - m_StateManager->RegisterState("Config", CreateScope()); - m_StateManager->RegisterState("Simulation", CreateScope()); + m_StateManager->RegisterState("Config", CreateScope()); + m_StateManager->RegisterState("Simulation", CreateScope()); + m_StateManager->RegisterState("WorldBuilder", CreateScope()); m_StateManager->SwitchToState("Config"); } @@ -141,8 +147,11 @@ namespace Donut void Application::OnRender() { m_StateManager->Render(); - m_Window->BeginImGuiFrame(); + + ImGuizmo::BeginFrame(); + ImGuizmo::SetOrthographic(false); + SetupDockingLayout(); m_StateManager->OnImUIRender(); m_Window->EndImGuiFrame(); diff --git a/src/Core/SettingsManager.cpp b/src/Core/SettingsManager.cpp index eed2a3f..af163e7 100644 --- a/src/Core/SettingsManager.cpp +++ b/src/Core/SettingsManager.cpp @@ -138,7 +138,9 @@ namespace Donut DONUT_INFO("Settings saved to {}", filePath); } catch (const std::exception& e) + { DONUT_ERROR("Failed to save settings: {}", e.what()); + } } void SettingsManager::SetSimulationSettings(const SimulationSettings& settings) -- cgit v1.3