Added command buffer implementation in the editor layer

This commit is contained in:
Antoine Pilote
2024-04-27 19:13:11 -04:00
parent bff56e9e39
commit f9081f669e
9 changed files with 99 additions and 22 deletions

View File

@@ -54,6 +54,7 @@
#include <src/Resource/StaticResources.h>
#include <src/Scripting/ScriptingEngineNet.h>
#include <src/Threading/JobSystem.h>
#include "../Commands/Commands/Commands.h"
namespace Nuake {
@@ -62,7 +63,8 @@ namespace Nuake {
ImFont* boldFont;
ImFont* EditorInterface::bigIconFont;
EditorInterface::EditorInterface()
EditorInterface::EditorInterface(CommandBuffer& commandBuffer) :
mCommandBuffer(&commandBuffer)
{
Logger::Log("Creating editor windows", "window", CRITICAL);
filesystem = new FileSystemUI(this);
@@ -2111,12 +2113,12 @@ namespace Nuake {
}
if (ImGui::MenuItem("Save", "CTRL+S"))
{
Engine::GetProject()->Save();
Engine::GetCurrentScene()->Save();
PushCommand(SaveProjectCommand(Engine::GetProject()));
Selection = EditorSelection();
SetStatusMessage("Project saved.");
Selection = EditorSelection();
}
if (ImGui::MenuItem("Save as...", "CTRL+SHIFT+S"))
{
@@ -2455,6 +2457,11 @@ namespace Nuake {
return entityTypeName;
}
void EditorInterface::PushCommand(ICommand&& command)
{
mCommandBuffer->PushCommand(command);
}
bool EditorInterface::LoadProject(const std::string& projectPath)
{
FileSystem::SetRootDirectory(FileSystem::GetParentPath(projectPath));