#include "app.h"
#include "render/renderapi.h"
#include "render/window.h"
#include "object/mesh/actor.h"
#include "data/property/actor_property.h"
#include "asset/asset_manager.h"
#include "object/scene/scene_manager.h"
namespace engineapi {
	App::App(const string& path)
	{
		const char* name = "zengine";
		new AssetManager();
		_RenderAPI = RenderAPI::MakeInstance();
		_Window = Window::MakeInstance(3, 640, 720, name);
		_RenderAPI->OnInit();
		auto scene_manager = new SceneManager();
		scene_manager->LoadScene(path);
	}
	App::~App()
	{
		delete _Window;
		delete _RenderAPI;
	}
	void App::Launch()
	{
		while (true) {
			Update();
			Render();
		}
	}
	void App::Update()
	{
		SceneManager::GetSingletonPtr()->Update();
	}
	void App::Render()
	{
		RenderAPI::GetSingletonPtr()->BeginFrame();

		SceneManager::GetSingletonPtr()->Render();

		RenderAPI::GetSingletonPtr()->EndFrame();
	}
}
