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) if (name)
game_err_msg(NULL); game_err_msg(NULL);
#ifndef ANDROID
if (gfx_video_init() || input_init())
return -1;
#endif
snd_init(opt_hz); snd_init(opt_hz);
game_change_vol(0, opt_vol); game_change_vol(0, opt_vol);
if (game_select(name)) if (game_select(name))
return -1; 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()) if (game_theme_optimize())
return -1; return -1;
@ -846,9 +838,9 @@ void game_done(int err)
input_clear(); input_clear();
snd_done(); snd_done();
instead_done(); instead_done();
#ifndef ANDROID //#ifndef ANDROID
gfx_video_done(); // gfx_video_done();
#endif //#endif
curgame_dir = NULL; curgame_dir = NULL;
game_own_theme = 0; game_own_theme = 0;
// SDL_Quit(); // SDL_Quit();

View file

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

View file

@ -704,6 +704,12 @@ int game_theme_init(void)
} }
game_theme_scale(w, h); 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()) { if (game_theme_update_data()) {
fprintf(stderr, "Can not init theme!\n"); fprintf(stderr, "Can not init theme!\n");
game_theme_free(); game_theme_free();