#include "editor/editor.h"
#include "editor/window/editor_main_window.h"
#include "ui/ui_render_device.h"
#include "event/event_system.h"
#include "os/file_manager.h"
#include <NoesisPCH.h>
namespace api {
	using namespace Noesis;
	Ptr<IView> mView;
	void EditorModule::OnLoad(int argc, char** argv)
	{
		PackagePath editor_noesis{"/engine/assets/noesis"};
		FileManager::Ptr()->Mount("editor_noesis", editor_noesis.RealPath().c_str());
	}

	void EditorModule::OnUnload()
	{
	}
	void EditorModule::Initialize(void)
	{
		Ptr<FrameworkElement> xaml = GUI::LoadXaml<FrameworkElement>("/editor_noesis/Menu.xaml");
		mView = GUI::CreateView(xaml);
		mView->SetFlags(RenderFlags_PPAA | RenderFlags_LCD);
		mView->SetSize(1024, 768);
		//mView->GetRenderer()->Init(UIRenderDevice::Ptr());
		EventSystem::Ptr()->BeginRenderFrame.Subscribe(mInfo.name, [](FrameGraph& graph, int32_t frame) {
			//mView->Update(0.033);
			//IRenderer* renderer = mView->GetRenderer();
			//renderer->UpdateRenderTree();
			//renderer->RenderOffscreen();
			//renderer->Render();
		});
	}
}