57 lines
1007 B
C
57 lines
1007 B
C
#include "app.h"
|
|
#include "window.h"
|
|
#include "render.h"
|
|
#include "input.h"
|
|
|
|
void App_Init(App_t *app) {
|
|
app->isRunning = false;
|
|
|
|
if (!Window_Init_SDL()) {
|
|
return;
|
|
}
|
|
|
|
System_QueryMetrics(&app->metrics);
|
|
|
|
// TODO: start this window maximized
|
|
if (!Window_Init(800, 600)) {
|
|
return;
|
|
}
|
|
|
|
Gui_Init(&app->gui);
|
|
|
|
Config_Load_Settings(&app->configParams);
|
|
if (!Map_Init(&app->map)) {
|
|
return;
|
|
}
|
|
|
|
if (!Bitmap_Init(&app->bitmap)) {
|
|
return;
|
|
}
|
|
|
|
if (!Objects_Init(&app->graphics)) {
|
|
return;
|
|
}
|
|
|
|
if (!Network_Init(&app->network)) {
|
|
return;
|
|
}
|
|
|
|
app->isRunning = true;
|
|
}
|
|
|
|
void App_Run(App_t *app) {
|
|
while (app->isRunning) {
|
|
Input_Poll(app);
|
|
Render_Frame(app);
|
|
}
|
|
}
|
|
|
|
void App_Shutdown(const App_t* app) {
|
|
Network_Shutdown(&app->network);
|
|
Objects_Destroy(&app->graphics);
|
|
Map_Destroy(&app->map);
|
|
Bitmap_Destroy(&app->bitmap);
|
|
Gui_Shutdown();
|
|
Window_Shutdown();
|
|
}
|