diff --git a/src/core/types/all.h b/src/core/types/all.h index da0c9b9..b5d7e7d 100644 --- a/src/core/types/all.h +++ b/src/core/types/all.h @@ -8,4 +8,4 @@ static constexpr float PI = 3.14159265358979323846f; #include "vec2.h" #include "vec3.h" #include "vec4.h" -#include "mat4.h" +#include "mat4.h" \ No newline at end of file diff --git a/src/editor/Editor.cpp b/src/editor/Editor.cpp index 1717374..eefabca 100644 --- a/src/editor/Editor.cpp +++ b/src/editor/Editor.cpp @@ -11,6 +11,8 @@ #include "Windows/LoggerWindow.h" #include "Windows/Viewport.h" #include "Windows/FileBrowser.h" +#include "types/all.h" + namespace OX { @@ -40,8 +42,9 @@ namespace OX ImGui_ImplGlfw_InitForOpenGL(core.GetWindow().GetHandle(), true); ImGui_ImplOpenGL3_Init("#version 330 core"); - primaryViewport = new Viewport(); // The first time ive ever use the new keyword... - fileBrowser = new FileBrowser(); + fileBrowser = std::make_shared(); + primaryViewport = std::make_shared(); + } void Editor::Update(Core &core) @@ -161,11 +164,7 @@ namespace OX void Editor::Shutdown(Core &core) { - delete primaryViewport; - primaryViewport = nullptr; - delete fileBrowser; - fileBrowser = nullptr; ImGui_ImplOpenGL3_Shutdown(); ImGui_ImplGlfw_Shutdown(); diff --git a/src/editor/Editor.h b/src/editor/Editor.h index df0f233..ffaebfc 100644 --- a/src/editor/Editor.h +++ b/src/editor/Editor.h @@ -7,6 +7,7 @@ #define OX_EDITOR_VERSION "Obsidian Editor (0.2.6)" #include "Layer.h" #include "Core.h" +#include "types/all.h" namespace OX @@ -28,8 +29,8 @@ namespace OX void Shutdown(Core &core) override; private: - Viewport* primaryViewport; - FileBrowser* fileBrowser; + std::shared_ptr primaryViewport; + std::shared_ptr fileBrowser; }; } // OX