Runtime progress

This commit is contained in:
Antoine Pilote
2023-07-22 13:08:04 -04:00
parent 0d32d28b82
commit aed3bb688a
4 changed files with 68 additions and 70 deletions

View File

@@ -1,75 +1,73 @@
#include <dependencies/GLEW/include/GL/glew.h>
#include <dependencies/glfw/include/GLFW/glfw3.h>
#include <string>
#include <Engine.h>
#include <dependencies/GLEW/include/GL/glew.h>
#include <src/Core/Logger.h>
#include <src/Rendering/SceneRenderer.h>
#include "src/Rendering/Shaders/ShaderManager.h"
#include "src/Rendering/Renderer.h"
#include <dependencies/glfw/include/GLFW/glfw3.h>
#include <iostream>
#include <src/Vendors/imgui/imgui.h>
#include <src/Vendors/imgui/imgui_impl_opengl3.h>
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<Nuake::Window> 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<Nuake::Window> 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();
}
}