lemur/main.c

36 lines
655 B
C
Raw Normal View History

#include "cli.h"
#include <SDL2/SDL.h>
2024-10-15 04:24:13 +00:00
#include <stdio.h>
#include "ui.h"
2024-10-15 04:24:13 +00:00
int main(int argc, char **argv) {
CLIArgs args;
UIContext *ui;
2024-10-15 04:24:13 +00:00
int status;
if (parseCLIArgs(argc, argv, &args)) {
return 1;
}
2024-10-26 05:20:25 +00:00
SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "0");
if (SDL_Init(SDL_INIT_EVERYTHING)) {
2024-10-15 04:24:13 +00:00
fprintf(stderr, "Error initializing SDL: %s\n", SDL_GetError());
return 1;
}
ui = uiInit();
if (!ui) {
SDL_Quit();
2024-10-15 04:24:13 +00:00
return 1;
}
if (args.filename) {
uiLoadGame(ui, args.filename);
}
status = uiRun(ui);
uiDestroy(ui);
2024-10-15 04:24:13 +00:00
SDL_Quit();
return status;
2024-10-15 05:06:52 +00:00
}