YoggieEngine/BarinkEngine/BarinkEngine.cpp

83 lines
1.3 KiB
C++

#include "BarinkEngine.h"
EngineStatistics* ES;
BarinkEngine::InputManager InputSystem;
int main(int argc, char* argv[]) {
// Setup performance sampler
PerfomanceSamplerInit();
// Create the window
BarinkWindow MainWindow = BarinkWindow(800, 600);
// =================================================
// Startup services
// =================================================
// Startup Renderer
BarinkEngine::Renderer renderer = BarinkEngine::Renderer();
// Startup InputManager
InputSystem = BarinkEngine::InputManager();
InputSystem.attach(&MainWindow);
InputSystem.setupGLFWInput(MainWindow.windowptr());
// Startup GUI System
GUIManager GUISystem = GUIManager(&MainWindow);
// Enable depth testing
// NOTE: TODO Move this into the renderer
glEnable(GL_DEPTH_TEST);
// First call to setup game
Start();
// 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;
InputSystem.detach(&MainWindow);
return 0;
}