2022-11-12 15:57:34 +00:00
|
|
|
#include "../../YoggieEngine/src/EntryPoint.h"
|
2023-05-08 20:07:29 +00:00
|
|
|
#include <stack>
|
|
|
|
#include "EditorLayer.h"
|
|
|
|
|
2022-11-05 18:14:23 +00:00
|
|
|
|
2023-01-14 16:27:37 +00:00
|
|
|
using namespace YoggieEngine;
|
2022-11-05 18:14:23 +00:00
|
|
|
|
2023-01-14 16:27:37 +00:00
|
|
|
class Editor : public Application {
|
|
|
|
public:
|
2023-01-14 21:11:09 +00:00
|
|
|
Editor() : Application("Editor"){}
|
2022-11-05 18:14:23 +00:00
|
|
|
|
2023-01-14 16:27:37 +00:00
|
|
|
void Run() override
|
|
|
|
{
|
2023-05-06 19:06:49 +00:00
|
|
|
|
2022-11-05 18:14:23 +00:00
|
|
|
|
2023-05-08 20:07:29 +00:00
|
|
|
// Create EditorLayer
|
|
|
|
EditorLayer* firstLayer = new EditorLayer();
|
|
|
|
|
|
|
|
firstLayer->OnStartup();
|
2023-05-06 19:06:49 +00:00
|
|
|
|
2023-01-14 21:11:09 +00:00
|
|
|
|
2023-01-14 16:27:37 +00:00
|
|
|
double previous = glfwGetTime();
|
|
|
|
double lag = 0.0;
|
2023-05-08 20:07:29 +00:00
|
|
|
while (!appWindow->WindowShouldClose()) {
|
2023-01-14 16:27:37 +00:00
|
|
|
PollEvents();
|
|
|
|
double now = glfwGetTime();
|
2023-05-08 20:07:29 +00:00
|
|
|
double elapsed = now - previous;
|
2023-01-14 16:27:37 +00:00
|
|
|
previous = now;
|
|
|
|
lag += elapsed;
|
|
|
|
GuiBegin();
|
2023-05-08 20:07:29 +00:00
|
|
|
firstLayer->OnUpdate();
|
|
|
|
firstLayer->OnUI();
|
2023-01-14 16:27:37 +00:00
|
|
|
GuiEnd();
|
2022-12-24 01:10:29 +00:00
|
|
|
|
2023-05-08 20:07:29 +00:00
|
|
|
SwapBuffers();
|
2023-01-14 20:44:48 +00:00
|
|
|
}
|
2022-11-05 18:14:23 +00:00
|
|
|
|
2023-05-08 20:07:29 +00:00
|
|
|
firstLayer->OnDestroy();
|
|
|
|
|
2022-11-05 18:14:23 +00:00
|
|
|
|
2023-01-14 16:27:37 +00:00
|
|
|
}
|
2022-12-24 01:10:29 +00:00
|
|
|
|
2023-05-03 14:40:43 +00:00
|
|
|
|
|
|
|
|
2023-05-08 20:07:29 +00:00
|
|
|
private:
|
2023-05-03 14:40:43 +00:00
|
|
|
|
|
|
|
|
2023-05-08 20:07:29 +00:00
|
|
|
std::vector<Layer*> layers = std::vector<Layer*>();
|
|
|
|
|
2023-05-03 14:40:43 +00:00
|
|
|
|
2022-11-05 18:14:23 +00:00
|
|
|
};
|
|
|
|
|
2022-11-12 15:57:34 +00:00
|
|
|
YoggieEngine::Application* CreateApplication() {
|
|
|
|
|
|
|
|
return new Editor();
|
2022-11-05 18:14:23 +00:00
|
|
|
|
|
|
|
}
|
2023-05-03 14:40:43 +00:00
|
|
|
|
|
|
|
|