Added Coral + minor fixes

This commit is contained in:
Antoine Pilote
2023-10-12 22:44:13 -04:00
parent c826056846
commit 868d019c35
10 changed files with 73 additions and 46 deletions

3
.gitmodules vendored
View File

@@ -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

View File

@@ -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<Directory>& 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();

View File

@@ -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<float>(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();

View File

@@ -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.

View File

@@ -0,0 +1,2 @@
include "Coral/Coral.Native"
include "Coral/Coral.Managed"

View File

@@ -147,13 +147,13 @@ namespace Nuake
void FileSystem::ScanDirectory(Ref<Directory> 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<Directory> newDir = CreateRef<Directory>();
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<Directory>();
RootDirectory->Files = std::vector<Ref<File>>();
RootDirectory->Directories = std::vector<Ref<Directory>>();
RootDirectory->name = FileSystem::AbsoluteToRelative(Root);
RootDirectory->fullPath = Root;
RootDirectory = CreateRef<Directory>(Root);
ScanDirectory(RootDirectory);
}
@@ -300,7 +296,7 @@ namespace Nuake
int currentDepth = -1;
std::string currentDirName = ".";
Ref<Directory> 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<Ref<File>>();
Directories = std::vector<Ref<Directory>>();
Name = FileSystem::AbsoluteToRelative(path);
FullPath = path;
}
}

View File

@@ -195,10 +195,14 @@ namespace Nuake
class Directory
{
public:
std::string name;
std::string fullPath;
std::string Name;
std::string FullPath;
Ref<Directory> Parent;
std::vector<Ref<Directory>> Directories;
std::vector<Ref<File>> Files;
Directory(const std::string& path);
Directory() = default;
~Directory() = default;
};
}

View File

@@ -56,7 +56,7 @@ namespace Nuake {
int OS::RenameFile(const Ref<File>& 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<Directory>& 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;
}

View File

@@ -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`" }