#include "sound.h"
#include "joystick.h"
#include "misc.h"
+#include "setup.h"
#if defined(TARGET_SDL)
fullscreen_mode = get_screen_mode_from_string(setup.fullscreen_mode);
+ if (fullscreen_mode == NULL)
+ return;
+
for (i = 0; video.fullscreen_modes[i].width != -1; i++)
{
if (fullscreen_mode->width == video.fullscreen_modes[i].width &&
}
}
+static void SDLSetWindowIcon(char *basename)
+{
+ char *filename = getCustomImageFilename(basename);
+ SDL_Surface *surface;
+
+ if (filename == NULL)
+ {
+ Error(ERR_WARN, "SDLSetWindowIcon(): cannot find file '%s'", basename);
+
+ return;
+ }
+
+ if ((surface = IMG_Load(filename)) == NULL)
+ {
+ Error(ERR_WARN, "IMG_Load() failed: %s", SDL_GetError());
+
+ return;
+ }
+
+ /* set transparent color */
+ SDL_SetColorKey(surface, SDL_SRCCOLORKEY,
+ SDL_MapRGB(surface->format, 0x00, 0x00, 0x00));
+
+ SDL_WM_SetIcon(surface, NULL);
+}
+
void SDLInitVideoDisplay(void)
{
putenv("SDL_VIDEO_CENTERED=1");
}
}
+ /* set window icon */
+ SDLSetWindowIcon(program.sdl_icon_filename);
+
/* open SDL video output device (window or fullscreen mode) */
if (!SDLSetVideoMode(backbuffer, fullscreen))
Error(ERR_EXIT, "setting video mode failed");
SDL_UpdateRect(backbuffer->surface, dst_x, dst_y, width, height);
}
-void SDLFillRectangle(Bitmap *dst_bitmap, int x, int y,
- int width, int height, Uint32 color)
+void SDLFillRectangle(Bitmap *dst_bitmap, int x, int y, int width, int height,
+ Uint32 color)
{
Bitmap *real_dst_bitmap = (dst_bitmap == window ? backbuffer : dst_bitmap);
SDL_Rect rect;
SDL_UpdateRect(backbuffer->surface, x, y, width, height);
}
-void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay,
- int post_delay)
+void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
+ int fade_mode, int fade_delay, int post_delay)
{
static boolean initialization_needed = TRUE;
static SDL_Surface *surface_screen_copy = NULL;
SDL_Surface *surface_screen = backbuffer->surface;
SDL_Surface *surface_cross; /* initialized later */
SDL_Rect src_rect, dst_rect;
- int src_x = 0, src_y = 0;
- int dst_x = 0, dst_y = 0;
+ int src_x = x, src_y = y;
+ int dst_x = x, dst_y = y;
boolean fade_reverse = (fade_mode == FADE_MODE_FADE_IN ? TRUE : FALSE);
unsigned int time_last, time_current;
float alpha;
src_rect.x = src_x;
src_rect.y = src_y;
- src_rect.w = video.width;
- src_rect.h = video.height;
+ src_rect.w = width;
+ src_rect.h = height;
dst_x += video_xoffset;
dst_y += video_yoffset;
dst_rect.x = dst_x;
dst_rect.y = dst_y;
- dst_rect.w = video.width;
- dst_rect.h = video.height;
+ dst_rect.w = width;
+ dst_rect.h = height;
#if 0
if (!initialization_needed)
SDL_BlitSurface(surface_cross, &src_rect, surface_screen, &dst_rect);
/* draw screen buffer to visible display */
+#if 1
+ SDL_UpdateRect(surface_screen, dst_x, dst_y, width, height);
+#else
SDL_Flip(surface_screen);
+#endif
}
Delay(post_delay);
if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
{
SetError("IMG_Load(): %s", SDL_GetError());
+
return NULL;
}
if ((new_bitmap->surface = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
{
SetError("SDL_DisplayFormat(): %s", SDL_GetError());
+
return NULL;
}
if ((new_bitmap->surface_masked = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
{
SetError("SDL_DisplayFormat(): %s", SDL_GetError());
+
return NULL;
}