mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Better logger and project launch arg fixed
This commit is contained in:
@@ -39,13 +39,7 @@
|
||||
|
||||
#include "src/EditorApplication.h"
|
||||
|
||||
struct LaunchSettings
|
||||
{
|
||||
int32_t monitor = -1;
|
||||
Vector2 resolution = { 1920, 1080 };
|
||||
std::string windowTitle = "Nuake Editor ";
|
||||
std::string projectPath;
|
||||
};
|
||||
#include "LaunchSettings.h"
|
||||
|
||||
|
||||
std::vector<std::string> ParseArguments(int argc, char* argv[])
|
||||
@@ -133,5 +127,5 @@ Nuake::Application* Nuake::CreateApplication(int argc, char** argv)
|
||||
specification.Name += "(DEBUG BUILD)";
|
||||
#endif
|
||||
|
||||
return new EditorApplication(specification);
|
||||
return new EditorApplication(specification, launchSettings);
|
||||
}
|
||||
|
||||
11
Editor/LaunchSettings.h
Normal file
11
Editor/LaunchSettings.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include <src/Core/Maths.h>
|
||||
#include <string>
|
||||
|
||||
struct LaunchSettings
|
||||
{
|
||||
int32_t monitor = 1;
|
||||
Nuake::Vector2 resolution = { 1920, 1080 };
|
||||
std::string windowTitle = "Nuake Editor ";
|
||||
std::string projectPath;
|
||||
};
|
||||
@@ -16,7 +16,35 @@ void EditorApplication::OnInit()
|
||||
m_Window = Engine::GetCurrentWindow();
|
||||
m_Window->SetSize({ m_Specification.WindowWidth, m_Specification.WindowHeight });
|
||||
m_Window->SetTitle(m_Specification.Name);
|
||||
m_Window->SetMonitor(1);
|
||||
|
||||
if (!m_LaunchSettings.projectPath.empty())
|
||||
{
|
||||
if (FileSystem::FileExists(m_LaunchSettings.projectPath, true))
|
||||
{
|
||||
const std::string projectPath = m_LaunchSettings.projectPath;
|
||||
|
||||
FileSystem::SetRootDirectory(FileSystem::GetParentPath(projectPath));
|
||||
|
||||
auto project = Project::New();
|
||||
auto projectFileData = FileSystem::ReadFile(projectPath, true);
|
||||
Logger::Log("Reading file project: " + projectFileData, "window", VERBOSE);
|
||||
try
|
||||
{
|
||||
Logger::Log("Starting deserializing", "window", VERBOSE);
|
||||
project->Deserialize(json::parse(projectFileData));
|
||||
project->FullPath = projectPath;
|
||||
|
||||
Engine::LoadProject(project);
|
||||
}
|
||||
catch (std::exception exception)
|
||||
{
|
||||
Logger::Log("Error loading project: " + projectPath, "editor", CRITICAL);
|
||||
Logger::Log(exception.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PushLayer(CreateScope<EditorLayer>());
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Misc/GizmoDrawer.h"
|
||||
|
||||
#include "Commands/CommandBuffer.h"
|
||||
#include "../LaunchSettings.h"
|
||||
|
||||
using namespace NuakeEditor;
|
||||
|
||||
@@ -15,9 +16,10 @@ private:
|
||||
CommandBuffer mCommandBuffer;
|
||||
|
||||
public:
|
||||
EditorApplication(const Nuake::ApplicationSpecification& specification)
|
||||
EditorApplication(const Nuake::ApplicationSpecification& specification, const LaunchSettings& launchSettings)
|
||||
: Application(specification),
|
||||
m_Editor(nullptr)
|
||||
m_Editor(nullptr),
|
||||
m_LaunchSettings(launchSettings)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -28,4 +30,5 @@ public:
|
||||
|
||||
private:
|
||||
Nuake::EditorInterface* m_Editor;
|
||||
LaunchSettings m_LaunchSettings;
|
||||
};
|
||||
@@ -68,6 +68,7 @@ namespace Nuake {
|
||||
{
|
||||
Logger::Log("Creating editor windows", "window", VERBOSE);
|
||||
filesystem = new FileSystemUI(this);
|
||||
|
||||
_WelcomeWindow = new WelcomeWindow(this);
|
||||
_audioWindow = new AudioWindow();
|
||||
|
||||
@@ -2007,9 +2008,9 @@ namespace Nuake {
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
if (AutoScroll)
|
||||
if (AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())
|
||||
{
|
||||
ImGui::SetScrollY(ImGui::GetScrollMaxY());
|
||||
ImGui::SetScrollHereY(1.0f);
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
|
||||
Reference in New Issue
Block a user