41 lines
773 B
C
41 lines
773 B
C
#include "cli.h"
|
|
#include <SDL2/SDL.h>
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include "ui.h"
|
|
|
|
int main(int argc, char **argv) {
|
|
CLIArgs args;
|
|
UIContext *ui;
|
|
int status;
|
|
bool running = false;
|
|
|
|
if (parseCLIArgs(argc, argv, &args)) {
|
|
return 1;
|
|
}
|
|
|
|
SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "0");
|
|
if (SDL_Init(SDL_INIT_EVERYTHING)) {
|
|
fprintf(stderr, "Error initializing SDL: %s\n", SDL_GetError());
|
|
return 1;
|
|
}
|
|
|
|
ui = uiInit();
|
|
if (!ui) {
|
|
SDL_Quit();
|
|
return 1;
|
|
}
|
|
|
|
if (args.filename) {
|
|
if (uiLoadGame(ui, args.filename)) {
|
|
return 1;
|
|
}
|
|
running = true;
|
|
}
|
|
|
|
status = uiRun(ui, running);
|
|
uiDestroy(ui);
|
|
SDL_Quit();
|
|
return status;
|
|
}
|