add command line option for selecting initial gamestate

This commit is contained in:
Sebastian Krzyszkowiak 2012-07-08 23:08:23 +02:00
parent 85056130ac
commit 471f33b720
2 changed files with 13 additions and 1 deletions

View file

@ -20,6 +20,7 @@
*/
#include <stdio.h>
#include "intro.h"
#include "menu.h"
#include "about.h"
void Disclaimer_Draw(struct Game *game) {
@ -52,6 +53,10 @@ int Disclaimer_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
}
void Disclaimer_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
if (!game->menu.loaded) {
game->menu.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.05,0 );
game->menu.font_selected = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.065,0 );
}
PrintConsole(game, "Preloading GAMESTATE_INTRO...");
Intro_Preload(game, progress);
}
@ -66,5 +71,9 @@ void Disclaimer_Unload(struct Game *game) {
DrawConsole(game);
al_flip_display();
}
if (!game->menu.loaded) {
al_destroy_font(game->menu.font);
al_destroy_font(game->menu.font_selected);
}
al_clear_to_color(al_map_rgb(0,0,0));
}

View file

@ -435,12 +435,15 @@ int main(int argc, char **argv){
game.loadstate = GAMESTATE_MENU;
int c;
while ((c = getopt (argc, argv, "l:")) != -1)
while ((c = getopt (argc, argv, "l:s:")) != -1)
switch (c) {
case 'l':
game.level.current_level = optarg[0]-'0';
game.loadstate = GAMESTATE_LEVEL;
break;
case 's':
game.loadstate = optarg[0]-'0';
break;
}
while(1) {