From 95f77209cff4404a6954f12bc4975fab2d84a485 Mon Sep 17 00:00:00 2001 From: Nigel Barink Date: Sat, 13 May 2023 21:32:55 +0200 Subject: [PATCH] Fixing lvalue errors on linux build nfd is not yet linking on Linux --- Editor/premake5.lua | 2 +- Editor/src/AssetManagement/AssetFinder.h | 8 +++++--- Editor/src/EditorLayer.h | 13 +++++++++---- Editor/src/EditorWindow.h | 3 ++- Editor/src/Project/Project.cpp | 9 +++++++-- premake5.lua | 4 ++-- 6 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Editor/premake5.lua b/Editor/premake5.lua index 3716f50..953e34e 100644 --- a/Editor/premake5.lua +++ b/Editor/premake5.lua @@ -7,7 +7,7 @@ links{ "YoggieEngine", "ImGuizmo", "yaml-cpp", - "nfd.lib" + "nfd" } includedirs{ diff --git a/Editor/src/AssetManagement/AssetFinder.h b/Editor/src/AssetManagement/AssetFinder.h index 7ef9449..25aca38 100644 --- a/Editor/src/AssetManagement/AssetFinder.h +++ b/Editor/src/AssetManagement/AssetFinder.h @@ -1,7 +1,7 @@ #pragma once #include "../../YoggieEngine/src/YoggieEngine.h" -#include "EditorWindow.h" -#include "AssetManagement/AssetRegistry.h" +#include "../EditorWindow.h" +#include "AssetRegistry.h" const char* hidden_extensions [] { ".exe", @@ -39,7 +39,9 @@ public: continue; Asset asset(filepath.filename().string().c_str()); - asset.setFilPath(filepath.string()); + + auto filepathStr = filepath.string(); + asset.setFilPath(filepathStr); spdlog::info("Created asset: {0}", asset.GetName()); files.push_back(asset); diff --git a/Editor/src/EditorLayer.h b/Editor/src/EditorLayer.h index fff700c..61055c3 100644 --- a/Editor/src/EditorLayer.h +++ b/Editor/src/EditorLayer.h @@ -7,7 +7,6 @@ #include #include "AssetManagement/SceneSerializer.h" -#include "AssetManagement/AssetRegistry.h" #include "AssetManagement/AssetFinder.h" #include "PropertyPanels/Inspector.h" #include "AssetManagement/uuid.h" @@ -52,7 +51,11 @@ public: project.setProjectDirectory(path); assetsView = AssetFinder(project.GetProjectDirectory()); LoadLastOrEmptyProject(); - cube = (ModelLoader()).LoadAsset(std::filesystem::path("build/debug/Models/cube.obj")); + + + auto cubePath = std::filesystem::path("build/debug/Models/cube.obj"); + + cube = (ModelLoader()).LoadAsset(cubePath); //Settings settings = Settings(); //Console console = Console(); @@ -389,14 +392,16 @@ public: ImGuizmo::SetRect(ImGui::GetWindowPos().x, ImGui::GetWindowPos().y, ImGui::GetWindowWidth(), ImGui::GetWindowHeight()); const auto& ProjMatrix = camera->projection; - glm::mat4& cameraView = glm::inverse(((EditorCamera*)camera)->view); + + const glm::mat4& viewMatrix = ((EditorCamera*)camera)->view; + glm::mat4 cameraView = glm::inverse(viewMatrix); glm::mat4 cameraDelta = glm::mat4(1.0f); auto& tc = Selected.GetComponent(); - glm::mat4& transform = tc.GetTransform(); + auto transform = tc.GetTransform(); ImGuizmo::Manipulate(glm::value_ptr(cameraView), glm::value_ptr(ProjMatrix), activeOperation, ImGuizmo::WORLD, glm::value_ptr(transform), nullptr, nullptr); if(ImGuizmo::IsUsing()) tc.Decompose(transform); diff --git a/Editor/src/EditorWindow.h b/Editor/src/EditorWindow.h index 0df6677..f908b0d 100644 --- a/Editor/src/EditorWindow.h +++ b/Editor/src/EditorWindow.h @@ -9,7 +9,8 @@ public: void Update() { - ImGui::Begin(name.c_str(), false, flags); + + ImGui::Begin(name.c_str(), nullptr, flags); Draw(); ImGui::End(); } diff --git a/Editor/src/Project/Project.cpp b/Editor/src/Project/Project.cpp index 8001eb3..c714eef 100644 --- a/Editor/src/Project/Project.cpp +++ b/Editor/src/Project/Project.cpp @@ -68,8 +68,13 @@ namespace YAML { { if (!node.IsMap()) return false; - rhs.setName(node["Project"].as()); - rhs.setProjectDirectory(node["Directory"].as()); + + std::string projectName = node["Project"].as(); + rhs.setName(projectName); + + + std::string projectDirectory = node["Directory"].as(); + rhs.setProjectDirectory(projectDirectory); diff --git a/premake5.lua b/premake5.lua index 371b592..62ea898 100644 --- a/premake5.lua +++ b/premake5.lua @@ -20,11 +20,11 @@ workspace "Yoggie GameEngine" } filter "configurations:Debug" - defines {"DEBUG"} + defines {"DEBUG", "_DEBUG"} symbols "On" filter "configurations:Release" - defines {"NDEBUG"} + defines {"NDEBUG", "_DEBUG"} optimize "On"