diff --git a/.gitmodules b/.gitmodules index 24ab4c6e..80408c54 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,6 @@ [submodule "Nuake/dependencies/optick"] path = Nuake/dependencies/optick url = https://github.com/bombomby/optick.git +[submodule "Nuake/dependencies/Coral"] + path = Nuake/dependencies/Coral + url = https://github.com/antopilo/Coral.git diff --git a/Editor/src/Windows/FileSystemUI.cpp b/Editor/src/Windows/FileSystemUI.cpp index 51175bfb..c65c0dc6 100644 --- a/Editor/src/Windows/FileSystemUI.cpp +++ b/Editor/src/Windows/FileSystemUI.cpp @@ -48,7 +48,7 @@ namespace Nuake base_flags |= ImGuiTreeNodeFlags_Leaf; std::string icon = ICON_FA_FOLDER; - bool open = ImGui::TreeNodeEx((icon + " " + dir->name.c_str()).c_str(), base_flags); + bool open = ImGui::TreeNodeEx((icon + " " + dir->Name.c_str()).c_str(), base_flags); if (ImGui::IsItemClicked()) m_CurrentDirectory = dir; @@ -67,7 +67,7 @@ namespace Nuake ImGui::PushFont(FontManager::GetFont(Icons)); ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 4.0f); const char* icon = ICON_FA_FOLDER; - const std::string id = std::string("##") + directory->name; + const std::string id = std::string("##") + directory->Name; ImVec2 prevCursor = ImGui::GetCursorPos(); ImVec2 prevScreenPos = ImGui::GetCursorScreenPos(); @@ -96,7 +96,7 @@ namespace Nuake } if (ImGui::IsItemHovered()) - ImGui::SetTooltip(directory->name.c_str()); + ImGui::SetTooltip(directory->Name.c_str()); ImGui::SetCursorPos(prevCursor); @@ -108,11 +108,11 @@ namespace Nuake ImVec2 offsetEnd = ImVec2(startOffset.x, imguiStyle.CellPadding.y / 2.0f); ImU32 rectColor = IM_COL32(255, 255, 255, 16); ImGui::GetWindowDrawList()->AddRectFilled(prevScreenPos + ImVec2(0, 100) - startOffset, prevScreenPos + ImVec2(100, 150) + offsetEnd, rectColor, 1.0f); - std::string visibleName = directory->name; + std::string visibleName = directory->Name; const uint32_t MAX_CHAR_NAME = 35; - if (directory->name.size() > MAX_CHAR_NAME) + if (directory->Name.size() > MAX_CHAR_NAME) { - visibleName = std::string(directory->name.begin(), directory->name.begin() + MAX_CHAR_NAME - 3) + "..."; + visibleName = std::string(directory->Name.begin(), directory->Name.begin() + MAX_CHAR_NAME - 3) + "..."; } ImGui::TextWrapped(visibleName.c_str()); @@ -136,12 +136,12 @@ namespace Nuake { if (ImGui::MenuItem("Full Path")) { - OS::CopyToClipboard(directory->fullPath); + OS::CopyToClipboard(directory->FullPath); } if (ImGui::MenuItem("Directory Name")) { - OS::CopyToClipboard(String::Split(directory->name, '/')[0]); + OS::CopyToClipboard(String::Split(directory->Name, '/')[0]); } ImGui::EndPopup(); @@ -161,7 +161,7 @@ namespace Nuake if (ImGui::MenuItem("Show in File Explorer")) { - OS::OpenIn(directory->fullPath); + OS::OpenIn(directory->FullPath); } ImGui::EndPopup(); @@ -171,7 +171,7 @@ namespace Nuake if (shouldRename) { - renameTempValue = directory->name; + renameTempValue = directory->Name; PopupHelper::OpenPopup(renameId); } @@ -194,9 +194,9 @@ namespace Nuake if(PopupHelper::DefineConfirmationDialog(deleteId, " Are you sure you want to delete the folder and all its children?\n This action cannot be undone, and all data within the folder \n will be permanently lost.")) { - if (FileSystem::DeleteFolder(directory->fullPath) != 0) + if (FileSystem::DeleteFolder(directory->FullPath) != 0) { - Logger::Log("Failed to remove directory: " + directory->name, "editor", CRITICAL); + Logger::Log("Failed to remove directory: " + directory->Name, "editor", CRITICAL); } RefreshFileBrowser(); } @@ -768,7 +768,7 @@ namespace Nuake } else { - pathLabel = paths[i]->name; + pathLabel = paths[i]->Name; } if (ImGui::Button(pathLabel.c_str())) @@ -801,7 +801,7 @@ namespace Nuake if (ImGui::Button((std::string(ICON_FA_FOLDER_OPEN)).c_str(), buttonSize)) { - OS::OpenIn(m_CurrentDirectory->fullPath); + OS::OpenIn(m_CurrentDirectory->FullPath); } ImGui::SameLine(); @@ -849,7 +849,7 @@ namespace Nuake { for (Ref& d : m_CurrentDirectory->Directories) { - if(String::Sanitize(d->name).find(String::Sanitize(m_SearchKeyword)) != std::string::npos) + if(String::Sanitize(d->Name).find(String::Sanitize(m_SearchKeyword)) != std::string::npos) { if (i + 1 % amount != 0) ImGui::TableNextColumn(); diff --git a/Nuake/Engine.cpp b/Nuake/Engine.cpp index 05c4b8f3..738b466e 100644 --- a/Nuake/Engine.cpp +++ b/Nuake/Engine.cpp @@ -34,7 +34,6 @@ namespace Nuake // Creates the window s_CurrentWindow = Window::Get(); - Logger::Log("Input initializing"); Input::Init(); Renderer2D::Init(); Logger::Log("Engine initialized"); @@ -42,12 +41,10 @@ namespace Nuake void Engine::Tick() { - s_Time = (float)glfwGetTime(); + s_Time = static_cast(glfwGetTime()); s_TimeStep = s_Time - s_LastFrameTime; s_LastFrameTime = s_Time; - //s_TimeStep = std::min((float)s_TimeStep, 0f); - // Dont update if no scene is loaded. if (s_CurrentWindow->GetScene()) { @@ -108,7 +105,7 @@ namespace Nuake void Engine::Draw() { - Nuake::RenderCommand::Clear(); + RenderCommand::Clear(); // Start imgui frame ImGui_ImplOpenGL3_NewFrame(); diff --git a/Nuake/Engine.h b/Nuake/Engine.h index 24832714..2335b1f5 100644 --- a/Nuake/Engine.h +++ b/Nuake/Engine.h @@ -6,9 +6,7 @@ #include "src/Core/Logger.h" /* TODOS: -[ ] - Parse the bones -[ ] - Create SceneStructure Entities(with bone component) -[ ] - Create SkinnedMesh resource(?) + */ // Welcome to the Nuake source code. diff --git a/Nuake/dependencies/Coral b/Nuake/dependencies/Coral new file mode 160000 index 00000000..5b1630d2 --- /dev/null +++ b/Nuake/dependencies/Coral @@ -0,0 +1 @@ +Subproject commit 5b1630d2eea89e8d5db28c827302e12b915bed3a diff --git a/Nuake/dependencies/coral_p5.lua b/Nuake/dependencies/coral_p5.lua new file mode 100644 index 00000000..feca2f02 --- /dev/null +++ b/Nuake/dependencies/coral_p5.lua @@ -0,0 +1,2 @@ +include "Coral/Coral.Native" +include "Coral/Coral.Managed" \ No newline at end of file diff --git a/Nuake/src/Core/FileSystem.cpp b/Nuake/src/Core/FileSystem.cpp index 989b0cd8..fe5c0f0d 100644 --- a/Nuake/src/Core/FileSystem.cpp +++ b/Nuake/src/Core/FileSystem.cpp @@ -147,13 +147,13 @@ namespace Nuake void FileSystem::ScanDirectory(Ref directory) { - for (const auto& entry : std::filesystem::directory_iterator(directory->fullPath)) + for (const auto& entry : std::filesystem::directory_iterator(directory->FullPath)) { if (entry.is_directory()) { Ref newDir = CreateRef(); - newDir->fullPath = entry.path().string(); - newDir->name = entry.path().filename().string(); + newDir->FullPath = entry.path().string(); + newDir->Name = entry.path().filename().string(); newDir->Parent = directory; ScanDirectory(newDir); @@ -197,11 +197,7 @@ namespace Nuake void FileSystem::Scan() { - RootDirectory = CreateRef(); - RootDirectory->Files = std::vector>(); - RootDirectory->Directories = std::vector>(); - RootDirectory->name = FileSystem::AbsoluteToRelative(Root); - RootDirectory->fullPath = Root; + RootDirectory = CreateRef(Root); ScanDirectory(RootDirectory); } @@ -300,7 +296,7 @@ namespace Nuake int currentDepth = -1; std::string currentDirName = "."; Ref currentDirComparator = RootDirectory; - while (currentDirName == currentDirComparator->name) + while (currentDirName == currentDirComparator->Name) { currentDepth++; currentDirName = splits[currentDepth]; @@ -308,7 +304,7 @@ namespace Nuake // Find next directory for (auto& d : currentDirComparator->Directories) { - if (d->name == currentDirName) + if (d->Name == currentDirName) { currentDirComparator = d; } @@ -333,4 +329,12 @@ namespace Nuake return String::Split(split[split.size() - 1], '.')[0]; } + + Directory::Directory(const std::string& path) + { + Files = std::vector>(); + Directories = std::vector>(); + Name = FileSystem::AbsoluteToRelative(path); + FullPath = path; + } } \ No newline at end of file diff --git a/Nuake/src/Core/FileSystem.h b/Nuake/src/Core/FileSystem.h index 9be0b67f..00f3d17b 100644 --- a/Nuake/src/Core/FileSystem.h +++ b/Nuake/src/Core/FileSystem.h @@ -195,10 +195,14 @@ namespace Nuake class Directory { public: - std::string name; - std::string fullPath; + std::string Name; + std::string FullPath; Ref Parent; std::vector> Directories; std::vector> Files; + + Directory(const std::string& path); + Directory() = default; + ~Directory() = default; }; } diff --git a/Nuake/src/Core/OS.cpp b/Nuake/src/Core/OS.cpp index 6fb5fec4..2d33955a 100644 --- a/Nuake/src/Core/OS.cpp +++ b/Nuake/src/Core/OS.cpp @@ -56,7 +56,7 @@ namespace Nuake { int OS::RenameFile(const Ref& file, const std::string& newName) { std::string extension = !String::EndsWith(newName, file->GetExtension().c_str()) ? file->GetExtension() : ""; - std::string newFilePath = file->GetParent()->fullPath + newName + extension; + std::string newFilePath = file->GetParent()->FullPath + newName + extension; std::error_code resultError; std::filesystem::rename(file->GetAbsolutePath().c_str(), newFilePath.c_str(), resultError); @@ -65,10 +65,10 @@ namespace Nuake { int OS::RenameDirectory(const Ref& dir, const std::string& newName) { - std::string newDirPath = dir->Parent->fullPath + newName; + std::string newDirPath = dir->Parent->FullPath + newName; std::error_code resultError; - std::filesystem::rename(dir->fullPath.c_str(), newDirPath.c_str(), resultError); + std::filesystem::rename(dir->FullPath.c_str(), newDirPath.c_str(), resultError); return resultError.value() == 0; } diff --git a/premake5.lua b/premake5.lua index 758f0724..8e2b85f1 100644 --- a/premake5.lua +++ b/premake5.lua @@ -1,5 +1,4 @@ workspace "Nuake" - architecture "x64" conformancemode "On" configurations { @@ -20,6 +19,12 @@ workspace "Nuake" "NK_DEBUG" } + filter { "language:C++" } + architecture "x64" + + filter { "language:C" } + architecture "x64" + outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}" include "Nuake/dependencies/glfw_p5.lua" @@ -29,6 +34,7 @@ include "Nuake/dependencies/freetype_p5.lua" include "Nuake/dependencies/jolt_p5.lua" include "Nuake/dependencies/soloud_p5.lua" include "Nuake/dependencies/optick_p5.lua" +include "Nuake/dependencies/coral_p5.lua" project "Nuake" location "Nuake" @@ -213,7 +219,7 @@ project "NuakeRuntime" { "/usr/include/gtk-3.0/", "/usr/lib/glib-2.0/include", - "/usr/include/glib-2.0", + "/usr/include/glib-2.0", } buildoptions { "`pkg-config --cflags glib-2.0 pango gdk-pixbuf-2.0 gtk-3 atk tk-3.0 glib-2.0`" } @@ -294,7 +300,8 @@ project "Editor" "%{prj.name}/../Nuake/src/Vendors/msdfgen", "%{prj.name}/../Nuake/src/Vendors/wren/src/include", "%{prj.name}/../Nuake/dependencies/JoltPhysics/bin/%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}/JoltPhysics/", - "%{prj.name}/../Nuake/dependencies/soloud/bin/%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}" + "%{prj.name}/../Nuake/dependencies/soloud/bin/%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}", + "%{prj.name}/../Nuake/dependencies/Coral/NetCore/7.0.7/" } links @@ -303,9 +310,12 @@ project "Editor" "glad", "GLFW", "assimp", - "Freetype", - "JoltPhysics", - "soloud" + "Freetype", + "JoltPhysics", + "soloud", + "Coral.Native", + "nethost", + "libnethost" } filter "system:Windows" @@ -322,6 +332,14 @@ project "Editor" { "NK_WIN" } + + externalincludedirs { "%{prj.name}/../Nuake/dependencies/Coral/Coral.Native/Include/" } + + postbuildcommands { + '{ECHO} Copying "%{wks.location}/NetCore/7.0.7/nethost.dll" to "%{cfg.targetdir}"', + '{COPYFILE} "%{wks.location}/Nuake/dependencies/Coral/NetCore/7.0.7/nethost.dll" "%{cfg.targetdir}"', + '{COPYFILE} "%{wks.location}/Nuake/dependencies/Coral/Coral.Managed/Coral.Managed.runtimeconfig.json" "%{cfg.targetdir}"', + } filter "system:linux" @@ -334,8 +352,8 @@ project "Editor" "asound", "glib-2.0", "gtk-3", - "gobject-2.0", - "asound" + "gobject-2.0", + "asound" } buildoptions { "`pkg-config --cflags glib-2.0 pango gdk-pixbuf-2.0 gtk-3 atk tk-3.0 glib-2.0`" }