2022-05-28 11:32:17 +00:00
|
|
|
#include "BarinkEngine.h"
|
2022-05-29 13:23:08 +00:00
|
|
|
|
|
|
|
EngineStatistics* ES;
|
|
|
|
|
|
|
|
|
2022-05-27 20:47:36 +00:00
|
|
|
int main(int argc, char* argv[]) {
|
2022-05-29 19:31:21 +00:00
|
|
|
// Setup performance sampler
|
|
|
|
PerfomanceSamplerInit();
|
|
|
|
|
2022-05-27 20:47:36 +00:00
|
|
|
|
2022-05-28 16:49:08 +00:00
|
|
|
// Startup services
|
2022-05-28 19:19:16 +00:00
|
|
|
BarinkWindow MainWindow = BarinkWindow(800, 600);
|
2022-05-27 20:47:36 +00:00
|
|
|
|
2022-05-29 19:31:21 +00:00
|
|
|
BarinkEngine::Renderer renderer = BarinkEngine::Renderer();
|
|
|
|
BarinkEngine::InputManager InputSystem = BarinkEngine::InputManager();
|
2022-05-28 16:49:08 +00:00
|
|
|
|
2022-05-28 19:19:16 +00:00
|
|
|
InputSystem.attach(&MainWindow);
|
2022-05-28 16:49:08 +00:00
|
|
|
|
2022-05-28 19:19:16 +00:00
|
|
|
GUIManager GUISystem = GUIManager(&MainWindow);
|
2022-05-28 16:49:08 +00:00
|
|
|
|
|
|
|
// First call to setup game
|
2022-05-28 19:19:16 +00:00
|
|
|
Start();
|
2022-05-27 20:47:36 +00:00
|
|
|
|
2022-05-29 13:23:08 +00:00
|
|
|
|
2022-05-28 16:49:08 +00:00
|
|
|
// Runtime loop
|
2022-05-28 19:19:16 +00:00
|
|
|
while (!MainWindow.WindowShouldClose()) {
|
2022-05-29 13:23:08 +00:00
|
|
|
|
2022-05-29 19:31:21 +00:00
|
|
|
SamplePerformance();
|
2022-05-29 13:23:08 +00:00
|
|
|
|
|
|
|
|
2022-05-29 19:31:21 +00:00
|
|
|
// Execute main logic
|
2022-05-28 16:49:08 +00:00
|
|
|
InputSystem.PollEvents();
|
|
|
|
|
|
|
|
Update();
|
|
|
|
|
|
|
|
renderer.Render();
|
2022-05-27 20:47:36 +00:00
|
|
|
|
2022-05-28 19:19:16 +00:00
|
|
|
ImmediateGraphicsDraw();
|
2022-05-28 16:49:08 +00:00
|
|
|
|
|
|
|
GUISystem.Render();
|
2022-05-29 13:23:08 +00:00
|
|
|
|
|
|
|
|
2022-05-28 16:49:08 +00:00
|
|
|
|
2022-05-28 19:19:16 +00:00
|
|
|
MainWindow.SwapBuffers();
|
2022-05-27 20:47:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-05-28 16:49:08 +00:00
|
|
|
// Shutdown game
|
|
|
|
Stop();
|
2022-05-27 20:47:36 +00:00
|
|
|
|
2022-05-28 16:49:08 +00:00
|
|
|
|
|
|
|
// Shutdown Services
|
2022-05-29 13:23:08 +00:00
|
|
|
delete ES;
|
2022-05-27 20:47:36 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|