steed/src/sdl-instead/main.c

66 lines
1.1 KiB
C
Raw Normal View History

2009-08-26 08:25:53 +03:00
#include <unistd.h>
2009-02-21 12:52:44 +02:00
#include <stdlib.h>
#include "graphics.h"
#include "game.h"
#include <stdio.h>
#include <sys/fcntl.h>
2009-08-26 08:25:53 +03:00
#include <string.h>
extern int debug_init(void);
extern void debug_done(void);
int debug_sw = 0;
2009-02-21 12:52:44 +02:00
int main(int argc, char **argv)
{
2009-08-26 08:25:53 +03:00
int i;
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i],"-alsa"))
alsa_sw = 1;
else if (!strcmp(argv[i], "-nosound"))
nosound_sw = 1;
else if (!strcmp(argv[i], "-fullscreen"))
fullscreen_sw = 1;
else if (!strcmp(argv[i], "-window"))
window_sw = 1;
else if (!strcmp(argv[i], "-debug"))
debug_sw = 1;
}
if (debug_sw) {
debug_init();
}
if (window_sw)
opt_fs = 0;
if (fullscreen_sw)
opt_fs = 1;
if (games_lookup(GAMES_PATH)) {
2009-02-21 12:52:44 +02:00
fprintf(stderr, "No games found.\n");
}
2009-08-26 08:25:53 +03:00
themes_lookup(THEMES_PATH);
themes_lookup(game_local_themes_path());
games_lookup(game_local_games_path());
cfg_load();
if (opt_theme)
game_theme_select(opt_theme);
if (!curtheme)
game_theme_select(DEFAULT_THEME);
2009-02-21 12:52:44 +02:00
2009-08-26 08:25:53 +03:00
if (game_init(opt_game)) {
game_error(opt_game);
2009-02-21 12:52:44 +02:00
}
game_loop();
2009-08-26 08:25:53 +03:00
cfg_save();
2009-02-21 12:52:44 +02:00
game_done();
2009-08-26 08:25:53 +03:00
if (debug_sw)
debug_done();
2009-02-21 12:52:44 +02:00
return 0;
}
2009-08-26 08:25:53 +03:00