2024-10-30 01:53:17 +00:00
|
|
|
#include "cli.h"
|
2024-10-23 23:01:54 +00:00
|
|
|
#include <SDL2/SDL.h>
|
2024-10-15 04:24:13 +00:00
|
|
|
#include <stdio.h>
|
2024-10-30 01:53:17 +00:00
|
|
|
#include "ui.h"
|
2024-10-15 04:24:13 +00:00
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
CLIArgs args;
|
2024-10-30 01:53:17 +00:00
|
|
|
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");
|
2024-10-23 23:01:54 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2024-10-30 01:53:17 +00:00
|
|
|
ui = uiInit();
|
|
|
|
if (!ui) {
|
2024-10-16 04:25:31 +00:00
|
|
|
SDL_Quit();
|
2024-10-15 04:24:13 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2024-10-30 01:53:17 +00:00
|
|
|
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
|
|
|
}
|