2022-06-04 16:26:58 +00:00
|
|
|
#include "BarinkEngine.h"
|
|
|
|
|
|
|
|
EngineStatistics* ES;
|
2022-06-10 20:44:40 +00:00
|
|
|
BarinkEngine::InputManager InputSystem;
|
2022-06-04 16:26:58 +00:00
|
|
|
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
// Setup performance sampler
|
|
|
|
PerfomanceSamplerInit();
|
|
|
|
|
|
|
|
|
2022-06-19 18:01:31 +00:00
|
|
|
// Create the window
|
|
|
|
BarinkWindow MainWindow = BarinkWindow(800, 600);
|
|
|
|
|
|
|
|
// =================================================
|
2022-06-04 16:26:58 +00:00
|
|
|
// Startup services
|
2022-06-19 18:01:31 +00:00
|
|
|
// =================================================
|
2022-06-04 16:26:58 +00:00
|
|
|
|
2022-06-19 18:01:31 +00:00
|
|
|
// Startup Renderer
|
2022-06-04 16:26:58 +00:00
|
|
|
BarinkEngine::Renderer renderer = BarinkEngine::Renderer();
|
2022-06-19 18:01:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Startup InputManager
|
2022-06-10 20:44:40 +00:00
|
|
|
InputSystem = BarinkEngine::InputManager();
|
2022-06-04 16:26:58 +00:00
|
|
|
|
|
|
|
InputSystem.attach(&MainWindow);
|
2022-06-19 18:01:31 +00:00
|
|
|
InputSystem.setupGLFWInput(MainWindow.windowptr());
|
|
|
|
|
|
|
|
|
2022-06-04 16:26:58 +00:00
|
|
|
|
2022-06-19 18:01:31 +00:00
|
|
|
// Startup GUI System
|
2022-06-04 16:26:58 +00:00
|
|
|
GUIManager GUISystem = GUIManager(&MainWindow);
|
|
|
|
|
|
|
|
|
2022-06-19 18:01:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Enable depth testing
|
|
|
|
// NOTE: TODO Move this into the renderer
|
2022-06-10 19:06:20 +00:00
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
|
|
|
|
|
2022-06-04 16:26:58 +00:00
|
|
|
|
|
|
|
// First call to setup game
|
|
|
|
Start();
|
|
|
|
|
2022-06-10 19:06:20 +00:00
|
|
|
|
2022-06-04 16:26:58 +00:00
|
|
|
|
|
|
|
// Runtime loop
|
|
|
|
while (!MainWindow.WindowShouldClose()) {
|
|
|
|
|
|
|
|
SamplePerformance();
|
|
|
|
|
|
|
|
|
|
|
|
// Execute main logic
|
|
|
|
InputSystem.PollEvents();
|
|
|
|
|
|
|
|
Update();
|
|
|
|
|
|
|
|
renderer.Render();
|
|
|
|
|
|
|
|
ImmediateGraphicsDraw();
|
|
|
|
|
|
|
|
GUISystem.Render();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MainWindow.SwapBuffers();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Shutdown game
|
|
|
|
Stop();
|
|
|
|
|
|
|
|
|
|
|
|
// Shutdown Services
|
|
|
|
delete ES;
|
2022-06-19 18:01:31 +00:00
|
|
|
InputSystem.detach(&MainWindow);
|
|
|
|
|
|
|
|
|
2022-06-04 16:26:58 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|