SDL 1.3.0 workaround

This commit is contained in:
p.kosyh 2011-02-20 15:24:41 +00:00
parent b6a14235de
commit fc16913116
2 changed files with 23 additions and 0 deletions

View file

@ -1149,7 +1149,18 @@ void game_menu_box_width(int show, const char *txt, int width)
menu = gfx_new(w + (b + pad)*2, h + (b + pad)*2);
gfx_img_fill(menu, 0, 0, w + (b + pad)*2, h + (b + pad)*2, game_theme.border_col);
gfx_img_fill(menu, b, b, w + pad*2, h + pad*2, game_theme.menu_bg);
#if SDL_VERSION_ATLEAST(1,3,0)
do { /* hack while SDL 1.3.0 is not released */
img_t img2;
img2 = gfx_alpha_img(menu, game_theme.menu_alpha);
if (img2) {
gfx_free_image(menu);
menu = img2;
}
} while(0);
#esle
gfx_set_alpha(menu, game_theme.menu_alpha);
#endif
x = (game_theme.w - w)/2;
y = (game_theme.h - h)/2;
mx = x - b - pad;

View file

@ -3638,9 +3638,21 @@ static void update_gfx(void *aux)
if (fade_step_nr == -1)
return;
game_cursor(CURSOR_CLEAR);
#if SDL_VERSION_ATLEAST(1,3,0)
do { /* hack while SDL 1.3.0 is not released */
img_t img2;
img2 = gfx_alpha_img(img, (255 * (fade_step_nr + 1)) / ALPHA_STEPS);
if (img2) {
gfx_draw(fade_bg, 0, 0);
gfx_draw(img2, 0, 0);
gfx_free_image(img2);
}
}
#else
gfx_set_alpha(img, (255 * (fade_step_nr + 1)) / ALPHA_STEPS);
gfx_draw(fade_bg, 0, 0);
gfx_draw(img, 0, 0);
#endif
game_cursor(CURSOR_DRAW);
gfx_flip();
fade_step_nr ++;