diff options
| author | hachem <im@hachem.wtf> | 2025-08-17 22:38:29 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2025-08-17 22:38:29 +0200 |
| commit | 1ecaea469e86ef3f5d18122c8b2cc187286e27f7 (patch) | |
| tree | c56d2320bd69ea3a1c2cd9c78c288546214a8667 /src/Core | |
| parent | d9a8a37a61bff05a06068e203d6548ca931857de (diff) | |
Add World builder state
Diffstat (limited to 'src/Core')
| -rw-r--r-- | src/Core/Application.cpp | 21 | ||||
| -rw-r--r-- | src/Core/SettingsManager.cpp | 2 |
2 files changed, 17 insertions, 6 deletions
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 <GLFW/glfw3.h> - +#include <ImGuizmo.h> 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<StateManager>(); - m_StateManager->RegisterState("Config", CreateScope<ConfigState>()); - m_StateManager->RegisterState("Simulation", CreateScope<SimulationState>()); + m_StateManager->RegisterState("Config", CreateScope<ConfigState>()); + m_StateManager->RegisterState("Simulation", CreateScope<SimulationState>()); + m_StateManager->RegisterState("WorldBuilder", CreateScope<WorldBuilderState>()); 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) |
