diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index fbbfbffb..d81e08c6 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -136,37 +136,13 @@ public: } }; -void CreateScene() +void CreateInterface() { - Ref scene = Engine::GetCurrentScene(); + Ref userInterface = UI::UserInterface::New("test"); - // Main map entity - auto mapEntity = scene->CreateEntity("Map"); - mapEntity.AddComponent(); - mapEntity.GetComponent().Load("Res/Maps/texture_test.map", true); - mapEntity.GetComponent().HasCollisions = true; + Ref rectangle = UI::Rect::New(16, 16, userInterface->Width - 16, userInterface->Height - 16); + userInterface->AddRect(rectangle); - // Light entity - auto lightEntity = scene->CreateEntity("Light"); - lightEntity.AddComponent(); - lightEntity.GetComponent().SyncDirectionWithSky = true; - lightEntity.GetComponent().Type = Directional; - // lightEntity.AddComponent().Bind(); - - // Create player - auto player = scene->CreateEntity("Player"); - player.GetComponent().Translation.y = 10.f; - player.AddComponent(); - - player.AddComponent().Bind(); - - // Add cam child - auto childEntity = scene->CreateEntity("camEntity"); - childEntity.AddComponent(); - childEntity.AddComponent().Bind(); - - // cam as child of player. - player.AddChild(childEntity); } int main() @@ -174,7 +150,8 @@ int main() Engine::Init(); // ScriptingEngine::UpdateScript("test.lua"); - + + CreateInterface(); EditorInterface editor; editor.BuildFonts(); diff --git a/Editor/src/EditorInterface.cpp b/Editor/src/EditorInterface.cpp index 5f512054..120ab916 100644 --- a/Editor/src/EditorInterface.cpp +++ b/Editor/src/EditorInterface.cpp @@ -21,7 +21,7 @@ #include ImFont* normalFont; -ImFont* bigIconFont; +ImFont* EditorInterface::bigIconFont; void EditorInterface::Init() { ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking; @@ -33,6 +33,8 @@ void EditorInterface::Init() ImGuiID dockspace_id = ImGui::GetID("MyDockSpace"); ImGui::DockSpaceOverViewport(viewport, dockspace_flags); + + this->filesystem = FileSystemUI(); } void EditorInterface::DrawViewport() @@ -532,35 +534,7 @@ void EditorInterface::DrawFileSystem() Ref rootDirectory = FileSystem::GetFileTree(); if (!rootDirectory) return; - if(ImGui::Begin("Tree browser")) - { - if (ImGui::BeginPopupContextItem("item context menu")) - { - if (ImGui::Selectable("Set to zero")); - if (ImGui::Selectable("Set to PI")); - ImGui::SetNextItemWidth(-1); - ImGui::EndPopup(); - } - ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanAvailWidth; - bool is_selected = m_CurrentDirectory == FileSystem::RootDirectory; - if (is_selected) - base_flags |= ImGuiTreeNodeFlags_Selected; - std::string icon = ICON_FA_FOLDER; - bool open = ImGui::TreeNodeEx((icon + " " + rootDirectory->name).c_str(), base_flags); - if (ImGui::IsItemClicked()) - { - m_CurrentDirectory = FileSystem::RootDirectory; - } - if (open) - { - EditorInterfaceDrawFiletree(rootDirectory); - ImGui::TreePop(); - } - - - } - ImGui::End(); } @@ -697,7 +671,7 @@ void EditorInterface::DrawLogger() { for (auto l : Logger::GetLogs()) { - ImGui::Text(l.c_str()); + ImGui::TextWrapped(l.c_str()); } } @@ -914,6 +888,18 @@ void OpenProject() } project->FullPath = projectPath; Engine::LoadProject(project); + + Ref userInterface = UI::UserInterface::New("test"); + + Ref rectangle = UI::Rect::New(0, 0, userInterface->Width, userInterface->Height); + userInterface->AddRect(rectangle); + + Ref rect2 = rectangle->CutLeft(1280.f); + rect2->Props.BackgroundColor = Color(0, 1, 0, 1); + userInterface->AddRect(rect2); + + Engine::GetCurrentScene()->AddInterface(userInterface); + } void OpenScene() @@ -964,7 +950,7 @@ void EditorInterface::Draw() if (ImGui::MenuItem("Open...", "CTRL+O")) { OpenProject(); - + m_IsEntitySelected = false; } if (ImGui::MenuItem("Save", "CTRL+S")) @@ -1080,7 +1066,7 @@ void EditorInterface::Draw() } DrawGizmos(); - + DrawRessourceWindow(); DrawViewport(); DrawSceneTree(); @@ -1088,6 +1074,10 @@ void EditorInterface::Draw() DrawDirectoryExplorer(); DrawEntityPropreties(); DrawLogger(); + + // new stuff + filesystem.Draw(); + if(m_ShowImGuiDemo) ImGui::ShowDemoWindow(); diff --git a/Editor/src/EditorInterface.h b/Editor/src/EditorInterface.h index ac467e87..4e3d5663 100644 --- a/Editor/src/EditorInterface.h +++ b/Editor/src/EditorInterface.h @@ -3,13 +3,13 @@ #include "src/Vendors/imgui/imgui.h" #include #include "src/Core/FileSystem.h" - +#include "FileSystemUI.h" class Material; class EditorInterface { private: - + FileSystemUI filesystem; Entity m_SelectedEntity; bool m_IsEntitySelected = false; bool m_DrawGrid = false; @@ -23,9 +23,8 @@ private: bool m_IsMaterialSelected = false; - - public: + static ImFont* bigIconFont; void BuildFonts(); void Init(); void Draw(); diff --git a/Editor/src/FileSystemUI.cpp b/Editor/src/FileSystemUI.cpp new file mode 100644 index 00000000..3772a1c6 --- /dev/null +++ b/Editor/src/FileSystemUI.cpp @@ -0,0 +1,210 @@ +#include "FileSystemUI.h" +#include +#include +#include +#include +#include +#include "EditorInterface.h" + +// TODO: add filetree in same panel +void FileSystemUI::Draw() +{ + Ref rootDirectory = FileSystem::GetFileTree(); + if (!rootDirectory) + return; + if (ImGui::Begin("Tree browser")) + { + if (ImGui::BeginPopupContextItem("item context menu")) + { + if (ImGui::Selectable("Set to zero")); + if (ImGui::Selectable("Set to PI")); + ImGui::SetNextItemWidth(-1); + ImGui::EndPopup(); + } + ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanAvailWidth; + bool is_selected = m_CurrentDirectory == FileSystem::RootDirectory; + if (is_selected) + base_flags |= ImGuiTreeNodeFlags_Selected; + std::string icon = ICON_FA_FOLDER; + + bool open = ImGui::TreeNodeEx((icon + " " + rootDirectory->name).c_str(), base_flags); + if (ImGui::IsItemClicked()) + { + m_CurrentDirectory = FileSystem::RootDirectory; + } + if (open) + { + //EditorInterfaceDrawFiletree(rootDirectory); + ImGui::TreePop(); + } + } + ImGui::End(); +} + +void FileSystemUI::DrawDirectoryContent() +{ +} + +void FileSystemUI::DrawFiletree() +{ +} + + +void FileSystemUI::EditorInterfaceDrawFiletree(Ref dir) +{ + for (auto d : dir->Directories) + { + ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanAvailWidth; + bool is_selected = m_CurrentDirectory == d; + if (is_selected) + base_flags |= ImGuiTreeNodeFlags_Selected; + + if (d->Directories.size() == 0) + { + base_flags = ImGuiTreeNodeFlags_Leaf; + } + std::string icon = ICON_FA_FOLDER; + if (is_selected) + icon = ICON_FA_FOLDER_OPEN; + bool open = ImGui::TreeNodeEx((icon + " " + d->name).c_str(), base_flags); + + if (ImGui::IsItemClicked()) + m_CurrentDirectory = d; + if (open) + { + if (d->Directories.size() > 0) + EditorInterfaceDrawFiletree(d); + ImGui::TreePop(); + } + + } +} + + + +void FileSystemUI::DrawDirectory(Ref directory) +{ + ImGui::PushFont(EditorInterface::bigIconFont); + std::string id = ICON_FA_FOLDER + std::string("##") + directory->name; + if (ImGui::Button(id.c_str(), ImVec2(100, 100))) + m_CurrentDirectory = directory; + ImGui::Text(directory->name.c_str()); + ImGui::PopFont(); +} + +bool FileSystemUI::EntityContainsItself(Entity source, Entity target) +{ + ParentComponent& targeParentComponent = target.GetComponent(); + if (!targeParentComponent.HasParent) + return false; + + Entity currentParent = target.GetComponent().Parent; + while (currentParent != source) + { + if (currentParent.GetComponent().HasParent) + currentParent = currentParent.GetComponent().Parent; + else + return false; + + if (currentParent == source) + return true; + } + return true; +} + +void FileSystemUI::DrawFile(Ref file) +{ + ImGui::PushFont(EditorInterface::bigIconFont); + if (file->Type == ".png" || file->Type == ".jpg") + { + Ref texture = TextureManager::Get()->GetTexture(file->fullPath); + ImGui::ImageButton((void*)texture->GetID(), ImVec2(100, 100), ImVec2(0, 1), ImVec2(1, 0)); + } + else + { + const char* icon = ICON_FA_FILE; + if (file->Type == ".shader") + icon = ICON_FA_FILE_CODE; + if (file->Type == ".map") + icon = ICON_FA_BROOM; + if (file->Type == ".ogg" || file->Type == ".mp3" || file->Type == ".wav" || file->Type == ".flac") + icon = ICON_FA_FILE_AUDIO; + if (file->Type == ".cpp" || file->Type == ".h" || file->Type == ".cs" || file->Type == ".py" || file->Type == ".lua") + icon = ICON_FA_FILE_CODE; + if (ImGui::Button(icon, ImVec2(100, 100))) + { + if (ImGui::BeginPopupContextItem("item context menu")) + { + if (ImGui::Selectable("Set to zero")); + if (ImGui::Selectable("Set to PI")); + ImGui::EndPopup(); + } + } + } + ImGui::Text(file->name.c_str()); + ImGui::PopFont(); + +} + +void FileSystemUI::DrawDirectoryExplorer() +{ + if (ImGui::Begin("File browser")) + { + // Wrapping. + int width = ImGui::GetWindowWidth(); + ImVec2 buttonSize = ImVec2(100, 100); + int amount = (width / 100); // -2 because button overflow width + ... button. + int i = 1; // current amount of item per row. + if (ImGui::BeginTable("ssss", amount)) + { + // Button to go up a level. + if (m_CurrentDirectory != FileSystem::RootDirectory) + { + ImGui::TableNextColumn(); + if (ImGui::Button("..", ImVec2(100, 100))) + m_CurrentDirectory = m_CurrentDirectory->Parent; + ImGui::TableNextColumn(); + // Increment item per row tracker. + i++; + } + + // Exit if no current directory. + if (!m_CurrentDirectory) { + ImGui::EndTable(); + ImGui::End(); + return; + } + + if (m_CurrentDirectory && m_CurrentDirectory->Directories.size() > 0) + { + for (auto d : m_CurrentDirectory->Directories) + { + DrawDirectory(d); + if (i - 1 % amount != 0) + ImGui::TableNextColumn(); + else + ImGui::TableNextRow(); + i++; + } + } + if (m_CurrentDirectory && m_CurrentDirectory->Files.size() > 0) + { + for (auto f : m_CurrentDirectory->Files) + { + DrawFile(f); + if (i - 1 % amount != 0) + ImGui::TableNextColumn(); + else + ImGui::TableNextRow(); + i++; + } + } + + ImGui::EndTable(); + } + + + } + ImGui::End(); +} + diff --git a/Editor/src/FileSystemUI.h b/Editor/src/FileSystemUI.h new file mode 100644 index 00000000..472ada0f --- /dev/null +++ b/Editor/src/FileSystemUI.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +#include +class FileSystemUI +{ +private: + Ref m_CurrentDirectory; + +public: + void Draw(); + void DrawDirectoryContent(); + void DrawFiletree(); + void EditorInterfaceDrawFiletree(Ref dir); + void DrawDirectory(Ref directory); + bool EntityContainsItself(Entity source, Entity target); + void DrawFile(Ref file); + void DrawDirectoryExplorer(); +}; \ No newline at end of file diff --git a/Editor/src/PropretiesWindow.h b/Editor/src/PropretiesWindow.h new file mode 100644 index 00000000..d0dc233c --- /dev/null +++ b/Editor/src/PropretiesWindow.h @@ -0,0 +1,33 @@ +#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(); +}; diff --git a/Editor/src/SceneTree.h b/Editor/src/SceneTree.h new file mode 100644 index 00000000..6f70f09b --- /dev/null +++ b/Editor/src/SceneTree.h @@ -0,0 +1 @@ +#pragma once diff --git a/Editor/src/Toolbar.h b/Editor/src/Toolbar.h new file mode 100644 index 00000000..6f70f09b --- /dev/null +++ b/Editor/src/Toolbar.h @@ -0,0 +1 @@ +#pragma once diff --git a/Nuake/Engine.cpp b/Nuake/Engine.cpp index 576643a8..93fadfb0 100644 --- a/Nuake/Engine.cpp +++ b/Nuake/Engine.cpp @@ -5,6 +5,8 @@ #include "src/Scripting/ScriptingEngine.h" #include "../Rendering/Renderer.h" +#include "../Rendering/Renderer2D.h" + #include #include @@ -26,7 +28,10 @@ void Engine::Init() CurrentWindow = Window::Get(); Logger::Log("Window initialized"); - Logger::Log("Engine initialized succesfully..."); + Renderer2D::Init(); + Logger::Log("2D renderer initialized"); + + Logger::Log("Engine initialized succesfully!"); } void Engine::Tick() diff --git a/Nuake/src/Core/Logger.cpp b/Nuake/src/Core/Logger.cpp new file mode 100644 index 00000000..358fc17e --- /dev/null +++ b/Nuake/src/Core/Logger.cpp @@ -0,0 +1,21 @@ +#include "Logger.h" +#include +#include +#include +#include + +std::vector Logger::logs = std::vector(); + +void Logger::Log(std::string log) +{ + char buff[100]; + time_t now = time(0); + strftime(buff, 100, "%Y-%m-%d %H:%M:%S.000", localtime(&now)); + std::string msg = "["+ std::string(buff) + "]" + std::string(" - ") + log; + logs.push_back(msg); +} + +std::vector Logger::GetLogs() +{ + return logs; +} \ No newline at end of file diff --git a/Nuake/src/Core/Logger.h b/Nuake/src/Core/Logger.h new file mode 100644 index 00000000..4ca225aa --- /dev/null +++ b/Nuake/src/Core/Logger.h @@ -0,0 +1,28 @@ +#pragma once +#include +#include + +enum LOG_TYPE +{ + VERBOSE, + DEBUG, + WARNING, + CRITICAL +}; + +struct Log +{ + LOG_TYPE type; + std::string time; + std::string message; +}; + +class Logger +{ + const int MAX_LOG = 64; + static std::vector logs; + static std::vector m_Logs; // TODO: Use log struct. +public: + static void Log(std::string log); + static std::vector GetLogs(); +}; \ No newline at end of file diff --git a/Nuake/src/Core/Maths.h b/Nuake/src/Core/Maths.h new file mode 100644 index 00000000..09041ee9 --- /dev/null +++ b/Nuake/src/Core/Maths.h @@ -0,0 +1,15 @@ +#pragma once +#include +#include +#include +#include + +#include + +using Vector3 = glm::vec3; +using Vector2 = glm::vec2; +using Vector4 = glm::vec4; +using Color = glm::vec4; +using Matrix4 = glm::mat4; + + diff --git a/Nuake/src/Rendering/Renderer.h b/Nuake/src/Rendering/Renderer.h index 55fbcae8..d2835d72 100644 --- a/Nuake/src/Rendering/Renderer.h +++ b/Nuake/src/Rendering/Renderer.h @@ -26,6 +26,7 @@ public: static void BeginDraw(Ref camera); static void EndDraw(); + // Lights static std::vector m_Lights; static void RegisterLight(TransformComponent transform, LightComponent light, Ref cam); diff --git a/Nuake/src/Rendering/Renderer2D.cpp b/Nuake/src/Rendering/Renderer2D.cpp new file mode 100644 index 00000000..613c8b0f --- /dev/null +++ b/Nuake/src/Rendering/Renderer2D.cpp @@ -0,0 +1,54 @@ +#include "Renderer2D.h" +#include "GL/glew.h" + +Ref Renderer2D::UIShader; +unsigned int Renderer2D::VAO; +unsigned int Renderer2D::VBO; + +Matrix4 Renderer2D::Projection; + +void Renderer2D::Init() +{ + UIShader = CreateRef("resources/Shaders/ui.shader"); + Projection = glm::ortho(0.f, 1920.f, 0.0f, 1080.f, -0.5f, 100.0f); + + float quad_Vertices[] = { + // positions // texture Coords + 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, + 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, + 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, + + + 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, + 1.0f, 1.0f, 1.0f, 1.0f, 1.0f + }; + // setup plane VAO + glGenVertexArrays(1, &Renderer2D::VAO); + glGenBuffers(1, &Renderer2D::VBO); + glBindVertexArray(Renderer2D::VAO); + glBindBuffer(GL_ARRAY_BUFFER, Renderer2D::VBO); + glBufferData(GL_ARRAY_BUFFER, sizeof(quad_Vertices), &quad_Vertices, GL_STATIC_DRAW); + glEnableVertexAttribArray(0); + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0); + glEnableVertexAttribArray(1); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float))); +} + +void Renderer2D::BeginDraw() +{ + UIShader->Bind(); + UIShader->SetUniformMat4f("projection", Projection); +} + +void Renderer2D::DrawRect() +{ + glBindVertexArray(Renderer2D::VAO); + glDrawArrays(GL_TRIANGLES, 0, 6); +} + + +void Renderer2D::EndDraw() +{ + +} diff --git a/Nuake/src/Rendering/Renderer2D.h b/Nuake/src/Rendering/Renderer2D.h new file mode 100644 index 00000000..2cd6d5c3 --- /dev/null +++ b/Nuake/src/Rendering/Renderer2D.h @@ -0,0 +1,18 @@ +#pragma once +#include +#include +#include +class Renderer2D +{ +private: + static unsigned int VAO; + static unsigned int VBO; +public: + static Ref UIShader; + static Matrix4 Projection; + + static void Init(); + static void BeginDraw(); + static void DrawRect(); + static void EndDraw(); +}; \ No newline at end of file diff --git a/Nuake/src/Resource/File.h b/Nuake/src/Resource/File.h new file mode 100644 index 00000000..848a1af9 --- /dev/null +++ b/Nuake/src/Resource/File.h @@ -0,0 +1,9 @@ +#pragma once +#include + + +class File +{ + File(const std::string& path); + void Write(const std::string& content); +}; \ No newline at end of file diff --git a/Nuake/src/Resource/Project.cpp b/Nuake/src/Resource/Project.cpp new file mode 100644 index 00000000..6a9433d4 --- /dev/null +++ b/Nuake/src/Resource/Project.cpp @@ -0,0 +1,123 @@ +#include "Project.h" +#include "../Core/FileSystem.h" +#include +#include +#include +#include "../Core/Logger.h" +Project::Project(const std::string Name, const std::string Description, const std::string& FullPath, const std::string& defaultScenePath ) +{ + this->Name = Name; + this->Description = Description; + this->FullPath = FullPath; + + if (defaultScenePath != "") + { + Ref scene = CreateRef(); + scene->Deserialize(defaultScenePath); + } + + SaveAs(FullPath); +} + +Project::Project() +{ + this->Name = ""; + this->Description = ""; + this->FullPath = ""; +} + +void Project::Save() +{ + SaveAs(this->FullPath); +} + +void Project::SaveAs(const std::string FullPath) +{ + // Serialize the scene. + BEGIN_SERIALIZE(); + SERIALIZE_VAL(Name); + SERIALIZE_VAL(Description); + + // Dump. + std::string serialized_string = j.dump(); + + // write to file. + std::ofstream projectFile; + projectFile.open(FullPath); + projectFile << serialized_string; + projectFile.close(); +} + +Ref Project::New(const std::string Name, const std::string Description, const std::string FullPath) +{ + if (Name == "") + return nullptr; + + return CreateRef(Name, Description, FullPath); +} + +Ref Project::New() +{ + return CreateRef(); +} + +Ref Project::Load(std::string path) +{ + std::ifstream i(path); + json j; + i >> j; + + // validation + std::string projectName = ""; + if(!j.contains("ProjectName")) + return nullptr; + + projectName = j["ProjectName"]; + + std::string description = ""; + if (j.contains("Description")) + description = j["Description"]; + + return CreateRef(projectName, description, path); +} + +json Project::Serialize() +{ + BEGIN_SERIALIZE(); + SERIALIZE_VAL(Name); + SERIALIZE_VAL(Description); + SERIALIZE_VAL_LBL("DefaultScene", DefaultScene->Path); + END_SERIALIZE(); +} + +bool Project::Deserialize(const std::string& str) +{ + json j = json::parse(str); + if (!j.contains("Name")) + return false; + if (!j.contains("Description")) + return false; + + this->DefaultScene = Scene::New(); + + if (j.contains("DefaultScene")) + { + std::string scenePath = j["DefaultScene"]; + if (scenePath != "") + { + std::string sceneContent = FileSystem::ReadFile(scenePath, false); + if (!this->DefaultScene->Deserialize(sceneContent)) + { + Logger::Log("Error loading scene: " + scenePath); + } + else + { + this->DefaultScene->Path = scenePath; + Logger::Log("Successfully loaded scene: " + scenePath); + } + } + + } + + return true; // Success +} diff --git a/Nuake/src/Resource/Project.h b/Nuake/src/Resource/Project.h new file mode 100644 index 00000000..e3bd0927 --- /dev/null +++ b/Nuake/src/Resource/Project.h @@ -0,0 +1,28 @@ +#pragma once +#include +#include "../Core/Core.h" +#include "../Scene/Scene.h" +#include "Serializable.h" +class Project : public ISerializable +{ +public: + std::string Name; + std::string Description; + std::string FullPath; + + Ref DefaultScene; + + Project(const std::string Name, const std::string Description, const std::string& FullPath, const std::string& defaultScenePath = ""); + Project(); + + void Save(); + void SaveAs(const std::string FullPath); + + static Ref New(const std::string Name, const std::string Description, const std::string FullPath); + static Ref New(); + static Ref Load(std::string path); + + json Serialize() override; + bool Deserialize(const std::string& str) override; + +}; \ No newline at end of file diff --git a/Nuake/src/Resource/Serializable.h b/Nuake/src/Resource/Serializable.h new file mode 100644 index 00000000..bfcdb012 --- /dev/null +++ b/Nuake/src/Resource/Serializable.h @@ -0,0 +1,36 @@ +#pragma once +#include +#include +using json = nlohmann::json; + +#define BEGIN_SERIALIZE() json j; +#define SERIALIZE_VAL_LBL(lbl, v) j[lbl] = v; +#define SERIALIZE_VAL(v) j[#v] = this->v; +#define SERIALIZE_VEC3(v) \ + j[#v]["x"] = this->v.x; \ + j[#v]["y"] = this->v.y; \ + j[#v]["z"] = this->v.z; + +#define SERIALIZE_VEC4(v) \ + SERIALIZE_VEC3(v) \ + j[#v]["w"] = this->v.z; + +#define SERIALIZE_OBJECT(v) j[#v] = v->Serialize(); +#define SERIALIZE_OBJECT_REF(v) j[#v] = v.Serialize(); +#define SERIALIZE_OBJECT_REF_LBL(lbl, v) j[lbl] = v.Serialize(); +#define END_SERIALIZE() return j; +#define DUMP_SERIALIZE() j.dump(4); + +#define BEGIN_DESERIALIZE() json j = json::parse(str); +#define DESERIALIZE_COMPONENT(c) \ + if(j.contains(#c)) \ + AddComponent().Deserialize(j[#c].dump()); + + +class ISerializable +{ +public: + virtual json Serialize() = 0; + virtual bool Deserialize(const std::string& str) = 0; + +}; \ No newline at end of file diff --git a/Nuake/src/Resource/Serializer.h b/Nuake/src/Resource/Serializer.h new file mode 100644 index 00000000..e4c26c76 --- /dev/null +++ b/Nuake/src/Resource/Serializer.h @@ -0,0 +1,10 @@ +#pragma once +#include + + +class Serializer +{ + static std::string Serialize(); + + static std::string Serialize(); +}; \ No newline at end of file diff --git a/Nuake/src/Scene/Entities/Components/LuaScriptComponent.h b/Nuake/src/Scene/Entities/Components/LuaScriptComponent.h new file mode 100644 index 00000000..9c926376 --- /dev/null +++ b/Nuake/src/Scene/Entities/Components/LuaScriptComponent.h @@ -0,0 +1,9 @@ +#pragma once +#include + +class LuaScriptComponent +{ +public: + + std::string Script; +}; \ No newline at end of file diff --git a/Nuake/src/Scene/Scene.cpp b/Nuake/src/Scene/Scene.cpp index 3ae0253c..df0dac16 100644 --- a/Nuake/src/Scene/Scene.cpp +++ b/Nuake/src/Scene/Scene.cpp @@ -23,6 +23,7 @@ Scene::Scene() { m_EditorCamera = CreateRef(); m_Environement = CreateRef(); + m_Interfaces = std::vector>(); } Scene::~Scene() {} @@ -337,6 +338,11 @@ void Scene::Draw() Renderer::m_DebugShader->SetUniformMat4f("u_Projection", cam->GetPerspective()); PhysicsManager::Get()->DrawDebug(); } + + for (auto i : m_Interfaces) + { + i->Draw(); + } } void Scene::EditorDraw() @@ -344,11 +350,18 @@ void Scene::EditorDraw() glDisable(GL_DEPTH_TEST); Ref env = GetEnvironment(); - if (env->ProceduralSkybox) + //if (env->ProceduralSkybox) + //{ + // env->ProceduralSkybox->Draw(m_EditorCamera); + //} + + for (auto i : m_Interfaces) { - env->ProceduralSkybox->Draw(m_EditorCamera); + i->Draw(); } + + Renderer::m_Shader->Bind(); env->Push(); glEnable(GL_DEPTH_TEST); @@ -383,7 +396,7 @@ void Scene::EditorDraw() Renderer::m_Shader->Bind(); Renderer::m_Shader->SetUniform1i("u_ShowNormal", 0); - if (m_EditorCamera) + /*if (m_EditorCamera) { Renderer::m_Shader->SetUniform1f("u_Exposure", m_EditorCamera->Exposure); @@ -495,6 +508,11 @@ void Scene::EditorDraw() t.Scale = (box.Radius * 2.f) * transform.Scale; Renderer::DrawSphere(t, glm::vec4(0.0f, 0.0f, 0.9f, 0.2f)); } + }*/ + + for (auto i : m_Interfaces) + { + i->Draw(); } } @@ -570,6 +588,8 @@ Ref Scene::GetCurrentCamera() break; } } + if (!cam) + cam = m_EditorCamera; return cam; } @@ -599,6 +619,12 @@ bool Scene::SaveAs(const std::string& path) return true; } +void Scene::AddInterface(Ref interface) +{ + this->m_Interfaces.push_back(interface); +} + + json Scene::Serialize() { BEGIN_SERIALIZE(); diff --git a/Nuake/src/Scene/Scene.h b/Nuake/src/Scene/Scene.h index 9a4ecd7a..a63a6a01 100644 --- a/Nuake/src/Scene/Scene.h +++ b/Nuake/src/Scene/Scene.h @@ -9,6 +9,7 @@ #include "../Core/Core.h" #include "EditorCamera.h" #include "../Resource/Serializable.h" +#include "src/UI/UserInterface.h" class Entity; class Scene : public ISerializable @@ -16,12 +17,14 @@ class Scene : public ISerializable friend Entity; private: - Ref m_Environement; - entt::registry m_Registry; - Ref m_EditorCamera; std::string Name; - bool has_changed = true; + + std::vector> m_Interfaces; + entt::registry m_Registry; + Ref m_Environement; + Ref m_EditorCamera; + public: std::string Path = ""; static Ref New(); @@ -61,6 +64,7 @@ public: bool Save(); bool SaveAs(const std::string& path); + void AddInterface(Ref interface); json Serialize() override; bool Deserialize(const std::string& str) override; diff --git a/Nuake/src/Scripting/ScriptLoader.cpp b/Nuake/src/Scripting/ScriptLoader.cpp new file mode 100644 index 00000000..d14b0f62 --- /dev/null +++ b/Nuake/src/Scripting/ScriptLoader.cpp @@ -0,0 +1,28 @@ +#include "ScriptLoader.h" +#include +#include + +bool ScriptLoader::RegisterScript(ScriptableEntity* script) +{ + return false; +} + +bool ScriptLoader::LoadModule(const std::string& path) +{ + HMODULE loadedLib = LoadLibraryA(path.c_str()); + if (!loadedLib) { + printf("Failed to load library\n"); + return false; + } + + printf("Library loaded\n"); + + ScriptModuleRegister* functionPointer = (ScriptModuleRegister*)GetProcAddress(loadedLib, "Register"); + + functionPointer(); + + return true; + +} + + diff --git a/Nuake/src/Scripting/ScriptLoader.h b/Nuake/src/Scripting/ScriptLoader.h new file mode 100644 index 00000000..a226feb1 --- /dev/null +++ b/Nuake/src/Scripting/ScriptLoader.h @@ -0,0 +1,31 @@ +#pragma once + +#include "ScriptModule.h" +#include +#include +#include "../Scene/Entities/ScriptableEntity.h" + + +typedef void (ScriptModuleRegister)(); +//#define X_INPUT_GET_STATE(name) DWORD WINAPI name(DWORD dwUserIndex, XINPUT_STATE* pState) +// Now we create a typedef for this function pointer +//typedef X_INPUT_GET_STATE(x_input_get_state); +extern "C" +{ + class ScriptLoader + { + private: + static std::map m_Scripts; + + public: + static bool RegisterScript(ScriptableEntity* script); + + + static ScriptableEntity* GetScript(std::string script) { + return m_Scripts[script]; + } + + static bool LoadModule(const std::string& path); + + }; +} diff --git a/Nuake/src/Scripting/ScriptModule.h b/Nuake/src/Scripting/ScriptModule.h new file mode 100644 index 00000000..642b0688 --- /dev/null +++ b/Nuake/src/Scripting/ScriptModule.h @@ -0,0 +1,7 @@ +#pragma once + +class ScriptModule +{ +public: + virtual void Register(); +}; diff --git a/Nuake/src/Scripting/ScriptingEngine.cpp b/Nuake/src/Scripting/ScriptingEngine.cpp new file mode 100644 index 00000000..1165dd51 --- /dev/null +++ b/Nuake/src/Scripting/ScriptingEngine.cpp @@ -0,0 +1,77 @@ +#include "ScriptingEngine.h" +#include +#include +#include + +inline void my_panic(sol::optional maybe_msg) { + std::cerr << "Lua script error detected!" << std::endl; + if (maybe_msg) { + const std::string& msg = maybe_msg.value(); + std::cerr << "\terror message: " << msg << std::endl; + } +} + +sol::state ScriptingEngine::lua = sol::state(sol::c_call); + +void ScriptingEngine::Init() +{ + lua.open_libraries(sol::lib::base, sol::lib::package); + +} + +void ScriptingEngine::RunFile(const std::string& path) +{ + +} + +void ScriptingEngine::RunCode(const std::string& code) +{ + lua.script(code); + bool isfullscreen = lua["config"]["fullscreen"]; + sol::table config = lua["config"]; + float x = lua["config"]["resolution"]["x"]; + return; + +} + +void ScriptingEngine::UpdateScript(const std::string& path) +{ + std::string fileContent; + std::string allFile = ""; + // Read from the text file + std::ifstream MyReadFile("resources/Scripts/test.lua"); + + // Use a while loop together with the getline() function to read the file line by line + while (getline(MyReadFile, fileContent)) { + allFile.append(fileContent); + } + + // Close the file + MyReadFile.close(); + + try { + auto bad_code_result = lua.script(allFile); + // it did not work + if (!bad_code_result.valid()) + { + printf(std::to_string((int)(bad_code_result.status())).c_str()); + return; + } + + int result = lua["update"](); + } + catch (int e) + { + + } + + + + + return; +} + +void ScriptingEngine::Close() +{ + +} \ No newline at end of file diff --git a/Nuake/src/Scripting/ScriptingEngine.h b/Nuake/src/Scripting/ScriptingEngine.h new file mode 100644 index 00000000..515f18f3 --- /dev/null +++ b/Nuake/src/Scripting/ScriptingEngine.h @@ -0,0 +1,26 @@ +#pragma once +#include +#include "sol/forward.hpp" +#include +#include + +class ScriptingEngine +{ +private: + static sol::state lua; + static std::map m_Scripts; + +public: + static void Init(); + + static void RegisterScript(std::string path); + + static void InitScript(std::string path); + static void UpdateScript(std::string path); + static void ExitScript(std::string path); + + static void RunFile(const std::string& path); + static void UpdateScript(const std::string& path); + static void RunCode(const std::string& code); + static void Close(); +}; \ No newline at end of file diff --git a/Nuake/src/UI/Rect.h b/Nuake/src/UI/Rect.h new file mode 100644 index 00000000..03dc6518 --- /dev/null +++ b/Nuake/src/UI/Rect.h @@ -0,0 +1,109 @@ +#pragma once +#include +#include +#include +#include +#include +#include + + +namespace UI +{ + // Styling props + class RectProp + { + public: + float BorderRadius = 0.0f; + float BorderMinXWidth = 0.0f; + float BorderMinYWidth = 0.0f; + float BorderMaxXWidth = 0.0f; + float BorderMaxYWidth = 0.0f; + Color BorderColor = Color(0, 0, 0, 1); + Color BackgroundColor = Color(1, 0, 0, 1); + Ref BackgroundTexture; + }; + + // This is the base component for every UI layout. + class Rect + { + private: + std::string id; // This is similar to html ids + std::vector groups; // this is similar to html classes + + public: + RectProp Props; + + float MinX; + float MinY; + float MaxX; + float MaxY; + + static Ref New(float minx, float miny, float maxx, float maxy) + { + return CreateRef(minx, miny, maxx, maxy); + } + + Rect(float minx, float miny, float maxx, float maxy) + { + this->MinX = minx; + this->MinY = miny; + this->MaxX = maxx; + this->MaxY = maxy; + + this->id = ""; + this->groups = std::vector(); + } + + // Check if a point is inside the rectangle. + bool IsInside(Vector2 point) + { + return point.x > MinX && point.x < MaxX && point.y > MinY && point.y < MaxY; + } + + bool HasGroup(const std::string& group) + { + for (auto g : groups) + if (g == group) + return true; + return false; + } + + std::vector GetGroups() { return groups; } + void AddGroup(const std::string& group) + { + // Check if already has group. + for (auto g : groups) + if (g == group) + return; + groups.push_back(group); + } + + std::string GetID() { return id; } + void SetID(const std::string& id) { this->id = id; } + + // Cuts a rectangle left and returns a new one. + Ref CutLeft(float a) + { + float minx = this->MinX; + this->MinX = std::min(this->MaxX, this->MinX + a); + return CreateRef(minx, this->MinY, this->MinX, this->MaxY); + } + + void Draw() + { + Renderer2D::UIShader->SetUniform4f("background_color", Props.BackgroundColor.r, + Props.BackgroundColor.g, + Props.BackgroundColor.b, + Props.BackgroundColor.a); + + // Get transform + Matrix4 transform = Matrix4(1.0f); + transform = glm::translate(transform, Vector3(MinX, MinY, 0)); + Vector3 scale = Vector3(MaxX - MinX, MaxY - MinY, 0); + transform = glm::scale(transform, scale); + Renderer2D::UIShader->SetUniformMat4f("model", transform); + + Renderer2D::DrawRect(); + } + }; +} \ No newline at end of file diff --git a/Nuake/src/UI/UserInterface.cpp b/Nuake/src/UI/UserInterface.cpp new file mode 100644 index 00000000..81b581f7 --- /dev/null +++ b/Nuake/src/UI/UserInterface.cpp @@ -0,0 +1,28 @@ +#include "UserInterface.h" + +namespace UI +{ + UserInterface::UserInterface(const std::string& name) + { + m_Name = name; + } + + Ref UserInterface::New(const std::string& name) + { + return CreateRef(name); + } + + void UserInterface::Draw() + { + Renderer2D::BeginDraw(); + for (auto r : m_Rects) + { + r->Draw(); + } + } + + void UserInterface::Update(Timestep ts) + { + + } +} diff --git a/Nuake/src/UI/UserInterface.h b/Nuake/src/UI/UserInterface.h new file mode 100644 index 00000000..888a0713 --- /dev/null +++ b/Nuake/src/UI/UserInterface.h @@ -0,0 +1,57 @@ +#pragma once +#include +#include +#include + +namespace UI +{ + class UserInterface + { + private: + std::vector> m_Rects; + Ref m_Framebuffer; // Texture of the interface. + std::string m_Name; + + public: + const int Width = 1920; + const int Height = 1080; + + UserInterface(const std::string& name); + + + static Ref New(const std::string& name); + void Draw(); + void Update(Timestep ts); + + std::vector> GetRects() + { + return m_Rects; + } + + void AddRect(Ref rect) + { + m_Rects.push_back(rect); + } + + Ref GetRectByID(const std::string& id) + { + for (auto r : m_Rects) + { + if (r->GetID() == id) + return r; + } + return nullptr; + } + + std::vector> GetRectsByGroup(const std::string& group) + { + std::vector> rects = std::vector>(); + for (auto r : m_Rects) + { + if(r->HasGroup(group)) + rects.push_back(r); + } + return rects; + } + }; +} \ No newline at end of file diff --git a/Nuake/src/Vendors/sol/config.hpp b/Nuake/src/Vendors/sol/config.hpp new file mode 100644 index 00000000..5fb4f925 --- /dev/null +++ b/Nuake/src/Vendors/sol/config.hpp @@ -0,0 +1,53 @@ +// The MIT License (MIT) + +// Copyright (c) 2013-2020 Rapptz, ThePhD and contributors + +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +// This file was generated with a script. +// Generated 2020-10-03 21:34:25.034794 UTC +// This header was generated with sol v3.2.1 (revision 48eea7b5) +// https://github.com/ThePhD/sol2 + +#ifndef SOL_SINGLE_CONFIG_HPP +#define SOL_SINGLE_CONFIG_HPP + +// beginning of sol/config.hpp + +/* Base, empty configuration file! + + To override, place a file in your include paths of the form: + +. (your include path here) +| sol (directory, or equivalent) + | config.hpp (your config.hpp file) + + So that when sol2 includes the file + +#include + + it gives you the configuration values you desire. Configuration values can be +seen in the safety.rst of the doc/src, or at +https://sol2.readthedocs.io/en/latest/safety.html ! You can also pass them through +the build system, or the command line options of your compiler. + +*/ + +// end of sol/config.hpp + +#endif // SOL_SINGLE_CONFIG_HPP diff --git a/Nuake/src/Vendors/sol/forward.hpp b/Nuake/src/Vendors/sol/forward.hpp new file mode 100644 index 00000000..c41b4ac8 --- /dev/null +++ b/Nuake/src/Vendors/sol/forward.hpp @@ -0,0 +1,828 @@ +// The MIT License (MIT) + +// Copyright (c) 2013-2020 Rapptz, ThePhD and contributors + +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +// This file was generated with a script. +// Generated 2020-10-03 21:34:25.022965 UTC +// This header was generated with sol v3.2.1 (revision 48eea7b5) +// https://github.com/ThePhD/sol2 + +#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP +#define SOL_SINGLE_INCLUDE_FORWARD_HPP + +// beginning of sol/forward.hpp + +#ifndef SOL_FORWARD_HPP +#define SOL_FORWARD_HPP + +// beginning of sol/version.hpp + +#include + +#include + +#define SOL_VERSION_MAJOR 3 +#define SOL_VERSION_MINOR 5 +#define SOL_VERSION_PATCH 0 +#define SOL_VERSION_STRING "3.5.0" +#define SOL_VERSION ((SOL_VERSION_MAJOR * 100000) + (SOL_VERSION_MINOR * 100) + (SOL_VERSION_PATCH)) + +#define SOL_IS_ON(OP_SYMBOL) ((3 OP_SYMBOL 3) != 0) +#define SOL_IS_OFF(OP_SYMBOL) ((3 OP_SYMBOL 3) == 0) +#define SOL_IS_DEFAULT_ON(OP_SYMBOL) ((3 OP_SYMBOL 3) > 3) +#define SOL_IS_DEFAULT_OFF(OP_SYMBOL) ((3 OP_SYMBOL 3 OP_SYMBOL 3) < 0) + +#define SOL_ON | +#define SOL_OFF ^ +#define SOL_DEFAULT_ON + +#define SOL_DEFAULT_OFF - + +#if defined(_MSC_VER) + #define SOL_COMPILER_CLANG_I_ SOL_OFF + #define SOL_COMPILER_GCC_I_ SOL_OFF + #define SOL_COMPILER_EDG_I_ SOL_OFF + #define SOL_COMPILER_VCXX_I_ SOL_ON +#elif defined(__clang__) + #define SOL_COMPILER_CLANG_I_ SOL_ON + #define SOL_COMPILER_GCC_I_ SOL_OFF + #define SOL_COMPILER_EDG_I_ SOL_OFF + #define SOL_COMPILER_VCXX_I_ SOL_OFF +#elif defined(__GNUC__) + #define SOL_COMPILER_CLANG_I_ SOL_OFF + #define SOL_COMPILER_GCC_I_ SOL_ON + #define SOL_COMPILER_EDG_I_ SOL_OFF + #define SOL_COMPILER_VCXX_I_ SOL_OFF +#else + #define SOL_COMPILER_CLANG_I_ SOL_OFF + #define SOL_COMPILER_GCC_I_ SOL_OFF + #define SOL_COMPILER_EDG_I_ SOL_OFF + #define SOL_COMPILER_VCXX_I_ SOL_OFF +#endif + +#if defined(__MINGW32__) + #define SOL_COMPILER_FRONTEND_MINGW_I_ SOL_ON +#else + #define SOL_COMPILER_FRONTEND_MINGW_I_ SOL_OFF +#endif + +#if SIZE_MAX <= 0xFFFFULL + #define SOL_PLATFORM_X16_I_ SOL_ON + #define SOL_PLATFORM_X86_I_ SOL_OFF + #define SOL_PLATFORM_X64_I_ SOL_OFF +#elif SIZE_MAX <= 0xFFFFFFFFULL + #define SOL_PLATFORM_X16_I_ SOL_OFF + #define SOL_PLATFORM_X86_I_ SOL_ON + #define SOL_PLATFORM_X64_I_ SOL_OFF +#else + #define SOL_PLATFORM_X16_I_ SOL_OFF + #define SOL_PLATFORM_X86_I_ SOL_OFF + #define SOL_PLATFORM_X64_I_ SOL_ON +#endif + +#define SOL_PLATFORM_ARM32_I_ SOL_OFF +#define SOL_PLATFORM_ARM64_I_ SOL_OFF + +#if defined(_WIN32) + #define SOL_PLATFORM_WINDOWS_I_ SOL_ON +#else + #define SOL_PLATFORM_WINDOWS_I_ SOL_OFF +#endif +#if defined(__APPLE__) + #define SOL_PLATFORM_APPLE_I_ SOL_ON +#else + #define SOL_PLATFORM_APPLE_I_ SOL_OFF +#endif +#if defined(__unix__) + #define SOL_PLATFORM_UNIXLIKE_I_ SOL_ON +#else + #define SOL_PLATFORM_UNIXLIKE_I_ SOL_OFF +#endif +#if defined(__linux__) + #define SOL_PLATFORM_LINUXLIKE_I_ SOL_ON +#else + #define SOL_PLATFORM_LINUXLIKE_I_ SOL_OFF +#endif + +#define SOL_PLATFORM_APPLE_IPHONE_I_ SOL_OFF +#define SOL_PLATFORM_BSDLIKE_I_ SOL_OFF + +#if defined(SOL_IN_DEBUG_DETECTED) + #if SOL_IN_DEBUG_DETECTED != 0 + #define SOL_DEBUG_BUILD_I_ SOL_ON + #else + #define SOL_DEBUG_BUILD_I_ SOL_OFF + #endif +#elif !defined(NDEBUG) + #if SOL_IS_ON(SOL_COMPILER_VCXX_I_) && defined(_DEBUG) + #define SOL_DEBUG_BUILD_I_ SOL_ON + #elif (SOL_IS_ON(SOL_COMPILER_CLANG_I_) || SOL_IS_ON(SOL_COMPILER_GCC_I_)) && !defined(__OPTIMIZE__) + #define SOL_DEBUG_BUILD_I_ SOL_ON + #else + #define SOL_DEBUG_BUILD_I_ SOL_OFF + #endif +#else + #define SOL_DEBUG_BUILD_I_ SOL_DEFAULT_OFF +#endif // We are in a debug mode of some sort + +#if defined(SOL_NO_EXCEPTIONS) + #if (SOL_NO_EXCEPTIONS != 0) + #define SOL_EXCEPTIONS_I_ SOL_OFF + #else + #define SOL_EXCEPTIONS_I_ SOL_ON + #endif +#elif SOL_IS_ON(SOL_COMPILER_VCXX_I_) + #if !defined(_CPPUNWIND) + #define SOL_EXCEPTIONS_I_ SOL_OFF + #else + #define SOL_EXCEPTIONS_I_ SOL_ON + #endif +#elif SOL_IS_ON(SOL_COMPILER_CLANG_I_) || SOL_IS_ON(SOL_COMPILER_GCC_I_) + #if !defined(__EXCEPTIONS) + #define SOL_EXCEPTIONS_I_ SOL_OFF + #else + #define SOL_EXCEPTIONS_I_ SOL_ON + #endif +#else + #define SOL_EXCEPTIONS_I_ SOL_DEFAULT_ON +#endif + +#if defined(SOL_NO_RTTI) + #if (SOL_NO_RTTI != 0) + #define SOL_RTTI_I_ SOL_OFF + #else + #define SOL_RTTI_I_ SOL_ON + #endif +#elif SOL_IS_ON(SOL_COMPILER_VCXX_I_) + #if !defined(_CPPRTTI) + #define SOL_RTTI_I_ SOL_OFF + #else + #define SOL_RTTI_I_ SOL_ON + #endif +#elif SOL_IS_ON(SOL_COMPILER_CLANG_I_) || SOL_IS_ON(SOL_COMPILER_GCC_I_) + #if !defined(__GXX_RTTI) + #define SOL_RTTI_I_ SOL_OFF + #else + #define SOL_RTTI_I_ SOL_ON + #endif +#else + #define SOL_RTTI_I_ SOL_DEFAULT_ON +#endif + +#if defined(SOL_NO_THREAD_LOCAL) && (SOL_NO_THREAD_LOCAL != 0) + #define SOL_USE_THREAD_LOCAL_I_ SOL_OFF +#else + #define SOL_USE_THREAD_LOCAL_I_ SOL_DEFAULT_ON +#endif // thread_local keyword is bjorked on some platforms + +#if defined(SOL_ALL_SAFETIES_ON) && (SOL_ALL_SAFETIES_ON != 0) + #define SOL_ALL_SAFETIES_ON_I_ SOL_ON +#else + #define SOL_ALL_SAFETIES_ON_I_ SOL_DEFAULT_OFF +#endif + +#if defined(SOL_SAFE_GETTER) && (SOL_SAFE_GETTER != 0) + #define SOL_SAFE_GETTER_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_GETTER_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_GETTER_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_GETTER_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_SAFE_USERTYPE) && (SOL_SAFE_USERTYPE != 0) + #define SOL_SAFE_USERTYPE_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_USERTYPE_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_USERTYPE_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_USERTYPE_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_SAFE_REFERENCES) && (SOL_SAFE_REFERENCES != 0) + #define SOL_SAFE_REFERENCES_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_REFERENCES_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_REFERENCES_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_REFERENCES_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if (defined(SOL_SAFE_FUNCTIONS) && (SOL_SAFE_FUNCTIONS != 0)) \ + || (defined(SOL_SAFE_FUNCTION_OBJECTS) && (SOL_SAFE_FUNCTION_OBJECTS != 0)) + #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_SAFE_FUNCTION_CALLS) && (SOL_SAFE_FUNCTION_CALLS != 0) + #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_SAFE_PROXIES) && (SOL_SAFE_PROXIES != 0) + #define SOL_SAFE_PROXIES_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_PROXIES_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_PROXIES_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_PROXIES_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_SAFE_NUMERICS) && (SOL_SAFE_NUMERICS != 0) + #define SOL_SAFE_NUMERICS_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_NUMERICS_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_NUMERICS_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_NUMERICS_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_SAFE_STACK_CHECK) && (SOL_SAFE_STACK_CHECK != 0) + #define SOL_SAFE_STACK_CHECK_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_STACK_CHECK_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_STACK_CHECK_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_STACK_CHECK_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if (defined(SOL_NO_CHECK_NUMBER_PRECISION) && (SOL_NO_CHECK_NUMBER_PRECISION != 0)) \ + || (defined(SOL_NO_CHECKING_NUMBER_PRECISION) && (SOL_NO_CHECKING_NUMBER_PRECISION != 0)) + #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_OFF +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON + #elif SOL_IS_ON(SOL_SAFE_NUMERICS_I_) + #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_DEFAULT_ON + #else + #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_STRINGS_ARE_NUMBERS) + #if (SOL_STRINGS_ARE_NUMBERS != 0) + #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_ON + #else + #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_OFF + #endif +#else + #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_DEFAULT_OFF +#endif + +#if defined(SOL_ENABLE_INTEROP) && (SOL_ENABLE_INTEROP != 0) \ + || defined(SOL_USE_INTEROP) && (SOL_USE_INTEROP != 0) + #define SOL_USE_INTEROP_I_ SOL_ON +#else + #define SOL_USE_INTEROP_I_ SOL_DEFAULT_OFF +#endif + +#if defined(SOL_NO_NIL) + #if (SOL_NO_NIL != 0) + #define SOL_NIL_I_ SOL_OFF + #else + #define SOL_NIL_I_ SOL_ON + #endif +#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) || defined(__OBJC__) || defined(nil) + #define SOL_NIL_I_ SOL_DEFAULT_OFF +#else + #define SOL_NIL_I_ SOL_DEFAULT_ON +#endif + +#if defined(SOL_USERTYPE_TYPE_BINDING_INFO) + #if (SOL_USERTYPE_TYPE_BINDING_INFO != 0) + #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_ON + #else + #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_OFF + #endif +#else + #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_DEFAULT_ON +#endif // We should generate a my_type.__type table with lots of class information for usertypes + +#if defined(SOL_AUTOMAGICAL_TYPES_BY_DEFAULT) + #if (SOL_AUTOMAGICAL_TYPES_BY_DEFAULT != 0) + #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_ON + #else + #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_OFF + #endif +#elif defined(SOL_DEFAULT_AUTOMAGICAL_USERTYPES) + #if (SOL_DEFAULT_AUTOMAGICAL_USERTYPES != 0) + #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_ON + #else + #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_OFF + #endif +#else + #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_DEFAULT_ON +#endif // make is_automagical on/off by default + +#if defined(SOL_STD_VARIANT) + #if (SOL_STD_VARIANT != 0) + #define SOL_STD_VARIANT_I_ SOL_ON + #else + #define SOL_STD_VARIANT_I_ SOL_OFF + #endif +#else + #if SOL_IS_ON(SOL_COMPILER_CLANG_I_) && SOL_IS_ON(SOL_PLATFORM_APPLE_I_) + #if defined(__has_include) + #if __has_include() + #define SOL_STD_VARIANT_I_ SOL_ON + #else + #define SOL_STD_VARIANT_I_ SOL_OFF + #endif + #else + #define SOL_STD_VARIANT_I_ SOL_OFF + #endif + #else + #define SOL_STD_VARIANT_I_ SOL_DEFAULT_ON + #endif +#endif // make is_automagical on/off by default + +#if defined(SOL_NOEXCEPT_FUNCTION_TYPE) + #if (SOL_NOEXCEPT_FUNCTION_TYPE != 0) + #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_ON + #else + #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_OFF + #endif +#else + #if defined(__cpp_noexcept_function_type) + #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_ON + #elif SOL_IS_ON(SOL_COMPILER_VCXX_I_) && (defined(_MSVC_LANG) && (_MSVC_LANG < 201403L)) + // There is a bug in the VC++ compiler?? + // on /std:c++latest under x86 conditions (VS 15.5.2), + // compiler errors are tossed for noexcept markings being on function types + // that are identical in every other way to their non-noexcept marked types function types... + // VS 2019: There is absolutely a bug. + #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_OFF + #else + #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_DEFAULT_ON + #endif +#endif // noexcept is part of a function's type + +#if defined(SOL_STACK_STRING_OPTIMIZATION_SIZE) && SOL_STACK_STRING_OPTIMIZATION_SIZE > 0 + #define SOL_OPTIMIZATION_STRING_CONVERSION_STACK_SIZE_I_ SOL_STACK_STRING_OPTIMIZATION_SIZE +#else + #define SOL_OPTIMIZATION_STRING_CONVERSION_STACK_SIZE_I_ 1024 +#endif + +#if defined(SOL_ID_SIZE) && SOL_ID_SIZE > 0 + #define SOL_ID_SIZE_I_ SOL_ID_SIZE +#else + #define SOL_ID_SIZE_I_ 512 +#endif + +#if defined(LUA_IDSIZE) && LUA_IDSIZE > 0 + #define SOL_FILE_ID_SIZE_I_ LUA_IDSIZE +#elif defined(SOL_ID_SIZE) && SOL_ID_SIZE > 0 + #define SOL_FILE_ID_SIZE_I_ SOL_FILE_ID_SIZE +#else + #define SOL_FILE_ID_SIZE_I_ 2048 +#endif + +#if defined(SOL_PRINT_ERRORS) + #if (SOL_PRINT_ERRORS != 0) + #define SOL_PRINT_ERRORS_I_ SOL_ON + #else + #define SOL_PRINT_ERRORS_I_ SOL_OFF + #endif +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_PRINT_ERRORS_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_PRINT_ERRORS_I_ SOL_DEFAULT_ON + #else + #define SOL_PRINT_ERRORS_I_ SOL_OFF + #endif +#endif + +#if defined(SOL_DEFAULT_PASS_ON_ERROR) && (SOL_DEFAULT_PASS_ON_ERROR != 0) + #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_DEFAULT_ON + #else + #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_OFF + #endif +#endif + +#if defined(SOL_USING_CXX_LUA) + #if (SOL_USING_CXX_LUA != 0) + #define SOL_USE_CXX_LUA_I_ SOL_ON + #else + #define SOL_USE_CXX_LUA_I_ SOL_OFF + #endif +#elif defined(SOL_USE_CXX_LUA) + #if (SOL_USE_CXX_LUA != 0) + #define SOL_USE_CXX_LUA_I_ SOL_ON + #else + #define SOL_USE_CXX_LUA_I_ SOL_OFF + #endif +#else + #define SOL_USE_CXX_LUA_I_ SOL_OFF +#endif + +#if defined(SOL_USING_CXX_LUAJIT) + #if (SOL_USING_CXX_LUA != 0) + #define SOL_USE_CXX_LUAJIT_I_ SOL_ON + #else + #define SOL_USE_CXX_LUAJIT_I_ SOL_OFF + #endif +#elif defined(SOL_USE_CXX_LUAJIT) + #if (SOL_USE_CXX_LUA != 0) + #define SOL_USE_CXX_LUAJIT_I_ SOL_ON + #else + #define SOL_USE_CXX_LUAJIT_I_ SOL_OFF + #endif +#else + #define SOL_USE_CXX_LUAJIT_I_ SOL_OFF +#endif + +#if defined(SOL_NO_LUA_HPP) + #if (SOL_NO_LUA_HPP != 0) + #define SOL_USE_LUA_HPP_I_ SOL_OFF + #else + #define SOL_USE_LUA_HPP_I_ SOL_ON + #endif +#elif defined(SOL_USING_CXX_LUA) + #define SOL_USE_LUA_HPP_I_ SOL_OFF +#elif defined(__has_include) + #if __has_include() + #define SOL_USE_LUA_HPP_I_ SOL_ON + #else + #define SOL_USE_LUA_HPP_I_ SOL_OFF + #endif +#else + #define SOL_USE_LUA_HPP_I_ SOL_DEFAULT_ON +#endif + +#if defined(SOL_CONTAINERS_START) + #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINERS_START +#elif defined(SOL_CONTAINERS_START_INDEX) + #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINERS_START_INDEX +#elif defined(SOL_CONTAINER_START_INDEX) + #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINER_START_INDEX +#else + #define SOL_CONTAINER_START_INDEX_I_ 1 +#endif + +#if defined (SOL_NO_MEMORY_ALIGNMENT) + #if (SOL_NO_MEMORY_ALIGNMENT != 0) + #define SOL_ALIGN_MEMORY_I_ SOL_OFF + #else + #define SOL_ALIGN_MEMORY_I_ SOL_ON + #endif +#else + #define SOL_ALIGN_MEMORY_I_ SOL_DEFAULT_ON +#endif + +#if defined(SOL_USE_BOOST) + #if (SOL_USE_BOOST != 0) + #define SOL_USE_BOOST_I_ SOL_ON + #else + #define SOL_USE_BOOST_I_ SOL_OFF + #endif +#else + #define SOL_USE_BOOST_I_ SOL_OFF +#endif + +#if defined(SOL_USE_UNSAFE_BASE_LOOKUP) + #if (SOL_USE_UNSAFE_BASE_LOOKUP != 0) + #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_ON + #else + #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_OFF + #endif +#else + #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_OFF +#endif + +#if defined(SOL_INSIDE_UNREAL) + #if (SOL_INSIDE_UNREAL != 0) + #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_ON + #else + #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_OFF + #endif +#else + #if defined(UE_BUILD_DEBUG) || defined(UE_BUILD_DEVELOPMENT) || defined(UE_BUILD_TEST) || defined(UE_BUILD_SHIPPING) || defined(UE_SERVER) + #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_ON + #else + #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_NO_COMPAT) + #if (SOL_NO_COMPAT != 0) + #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_OFF + #else + #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_ON + #endif +#else + #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_DEFAULT_ON +#endif + +#if defined(SOL_GET_FUNCTION_POINTER_UNSAFE) + #if (SOL_GET_FUNCTION_POINTER_UNSAFE != 0) + #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_ON + #else + #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_OFF + #endif +#else + #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_DEFAULT_OFF +#endif + +#if SOL_IS_ON(SOL_COMPILER_FRONTEND_MINGW_I_) && defined(__GNUC__) && (__GNUC__ < 6) + // MinGW is off its rocker in some places... + #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_ON +#else + #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_DEFAULT_OFF +#endif + +// end of sol/version.hpp + +#include +#include +#include + +#if SOL_IS_ON(SOL_USE_CXX_LUA_I_) || SOL_IS_ON(SOL_USE_CXX_LUAJIT_I_) +struct lua_State; +#else +extern "C" { +struct lua_State; +} +#endif // C++ Mangling for Lua vs. Not + +namespace sol { + + enum class type; + + class stateless_reference; + template + class basic_reference; + using reference = basic_reference; + using main_reference = basic_reference; + class stateless_stack_reference; + class stack_reference; + + template + class basic_bytecode; + + struct lua_value; + + struct proxy_base_tag; + template + struct proxy_base; + template + struct table_proxy; + + template + class basic_table_core; + template + using table_core = basic_table_core; + template + using main_table_core = basic_table_core; + template + using stack_table_core = basic_table_core; + template + using basic_table = basic_table_core; + using table = table_core; + using global_table = table_core; + using main_table = main_table_core; + using main_global_table = main_table_core; + using stack_table = stack_table_core; + using stack_global_table = stack_table_core; + + template + struct basic_lua_table; + using lua_table = basic_lua_table; + using stack_lua_table = basic_lua_table; + + template + class basic_usertype; + template + using usertype = basic_usertype; + template + using stack_usertype = basic_usertype; + + template + class basic_metatable; + using metatable = basic_metatable; + using stack_metatable = basic_metatable; + + template + struct basic_environment; + using environment = basic_environment; + using main_environment = basic_environment; + using stack_environment = basic_environment; + + template + class basic_function; + template + class basic_protected_function; + using unsafe_function = basic_function; + using safe_function = basic_protected_function; + using main_unsafe_function = basic_function; + using main_safe_function = basic_protected_function; + using stack_unsafe_function = basic_function; + using stack_safe_function = basic_protected_function; + using stack_aligned_unsafe_function = basic_function; + using stack_aligned_safe_function = basic_protected_function; + using protected_function = safe_function; + using main_protected_function = main_safe_function; + using stack_protected_function = stack_safe_function; + using stack_aligned_protected_function = stack_aligned_safe_function; +#if SOL_IS_ON(SOL_SAFE_FUNCTION_OBJECTS_I_) + using function = protected_function; + using main_function = main_protected_function; + using stack_function = stack_protected_function; + using stack_aligned_function = stack_aligned_safe_function; +#else + using function = unsafe_function; + using main_function = main_unsafe_function; + using stack_function = stack_unsafe_function; + using stack_aligned_function = stack_aligned_unsafe_function; +#endif + using stack_aligned_stack_handler_function = basic_protected_function; + + struct unsafe_function_result; + struct protected_function_result; + using safe_function_result = protected_function_result; +#if SOL_IS_ON(SOL_SAFE_FUNCTION_OBJECTS_I_) + using function_result = safe_function_result; +#else + using function_result = unsafe_function_result; +#endif + + template + class basic_object_base; + template + class basic_object; + template + class basic_userdata; + template + class basic_lightuserdata; + template + class basic_coroutine; + template + class basic_thread; + + using object = basic_object; + using userdata = basic_userdata; + using lightuserdata = basic_lightuserdata; + using thread = basic_thread; + using coroutine = basic_coroutine; + using main_object = basic_object; + using main_userdata = basic_userdata; + using main_lightuserdata = basic_lightuserdata; + using main_coroutine = basic_coroutine; + using stack_object = basic_object; + using stack_userdata = basic_userdata; + using stack_lightuserdata = basic_lightuserdata; + using stack_thread = basic_thread; + using stack_coroutine = basic_coroutine; + + struct stack_proxy_base; + struct stack_proxy; + struct variadic_args; + struct variadic_results; + struct stack_count; + struct this_state; + struct this_main_state; + struct this_environment; + + class state_view; + class state; + + template + struct as_table_t; + template + struct as_container_t; + template + struct nested; + template + struct light; + template + struct user; + template + struct as_args_t; + template + struct protect_t; + template + struct policy_wrapper; + + template + struct usertype_traits; + template + struct unique_usertype_traits; + + template + struct types { + typedef std::make_index_sequence indices; + static constexpr std::size_t size() { + return sizeof...(Args); + } + }; + + template + struct derive : std::false_type { + typedef types<> type; + }; + + template + struct base : std::false_type { + typedef types<> type; + }; + + template + struct weak_derive { + static bool value; + }; + + template + bool weak_derive::value = false; + + namespace stack { + struct record; + } + +#if SOL_IS_OFF(SOL_USE_BOOST_I_) + template + class optional; + + template + class optional; +#endif + + using check_handler_type = int(lua_State*, int, type, type, const char*); + +} // namespace sol + +#define SOL_BASE_CLASSES(T, ...) \ + namespace sol { \ + template <> \ + struct base : std::true_type { \ + typedef ::sol::types<__VA_ARGS__> type; \ + }; \ + } \ + void a_sol3_detail_function_decl_please_no_collide() +#define SOL_DERIVED_CLASSES(T, ...) \ + namespace sol { \ + template <> \ + struct derive : std::true_type { \ + typedef ::sol::types<__VA_ARGS__> type; \ + }; \ + } \ + void a_sol3_detail_function_decl_please_no_collide() + +#endif // SOL_FORWARD_HPP +// end of sol/forward.hpp + +#endif // SOL_SINGLE_INCLUDE_FORWARD_HPP diff --git a/Nuake/src/Vendors/sol/sol.hpp b/Nuake/src/Vendors/sol/sol.hpp new file mode 100644 index 00000000..4ef5807f --- /dev/null +++ b/Nuake/src/Vendors/sol/sol.hpp @@ -0,0 +1,26674 @@ +// The MIT License (MIT) + +// Copyright (c) 2013-2020 Rapptz, ThePhD and contributors + +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +// This file was generated with a script. +// Generated 2020-10-03 21:34:24.496436 UTC +// This header was generated with sol v3.2.1 (revision 48eea7b5) +// https://github.com/ThePhD/sol2 + +#ifndef SOL_SINGLE_INCLUDE_HPP +#define SOL_SINGLE_INCLUDE_HPP + +// beginning of sol/sol.hpp + +#ifndef SOL_HPP +#define SOL_HPP + +// beginning of sol/version.hpp + +#include + +#include + +#define SOL_VERSION_MAJOR 3 +#define SOL_VERSION_MINOR 5 +#define SOL_VERSION_PATCH 0 +#define SOL_VERSION_STRING "3.5.0" +#define SOL_VERSION ((SOL_VERSION_MAJOR * 100000) + (SOL_VERSION_MINOR * 100) + (SOL_VERSION_PATCH)) + +#define SOL_IS_ON(OP_SYMBOL) ((3 OP_SYMBOL 3) != 0) +#define SOL_IS_OFF(OP_SYMBOL) ((3 OP_SYMBOL 3) == 0) +#define SOL_IS_DEFAULT_ON(OP_SYMBOL) ((3 OP_SYMBOL 3) > 3) +#define SOL_IS_DEFAULT_OFF(OP_SYMBOL) ((3 OP_SYMBOL 3 OP_SYMBOL 3) < 0) + +#define SOL_ON | +#define SOL_OFF ^ +#define SOL_DEFAULT_ON + +#define SOL_DEFAULT_OFF - + +#if defined(_MSC_VER) + #define SOL_COMPILER_CLANG_I_ SOL_OFF + #define SOL_COMPILER_GCC_I_ SOL_OFF + #define SOL_COMPILER_EDG_I_ SOL_OFF + #define SOL_COMPILER_VCXX_I_ SOL_ON +#elif defined(__clang__) + #define SOL_COMPILER_CLANG_I_ SOL_ON + #define SOL_COMPILER_GCC_I_ SOL_OFF + #define SOL_COMPILER_EDG_I_ SOL_OFF + #define SOL_COMPILER_VCXX_I_ SOL_OFF +#elif defined(__GNUC__) + #define SOL_COMPILER_CLANG_I_ SOL_OFF + #define SOL_COMPILER_GCC_I_ SOL_ON + #define SOL_COMPILER_EDG_I_ SOL_OFF + #define SOL_COMPILER_VCXX_I_ SOL_OFF +#else + #define SOL_COMPILER_CLANG_I_ SOL_OFF + #define SOL_COMPILER_GCC_I_ SOL_OFF + #define SOL_COMPILER_EDG_I_ SOL_OFF + #define SOL_COMPILER_VCXX_I_ SOL_OFF +#endif + +#if defined(__MINGW32__) + #define SOL_COMPILER_FRONTEND_MINGW_I_ SOL_ON +#else + #define SOL_COMPILER_FRONTEND_MINGW_I_ SOL_OFF +#endif + +#if SIZE_MAX <= 0xFFFFULL + #define SOL_PLATFORM_X16_I_ SOL_ON + #define SOL_PLATFORM_X86_I_ SOL_OFF + #define SOL_PLATFORM_X64_I_ SOL_OFF +#elif SIZE_MAX <= 0xFFFFFFFFULL + #define SOL_PLATFORM_X16_I_ SOL_OFF + #define SOL_PLATFORM_X86_I_ SOL_ON + #define SOL_PLATFORM_X64_I_ SOL_OFF +#else + #define SOL_PLATFORM_X16_I_ SOL_OFF + #define SOL_PLATFORM_X86_I_ SOL_OFF + #define SOL_PLATFORM_X64_I_ SOL_ON +#endif + +#define SOL_PLATFORM_ARM32_I_ SOL_OFF +#define SOL_PLATFORM_ARM64_I_ SOL_OFF + +#if defined(_WIN32) + #define SOL_PLATFORM_WINDOWS_I_ SOL_ON +#else + #define SOL_PLATFORM_WINDOWS_I_ SOL_OFF +#endif +#if defined(__APPLE__) + #define SOL_PLATFORM_APPLE_I_ SOL_ON +#else + #define SOL_PLATFORM_APPLE_I_ SOL_OFF +#endif +#if defined(__unix__) + #define SOL_PLATFORM_UNIXLIKE_I_ SOL_ON +#else + #define SOL_PLATFORM_UNIXLIKE_I_ SOL_OFF +#endif +#if defined(__linux__) + #define SOL_PLATFORM_LINUXLIKE_I_ SOL_ON +#else + #define SOL_PLATFORM_LINUXLIKE_I_ SOL_OFF +#endif + +#define SOL_PLATFORM_APPLE_IPHONE_I_ SOL_OFF +#define SOL_PLATFORM_BSDLIKE_I_ SOL_OFF + +#if defined(SOL_IN_DEBUG_DETECTED) + #if SOL_IN_DEBUG_DETECTED != 0 + #define SOL_DEBUG_BUILD_I_ SOL_ON + #else + #define SOL_DEBUG_BUILD_I_ SOL_OFF + #endif +#elif !defined(NDEBUG) + #if SOL_IS_ON(SOL_COMPILER_VCXX_I_) && defined(_DEBUG) + #define SOL_DEBUG_BUILD_I_ SOL_ON + #elif (SOL_IS_ON(SOL_COMPILER_CLANG_I_) || SOL_IS_ON(SOL_COMPILER_GCC_I_)) && !defined(__OPTIMIZE__) + #define SOL_DEBUG_BUILD_I_ SOL_ON + #else + #define SOL_DEBUG_BUILD_I_ SOL_OFF + #endif +#else + #define SOL_DEBUG_BUILD_I_ SOL_DEFAULT_OFF +#endif // We are in a debug mode of some sort + +#if defined(SOL_NO_EXCEPTIONS) + #if (SOL_NO_EXCEPTIONS != 0) + #define SOL_EXCEPTIONS_I_ SOL_OFF + #else + #define SOL_EXCEPTIONS_I_ SOL_ON + #endif +#elif SOL_IS_ON(SOL_COMPILER_VCXX_I_) + #if !defined(_CPPUNWIND) + #define SOL_EXCEPTIONS_I_ SOL_OFF + #else + #define SOL_EXCEPTIONS_I_ SOL_ON + #endif +#elif SOL_IS_ON(SOL_COMPILER_CLANG_I_) || SOL_IS_ON(SOL_COMPILER_GCC_I_) + #if !defined(__EXCEPTIONS) + #define SOL_EXCEPTIONS_I_ SOL_OFF + #else + #define SOL_EXCEPTIONS_I_ SOL_ON + #endif +#else + #define SOL_EXCEPTIONS_I_ SOL_DEFAULT_ON +#endif + +#if defined(SOL_NO_RTTI) + #if (SOL_NO_RTTI != 0) + #define SOL_RTTI_I_ SOL_OFF + #else + #define SOL_RTTI_I_ SOL_ON + #endif +#elif SOL_IS_ON(SOL_COMPILER_VCXX_I_) + #if !defined(_CPPRTTI) + #define SOL_RTTI_I_ SOL_OFF + #else + #define SOL_RTTI_I_ SOL_ON + #endif +#elif SOL_IS_ON(SOL_COMPILER_CLANG_I_) || SOL_IS_ON(SOL_COMPILER_GCC_I_) + #if !defined(__GXX_RTTI) + #define SOL_RTTI_I_ SOL_OFF + #else + #define SOL_RTTI_I_ SOL_ON + #endif +#else + #define SOL_RTTI_I_ SOL_DEFAULT_ON +#endif + +#if defined(SOL_NO_THREAD_LOCAL) && (SOL_NO_THREAD_LOCAL != 0) + #define SOL_USE_THREAD_LOCAL_I_ SOL_OFF +#else + #define SOL_USE_THREAD_LOCAL_I_ SOL_DEFAULT_ON +#endif // thread_local keyword is bjorked on some platforms + +#if defined(SOL_ALL_SAFETIES_ON) && (SOL_ALL_SAFETIES_ON != 0) + #define SOL_ALL_SAFETIES_ON_I_ SOL_ON +#else + #define SOL_ALL_SAFETIES_ON_I_ SOL_DEFAULT_OFF +#endif + +#if defined(SOL_SAFE_GETTER) && (SOL_SAFE_GETTER != 0) + #define SOL_SAFE_GETTER_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_GETTER_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_GETTER_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_GETTER_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_SAFE_USERTYPE) && (SOL_SAFE_USERTYPE != 0) + #define SOL_SAFE_USERTYPE_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_USERTYPE_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_USERTYPE_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_USERTYPE_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_SAFE_REFERENCES) && (SOL_SAFE_REFERENCES != 0) + #define SOL_SAFE_REFERENCES_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_REFERENCES_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_REFERENCES_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_REFERENCES_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if (defined(SOL_SAFE_FUNCTIONS) && (SOL_SAFE_FUNCTIONS != 0)) \ + || (defined(SOL_SAFE_FUNCTION_OBJECTS) && (SOL_SAFE_FUNCTION_OBJECTS != 0)) + #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_SAFE_FUNCTION_CALLS) && (SOL_SAFE_FUNCTION_CALLS != 0) + #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_SAFE_PROXIES) && (SOL_SAFE_PROXIES != 0) + #define SOL_SAFE_PROXIES_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_PROXIES_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_PROXIES_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_PROXIES_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_SAFE_NUMERICS) && (SOL_SAFE_NUMERICS != 0) + #define SOL_SAFE_NUMERICS_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_NUMERICS_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_NUMERICS_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_NUMERICS_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_SAFE_STACK_CHECK) && (SOL_SAFE_STACK_CHECK != 0) + #define SOL_SAFE_STACK_CHECK_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_SAFE_STACK_CHECK_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_SAFE_STACK_CHECK_I_ SOL_DEFAULT_ON + #else + #define SOL_SAFE_STACK_CHECK_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if (defined(SOL_NO_CHECK_NUMBER_PRECISION) && (SOL_NO_CHECK_NUMBER_PRECISION != 0)) \ + || (defined(SOL_NO_CHECKING_NUMBER_PRECISION) && (SOL_NO_CHECKING_NUMBER_PRECISION != 0)) + #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_OFF +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON + #elif SOL_IS_ON(SOL_SAFE_NUMERICS_I_) + #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_DEFAULT_ON + #else + #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_STRINGS_ARE_NUMBERS) + #if (SOL_STRINGS_ARE_NUMBERS != 0) + #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_ON + #else + #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_OFF + #endif +#else + #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_DEFAULT_OFF +#endif + +#if defined(SOL_ENABLE_INTEROP) && (SOL_ENABLE_INTEROP != 0) \ + || defined(SOL_USE_INTEROP) && (SOL_USE_INTEROP != 0) + #define SOL_USE_INTEROP_I_ SOL_ON +#else + #define SOL_USE_INTEROP_I_ SOL_DEFAULT_OFF +#endif + +#if defined(SOL_NO_NIL) + #if (SOL_NO_NIL != 0) + #define SOL_NIL_I_ SOL_OFF + #else + #define SOL_NIL_I_ SOL_ON + #endif +#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) || defined(__OBJC__) || defined(nil) + #define SOL_NIL_I_ SOL_DEFAULT_OFF +#else + #define SOL_NIL_I_ SOL_DEFAULT_ON +#endif + +#if defined(SOL_USERTYPE_TYPE_BINDING_INFO) + #if (SOL_USERTYPE_TYPE_BINDING_INFO != 0) + #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_ON + #else + #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_OFF + #endif +#else + #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_DEFAULT_ON +#endif // We should generate a my_type.__type table with lots of class information for usertypes + +#if defined(SOL_AUTOMAGICAL_TYPES_BY_DEFAULT) + #if (SOL_AUTOMAGICAL_TYPES_BY_DEFAULT != 0) + #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_ON + #else + #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_OFF + #endif +#elif defined(SOL_DEFAULT_AUTOMAGICAL_USERTYPES) + #if (SOL_DEFAULT_AUTOMAGICAL_USERTYPES != 0) + #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_ON + #else + #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_OFF + #endif +#else + #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_DEFAULT_ON +#endif // make is_automagical on/off by default + +#if defined(SOL_STD_VARIANT) + #if (SOL_STD_VARIANT != 0) + #define SOL_STD_VARIANT_I_ SOL_ON + #else + #define SOL_STD_VARIANT_I_ SOL_OFF + #endif +#else + #if SOL_IS_ON(SOL_COMPILER_CLANG_I_) && SOL_IS_ON(SOL_PLATFORM_APPLE_I_) + #if defined(__has_include) + #if __has_include() + #define SOL_STD_VARIANT_I_ SOL_ON + #else + #define SOL_STD_VARIANT_I_ SOL_OFF + #endif + #else + #define SOL_STD_VARIANT_I_ SOL_OFF + #endif + #else + #define SOL_STD_VARIANT_I_ SOL_DEFAULT_ON + #endif +#endif // make is_automagical on/off by default + +#if defined(SOL_NOEXCEPT_FUNCTION_TYPE) + #if (SOL_NOEXCEPT_FUNCTION_TYPE != 0) + #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_ON + #else + #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_OFF + #endif +#else + #if defined(__cpp_noexcept_function_type) + #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_ON + #elif SOL_IS_ON(SOL_COMPILER_VCXX_I_) && (defined(_MSVC_LANG) && (_MSVC_LANG < 201403L)) + // There is a bug in the VC++ compiler?? + // on /std:c++latest under x86 conditions (VS 15.5.2), + // compiler errors are tossed for noexcept markings being on function types + // that are identical in every other way to their non-noexcept marked types function types... + // VS 2019: There is absolutely a bug. + #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_OFF + #else + #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_DEFAULT_ON + #endif +#endif // noexcept is part of a function's type + +#if defined(SOL_STACK_STRING_OPTIMIZATION_SIZE) && SOL_STACK_STRING_OPTIMIZATION_SIZE > 0 + #define SOL_OPTIMIZATION_STRING_CONVERSION_STACK_SIZE_I_ SOL_STACK_STRING_OPTIMIZATION_SIZE +#else + #define SOL_OPTIMIZATION_STRING_CONVERSION_STACK_SIZE_I_ 1024 +#endif + +#if defined(SOL_ID_SIZE) && SOL_ID_SIZE > 0 + #define SOL_ID_SIZE_I_ SOL_ID_SIZE +#else + #define SOL_ID_SIZE_I_ 512 +#endif + +#if defined(LUA_IDSIZE) && LUA_IDSIZE > 0 + #define SOL_FILE_ID_SIZE_I_ LUA_IDSIZE +#elif defined(SOL_ID_SIZE) && SOL_ID_SIZE > 0 + #define SOL_FILE_ID_SIZE_I_ SOL_FILE_ID_SIZE +#else + #define SOL_FILE_ID_SIZE_I_ 2048 +#endif + +#if defined(SOL_PRINT_ERRORS) + #if (SOL_PRINT_ERRORS != 0) + #define SOL_PRINT_ERRORS_I_ SOL_ON + #else + #define SOL_PRINT_ERRORS_I_ SOL_OFF + #endif +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_PRINT_ERRORS_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_PRINT_ERRORS_I_ SOL_DEFAULT_ON + #else + #define SOL_PRINT_ERRORS_I_ SOL_OFF + #endif +#endif + +#if defined(SOL_DEFAULT_PASS_ON_ERROR) && (SOL_DEFAULT_PASS_ON_ERROR != 0) + #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_ON +#else + #if SOL_IS_ON(SOL_ALL_SAFETIES_ON_I_) + #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_ON + #elif SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_DEFAULT_ON + #else + #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_OFF + #endif +#endif + +#if defined(SOL_USING_CXX_LUA) + #if (SOL_USING_CXX_LUA != 0) + #define SOL_USE_CXX_LUA_I_ SOL_ON + #else + #define SOL_USE_CXX_LUA_I_ SOL_OFF + #endif +#elif defined(SOL_USE_CXX_LUA) + #if (SOL_USE_CXX_LUA != 0) + #define SOL_USE_CXX_LUA_I_ SOL_ON + #else + #define SOL_USE_CXX_LUA_I_ SOL_OFF + #endif +#else + #define SOL_USE_CXX_LUA_I_ SOL_OFF +#endif + +#if defined(SOL_USING_CXX_LUAJIT) + #if (SOL_USING_CXX_LUA != 0) + #define SOL_USE_CXX_LUAJIT_I_ SOL_ON + #else + #define SOL_USE_CXX_LUAJIT_I_ SOL_OFF + #endif +#elif defined(SOL_USE_CXX_LUAJIT) + #if (SOL_USE_CXX_LUA != 0) + #define SOL_USE_CXX_LUAJIT_I_ SOL_ON + #else + #define SOL_USE_CXX_LUAJIT_I_ SOL_OFF + #endif +#else + #define SOL_USE_CXX_LUAJIT_I_ SOL_OFF +#endif + +#if defined(SOL_NO_LUA_HPP) + #if (SOL_NO_LUA_HPP != 0) + #define SOL_USE_LUA_HPP_I_ SOL_OFF + #else + #define SOL_USE_LUA_HPP_I_ SOL_ON + #endif +#elif defined(SOL_USING_CXX_LUA) + #define SOL_USE_LUA_HPP_I_ SOL_OFF +#elif defined(__has_include) + #if __has_include() + #define SOL_USE_LUA_HPP_I_ SOL_ON + #else + #define SOL_USE_LUA_HPP_I_ SOL_OFF + #endif +#else + #define SOL_USE_LUA_HPP_I_ SOL_DEFAULT_ON +#endif + +#if defined(SOL_CONTAINERS_START) + #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINERS_START +#elif defined(SOL_CONTAINERS_START_INDEX) + #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINERS_START_INDEX +#elif defined(SOL_CONTAINER_START_INDEX) + #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINER_START_INDEX +#else + #define SOL_CONTAINER_START_INDEX_I_ 1 +#endif + +#if defined (SOL_NO_MEMORY_ALIGNMENT) + #if (SOL_NO_MEMORY_ALIGNMENT != 0) + #define SOL_ALIGN_MEMORY_I_ SOL_OFF + #else + #define SOL_ALIGN_MEMORY_I_ SOL_ON + #endif +#else + #define SOL_ALIGN_MEMORY_I_ SOL_DEFAULT_ON +#endif + +#if defined(SOL_USE_BOOST) + #if (SOL_USE_BOOST != 0) + #define SOL_USE_BOOST_I_ SOL_ON + #else + #define SOL_USE_BOOST_I_ SOL_OFF + #endif +#else + #define SOL_USE_BOOST_I_ SOL_OFF +#endif + +#if defined(SOL_USE_UNSAFE_BASE_LOOKUP) + #if (SOL_USE_UNSAFE_BASE_LOOKUP != 0) + #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_ON + #else + #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_OFF + #endif +#else + #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_OFF +#endif + +#if defined(SOL_INSIDE_UNREAL) + #if (SOL_INSIDE_UNREAL != 0) + #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_ON + #else + #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_OFF + #endif +#else + #if defined(UE_BUILD_DEBUG) || defined(UE_BUILD_DEVELOPMENT) || defined(UE_BUILD_TEST) || defined(UE_BUILD_SHIPPING) || defined(UE_SERVER) + #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_ON + #else + #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_DEFAULT_OFF + #endif +#endif + +#if defined(SOL_NO_COMPAT) + #if (SOL_NO_COMPAT != 0) + #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_OFF + #else + #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_ON + #endif +#else + #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_DEFAULT_ON +#endif + +#if defined(SOL_GET_FUNCTION_POINTER_UNSAFE) + #if (SOL_GET_FUNCTION_POINTER_UNSAFE != 0) + #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_ON + #else + #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_OFF + #endif +#else + #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_DEFAULT_OFF +#endif + +#if SOL_IS_ON(SOL_COMPILER_FRONTEND_MINGW_I_) && defined(__GNUC__) && (__GNUC__ < 6) + // MinGW is off its rocker in some places... + #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_ON +#else + #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_DEFAULT_OFF +#endif + +// end of sol/version.hpp + +#if SOL_IS_ON(SOL_INSIDE_UNREAL_ENGINE_I_) +#ifdef check +#pragma push_macro("check") +#undef check +#endif +#endif // Unreal Engine 4 Bullshit + +#if SOL_IS_ON(SOL_COMPILER_GCC_I_) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wconversion" +#if __GNUC__ > 6 +#pragma GCC diagnostic ignored "-Wnoexcept-type" +#endif +#elif SOL_IS_ON(SOL_COMPILER_CLANG_I_) +#elif SOL_IS_ON(SOL_COMPILER_VCXX_I_) +#pragma warning(push) +#pragma warning(disable : 4505) // unreferenced local function has been removed GEE THANKS +#endif // clang++ vs. g++ vs. VC++ + +// beginning of sol/forward.hpp + +#ifndef SOL_FORWARD_HPP +#define SOL_FORWARD_HPP + +#include +#include +#include + +#if SOL_IS_ON(SOL_USE_CXX_LUA_I_) || SOL_IS_ON(SOL_USE_CXX_LUAJIT_I_) +struct lua_State; +#else +extern "C" { +struct lua_State; +} +#endif // C++ Mangling for Lua vs. Not + +namespace sol { + + enum class type; + + class stateless_reference; + template + class basic_reference; + using reference = basic_reference; + using main_reference = basic_reference; + class stateless_stack_reference; + class stack_reference; + + template + class basic_bytecode; + + struct lua_value; + + struct proxy_base_tag; + template + struct proxy_base; + template + struct table_proxy; + + template + class basic_table_core; + template + using table_core = basic_table_core; + template + using main_table_core = basic_table_core; + template + using stack_table_core = basic_table_core; + template + using basic_table = basic_table_core; + using table = table_core; + using global_table = table_core; + using main_table = main_table_core; + using main_global_table = main_table_core; + using stack_table = stack_table_core; + using stack_global_table = stack_table_core; + + template + struct basic_lua_table; + using lua_table = basic_lua_table; + using stack_lua_table = basic_lua_table; + + template + class basic_usertype; + template + using usertype = basic_usertype; + template + using stack_usertype = basic_usertype; + + template + class basic_metatable; + using metatable = basic_metatable; + using stack_metatable = basic_metatable; + + template + struct basic_environment; + using environment = basic_environment; + using main_environment = basic_environment; + using stack_environment = basic_environment; + + template + class basic_function; + template + class basic_protected_function; + using unsafe_function = basic_function; + using safe_function = basic_protected_function; + using main_unsafe_function = basic_function; + using main_safe_function = basic_protected_function; + using stack_unsafe_function = basic_function; + using stack_safe_function = basic_protected_function; + using stack_aligned_unsafe_function = basic_function; + using stack_aligned_safe_function = basic_protected_function; + using protected_function = safe_function; + using main_protected_function = main_safe_function; + using stack_protected_function = stack_safe_function; + using stack_aligned_protected_function = stack_aligned_safe_function; +#if SOL_IS_ON(SOL_SAFE_FUNCTION_OBJECTS_I_) + using function = protected_function; + using main_function = main_protected_function; + using stack_function = stack_protected_function; + using stack_aligned_function = stack_aligned_safe_function; +#else + using function = unsafe_function; + using main_function = main_unsafe_function; + using stack_function = stack_unsafe_function; + using stack_aligned_function = stack_aligned_unsafe_function; +#endif + using stack_aligned_stack_handler_function = basic_protected_function; + + struct unsafe_function_result; + struct protected_function_result; + using safe_function_result = protected_function_result; +#if SOL_IS_ON(SOL_SAFE_FUNCTION_OBJECTS_I_) + using function_result = safe_function_result; +#else + using function_result = unsafe_function_result; +#endif + + template + class basic_object_base; + template + class basic_object; + template + class basic_userdata; + template + class basic_lightuserdata; + template + class basic_coroutine; + template + class basic_thread; + + using object = basic_object; + using userdata = basic_userdata; + using lightuserdata = basic_lightuserdata; + using thread = basic_thread; + using coroutine = basic_coroutine; + using main_object = basic_object; + using main_userdata = basic_userdata; + using main_lightuserdata = basic_lightuserdata; + using main_coroutine = basic_coroutine; + using stack_object = basic_object; + using stack_userdata = basic_userdata; + using stack_lightuserdata = basic_lightuserdata; + using stack_thread = basic_thread; + using stack_coroutine = basic_coroutine; + + struct stack_proxy_base; + struct stack_proxy; + struct variadic_args; + struct variadic_results; + struct stack_count; + struct this_state; + struct this_main_state; + struct this_environment; + + class state_view; + class state; + + template + struct as_table_t; + template + struct as_container_t; + template + struct nested; + template + struct light; + template + struct user; + template + struct as_args_t; + template + struct protect_t; + template + struct policy_wrapper; + + template + struct usertype_traits; + template + struct unique_usertype_traits; + + template + struct types { + typedef std::make_index_sequence indices; + static constexpr std::size_t size() { + return sizeof...(Args); + } + }; + + template + struct derive : std::false_type { + typedef types<> type; + }; + + template + struct base : std::false_type { + typedef types<> type; + }; + + template + struct weak_derive { + static bool value; + }; + + template + bool weak_derive::value = false; + + namespace stack { + struct record; + } + +#if SOL_IS_OFF(SOL_USE_BOOST_I_) + template + class optional; + + template + class optional; +#endif + + using check_handler_type = int(lua_State*, int, type, type, const char*); + +} // namespace sol + +#define SOL_BASE_CLASSES(T, ...) \ + namespace sol { \ + template <> \ + struct base : std::true_type { \ + typedef ::sol::types<__VA_ARGS__> type; \ + }; \ + } \ + void a_sol3_detail_function_decl_please_no_collide() +#define SOL_DERIVED_CLASSES(T, ...) \ + namespace sol { \ + template <> \ + struct derive : std::true_type { \ + typedef ::sol::types<__VA_ARGS__> type; \ + }; \ + } \ + void a_sol3_detail_function_decl_please_no_collide() + +#endif // SOL_FORWARD_HPP +// end of sol/forward.hpp + +// beginning of sol/forward_detail.hpp + +#ifndef SOL_FORWARD_DETAIL_HPP +#define SOL_FORWARD_DETAIL_HPP + +// beginning of sol/traits.hpp + +// beginning of sol/tuple.hpp + +// beginning of sol/base_traits.hpp + +#include + +namespace sol { + namespace detail { + struct unchecked_t {}; + const unchecked_t unchecked = unchecked_t{}; + } // namespace detail + + namespace meta { + using sfinae_yes_t = std::true_type; + using sfinae_no_t = std::false_type; + + template + using void_t = void; + + template + using unqualified = std::remove_cv>; + + template + using unqualified_t = typename unqualified::type; + + namespace meta_detail { + template + struct unqualified_non_alias : unqualified {}; + + template