From 0cda3fde9d7f42fa301f961d24253d9a0e338c40 Mon Sep 17 00:00:00 2001 From: "p.kosyh" Date: Thu, 10 Sep 2009 16:58:50 +0000 Subject: [PATCH] wow! More clever video handling. Thanks to bug in win version. SDL bug? Or feature? --- Rules.make.standalone | 4 ++-- debian/changelog | 1 + src/sdl-instead/graphics.c | 7 ------- src/sdl-instead/main.c | 8 ++++++++ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Rules.make.standalone b/Rules.make.standalone index c5b087f..fcd6e87 100644 --- a/Rules.make.standalone +++ b/Rules.make.standalone @@ -14,8 +14,8 @@ LUA_LFLAGS=$(shell pkg-config --libs lua5.1) # for arch linux (may be others) use this # -# LUA_CFLAGS=$(shell pkg-config --cflags lua) -# LUA_LFLAGS=$(shell pkg-config --libs lua) +LUA_CFLAGS=$(shell pkg-config --cflags lua) +LUA_LFLAGS=$(shell pkg-config --libs lua) # SDL_CFLAGS=$(shell sdl-config --cflags) diff --git a/debian/changelog b/debian/changelog index 5ae69a4..0c114e1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,7 @@ instead (0.8.9) unstable; urgency=low * full keyboard control! * alt enter fix * gfx cursor support! + * no reset video while change game/theme -- Peter Kosyh Sat, 5 Aug 2009 11:25:01 +0400 diff --git a/src/sdl-instead/graphics.c b/src/sdl-instead/graphics.c index bb06236..c022975 100644 --- a/src/sdl-instead/graphics.c +++ b/src/sdl-instead/graphics.c @@ -484,12 +484,6 @@ int gfx_init(void) fprintf(stderr, "Can't init TTF subsystem.\n"); return -1; } - - // Initialize SDL - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER /*| SDL_INIT_AUDIO*/) < 0) { - fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); - return -1; - } SDL_WM_SetCaption( title, title ); @@ -540,7 +534,6 @@ void gfx_done(void) SDL_RemoveTimer(timer_han); timer_han = NULL; TTF_Quit(); - SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_TIMER); } img_t gfx_scale(img_t src, float xscale, float yscale) diff --git a/src/sdl-instead/main.c b/src/sdl-instead/main.c index 744f140..a5fd37d 100644 --- a/src/sdl-instead/main.c +++ b/src/sdl-instead/main.c @@ -1,3 +1,4 @@ +#include #include "externals.h" #include "internals.h" @@ -92,6 +93,12 @@ int main(int argc, char **argv) game_theme_select(opt_theme); if (!curtheme_dir) game_theme_select(DEFAULT_THEME); + + // Initialize SDL + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) { + fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); + return -1; + } if (game_init(opt_game)) { game_error(opt_game); @@ -101,6 +108,7 @@ int main(int argc, char **argv) game_done(); if (debug_sw) debug_done(); + SDL_Quit(); return 0; }