Serialization work

This commit is contained in:
Antoine Pilote
2021-05-15 23:57:26 -04:00
parent b53d2e729e
commit 5f364dabb2
27 changed files with 368 additions and 305 deletions

View File

@@ -7,20 +7,24 @@ float Engine::m_LastFrameTime = 0.0f;
Ref<Window> Engine::CurrentWindow;
bool Engine::IsPlayMode = false;
Ref<Project> Engine::CurrentProject;
#include "../Rendering/Renderer.h"
#include <imgui/imgui_impl_glfw.h>
#include <imgui/imgui_impl_opengl3.h>
void Engine::Init()
{
PhysicsManager::Get()->Init();
FileSystem::Scan();
CurrentWindow = std::make_shared<Window>();
}
void Engine::Tick()
{
if (!CurrentWindow->GetScene())
return;
float time = (float)glfwGetTime();
Timestep timestep = time - m_LastFrameTime;
m_LastFrameTime = time;
@@ -49,6 +53,11 @@ void Engine::ExitPlayMode()
void Engine::Draw()
{
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
Window::Get()->Draw();
}
@@ -72,6 +81,27 @@ Ref<Scene> Engine::GetCurrentScene()
return CurrentWindow->GetScene();
}
bool Engine::LoadScene(Ref<Scene> scene)
{
CurrentWindow->SetScene(scene);
return true;
}
Ref<Project> Engine::GetProject()
{
return CurrentProject;
}
bool Engine::LoadProject(Ref<Project> project)
{
CurrentProject = project;
Ref<Scene> newScene = CreateRef<Scene>();
Engine::LoadScene(newScene);
return true;
}
int Engine::HelloWorld()
{
return 1;