diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index c0e165f4..fd4e16f2 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -33,7 +33,6 @@ #include - const std::string WindowTitle = "Nuake Editor"; int main(int argc, char* argv[]) diff --git a/Editor/Runtime.cpp b/Editor/Runtime.cpp index 1c9c408e..ce641fdc 100644 --- a/Editor/Runtime.cpp +++ b/Editor/Runtime.cpp @@ -1,75 +1,73 @@ +#include +#include + + #include #include -#include +#include +#include -#include "src/Rendering/Shaders/ShaderManager.h" -#include "src/Rendering/Renderer.h" -#include +#include #include -#include + +void CheckError() +{ + GLenum err; + while ((err = glGetError()) != GL_NO_ERROR) + { + // Process/log the error. + std::cout << "OPENGL ERROR: " << err << std::endl; + } +} void main(int argc, char* argv[]) { - for (uint32_t i = 0; i < argc; i++) + std::string projectPath; + if (argc == 1) { - char* arg = argv[i]; - std::string projectPath; - if (argc == 1) - { - return; - } - - projectPath = std::string(argv[1]); - - using namespace Nuake; - - Nuake::Engine::Init(); - Engine::GetCurrentWindow()->SetSize({ 1920, 1080 }); - - Ref window = Nuake::Engine::GetCurrentWindow(); - window->SetTitle("Nuake Runtime"); - - FileSystem::SetRootDirectory(FileSystem::GetParentPath(projectPath)); - - auto project = Project::New(); - auto projectFileData = FileSystem::ReadFile(projectPath, true); - try - { - project->Deserialize(projectFileData); - project->FullPath = projectPath; - - Engine::LoadProject(project); - } - catch (std::exception exception) - { - Logger::Log("Error loading project: " + projectPath, "editor", CRITICAL); - Logger::Log(exception.what()); - } - - glClearColor(0.2f, 0.3f, 0.3f, 1.0f); - Engine::EnterPlayMode(); - glViewport(0, 0, 100, 100); - while (!window->ShouldClose()) - { - Nuake::Engine::Tick(); - Nuake::Engine::Draw(); - - Timestep ts = Nuake::Engine::GetTimestep(); - - //ImGui::Render(); - //ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); - - Nuake::Vector2 WindowSize = window->GetSize(); - glViewport(0, 0, WindowSize.x, WindowSize.y); - glClear(GL_COLOR_BUFFER_BIT); - auto shader = ShaderManager::GetShader("resources/Shaders/copy.shader"); - shader->SetUniformTex("u_Source", Engine::GetCurrentScene()->mSceneRenderer->GetTexture().get()); - Renderer::DrawQuad(Matrix4()); - - glfwSwapBuffers(window->GetHandle()); - glfwPollEvents(); - } + return; } - Nuake::Engine::Close(); + projectPath = std::string(argv[1]); + + using namespace Nuake; + Nuake::Engine::Init(); + + Ref window = Nuake::Engine::GetCurrentWindow(); + window->SetTitle("asdasd"); + + FileSystem::SetRootDirectory(FileSystem::GetParentPath(projectPath)); + auto project = Project::New(); + auto scene = Scene::New(); + auto projectFileData = FileSystem::ReadFile(projectPath, true); + try + { + project->Deserialize(projectFileData); + project->FullPath = projectPath; + Engine::LoadProject(project); + } + catch (std::exception exception) + { + Logger::Log("Error loading project: " + projectPath, "editor", CRITICAL); + Logger::Log(exception.what()); + } + + //Engine::EnterPlayMode(); + + while (!window->ShouldClose()) + { + Nuake::Engine::Tick(); + Nuake::Engine::Draw(); + + ImGui::Begin("test"); + + ImGui::End(); + const auto& WindowSize = window->GetSize(); + glViewport(0, 0, WindowSize.x, WindowSize.y); + + RenderCommand::SetClearColor({ 0.1, 0.1 ,0.1, 1.0 }); + RenderCommand::Clear(); + + Nuake::Engine::EndDraw(); + } } \ No newline at end of file diff --git a/Nuake/Engine.cpp b/Nuake/Engine.cpp index cc2b288e..cea54337 100644 --- a/Nuake/Engine.cpp +++ b/Nuake/Engine.cpp @@ -112,9 +112,9 @@ namespace Nuake Nuake::RenderCommand::Clear(); // Start imgui frame - //ImGui_ImplOpenGL3_NewFrame(); - //ImGui_ImplGlfw_NewFrame(); - //ImGui::NewFrame(); + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplGlfw_NewFrame(); + ImGui::NewFrame(); // Draw scene Window::Get()->Draw(); diff --git a/premake5.lua b/premake5.lua index 9d9d752e..50dc6cb9 100644 --- a/premake5.lua +++ b/premake5.lua @@ -163,8 +163,9 @@ project "Editor" files { - "%{prj.name}/**.h", - "%{prj.name}/**.cpp", + "%{prj.name}/Editor.cpp", + "%{prj.name}/src/**.cpp", + "%{prj.name}/src/**.h", "%{prj.name}/resources/*.rc", "%{prj.name}/resources/**.ico" }