Show a dialogue on panics

This commit is contained in:
simon.kagstrom 2009-05-21 08:47:27 +00:00
parent 3a8daf91cd
commit 938bd5f58b
3 changed files with 19 additions and 1 deletions

View File

@ -491,7 +491,16 @@ void gui_message (const char *format,...)
va_start (parms,format);
vsprintf ( msg, format, parms);
va_end (parms);
// msgYesNo(msg, 0, 24, 24);
if (!menu_is_inited())
{
/* Some error message at startup - just quit */
SDL_Surface *screen = SDL_SetVideoMode(640, 480, 16, 0);
if (!screen)
return; /* Deep trouble! */
menu_init(screen);
}
msgYesNo(msg, 0, 24, 24);
write_log (msg);
}

View File

@ -53,6 +53,7 @@ static SDL_Surface *real_screen;
#define IS_TEXT(p_msg) ( (p_msg)[0] == '#' || (p_msg)[0] == ' ' )
#define IS_MARKER(p_msg) ( (p_msg)[0] == '@' )
static int is_inited = 0;
static TTF_Font *menu_font;
static TTF_Font *menu_font64;
#if defined(GEKKO)
@ -992,4 +993,10 @@ void menu_init(SDL_Surface *screen)
menu_font64 = read_font(FONT_ALT_PATH);
real_screen = screen;
is_inited = 1;
}
int menu_is_inited(void)
{
return is_inited;
}

View File

@ -44,4 +44,6 @@ extern int msgYesNo(char *text, int def,int x, int y);
void menu_init(SDL_Surface *screen);
int menu_is_inited(void);
#endif /* !__MENU_H__ */