more clever video init

This commit is contained in:
p.kosyh@gmail.com 2011-03-06 17:26:26 +00:00
parent 159a604a1a
commit edbd256250
3 changed files with 16 additions and 17 deletions

View file

@ -740,21 +740,13 @@ int game_init(const char *name)
if (name)
game_err_msg(NULL);
#ifndef ANDROID
if (gfx_video_init() || input_init())
return -1;
#endif
snd_init(opt_hz);
game_change_vol(0, opt_vol);
if (game_select(name))
return -1;
if (gfx_set_mode(game_theme.w, game_theme.h, opt_fs)) {
opt_mode[0] = opt_mode[1] = -1; opt_fs = 0; /* safe options */
return -1;
}
if (game_theme_optimize())
return -1;
@ -846,9 +838,9 @@ void game_done(int err)
input_clear();
snd_done();
instead_done();
#ifndef ANDROID
gfx_video_done();
#endif
//#ifndef ANDROID
// gfx_video_done();
//#endif
curgame_dir = NULL;
game_own_theme = 0;
// SDL_Quit();

View file

@ -288,10 +288,10 @@ int main(int argc, char *argv[])
// Initialize SDL
if (gfx_init() < 0)
return -1;
#ifdef ANDROID
if (gfx_video_init() || input_init())
return -1;
#endif
return -1;
if (game_init(opt_game)) {
game_error(opt_game);
}
@ -300,11 +300,12 @@ int main(int argc, char *argv[])
cfg_save();
game_done(0);
gfx_video_done();
#ifndef ANDROID
gfx_done();
#else
gfx_video_done();
#endif
out:
if (debug_sw)
debug_done();

View file

@ -704,6 +704,12 @@ int game_theme_init(void)
}
game_theme_scale(w, h);
if (gfx_set_mode(game_theme.w, game_theme.h, opt_fs)) {
opt_mode[0] = opt_mode[1] = -1; opt_fs = 0; /* safe options */
return -1;
}
if (game_theme_update_data()) {
fprintf(stderr, "Can not init theme!\n");
game_theme_free();