diff --git a/.gitignore b/.gitignore index ff996e7f..de8ad28d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ install_manifest.txt compile_commands.json CTestTestfile.cmake _deps +*.make # Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. @@ -864,4 +865,4 @@ Nuake/dependencies/glad/glad.vcxproj.filters *.csproj *.filters cloc.exe -Nuake/src/Modules/Modules.cpp \ No newline at end of file +Nuake/src/Modules/Modules.cpp diff --git a/Editor/Source/Editor/ComponentsPanel/ComponentPanel.h b/Editor/Source/Editor/ComponentsPanel/ComponentPanel.h index 8c7ae4e7..9e89c941 100644 --- a/Editor/Source/Editor/ComponentsPanel/ComponentPanel.h +++ b/Editor/Source/Editor/ComponentsPanel/ComponentPanel.h @@ -16,7 +16,7 @@ #define CompononentPropertyName(name) \ ImGui::AlignTextToFramePadding(); \ -ImGui::Text(##name); +ImGui::Text(name); #define BeginComponentTable(name, component) \ UIFont* boldFont = new UIFont(Fonts::Bold); \ diff --git a/Editor/Source/Editor/ComponentsPanel/MaterialEditor.cpp b/Editor/Source/Editor/ComponentsPanel/MaterialEditor.cpp index 322b0df3..0dc72daf 100644 --- a/Editor/Source/Editor/ComponentsPanel/MaterialEditor.cpp +++ b/Editor/Source/Editor/ComponentsPanel/MaterialEditor.cpp @@ -99,7 +99,7 @@ void MaterialEditor::Draw(Ref material) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image1"), (ImTextureID)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (texture != "") { material->SetAlbedo(TextureManager::Get()->GetTexture(texture)); @@ -133,7 +133,7 @@ void MaterialEditor::Draw(Ref material) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image3"), (void*)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 1), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (texture != "") { material->SetNormal(TextureManager::Get()->GetTexture(texture)); @@ -164,7 +164,7 @@ void MaterialEditor::Draw(Ref material) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image2"), (void*)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(1, 1, 1, 1), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("Image files (*.png) | *.png | Image files (*.jpg) | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (texture != "") { material->SetAO(TextureManager::Get()->GetTexture(texture)); @@ -198,7 +198,7 @@ void MaterialEditor::Draw(Ref material) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image4"), (void*)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 1), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (texture != "") { material->SetMetalness(TextureManager::Get()->GetTexture(texture)); @@ -232,7 +232,7 @@ void MaterialEditor::Draw(Ref material) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image5"), (void*)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (texture != "") { material->SetRoughness(TextureManager::Get()->GetTexture(texture)); @@ -252,4 +252,4 @@ void MaterialEditor::Draw(Ref material) } ImGui::EndChild(); } -} \ No newline at end of file +} diff --git a/Editor/Source/Editor/EditorApplication.cpp b/Editor/Source/Editor/EditorApplication.cpp index 05d3c1b2..f0cd4a70 100644 --- a/Editor/Source/Editor/EditorApplication.cpp +++ b/Editor/Source/Editor/EditorApplication.cpp @@ -87,4 +87,4 @@ void EditorApplication::OnInit() void EditorApplication::OnShutdown() { Nuake::Engine::Close(); -} \ No newline at end of file +} diff --git a/Editor/Source/Editor/Misc/ImGuiTextHelper.cpp b/Editor/Source/Editor/Misc/ImGuiTextHelper.cpp index 9f69b06f..502997af 100644 --- a/Editor/Source/Editor/Misc/ImGuiTextHelper.cpp +++ b/Editor/Source/Editor/Misc/ImGuiTextHelper.cpp @@ -2,6 +2,10 @@ #include +#ifndef _MSC_VER +#define strncpy_s strncpy +#endif + void ImGuiTextSTD(const std::string& label, std::string& value) { char buffer[256]; diff --git a/Editor/Source/Editor/ScriptingContext/Modules/EditorModule.cpp b/Editor/Source/Editor/ScriptingContext/Modules/EditorModule.cpp index d6eb8445..4269a793 100644 --- a/Editor/Source/Editor/ScriptingContext/Modules/EditorModule.cpp +++ b/Editor/Source/Editor/ScriptingContext/Modules/EditorModule.cpp @@ -19,6 +19,6 @@ int GetSelectedEntity() void EditorNetAPI::RegisterMethods() { - RegisterMethod("Editor.SetSelectedEntityIcall", &SelectEntity); - RegisterMethod("Editor.GetSelectedEntityIcall", &GetSelectedEntity); + RegisterMethod("Editor.SetSelectedEntityIcall", (void*)(&SelectEntity)); + RegisterMethod("Editor.GetSelectedEntityIcall", (void*)(&GetSelectedEntity)); } diff --git a/Editor/Source/Editor/Windows/EditorInterface.cpp b/Editor/Source/Editor/Windows/EditorInterface.cpp index 87d4b7a7..1f065af1 100644 --- a/Editor/Source/Editor/Windows/EditorInterface.cpp +++ b/Editor/Source/Editor/Windows/EditorInterface.cpp @@ -2260,7 +2260,7 @@ namespace Nuake { void OpenScene() { // Parse the project and load it. - std::string projectPath = FileDialog::OpenFile(".scene"); + std::string projectPath = FileDialog::OpenFile("Scene file\0*.scene"); if (projectPath.empty() || !FileSystem::FileExists(projectPath, true)) { return; diff --git a/Editor/Source/Editor/Windows/EditorSelectionPanel.cpp b/Editor/Source/Editor/Windows/EditorSelectionPanel.cpp index 0f0346ab..5ef5773e 100644 --- a/Editor/Source/Editor/Windows/EditorSelectionPanel.cpp +++ b/Editor/Source/Editor/Windows/EditorSelectionPanel.cpp @@ -308,7 +308,7 @@ void EditorSelectionPanel::DrawFile(Ref file) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#skytexture1"), (void*)textureId, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (!texture.empty()) { sky->SetTextureFace(SkyFaces::Top, FileSystem::AbsoluteToRelative(texture)); @@ -335,7 +335,7 @@ void EditorSelectionPanel::DrawFile(Ref file) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#skytexture2"), (void*)textureId, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (!texture.empty()) { sky->SetTextureFace(SkyFaces::Bottom, FileSystem::AbsoluteToRelative(texture)); @@ -362,7 +362,7 @@ void EditorSelectionPanel::DrawFile(Ref file) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#skytexture3"), (void*)textureId, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (!texture.empty()) { sky->SetTextureFace(SkyFaces::Left, FileSystem::AbsoluteToRelative(texture)); @@ -389,7 +389,7 @@ void EditorSelectionPanel::DrawFile(Ref file) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#skytexture4"), (void*)textureId, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (!texture.empty()) { sky->SetTextureFace(SkyFaces::Right, FileSystem::AbsoluteToRelative(texture)); @@ -416,7 +416,7 @@ void EditorSelectionPanel::DrawFile(Ref file) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#skytexture5"), (void*)textureId, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (!texture.empty()) { sky->SetTextureFace(SkyFaces::Front, FileSystem::AbsoluteToRelative(texture)); @@ -443,7 +443,7 @@ void EditorSelectionPanel::DrawFile(Ref file) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#skytexture6"), (void*)textureId, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (!texture.empty()) { sky->SetTextureFace(SkyFaces::Back, FileSystem::AbsoluteToRelative(texture)); @@ -1587,7 +1587,7 @@ void EditorSelectionPanel::DrawMaterialPanel(Ref material) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image1"), (void*)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (texture != "") { material->SetAlbedo(TextureManager::Get()->GetTexture(texture)); @@ -1621,7 +1621,7 @@ void EditorSelectionPanel::DrawMaterialPanel(Ref material) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image3"), (void*)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 1), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (texture != "") { material->SetNormal(TextureManager::Get()->GetTexture(texture)); @@ -1652,7 +1652,7 @@ void EditorSelectionPanel::DrawMaterialPanel(Ref material) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image2"), (void*)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(1, 1, 1, 1), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("Image files (*.png) | *.png | Image files (*.jpg) | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (texture != "") { material->SetAO(TextureManager::Get()->GetTexture(texture)); @@ -1683,7 +1683,7 @@ void EditorSelectionPanel::DrawMaterialPanel(Ref material) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image4"), (void*)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 1), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (texture != "") { material->SetMetalness(TextureManager::Get()->GetTexture(texture)); @@ -1717,7 +1717,7 @@ void EditorSelectionPanel::DrawMaterialPanel(Ref material) if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image5"), (void*)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { - std::string texture = FileDialog::OpenFile("*.png | *.jpg"); + std::string texture = FileDialog::OpenFile("Image Files\0*.png|*.jpg"); if (texture != "") { material->SetRoughness(TextureManager::Get()->GetTexture(texture)); @@ -2040,10 +2040,10 @@ void EditorSelectionPanel::DrawFieldTypeString(entt::meta_data& field, entt::met std::string controlId = std::string("##") + displayName; ImGui::InputText(controlId.c_str(), &fieldValProxy); - //if (fieldValProxy != fieldVal) - //{ - // Engine::GetProject()->IsDirty = true; - //} + if (fieldValProxy != (const char*)fieldVal.data()) + { + Engine::GetProject()->IsDirty = true; + } } else { diff --git a/Editor/Source/Editor/Windows/MapImporterWindow.cpp b/Editor/Source/Editor/Windows/MapImporterWindow.cpp index 145aaee3..daf2587e 100644 --- a/Editor/Source/Editor/Windows/MapImporterWindow.cpp +++ b/Editor/Source/Editor/Windows/MapImporterWindow.cpp @@ -47,7 +47,7 @@ void MapImporterWindow::Draw() using namespace Nuake; if (ImGui::Button(buttonLbl.c_str())) { - std::string selectedFile = FileDialog::OpenFile("*.map"); + std::string selectedFile = FileDialog::OpenFile("Quake maps\0*.map"); std::string relativePath = FileSystem::AbsoluteToRelative(selectedFile); if (!selectedFile.empty() && FileSystem::FileExists(relativePath)) { diff --git a/Editor/Source/Editor/Windows/PrefabEditor/PrefabEditorWindow.cpp b/Editor/Source/Editor/Windows/PrefabEditor/PrefabEditorWindow.cpp index 4f247880..bc84c7ca 100644 --- a/Editor/Source/Editor/Windows/PrefabEditor/PrefabEditorWindow.cpp +++ b/Editor/Source/Editor/Windows/PrefabEditor/PrefabEditorWindow.cpp @@ -1,7 +1,7 @@ #include "PrefabEditorWindow.h" #include -#include +#include #include #include #include diff --git a/Editor/Source/Editor/Windows/ProjectInterface.cpp b/Editor/Source/Editor/Windows/ProjectInterface.cpp index 14a6bf78..1272cd26 100644 --- a/Editor/Source/Editor/Windows/ProjectInterface.cpp +++ b/Editor/Source/Editor/Windows/ProjectInterface.cpp @@ -54,7 +54,7 @@ namespace Nuake { ImGui::SameLine(); if (ImGui::Button("Browse")) { - std::string path = FileDialog::OpenFile("*.exe"); + std::string path = FileDialog::OpenFile("Windows Executable\0*.exe"); if (path != "") { path += "/../"; diff --git a/Editor/premake5.lua b/Editor/premake5.lua index d5fc6f85..45bc4ddd 100644 --- a/Editor/premake5.lua +++ b/Editor/premake5.lua @@ -72,18 +72,66 @@ project "Editor" "msdf-gen", "msdf-atlas-gen", "Freetype", - "vma" + "vma", + "dxcompiler" } + libdirs { "../Nuake/Thirdparty/dxc/lib/x64" } - prebuildcommands { - '{ECHO} "Copying dxcompiler.dll to Working directory..."', - '{COPYFILE} "%{wks.location}Nuake/Thirdparty/dxc/bin/x64/dxcompiler.dll" "%{cfg.debugdir}/"', - '{ECHO} Copying Coral to Working directory...', - '{COPYFILE} "%{wks.location}Nuake/Thirdparty/Coral/Coral.Managed/bin/%{cfg.buildcfg}/Coral.Managed.dll" "%{cfg.debugdir}/"', - '{COPYFILE} "%{wks.location}Nuake/Thirdparty/Coral/Coral.Managed/bin/%{cfg.buildcfg}/Coral.Managed.runtimeconfig.json" "%{cfg.debugdir}/"', - '{COPYFILE} "%{wks.location}NuakeNet/Build/%{cfg.buildcfg}/Binaries/NuakeNet.dll" "%{cfg.debugdir}/"', - 'xcopy /E /I /Y "%{wks.location}Data" "%{cfg.debugdir}\\Resources"' - } + filter "system:windows" + defines + { + "NK_WIN" + } + prebuildcommands { + '{ECHO} "Copying dxcompiler.dll to Working directory..."', + '{COPYFILE} "%{wks.location}Nuake/Thirdparty/dxc/bin/x64/dxcompiler.dll" "%{cfg.debugdir}/"', + '{ECHO} Copying Coral to Working directory...', + '{COPYFILE} "%{wks.location}Nuake/Thirdparty/Coral/Coral.Managed/bin/%{cfg.buildcfg}/Coral.Managed.dll" "%{cfg.debugdir}/"', + '{COPYFILE} "%{wks.location}Nuake/Thirdparty/Coral/Coral.Managed/bin/%{cfg.buildcfg}/Coral.Managed.runtimeconfig.json" "%{cfg.debugdir}/"', + '{COPYFILE} "%{wks.location}NuakeNet/Build/%{cfg.buildcfg}/Binaries/NuakeNet.dll" "%{cfg.debugdir}/"', + 'xcopy /E /I /Y "%{wks.location}Data" "%{cfg.debugdir}\\Resources"' + } + + filter "system:linux" + defines + { + "NK_LINUX" + } + + links + { + "GL", + "glfw", + "glad", + "X11", + "asound", + "glib-2.0", + "gtk-3", + "gobject-2.0" + } + linkoptions { "`pkg-config --libs glib-2.0 pango gdk-pixbuf-2.0 gtk+-3.0 glib-2.0 gobject-2.0`" } + + filter "system:bsd" + defines + { + "NK_LINUX", + "NK_BSD" + } + + links + { + "GL", + "glfw", + "glad", + "X11", + "asound", + "glib-2.0", + "gtk-3", + "gobject-2.0", + "pthread", + "execinfo" + } + linkoptions { "`pkg-config --libs glib-2.0 pango gdk-pixbuf-2.0 gtk+-3.0 glib-2.0 gobject-2.0`" } filter { "system:windows", "action:vs*"} flags diff --git a/Nuake/Source/Nuake/Application/Application.h b/Nuake/Source/Nuake/Application/Application.h index e22f18cd..83170654 100644 --- a/Nuake/Source/Nuake/Application/Application.h +++ b/Nuake/Source/Nuake/Application/Application.h @@ -4,7 +4,7 @@ #include "LayerStack.h" #include -#include +#include #include "Nuake/Window.h" @@ -86,4 +86,4 @@ namespace Nuake { // Implemented by the client Application* CreateApplication(int argc, char** argv); -} \ No newline at end of file +} diff --git a/Nuake/Source/Nuake/Application/EntryPoint.h b/Nuake/Source/Nuake/Application/EntryPoint.h index 5423d8ca..50987c1e 100644 --- a/Nuake/Source/Nuake/Application/EntryPoint.h +++ b/Nuake/Source/Nuake/Application/EntryPoint.h @@ -18,7 +18,7 @@ namespace Nuake { g_ApplicationRunning = false; } - return 1; + return 0; } } @@ -41,4 +41,4 @@ int main(int argc, char** argv) { return Nuake::Main(argc, argv); } -#endif \ No newline at end of file +#endif diff --git a/Nuake/Source/Nuake/Core/OS.cpp b/Nuake/Source/Nuake/Core/OS.cpp index 84241424..e7444595 100644 --- a/Nuake/Source/Nuake/Core/OS.cpp +++ b/Nuake/Source/Nuake/Core/OS.cpp @@ -140,10 +140,13 @@ namespace Nuake { { path = ""; } -#endif -#ifdef NK_LINUX - path = "~/.config"; +#elif defined(NK_LINUX) + const char* homeDir = getenv("HOME"); + // fallback, should be almost impossible in almost all desktop setups + if (homeDir[0] == '\0') + homeDir = "/root"; + path = std::string(homeDir) + "/.config"; #endif return path; @@ -224,4 +227,4 @@ namespace Nuake { system(command.c_str()); #endif } -} \ No newline at end of file +} diff --git a/Nuake/Source/Nuake/FileSystem/FileDialog.cpp b/Nuake/Source/Nuake/FileSystem/FileDialog.cpp index 247889d4..8865f938 100644 --- a/Nuake/Source/Nuake/FileSystem/FileDialog.cpp +++ b/Nuake/Source/Nuake/FileSystem/FileDialog.cpp @@ -40,9 +40,7 @@ std::string FileDialog::OpenFile(const std::string_view& filter) filePath = std::string(ofn.lpstrFile); } -#endif - -#ifdef NK_LINUX +#elif defined(NK_LINUX) GtkWidget *dialog; GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; gint res; @@ -58,10 +56,19 @@ std::string FileDialog::OpenFile(const std::string_view& filter) gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE); - if (filter) { + if (!filter.empty()) { GtkFileFilter *file_filter = gtk_file_filter_new(); - gtk_file_filter_set_name(file_filter, "Filter Name"); - gtk_file_filter_add_pattern(file_filter, filter); + gtk_file_filter_set_name(file_filter, filter.data()); + + size_t pos = 0; + size_t end = 0; + std::string filterCopy(filter.data() + strlen(filter.data()) + 1); + while ((end = filterCopy.find('|', pos)) != std::string::npos) { + std::string token = filterCopy.substr(pos, end - pos); + gtk_file_filter_add_pattern(file_filter, token.c_str()); + pos = end + 1; + } + gtk_file_filter_add_pattern(file_filter, filterCopy.substr(pos).c_str()); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), file_filter); } @@ -102,8 +109,6 @@ std::string FileDialog::SaveFile(const std::string_view& filter) GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE; gint res; - gtk_init(NULL, NULL); - dialog = gtk_file_chooser_dialog_new("Save File", NULL, action, @@ -114,7 +119,7 @@ std::string FileDialog::SaveFile(const std::string_view& filter) NULL); GtkFileFilter *file_filter = gtk_file_filter_new(); - gtk_file_filter_set_name(file_filter, filter); + gtk_file_filter_set_name(file_filter, filter.data()); gtk_file_filter_add_pattern(file_filter, "*.*"); // You can customize this pattern gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), file_filter); @@ -197,6 +202,30 @@ std::string FileDialog::OpenFolder() // Uninitialize COM library CoUninitialize(); } + +#elif defined(NK_LINUX) + GtkWidget *dialog; + GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; + gint res; + + dialog = gtk_file_chooser_dialog_new("Open Folder", + NULL, + action, + "_Cancel", + GTK_RESPONSE_CANCEL, + "_Open", + GTK_RESPONSE_ACCEPT, + NULL); + + res = gtk_dialog_run(GTK_DIALOG(dialog)); + + if (res == GTK_RESPONSE_ACCEPT) { + char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); + folderPath = filename; + g_free(filename); + } + + gtk_widget_destroy(dialog); #endif return folderPath; -} \ No newline at end of file +} diff --git a/Nuake/Source/Nuake/FileSystem/FileSystem.cpp b/Nuake/Source/Nuake/FileSystem/FileSystem.cpp index 41b01962..a1da7d95 100644 --- a/Nuake/Source/Nuake/FileSystem/FileSystem.cpp +++ b/Nuake/Source/Nuake/FileSystem/FileSystem.cpp @@ -7,16 +7,21 @@ #include "Directory.h" #include "File.h" +#ifndef NK_BSD #include "filewatch/FileWatch.hpp" +#endif #include +#include using namespace Nuake; std::string FileSystem::Root = ""; Ref FileSystem::RootDirectory; +#ifndef NK_BSD Ref> FileSystem::RootFileWatch; +#endif void FileSystem::ForeachFile(OnFileFunc func) { @@ -113,6 +118,7 @@ std::vector> FileSystem::GetAllFiles(const FileType fileType) void FileSystem::SetRootDirectory(const std::string path) { Root = path; +#ifndef NK_BSD RootFileWatch = CreateRef>( path, [&](const std::string& path, const filewatch::Event& event) { @@ -150,6 +156,7 @@ void FileSystem::SetRootDirectory(const std::string path) } } ); +#endif Scan(); } diff --git a/Nuake/Source/Nuake/FileSystem/FileSystem.h b/Nuake/Source/Nuake/FileSystem/FileSystem.h index 38767827..631e09a3 100644 --- a/Nuake/Source/Nuake/FileSystem/FileSystem.h +++ b/Nuake/Source/Nuake/FileSystem/FileSystem.h @@ -4,11 +4,13 @@ #include +#ifndef NK_BSD namespace filewatch { template class FileWatch; } +#endif namespace Nuake { @@ -22,7 +24,9 @@ namespace Nuake public: static std::string Root; static Ref RootDirectory; +#ifndef NK_BSD static Ref> RootFileWatch; +#endif static void SetRootDirectory(const std::string path); diff --git a/Nuake/Source/Nuake/Physics/DynamicWorld.cpp b/Nuake/Source/Nuake/Physics/DynamicWorld.cpp index 5c7e8777..b868dff0 100644 --- a/Nuake/Source/Nuake/Physics/DynamicWorld.cpp +++ b/Nuake/Source/Nuake/Physics/DynamicWorld.cpp @@ -590,7 +590,7 @@ namespace Nuake Vector3(hitPosition.GetX(), hitPosition.GetY(), hitPosition.GetZ()), hitFraction, Vector3(0, 0, 0), - layer, + static_cast(layer), userData }; diff --git a/Nuake/Source/Nuake/Rendering/Vulkan/ShaderCompiler.cpp b/Nuake/Source/Nuake/Rendering/Vulkan/ShaderCompiler.cpp index 6c7794d4..b898c27e 100644 --- a/Nuake/Source/Nuake/Rendering/Vulkan/ShaderCompiler.cpp +++ b/Nuake/Source/Nuake/Rendering/Vulkan/ShaderCompiler.cpp @@ -2,7 +2,11 @@ #include "VulkanShader.h" +#if NK_WIN #include +#else +#define __EMULATE_UUID 1 +#endif #include "dxcapi.h" #include #include diff --git a/Nuake/Source/Nuake/Rendering/Vulkan/VulkanInit.cpp b/Nuake/Source/Nuake/Rendering/Vulkan/VulkanInit.cpp index 6480b8ba..7ccbce38 100644 --- a/Nuake/Source/Nuake/Rendering/Vulkan/VulkanInit.cpp +++ b/Nuake/Source/Nuake/Rendering/Vulkan/VulkanInit.cpp @@ -1,5 +1,5 @@ #include "VulkanInit.h" -#include "VulkanImage\VulkanImage.h" +#include "VulkanImage/VulkanImage.h" using namespace Nuake; @@ -294,4 +294,4 @@ void VulkanUtil::CopyImageToImage(VkCommandBuffer cmd, VkImage source, VkImage d blitInfo.pRegions = &blitRegion; vkCmdBlitImage2(cmd, &blitInfo); -} \ No newline at end of file +} diff --git a/Nuake/Source/Nuake/Rendering/Vulkan/VulkanSceneRenderer.cpp b/Nuake/Source/Nuake/Rendering/Vulkan/VulkanSceneRenderer.cpp index 400e3cd4..a2c15f2c 100644 --- a/Nuake/Source/Nuake/Rendering/Vulkan/VulkanSceneRenderer.cpp +++ b/Nuake/Source/Nuake/Rendering/Vulkan/VulkanSceneRenderer.cpp @@ -52,19 +52,27 @@ void VkSceneRenderer::Init() void VkSceneRenderer::LoadShaders() { - // TODO: load embedded shaders in the future - VkShaderManager& shaderMgr = VkShaderManager::Get(); - ShaderCompiler& shaderCompiler = ShaderCompiler::Get(); - shaderMgr.AddShader("basic_frag", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/triangle.frag")); - shaderMgr.AddShader("basic_vert", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/triangle.vert")); - shaderMgr.AddShader("shading_frag", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/shading.frag")); - shaderMgr.AddShader("shading_vert", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/shading.vert")); - shaderMgr.AddShader("shadow_frag", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/shadow.frag")); - shaderMgr.AddShader("shadow_vert", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/shadow.vert")); - shaderMgr.AddShader("tonemap_frag", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/tonemap.frag")); - shaderMgr.AddShader("tonemap_vert", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/tonemap.vert")); - shaderMgr.AddShader("outline_frag", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/outline.frag")); - shaderMgr.AddShader("outline_vert", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/outline.vert")); + try + { + // TODO: load embedded shaders in the future + VkShaderManager& shaderMgr = VkShaderManager::Get(); + ShaderCompiler& shaderCompiler = ShaderCompiler::Get(); + shaderMgr.AddShader("basic_frag", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/triangle.frag")); + shaderMgr.AddShader("basic_vert", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/triangle.vert")); + shaderMgr.AddShader("shading_frag", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/shading.frag")); + shaderMgr.AddShader("shading_vert", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/shading.vert")); + shaderMgr.AddShader("shadow_frag", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/shadow.frag")); + shaderMgr.AddShader("shadow_vert", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/shadow.vert")); + shaderMgr.AddShader("tonemap_frag", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/tonemap.frag")); + shaderMgr.AddShader("tonemap_vert", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/tonemap.vert")); + shaderMgr.AddShader("outline_frag", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/outline.frag")); + shaderMgr.AddShader("outline_vert", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/outline.vert")); + } + catch (std::exception& e) + { + Logger::Log(e.what(), "scenerenderer", CRITICAL); + assert(false && "Failed to load shaders"); + } } void VkSceneRenderer::PrepareScenes(const std::vector>& scenes, RenderContext inContext) diff --git a/Nuake/Source/Nuake/Resource/FGD/FGDFile.h b/Nuake/Source/Nuake/Resource/FGD/FGDFile.h index b0c2f74d..f3f7e5f1 100644 --- a/Nuake/Source/Nuake/Resource/FGD/FGDFile.h +++ b/Nuake/Source/Nuake/Resource/FGD/FGDFile.h @@ -40,7 +40,7 @@ namespace Nuake { END_SERIALIZE(); } - bool Deserialize(const json& j) + bool Deserialize(const json& j) override { if (j.contains("BrushEntities")) { diff --git a/Nuake/Source/Nuake/Scene/Components/CameraComponent.cpp b/Nuake/Source/Nuake/Scene/Components/CameraComponent.cpp index 0c69ada9..0c398044 100644 --- a/Nuake/Source/Nuake/Scene/Components/CameraComponent.cpp +++ b/Nuake/Source/Nuake/Scene/Components/CameraComponent.cpp @@ -1,4 +1,3 @@ -#pragma once #include "CameraComponent.h" #include "Nuake/Rendering/Camera.h" #include "Nuake/Scene/Entities/ImGuiHelper.h" diff --git a/Nuake/Source/Nuake/Scene/Components/LightComponent.cpp b/Nuake/Source/Nuake/Scene/Components/LightComponent.cpp index 57195565..fa6864f4 100644 --- a/Nuake/Source/Nuake/Scene/Components/LightComponent.cpp +++ b/Nuake/Source/Nuake/Scene/Components/LightComponent.cpp @@ -1,5 +1,4 @@ -#pragma once -//#include +//#include #include "LightComponent.h" #include "Nuake/Rendering/Renderer.h" diff --git a/Nuake/Source/Nuake/Scene/Components/RigidbodyComponent.cpp b/Nuake/Source/Nuake/Scene/Components/RigidbodyComponent.cpp index c006498f..05e53915 100644 --- a/Nuake/Source/Nuake/Scene/Components/RigidbodyComponent.cpp +++ b/Nuake/Source/Nuake/Scene/Components/RigidbodyComponent.cpp @@ -1,4 +1,3 @@ -#pragma once #include "RigidbodyComponent.h" #include "Nuake/Physics/Rigibody.h" diff --git a/Nuake/Source/Nuake/Scene/Entities/Entity.h b/Nuake/Source/Nuake/Scene/Entities/Entity.h index a767714e..7048a091 100644 --- a/Nuake/Source/Nuake/Scene/Entities/Entity.h +++ b/Nuake/Source/Nuake/Scene/Entities/Entity.h @@ -128,7 +128,7 @@ namespace Nuake } json Serialize() override; - bool Deserialize(const json& str); + bool Deserialize(const json& str) override; bool DeserializeComponents(const json& str); void PostDeserialize(); diff --git a/Nuake/Source/Nuake/Scene/Lighting/Environment.cpp b/Nuake/Source/Nuake/Scene/Lighting/Environment.cpp index 5d7545e4..882b0fd0 100644 --- a/Nuake/Source/Nuake/Scene/Lighting/Environment.cpp +++ b/Nuake/Source/Nuake/Scene/Lighting/Environment.cpp @@ -1,4 +1,3 @@ -#pragma once #include "Environment.h" #include "Nuake/Core/Core.h" diff --git a/Nuake/Source/Nuake/Scene/Scene.cpp b/Nuake/Source/Nuake/Scene/Scene.cpp index bdb74ed6..fbce57df 100644 --- a/Nuake/Source/Nuake/Scene/Scene.cpp +++ b/Nuake/Source/Nuake/Scene/Scene.cpp @@ -1,4 +1,3 @@ -#pragma once #include "Scene.h" #include "Entities/Entity.h" diff --git a/Nuake/Source/Nuake/Scene/Systems/WadConverter.cpp b/Nuake/Source/Nuake/Scene/Systems/WadConverter.cpp index e0747401..49fce38a 100644 --- a/Nuake/Source/Nuake/Scene/Systems/WadConverter.cpp +++ b/Nuake/Source/Nuake/Scene/Systems/WadConverter.cpp @@ -475,11 +475,11 @@ namespace Nuake if (!wad_R_fp) { - printf("WAD2_OpenRead: no such file: %s\n", filename); + printf("WAD2_OpenRead: no such file: %s\n", filename.c_str()); return; } - printf("Opened WAD2 file: %s\n", filename); + printf("Opened WAD2 file: %s\n", filename.c_str()); if (fread(&wad_R_header, sizeof(wad_R_header), 1, wad_R_fp) != 1) { @@ -560,4 +560,4 @@ namespace Nuake wad_R_dir = NULL; } -} \ No newline at end of file +} diff --git a/Nuake/Source/Nuake/Scripting/NetModules/EngineNetAPI.cpp b/Nuake/Source/Nuake/Scripting/NetModules/EngineNetAPI.cpp index e259bfb4..85a67444 100644 --- a/Nuake/Source/Nuake/Scripting/NetModules/EngineNetAPI.cpp +++ b/Nuake/Source/Nuake/Scripting/NetModules/EngineNetAPI.cpp @@ -9,7 +9,7 @@ #include #include #include "Coral/Type.hpp" -#include "..\..\Subsystems\EngineSubsystemScriptable.h" +#include "../../Subsystems/EngineSubsystemScriptable.h" namespace Nuake { @@ -141,21 +141,21 @@ namespace Nuake { void EngineNetAPI::RegisterMethods() { - RegisterMethod("Engine.LoadSceneIcall", &LoadScene); + RegisterMethod("Engine.LoadSceneIcall", (void*)(&LoadScene)); RegisterMethod("Engine.LoggerLogIcall", (void*)(&Log)); - RegisterMethod("Engine.GetSubsystemByNameIcall", &GetEngineSubsystemByName); + RegisterMethod("Engine.GetSubsystemByNameIcall", (void*)(&GetEngineSubsystemByName)); // Debug renderer - RegisterMethod("Debug.DrawLineIcall", &DrawLine); - RegisterMethod("Debug.DrawShapeBoxIcall", &DrawShapeBox); - RegisterMethod("Debug.DrawShapeSphereIcall", &DrawShapeSphere); - RegisterMethod("Debug.DrawShapeCapsuleIcall", &DrawShapeCapsule); - RegisterMethod("Debug.DrawShapeCylinderIcall", &DrawShapeCylinder); + RegisterMethod("Debug.DrawLineIcall", (void*)(&DrawLine)); + RegisterMethod("Debug.DrawShapeBoxIcall", (void*)(&DrawShapeBox)); + RegisterMethod("Debug.DrawShapeSphereIcall", (void*)(&DrawShapeSphere)); + RegisterMethod("Debug.DrawShapeCapsuleIcall", (void*)(&DrawShapeCapsule)); + RegisterMethod("Debug.DrawShapeCylinderIcall", (void*)(&DrawShapeCylinder)); - RegisterMethod("Physic.RayCastIcall", &Raycast); - RegisterMethod("Physic.ShapeCastSphereIcall", &ShapeCastSphere); - RegisterMethod("Physic.ShapeCastCapsuleIcall", &ShapeCastCapsule); - RegisterMethod("Physic.ShapeCastBoxIcall", &ShapeCastBox); + RegisterMethod("Physic.RayCastIcall", (void*)(&Raycast)); + RegisterMethod("Physic.ShapeCastSphereIcall", (void*)(&ShapeCastSphere)); + RegisterMethod("Physic.ShapeCastCapsuleIcall", (void*)(&ShapeCastCapsule)); + RegisterMethod("Physic.ShapeCastBoxIcall", (void*)(&ShapeCastBox)); } } diff --git a/Nuake/Source/Nuake/Scripting/NetModules/EngineSubsystemNetAPI.cpp b/Nuake/Source/Nuake/Scripting/NetModules/EngineSubsystemNetAPI.cpp index ebfedd72..3ea30172 100644 --- a/Nuake/Source/Nuake/Scripting/NetModules/EngineSubsystemNetAPI.cpp +++ b/Nuake/Source/Nuake/Scripting/NetModules/EngineSubsystemNetAPI.cpp @@ -31,7 +31,7 @@ namespace Nuake void EngineSubsystemNetAPI::RegisterMethods() { - RegisterMethod("EngineSubsystem.SetCanTickIcall", &SetCanTick); - RegisterMethod("EngineSubsystem.GetCanTickIcall", &GetCanTick); + RegisterMethod("EngineSubsystem.SetCanTickIcall", (void*)(&SetCanTick)); + RegisterMethod("EngineSubsystem.GetCanTickIcall", (void*)(&GetCanTick)); } } diff --git a/Nuake/Source/Nuake/Scripting/NetModules/InputNetAPI.cpp b/Nuake/Source/Nuake/Scripting/NetModules/InputNetAPI.cpp index ea9bf717..e8b20507 100644 --- a/Nuake/Source/Nuake/Scripting/NetModules/InputNetAPI.cpp +++ b/Nuake/Source/Nuake/Scripting/NetModules/InputNetAPI.cpp @@ -63,17 +63,17 @@ namespace Nuake { void InputNetAPI::RegisterMethods() { - RegisterMethod("Input.ShowMouseIcall", &ShowMouse); - RegisterMethod("Input.IsKeyDownIcall", &IsKeyDown); - RegisterMethod("Input.IsKeyPressedIcall", &IsKeyPressed); + RegisterMethod("Input.ShowMouseIcall", (void*)(&ShowMouse)); + RegisterMethod("Input.IsKeyDownIcall", (void*)(&IsKeyDown)); + RegisterMethod("Input.IsKeyPressedIcall", (void*)(&IsKeyPressed)); - RegisterMethod("Input.IsMouseButtonDownIcall", &IsMouseButtonDown); - RegisterMethod("Input.GetMousePositionIcall", &GetMousePosition); + RegisterMethod("Input.IsMouseButtonDownIcall", (void*)(&IsMouseButtonDown)); + RegisterMethod("Input.GetMousePositionIcall", (void*)(&GetMousePosition)); - RegisterMethod("Input.IsControllerConnectedIcall", &IsControllerConnected); - RegisterMethod("Input.GetControllerNameIcall", &GetControllerName); - RegisterMethod("Input.IsControllerButtonPressedIcall", &IsControllerButtonPressed); - RegisterMethod("Input.GetControllerAxisIcall", &GetControllerAxis); + RegisterMethod("Input.IsControllerConnectedIcall", (void*)(&IsControllerConnected)); + RegisterMethod("Input.GetControllerNameIcall", (void*)(&GetControllerName)); + RegisterMethod("Input.IsControllerButtonPressedIcall", (void*)(&IsControllerButtonPressed)); + RegisterMethod("Input.GetControllerAxisIcall", (void*)(&GetControllerAxis)); } diff --git a/Nuake/Source/Nuake/Scripting/NetModules/NetAPIModule.h b/Nuake/Source/Nuake/Scripting/NetModules/NetAPIModule.h index 50ac35ca..1e5f2b25 100644 --- a/Nuake/Source/Nuake/Scripting/NetModules/NetAPIModule.h +++ b/Nuake/Source/Nuake/Scripting/NetModules/NetAPIModule.h @@ -24,4 +24,4 @@ namespace Nuake { private: MethodMap m_Methods; }; -} \ No newline at end of file +} diff --git a/Nuake/Source/Nuake/Scripting/NetModules/SceneNetAPI.cpp b/Nuake/Source/Nuake/Scripting/NetModules/SceneNetAPI.cpp index 0b1e7018..3dc16c63 100644 --- a/Nuake/Source/Nuake/Scripting/NetModules/SceneNetAPI.cpp +++ b/Nuake/Source/Nuake/Scripting/NetModules/SceneNetAPI.cpp @@ -637,61 +637,61 @@ namespace Nuake { void Nuake::SceneNetAPI::RegisterMethods() { // Entity - RegisterMethod("Entity.EntityHasComponentIcall", &EntityHasComponent); - RegisterMethod("Entity.EntityAddComponentIcall", &EntityAddComponent); - RegisterMethod("Entity.EntityHasManagedInstanceIcall", &EntityHasManagedInstance); - RegisterMethod("Entity.EntityGetEntityIcall", &EntityGetEntity); - RegisterMethod("Entity.EntityGetNameIcall", &EntityGetName); - RegisterMethod("Entity.EntitySetNameIcall", &EntitySetName); - RegisterMethod("Entity.EntityIsValidIcall", &EntityIsValid); - RegisterMethod("Entity.EntityGetTargetsIcall", &EntityGetTargets); - RegisterMethod("Entity.EntityGetTargetIcall", &EntityGetTarget); + RegisterMethod("Entity.EntityHasComponentIcall", (void*)(&EntityHasComponent)); + RegisterMethod("Entity.EntityAddComponentIcall", (void*)(&EntityAddComponent)); + RegisterMethod("Entity.EntityHasManagedInstanceIcall", (void*)(&EntityHasManagedInstance)); + RegisterMethod("Entity.EntityGetEntityIcall", (void*)(&EntityGetEntity)); + RegisterMethod("Entity.EntityGetNameIcall", (void*)(&EntityGetName)); + RegisterMethod("Entity.EntitySetNameIcall", (void*)(&EntitySetName)); + RegisterMethod("Entity.EntityIsValidIcall", (void*)(&EntityIsValid)); + RegisterMethod("Entity.EntityGetTargetsIcall", (void*)(&EntityGetTargets)); + RegisterMethod("Entity.EntityGetTargetIcall", (void*)(&EntityGetTarget)); // Prefab - RegisterMethod("Prefab.PrefabInstanceIcall", &PrefabInstance); + RegisterMethod("Prefab.PrefabInstanceIcall", (void*)(&PrefabInstance)); // Scene - RegisterMethod("Scene.GetEntityIcall", &GetEntity); - RegisterMethod("Scene.GetEntityScriptFromNameIcall", &GetEntityScriptFromName); - RegisterMethod("Scene.GetEntityScriptFromHandleIcall", &GetEntityScriptFromHandle); - RegisterMethod("Scene.InstancePrefabIcall", &InstancePrefab); + RegisterMethod("Scene.GetEntityIcall", (void*)(&GetEntity)); + RegisterMethod("Scene.GetEntityScriptFromNameIcall", (void*)(&GetEntityScriptFromName)); + RegisterMethod("Scene.GetEntityScriptFromHandleIcall", (void*)(&GetEntityScriptFromHandle)); + RegisterMethod("Scene.InstancePrefabIcall", (void*)(&InstancePrefab)); // Components // Transform - RegisterMethod("TransformComponent.SetPositionIcall", &TransformSetPosition); - RegisterMethod("TransformComponent.GetPositionIcall", &TransformGetPosition); - RegisterMethod("TransformComponent.GetGlobalPositionIcall", &TransformGetGlobalPosition); - RegisterMethod("TransformComponent.RotateIcall", &TransformRotate); - RegisterMethod("TransformComponent.LookAtIcall", &TransformLookAt); + RegisterMethod("TransformComponent.SetPositionIcall", (void*)(&TransformSetPosition)); + RegisterMethod("TransformComponent.GetPositionIcall", (void*)(&TransformGetPosition)); + RegisterMethod("TransformComponent.GetGlobalPositionIcall", (void*)(&TransformGetGlobalPosition)); + RegisterMethod("TransformComponent.RotateIcall", (void*)(&TransformRotate)); + RegisterMethod("TransformComponent.LookAtIcall", (void*)(&TransformLookAt)); // Lights - RegisterMethod("LightComponent.GetLightIntensityIcall", &LightGetIntensity); - RegisterMethod("LightComponent.SetLightIntensityIcall", &LightSetIntensity); - RegisterMethod("LightComponent.SetLightColorIcall", &LightSetColor); + RegisterMethod("LightComponent.GetLightIntensityIcall", (void*)(&LightGetIntensity)); + RegisterMethod("LightComponent.SetLightIntensityIcall", (void*)(&LightSetIntensity)); + RegisterMethod("LightComponent.SetLightColorIcall", (void*)(&LightSetColor)); // Camera - RegisterMethod("CameraComponent.GetDirectionIcall", &CameraGetDirection); - RegisterMethod("CameraComponent.GetCameraFOVIcall", &CameraGetFOV); - RegisterMethod("CameraComponent.SetCameraFOVIcall", &CameraSetFOV); + RegisterMethod("CameraComponent.GetDirectionIcall", (void*)(&CameraGetDirection)); + RegisterMethod("CameraComponent.GetCameraFOVIcall", (void*)(&CameraGetFOV)); + RegisterMethod("CameraComponent.SetCameraFOVIcall", (void*)(&CameraSetFOV)); // Character Controller - RegisterMethod("CharacterControllerComponent.MoveAndSlideIcall", &MoveAndSlide); - RegisterMethod("CharacterControllerComponent.IsOnGroundIcall", &IsOnGround); - RegisterMethod("CharacterControllerComponent.GetGroundVelocityIcall", &GetGroundVelocity); - RegisterMethod("CharacterControllerComponent.GetGroundNormalIcall", &GetGroundNormal); + RegisterMethod("CharacterControllerComponent.MoveAndSlideIcall", (void*)(&MoveAndSlide)); + RegisterMethod("CharacterControllerComponent.IsOnGroundIcall", (void*)(&IsOnGround)); + RegisterMethod("CharacterControllerComponent.GetGroundVelocityIcall", (void*)(&GetGroundVelocity)); + RegisterMethod("CharacterControllerComponent.GetGroundNormalIcall", (void*)(&GetGroundNormal)); // Skinned - RegisterMethod("SkinnedModelComponent.PlayIcall", &Play); + RegisterMethod("SkinnedModelComponent.PlayIcall", (void*)(&Play)); // Navigation Mesh - RegisterMethod("NavMeshVolumeComponent.FindPathIcall", &NavMeshComponentFindPath); + RegisterMethod("NavMeshVolumeComponent.FindPathIcall", (void*)(&NavMeshComponentFindPath)); // Audio Emitter - RegisterMethod("AudioEmitterComponent.GetIsPlayingIcall", &AudioEmitterGetIsPlaying); - RegisterMethod("AudioEmitterComponent.SetIsPlayingIcall", &AudioEmitterSetIsPlaying); + RegisterMethod("AudioEmitterComponent.GetIsPlayingIcall", (void*)(&AudioEmitterGetIsPlaying)); + RegisterMethod("AudioEmitterComponent.SetIsPlayingIcall", (void*)(&AudioEmitterSetIsPlaying)); - RegisterMethod("Environment.SetFocusDistanceIcall", &EnvironmentDepthOfFieldSetFocusDistanceIcall); - RegisterMethod("Environment.GetFocusDistanceIcall", &EnvironmentDepthOfFieldGetFocusDistanceIcall); + RegisterMethod("Environment.SetFocusDistanceIcall", (void*)(&EnvironmentDepthOfFieldSetFocusDistanceIcall)); + RegisterMethod("Environment.GetFocusDistanceIcall", (void*)(&EnvironmentDepthOfFieldGetFocusDistanceIcall)); } } diff --git a/Nuake/Source/Nuake/Scripting/NetModules/UINetAPI.cpp b/Nuake/Source/Nuake/Scripting/NetModules/UINetAPI.cpp index 5905c732..227095f0 100644 --- a/Nuake/Source/Nuake/Scripting/NetModules/UINetAPI.cpp +++ b/Nuake/Source/Nuake/Scripting/NetModules/UINetAPI.cpp @@ -168,19 +168,19 @@ void SetTextNodeTextICall(const Coral::String& canvasUUID, const Coral::String& void UINetAPI::RegisterMethods() { - RegisterMethod("Node.FindChildByIDICall", &FindChildByIDIcall); - RegisterMethod("Node.HasNativeInstanceICall", &HasNativeInstanceICall); - RegisterMethod("Node.GetNativeInstanceNodeICall", &GetNativeInstanceNodeICall); + RegisterMethod("Node.FindChildByIDICall", (void*)(&FindChildByIDIcall)); + RegisterMethod("Node.HasNativeInstanceICall", (void*)(&HasNativeInstanceICall)); + RegisterMethod("Node.GetNativeInstanceNodeICall", (void*)(&GetNativeInstanceNodeICall)); // Styling - RegisterMethod("Node.GetVisibilityICall", &GetVisibilityICall); - RegisterMethod("Node.SetVisibilityICall", &SetVisibilityICall); + RegisterMethod("Node.GetVisibilityICall", (void*)(&GetVisibilityICall)); + RegisterMethod("Node.SetVisibilityICall", (void*)(&SetVisibilityICall)); - //RegisterMethod("Node.GetWidthPercentageICall", &GetWidthPercentageICall); - RegisterMethod("Node.SetWidthPercentageICall", &SetWidthPercentageICall); - // RegisterMethod("Node.GetHeightPercentageICall", &GetHeightPercentageICall); - RegisterMethod("Node.SetHeightPercentageICall", &SetHeightPercentageICall); + //RegisterMethod("Node.GetWidthPercentageICall", (void*)(&GetWidthPercentageICall)); + RegisterMethod("Node.SetWidthPercentageICall", (void*)(&SetWidthPercentageICall)); + // RegisterMethod("Node.GetHeightPercentageICall", (void*)(&GetHeightPercentageICall)); + RegisterMethod("Node.SetHeightPercentageICall", (void*)(&SetHeightPercentageICall)); - RegisterMethod("TextNode.GetTextNodeTextICall", &GetTextNodeTextICall); - RegisterMethod("TextNode.SetTextNodeTextICall", &SetTextNodeTextICall); -} \ No newline at end of file + RegisterMethod("TextNode.GetTextNodeTextICall", (void*)(&GetTextNodeTextICall)); + RegisterMethod("TextNode.SetTextNodeTextICall", (void*)(&SetTextNodeTextICall)); +} diff --git a/Nuake/Source/Nuake/Scripting/ScriptingEngineNet.cpp b/Nuake/Source/Nuake/Scripting/ScriptingEngineNet.cpp index a6127271..995265c1 100644 --- a/Nuake/Source/Nuake/Scripting/ScriptingEngineNet.cpp +++ b/Nuake/Source/Nuake/Scripting/ScriptingEngineNet.cpp @@ -51,6 +51,8 @@ namespace Nuake if (status != Coral::CoralInitStatus::Success) { Logger::Log("Failed to initialize Coral: " + std::to_string((int)status)); + delete hostInstance; + return; } // Initialize API modules @@ -81,7 +83,9 @@ namespace Nuake ScriptingEngineNet::~ScriptingEngineNet() { - hostInstance->Shutdown(); + if (isInitialized) + hostInstance->Shutdown(); + delete hostInstance; } std::vector ScriptingEngineNet::ExtractErrors(const std::string& output) @@ -178,6 +182,9 @@ namespace Nuake void ScriptingEngineNet::Initialize() { + if (!isInitialized) + return; + loadContext = hostInstance->CreateAssemblyLoadContext(m_ContextName); nuakeAssembly = ReloadEngineAPI(loadContext); @@ -925,4 +932,4 @@ namespace NuakeShowcase return oss.str(); } -} \ No newline at end of file +} diff --git a/Nuake/Source/Nuake/UI/DataBinding/DataBindObject.h b/Nuake/Source/Nuake/UI/DataBinding/DataBindObject.h index 215bf1fe..4162afd8 100644 --- a/Nuake/Source/Nuake/UI/DataBinding/DataBindObject.h +++ b/Nuake/Source/Nuake/UI/DataBinding/DataBindObject.h @@ -100,6 +100,8 @@ namespace NuakeUI return dataObject.GetType(); } } + + assert(false); } template @@ -138,6 +140,8 @@ namespace NuakeUI return *data; } } + + assert(false); } template<> @@ -154,6 +158,8 @@ namespace NuakeUI return *data; } } + + assert(false); } template<> @@ -170,6 +176,8 @@ namespace NuakeUI return *data; } } + + assert(false); } template<> @@ -186,6 +194,8 @@ namespace NuakeUI return *data; } } + + assert(false); } }; -} \ No newline at end of file +} diff --git a/Nuake/Source/Nuake/UI/Font/FontLoader.h b/Nuake/Source/Nuake/UI/Font/FontLoader.h index 266a7bc2..6688f4e7 100644 --- a/Nuake/Source/Nuake/UI/Font/FontLoader.h +++ b/Nuake/Source/Nuake/UI/Font/FontLoader.h @@ -168,4 +168,4 @@ namespace NuakeUI } }; -} \ No newline at end of file +} diff --git a/Nuake/Source/Nuake/UI/Nodes/Node.h b/Nuake/Source/Nuake/UI/Nodes/Node.h index 931428c0..2b381026 100644 --- a/Nuake/Source/Nuake/UI/Nodes/Node.h +++ b/Nuake/Source/Nuake/UI/Nodes/Node.h @@ -11,7 +11,7 @@ #include "Nuake/Resource/UUID.h" #include "Nuake/Scripting/ScriptingEngineNet.h" -#include +#include #include #include @@ -20,33 +20,33 @@ #define SetLength(name) \ -if (ComputedStyle.##name.type == LengthType::Auto) \ +if (ComputedStyle.name.type == LengthType::Auto) \ YGNodeStyleSet##name##Auto(mNode); \ -else if (ComputedStyle.##name.type == LengthType::Pixel) YGNodeStyleSet##name(mNode, ComputedStyle.##name.value); \ -else if (ComputedStyle.##name.type == LengthType::Percentage) YGNodeStyleSet##name##Percent(mNode, ComputedStyle.##name.value); \ +else if (ComputedStyle.name.type == LengthType::Pixel) YGNodeStyleSet##name(mNode, ComputedStyle.name.value); \ +else if (ComputedStyle.name.type == LengthType::Percentage) YGNodeStyleSet##name##Percent(mNode, ComputedStyle.name.value); \ #define SetLengthBorder(name, border) \ -if (ComputedStyle.##name##border.type == LengthType::Auto) \ +if (ComputedStyle.name##border.type == LengthType::Auto) \ YGNodeStyleSet##name##Auto(mNode, YGEdge##border); \ -else if (ComputedStyle.##name##border.type == LengthType::Pixel) YGNodeStyleSet##name(mNode, YGEdge##border, ComputedStyle.##name##border.value); \ -else if (ComputedStyle.##name##border.type == LengthType::Percentage) YGNodeStyleSet##name##Percent(mNode, YGEdge##border, ComputedStyle.##name##border.value); \ +else if (ComputedStyle.name##border.type == LengthType::Pixel) YGNodeStyleSet##name(mNode, YGEdge##border, ComputedStyle.name##border.value); \ +else if (ComputedStyle.name##border.type == LengthType::Percentage) YGNodeStyleSet##name##Percent(mNode, YGEdge##border, ComputedStyle.name##border.value); \ #define SetLengthBorderNoAuto(name, border) \ -if (ComputedStyle.##name##border.type == LengthType::Pixel) YGNodeStyleSet##name(mNode, YGEdge##border, ComputedStyle.##name##border.value); \ -else if (ComputedStyle.##name##border.type == LengthType::Percentage) YGNodeStyleSet##name##Percent(mNode, YGEdge##border, ComputedStyle.##name##border.value); \ +if (ComputedStyle.name##border.type == LengthType::Pixel) YGNodeStyleSet##name(mNode, YGEdge##border, ComputedStyle.name##border.value); \ +else if (ComputedStyle.name##border.type == LengthType::Percentage) YGNodeStyleSet##name##Percent(mNode, YGEdge##border, ComputedStyle.name##border.value); \ #define SetLengthNoAuto(name) \ -if (ComputedStyle.##name.type == LengthType::Pixel) YGNodeStyleSet##name(mNode, ComputedStyle.##name.value); \ -else if (ComputedStyle.##name.type == LengthType::Percentage) YGNodeStyleSet##name##Percent(mNode, ComputedStyle.##name.value); \ +if (ComputedStyle.name.type == LengthType::Pixel) YGNodeStyleSet##name(mNode, ComputedStyle.name.value); \ +else if (ComputedStyle.name.type == LengthType::Percentage) YGNodeStyleSet##name##Percent(mNode, ComputedStyle.name.value); \ -#define EnumProp(name) EnumPropEx(name, ##name##Type) +#define EnumProp(name) EnumPropEx(name, name##Type) #define EnumPropEx(name, enums) \ case StyleProperties::name: \ { \ auto type = value.value.Enum; \ -ComputedStyle.##name## = (##enums##)type; \ +ComputedStyle.name = (enums)type; \ } \ break;\ diff --git a/Nuake/Source/Nuake/UI/Parsers/CanvasParser.cpp b/Nuake/Source/Nuake/UI/Parsers/CanvasParser.cpp index 1576890a..a0190e21 100644 --- a/Nuake/Source/Nuake/UI/Parsers/CanvasParser.cpp +++ b/Nuake/Source/Nuake/UI/Parsers/CanvasParser.cpp @@ -94,10 +94,14 @@ void CanvasParser::WriteValueFromString(std::variantstring, "%02x%02x%02x%02x", &r, &g, &b, &a); +#else + int result = sscanf(value->string, "%02x%02x%02x%02x", &r, &g, &b, &a); +#endif propValue.value.Color = Color(r, g, b, a); propValue.type = PropValueType::Color; } diff --git a/Nuake/Source/Nuake/Window.cpp b/Nuake/Source/Nuake/Window.cpp index 54331f1a..26637231 100644 --- a/Nuake/Source/Nuake/Window.cpp +++ b/Nuake/Source/Nuake/Window.cpp @@ -19,6 +19,11 @@ #include #include +// Linux +#ifdef NK_LINUX +#include "gtk/gtk.h" +#endif + using namespace Nuake; Window::Window() : @@ -53,9 +58,15 @@ bool Window::ShouldClose() int Window::Init() { +#ifdef NK_LINUX + gtk_init(NULL, NULL); +#endif + if (!glfwInit()) { - Logger::Log("GLFW initialization failed", "window", CRITICAL); + const char* description; + glfwGetError(&description); + Logger::Log("GLFW initialization failed: " + std::string(description), "window", CRITICAL); return -1; } diff --git a/Nuake/Thirdparty/glfw_p5.lua b/Nuake/Thirdparty/glfw_p5.lua index 69cc02df..69d506d5 100644 --- a/Nuake/Thirdparty/glfw_p5.lua +++ b/Nuake/Thirdparty/glfw_p5.lua @@ -56,13 +56,13 @@ project "GLFW" files { - "glfw/src/x11_init.c", + "glfw/src/x11_init.c", "glfw/src/x11_monitor.c", "glfw/src/x11_window.c", "glfw/src/xkb_unicode.c", "glfw/src/posix_time.c", "glfw/src/posix_thread.c", - "glfw/src/posix_module.c", + "glfw/src/posix_module.c", "glfw/src/glx_context.c", "glfw/src/egl_context.c", "glfw/src/osmesa_context.c", @@ -74,6 +74,29 @@ project "GLFW" "_GLFW_X11" } + filter "system:bsd" + pic "On" + includedirs "/usr/local/include" + + files + { + "glfw/src/x11_init.c", + "glfw/src/x11_monitor.c", + "glfw/src/x11_window.c", + "glfw/src/xkb_unicode.c", + "glfw/src/posix_time.c", + "glfw/src/posix_thread.c", + "glfw/src/posix_module.c", + "glfw/src/glx_context.c", + "glfw/src/egl_context.c", + "glfw/src/osmesa_context.c", + } + + defines + { + "_GLFW_X11" + } + filter "configurations:Debug" runtime "Debug" diff --git a/Nuake/Thirdparty/msdf-atlas-gen_p5.lua b/Nuake/Thirdparty/msdf-atlas-gen_p5.lua index 53dd7532..1c505a7c 100644 --- a/Nuake/Thirdparty/msdf-atlas-gen_p5.lua +++ b/Nuake/Thirdparty/msdf-atlas-gen_p5.lua @@ -21,9 +21,9 @@ project 'msdf-gen' 'msdf-atlas-gen/msdfgen/*.h', 'msdf-atlas-gen/msdfgen/*.cpp', 'msdf-atlas-gen/msdfgen/*.hpp', - 'msdf-atlas-gen/msdfgen/Core/*.h', - 'msdf-atlas-gen/msdfgen/Core/*.hpp', - 'msdf-atlas-gen/msdfgen/Core/*.cpp', + 'msdf-atlas-gen/msdfgen/core/*.h', + 'msdf-atlas-gen/msdfgen/core/*.hpp', + 'msdf-atlas-gen/msdfgen/core/*.cpp', 'msdf-atlas-gen/msdfgen/lib/*.cpp', 'msdf-atlas-gen/msdfgen/ext/*.h', 'msdf-atlas-gen/msdfgen/ext/*.cpp' @@ -83,4 +83,4 @@ project 'msdf-atlas-gen' runtime "Release" optimize "on" -group "" \ No newline at end of file +group "" diff --git a/Nuake/Thirdparty/soloud_p5.lua b/Nuake/Thirdparty/soloud_p5.lua index 41ce52d8..0470e9a8 100644 --- a/Nuake/Thirdparty/soloud_p5.lua +++ b/Nuake/Thirdparty/soloud_p5.lua @@ -45,6 +45,16 @@ project 'Soloud' "soloud/src/backend/alsa/soloud_alsa.cpp" } + filter "system:bsd" + -- assuming we're on FreeBSD, for other *BSD you may need portaudio or miniaudio + defines { + "WITH_OSS" + } + files + { + "soloud/src/backend/oss/soloud_oss.cpp" + } + filter "configurations:Debug" cppdialect "C++17" runtime "Debug" @@ -54,4 +64,4 @@ project 'Soloud' cppdialect "C++17" runtime "Release" optimize "on" -group "" \ No newline at end of file +group "" diff --git a/Nuake/Vendors/katana-parser/foundation.c b/Nuake/Vendors/katana-parser/foundation.c index c3fd2a75..48fa8b45 100644 --- a/Nuake/Vendors/katana-parser/foundation.c +++ b/Nuake/Vendors/katana-parser/foundation.c @@ -84,7 +84,7 @@ bool katana_string_has_prefix(const char* str, const char* prefix) { size_t pre_len = strlen(prefix); size_t str_len = strlen(str); - return pre_len <= str_len && stricmp(prefix, str); + return pre_len <= str_len && strncasecmp(prefix, str, pre_len); } void katana_string_to_lowercase(struct KatanaInternalParser* parser, diff --git a/Nuake/Vendors/katana-parser/katana.tab.c b/Nuake/Vendors/katana-parser/katana.tab.c index d0f63aa5..07a9ce43 100644 --- a/Nuake/Vendors/katana-parser/katana.tab.c +++ b/Nuake/Vendors/katana-parser/katana.tab.c @@ -2795,13 +2795,13 @@ yyreduce: case 129: { - if (!stricmp((yyvsp[0].string).data, "from")) { + if (!strcasecmp((yyvsp[0].string).data, "from")) { KatanaParserNumber number; number.val = 0; number.raw = (KatanaParserString){"from", 4}; (yyval.value) = katana_new_number_value(parser, 1, &number, KATANA_VALUE_NUMBER); } - else if (!stricmp((yyvsp[0].string).data, "to")) { + else if (!strcasecmp((yyvsp[0].string).data, "to")) { KatanaParserNumber number; number.val = 100; number.raw = (KatanaParserString){"to", 4}; @@ -2862,7 +2862,7 @@ yyreduce: case 136: { - if (!stricmp((yyvsp[-2].string).data, "deep")) + if (!strcasecmp((yyvsp[-2].string).data, "deep")) (yyval.relation) = KatanaSelectorRelationShadowDeep; else YYERROR; diff --git a/Nuake/Vendors/katana-parser/parser.c b/Nuake/Vendors/katana-parser/parser.c index 02065c9f..8f720e7f 100644 --- a/Nuake/Vendors/katana-parser/parser.c +++ b/Nuake/Vendors/katana-parser/parser.c @@ -1458,7 +1458,7 @@ void katana_print_media_query(KatanaParser* parser, KatanaMediaQuery* query) return; } - if ( (NULL != query->type && stricmp(query->type, "all")) || query->restrictor != KatanaMediaQueryRestrictorNone) { + if ( (NULL != query->type && strcasecmp(query->type, "all")) || query->restrictor != KatanaMediaQueryRestrictorNone) { if ( NULL != query->type ) { katana_print("%s", query->type); } diff --git a/Nuake/Vendors/katana-parser/selector.c b/Nuake/Vendors/katana-parser/selector.c index c3669116..afe06a5a 100644 --- a/Nuake/Vendors/katana-parser/selector.c +++ b/Nuake/Vendors/katana-parser/selector.c @@ -450,7 +450,7 @@ unsigned calc_specificity_for_one_selector(const KatanaSelector* selector) return 0x100; case KatanaSelectorMatchTag: - return !stricmp(selector->tag->local, "*") ? 0 : 1; + return !strcmp(selector->tag->local, "*") ? 0 : 1; case KatanaSelectorMatchUnknown: case KatanaSelectorMatchPagePseudoClass: return 0; @@ -608,7 +608,7 @@ static KatanaPseudoType name_to_pseudo_type(const char* name, bool hasArguments) const KatanaNameToPseudoStruct* match = lower_bound(pseudoTypeMap, count, name); if ( match == (pseudoTypeMap + count) - || 0 != stricmp(match->string, name) ) + || 0 != strcasecmp(match->string, name) ) return KatanaPseudoUnknown; return match->type; diff --git a/Nuake/Vendors/vkb/VkBootstrap.cpp b/Nuake/Vendors/vkb/VkBootstrap.cpp index 6fc90aec..a277a796 100644 --- a/Nuake/Vendors/vkb/VkBootstrap.cpp +++ b/Nuake/Vendors/vkb/VkBootstrap.cpp @@ -26,7 +26,8 @@ #include #endif // _WIN32 -#if defined(__linux__) || defined(__APPLE__) +#if defined(__linux__) || defined(__APPLE__) || defined(__unix__) +#define UNIX 1 #include #endif @@ -114,7 +115,7 @@ namespace vkb { private: std::mutex init_mutex; -#if defined(__linux__) || defined(__APPLE__) +#if defined(UNIX) void* library = nullptr; #elif defined(_WIN32) HMODULE library = nullptr; @@ -125,13 +126,13 @@ namespace vkb { if (library) { return true; } -#if defined(__linux__) - library = dlopen("libvulkan.so.1", RTLD_NOW | RTLD_LOCAL); - if (!library) library = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL); -#elif defined(__APPLE__) +#if defined(__APPLE__) library = dlopen("libvulkan.dylib", RTLD_NOW | RTLD_LOCAL); if (!library) library = dlopen("libvulkan.1.dylib", RTLD_NOW | RTLD_LOCAL); if (!library) library = dlopen("libMoltenVK.dylib", RTLD_NOW | RTLD_LOCAL); +#elif defined(UNIX) + library = dlopen("libvulkan.so.1", RTLD_NOW | RTLD_LOCAL); + if (!library) library = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL); #elif defined(_WIN32) library = LoadLibrary(TEXT("vulkan-1.dll")); #else @@ -143,14 +144,14 @@ namespace vkb { } template void load_func(T& func_dest, const char* func_name) { -#if defined(__linux__) || defined(__APPLE__) +#if defined(UNIX) func_dest = reinterpret_cast(dlsym(library, func_name)); #elif defined(_WIN32) func_dest = reinterpret_cast(GetProcAddress(library, func_name)); #endif } void close() { -#if defined(__linux__) || defined(__APPLE__) +#if defined(UNIX) dlclose(library); #elif defined(_WIN32) FreeLibrary(library); @@ -663,13 +664,13 @@ namespace vkb { bool added_window_exts = check_add_window_ext("VK_KHR_android_surface"); #elif defined(_DIRECT2DISPLAY) bool added_window_exts = check_add_window_ext("VK_KHR_display"); -#elif defined(__linux__) +#elif defined(__APPLE__) + bool added_window_exts = check_add_window_ext("VK_EXT_metal_surface"); +#elif defined(UNIX) // make sure all three calls to check_add_window_ext, don't allow short circuiting bool added_window_exts = check_add_window_ext("VK_KHR_xcb_surface"); added_window_exts = check_add_window_ext("VK_KHR_xlib_surface") || added_window_exts; added_window_exts = check_add_window_ext("VK_KHR_wayland_surface") || added_window_exts; -#elif defined(__APPLE__) - bool added_window_exts = check_add_window_ext("VK_EXT_metal_surface"); #endif if (!khr_surface_added || !added_window_exts) return make_error_code(InstanceError::windowing_extensions_not_present); @@ -2204,4 +2205,4 @@ namespace vkb { modes.push_back(VK_PRESENT_MODE_MAILBOX_KHR); modes.push_back(VK_PRESENT_MODE_FIFO_KHR); } -} // namespace vkb \ No newline at end of file +} // namespace vkb diff --git a/Nuake/premake5.lua b/Nuake/premake5.lua index b880cc31..ddea8662 100644 --- a/Nuake/premake5.lua +++ b/Nuake/premake5.lua @@ -107,20 +107,20 @@ project "Nuake" } filter "system:linux" - defines + defines { "GLFW_STATIC", "NK_LINUX" } - - links + + links { "glib-2.0" } - + buildoptions { "`pkg-config --cflags glib-2.0 pango gdk-pixbuf-2.0 atk`" } - linkoptions { "`pkg-config --libs glib-2.0 pango gdk-pixbuf-2.0`" } - + linkoptions { "`pkg-config --libs glib-2.0 pango gdk-pixbuf-2.0`" } + includedirs { "/usr/include/gtk-3.0/", @@ -128,6 +128,29 @@ project "Nuake" "/usr/include/glib-2.0", } + filter "system:bsd" + defines + { + "GLFW_STATIC", + "NK_LINUX", + "NK_BSD" + } + + links + { + "glib-2.0" + } + + buildoptions { "`pkg-config --cflags glib-2.0 pango gdk-pixbuf-2.0 atk`" } + linkoptions { "`pkg-config --libs glib-2.0 pango gdk-pixbuf-2.0`" } + + includedirs + { + "/usr/local/include/gtk-3.0/", + "/usr/local/lib/glib-2.0/include", + "/usr/local/include/glib-2.0", + } + filter "system:windows" staticruntime "On" defines @@ -153,4 +176,4 @@ project "Nuake" filter "configurations:Dist" runtime "Release" - optimize "on" \ No newline at end of file + optimize "on" diff --git a/Runtime/premake5.lua b/Runtime/premake5.lua index 367d5d58..748819a4 100644 --- a/Runtime/premake5.lua +++ b/Runtime/premake5.lua @@ -1,6 +1,7 @@ project "Runtime" kind "ConsoleApp" language "C++" + cppdialect "C++20" debugdir (binaryOutputDir) targetdir (binaryOutputDir) @@ -72,22 +73,15 @@ project "Runtime" "msdf-gen", "msdf-atlas-gen", "Freetype", - "vma" + "vma", + "dxcompiler" } + libdirs { "../Nuake/Thirdparty/dxc/lib/x64" } defines { table.unpack(globalDefines) } - prebuildcommands { - '{ECHO} "Copying dxcompiler.dll to Working directory..."', - '{COPYFILE} "%{wks.location}Nuake/Thirdparty/dxc/bin/x64/dxcompiler.dll" "%{cfg.debugdir}/"', - '{ECHO} Copying Coral to Working directory...', - '{COPYFILE} "%{wks.location}Nuake/Thirdparty/Coral/Coral.Managed/bin/%{cfg.buildcfg}/Coral.Managed.dll" "%{cfg.debugdir}/"', - '{COPYFILE} "%{wks.location}Nuake/Thirdparty/Coral/Coral.Managed/bin/%{cfg.buildcfg}/Coral.Managed.runtimeconfig.json" "%{cfg.debugdir}/"', - 'xcopy /E /I /Y "%{wks.location}Data" "%{cfg.debugdir}\\Resources"' - } - filter "system:windows" cppdialect "C++20" staticruntime "On" @@ -96,6 +90,15 @@ project "Runtime" } externalincludedirs { "../Nuake/Thirdparty/Coral/Coral.Native/Include/" } + prebuildcommands { + '{ECHO} "Copying dxcompiler.dll to Working directory..."', + '{COPYFILE} "%{wks.location}Nuake/Thirdparty/dxc/bin/x64/dxcompiler.dll" "%{cfg.debugdir}/"', + '{ECHO} Copying Coral to Working directory...', + '{COPYFILE} "%{wks.location}Nuake/Thirdparty/Coral/Coral.Managed/bin/%{cfg.buildcfg}/Coral.Managed.dll" "%{cfg.debugdir}/"', + '{COPYFILE} "%{wks.location}Nuake/Thirdparty/Coral/Coral.Managed/bin/%{cfg.buildcfg}/Coral.Managed.runtimeconfig.json" "%{cfg.debugdir}/"', + 'xcopy /E /I /Y "%{wks.location}Data" "%{cfg.debugdir}\\Resources"' + } + filter { "system:windows", "action:vs*" } flags { @@ -112,18 +115,43 @@ project "Runtime" "asound", "glib-2.0", "gtk-3", - "gobject-2.0" + "gobject-2.0" } includedirs { - "/usr/include/gtk-3.0/", - "/usr/lib/glib-2.0/include", - "/usr/include/glib-2.0", + "/usr/include/gtk-3.0/", + "/usr/lib/glib-2.0/include", + "/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`" } - linkoptions { "`pkg-config --libs glib-2.0 pango gdk-pixbuf-2.0 gtk-3 glib-2.0 lgobject-2.0`" } + + buildoptions { "`pkg-config --cflags glib-2.0 pango gdk-pixbuf-2.0 gtk+-3.0 atk glib-2.0`" } + linkoptions { "`pkg-config --libs glib-2.0 pango gdk-pixbuf-2.0 gtk+-3.0 glib-2.0 gobject-2.0`" } + + filter "system:bsd" + links + { + "GL", + "glfw", + "glad", + "X11", + "asound", + "glib-2.0", + "gtk-3", + "gobject-2.0", + "pthread", + "execinfo" + } + + includedirs + { + "/usr/local/include/gtk-3.0/", + "/usr/local/lib/glib-2.0/include", + "/usr/local/include/glib-2.0", + } + + buildoptions { "`pkg-config --cflags glib-2.0 pango gdk-pixbuf-2.0 gtk+-3.0 atk glib-2.0`" } + linkoptions { "`pkg-config --libs glib-2.0 pango gdk-pixbuf-2.0 gtk+-3.0 glib-2.0 gobject-2.0`" } filter "configurations:Debug" runtime "Debug" @@ -156,4 +184,4 @@ project "Runtime" { "NK_DIST", "WIN32_LEAN_AND_MEAN" - } \ No newline at end of file + } diff --git a/premake5.lua b/premake5.lua index 942211ac..2b3207f2 100644 --- a/premake5.lua +++ b/premake5.lua @@ -61,7 +61,6 @@ globalDefines = { "TRACY_ON_DEMAND", "NK_VK", "IMGUI_DEFINE_MATH_OPERATORS", - "NK_WIN" } group "Thirdparty"