Removed all dead code

This commit is contained in:
Antoine Pilote
2024-08-14 19:21:17 -04:00
parent b887e8e826
commit 0de9c216c5
37 changed files with 22 additions and 2615 deletions

View File

@@ -1,6 +1,7 @@
#include "Commands.h"
#include <Engine.h>
#include "src/Core/FileSystem.h"
namespace NuakeEditor
{

View File

@@ -1,109 +0,0 @@
#include "NewEditor.h"
#include "Engine.h"
#include "src/Core/Input.h"
#include <dependencies/glfw/include/GLFW/glfw3.h>
namespace Nuake
{
NewEditor::NewEditor()
{
m_UserInterface = UI::UserInterface::New("Editor", "resources/Interface/Editor.interface");
FetchNodes();
}
void NewEditor::FetchNodes()
{
m_SceneFramebuffer = Engine::GetCurrentWindow()->GetFrameBuffer();
m_ViewportNode = m_UserInterface->GetNodeByID("viewport-texture");
m_ViewportNode->BackgroundTexture = m_SceneFramebuffer->GetTexture();
m_FileMenu = m_UserInterface->GetNodeByID("action-menu-file");
m_Splitter = m_UserInterface->GetNodeByID("splitter");
m_Splitter2 = m_UserInterface->GetNodeByID("splitter2");
m_Right = m_UserInterface->GetNodeByID("right");
m_Left = m_UserInterface->GetNodeByID("left");
m_Inspector = m_UserInterface->GetNodeByID("inspector");
}
bool dragging = false;
bool dragging2 = false;
void NewEditor::Update(Timestep ts)
{
if (Input::IsKeyPressed(Key::F1))
{
m_UserInterface->Reload();
FetchNodes();
}
if (m_FileMenu->IsClicked)
{
// Parse the project and load it.
std::string projectPath = FileDialog::OpenFile(".project");
FileSystem::SetRootDirectory(FileSystem::GetParentPath(projectPath));
Ref<Project> project = Project::New();
if (!project->Deserialize(FileSystem::ReadFile(projectPath, true)))
{
Logger::Log("Error loading project: " + projectPath, "editor", CRITICAL);
return;
}
project->FullPath = projectPath;
Engine::LoadProject(project);
}
float mouseX = Input::GetMouseX();
if (m_Splitter->IsHover && Input::IsMouseButtonDown(0))
{
dragging = true;
}
if (m_Splitter2->IsHover && Input::IsMouseButtonDown(0))
dragging2 = true;
if (dragging)
{
if (!Input::IsMouseButtonDown(0))
dragging = false;
float totalWidth = m_UserInterface->Size.x;
float mouseX = Input::GetMouseX();
float ratio = mouseX / totalWidth;
m_Inspector->NormalStyle.Width.mUnit = Layout::PIXEL;
m_Inspector->NormalStyle.Width.Value = (1.0f - ratio) * totalWidth - 3.0f;
m_ViewportNode->NormalStyle.Width.mUnit = Layout::PIXEL;
m_ViewportNode->NormalStyle.Width.Value = ratio * totalWidth;
m_Inspector->HoverStyle.Width.mUnit = Layout::PIXEL;
m_Inspector->HoverStyle.Width.Value = (1.0f - ratio) * totalWidth - 3.0f;
m_ViewportNode->HoverStyle.Width.mUnit = Layout::PIXEL;
m_ViewportNode->HoverStyle.Width.Value = ratio * totalWidth;
Logger::Log("mouseX " + std::to_string(ratio));
}
if (dragging2 == true)
{
if (!Input::IsMouseButtonDown(0))
dragging2 = false;
float totalWidth = m_UserInterface->Size.x;
float mouseX = Input::GetMouseX();
float ratio = mouseX / totalWidth;
}
m_UserInterface->Update(ts);
// Layout logic
}
void NewEditor::Draw(Vector2 screenSize)
{
m_UserInterface->Draw(screenSize);
}
}

View File

@@ -1,31 +0,0 @@
#pragma once
#include "src/Core/Core.h"
#include "src/UI/UserInterface.h"
#include "src/Core/Maths.h"
#include "src/Core/Timestep.h"
namespace Nuake
{
class NewEditor
{
public:
NewEditor();
void Update(Timestep ts);
void Draw(Vector2 screenSize);
private:
void FetchNodes();
Ref<UI::UserInterface> m_UserInterface;
Ref<FrameBuffer> m_SceneFramebuffer;
Ref<Node> m_ViewportNode;
Ref<Node> m_FileMenu;
Ref<Node> m_Splitter;
Ref<Node> m_Splitter2;
Ref<Node> m_Left;
Ref<Node> m_Right;
Ref<Node> m_Inspector;
bool fileOpened = false;
};
}

View File

@@ -1,33 +0,0 @@
#pragma once
class SelectableElement
{
virtual void Draw();
};
class SceneFile : public SelectableElement
{
void Draw() override;
};
class ProjectFile : public SelectableElement
{
void Draw() override;
};
class MaterialFile : public SelectableElement
{
void Draw() override;
};
class Entity : public SelectableElement
{
void Draw() override;
};
class PropretiesWindow
{
SelectableElement selected;
static void Draw();
};

View File

@@ -32,7 +32,6 @@
#include <src/Scene/Components/PrefabComponent.h>
#include <src/Rendering/Shaders/ShaderManager.h>
#include "src/Rendering/Renderer.h"
#include <src/Scene/Components/InterfaceComponent.h>
#include "src/Core/Input.h"
#include "../Actions/EditorSelection.h"
@@ -50,7 +49,7 @@
#include <src/Audio/AudioManager.h>
#include <src/UI/ImUI.h>
#include "src/Core/FileSystem.h"
#include <src/Resource/StaticResources.h>
#include <src/Scripting/ScriptingEngineNet.h>
#include <src/Threading/JobSystem.h>
@@ -59,7 +58,6 @@
namespace Nuake {
Ref<UI::UserInterface> userInterface;
ImFont* normalFont;
ImFont* boldFont;
ImFont* EditorInterface::bigIconFont;

View File

@@ -1,6 +1,7 @@
#include "ProjectInterface.h"
#include <src/Vendors/imgui/imgui.h>
#include "Engine.h"
#include "src/Core/FileSystem.h"
//#include "ImGuiTextHelper.h"
namespace Nuake {