projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20070131-1-src
[rocksndiamonds.git]
/
src
/
libgame
/
sdl.c
diff --git
a/src/libgame/sdl.c
b/src/libgame/sdl.c
index 0b49269361786c66a276d69c78be4d887c238d6a..6ac1229fcc3c761fa3b5ba3b2c2e568b928ce038 100644
(file)
--- a/
src/libgame/sdl.c
+++ b/
src/libgame/sdl.c
@@
-1,7
+1,7
@@
/***********************************************************
* Artsoft Retro-Game Library *
*----------------------------------------------------------*
/***********************************************************
* Artsoft Retro-Game Library *
*----------------------------------------------------------*
-* (c) 1994-200
2
Artsoft Entertainment *
+* (c) 1994-200
6
Artsoft Entertainment *
* Holger Schemel *
* Detmolder Strasse 189 *
* 33604 Bielefeld *
* Holger Schemel *
* Detmolder Strasse 189 *
* 33604 Bielefeld *
@@
-35,12
+35,12
@@
static int fullscreen_yoffset;
static int video_xoffset;
static int video_yoffset;
static int video_xoffset;
static int video_yoffset;
-static void setFullscreenParameters()
+static void setFullscreenParameters(
char *fullscreen_mode_string
)
{
struct ScreenModeInfo *fullscreen_mode;
int i;
{
struct ScreenModeInfo *fullscreen_mode;
int i;
- fullscreen_mode = get_screen_mode_from_string(
setup.fullscreen_mode
);
+ fullscreen_mode = get_screen_mode_from_string(
fullscreen_mode_string
);
if (fullscreen_mode == NULL)
return;
if (fullscreen_mode == NULL)
return;
@@
-63,6
+63,10
@@
static void setFullscreenParameters()
static void SDLSetWindowIcon(char *basename)
{
static void SDLSetWindowIcon(char *basename)
{
+ /* (setting the window icon on Mac OS X would replace the high-quality
+ dock icon with the currently smaller (and uglier) icon from file) */
+
+#if !defined(PLATFORM_MACOSX)
char *filename = getCustomImageFilename(basename);
SDL_Surface *surface;
char *filename = getCustomImageFilename(basename);
SDL_Surface *surface;
@@
-85,6
+89,7
@@
static void SDLSetWindowIcon(char *basename)
SDL_MapRGB(surface->format, 0x00, 0x00, 0x00));
SDL_WM_SetIcon(surface, NULL);
SDL_MapRGB(surface->format, 0x00, 0x00, 0x00));
SDL_WM_SetIcon(surface, NULL);
+#endif
}
void SDLInitVideoDisplay(void)
}
void SDLInitVideoDisplay(void)
@@
-235,7
+240,7
@@
boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen)
if (fullscreen && !video.fullscreen_enabled && video.fullscreen_available)
{
if (fullscreen && !video.fullscreen_enabled && video.fullscreen_available)
{
- setFullscreenParameters();
+ setFullscreenParameters(
setup.fullscreen_mode
);
video_xoffset = fullscreen_xoffset;
video_yoffset = fullscreen_yoffset;
video_xoffset = fullscreen_xoffset;
video_yoffset = fullscreen_yoffset;
@@
-250,6
+255,7
@@
boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen)
/* do not try it again */
video.fullscreen_available = FALSE;
/* do not try it again */
video.fullscreen_available = FALSE;
+
success = FALSE;
}
else
success = FALSE;
}
else
@@
-257,6
+263,8
@@
boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen)
(*backbuffer)->surface = new_surface;
video.fullscreen_enabled = TRUE;
(*backbuffer)->surface = new_surface;
video.fullscreen_enabled = TRUE;
+ video.fullscreen_mode_current = setup.fullscreen_mode;
+
success = TRUE;
}
}
success = TRUE;
}
}
@@
-378,7
+386,8
@@
void SDLFillRectangle(Bitmap *dst_bitmap, int x, int y, int width, int height,
}
void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
}
void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
- int fade_mode, int fade_delay, int post_delay)
+ int fade_mode, int fade_delay, int post_delay,
+ void (*draw_border_function)(void))
{
static boolean initialization_needed = TRUE;
static SDL_Surface *surface_source = NULL;
{
static boolean initialization_needed = TRUE;
static SDL_Surface *surface_source = NULL;
@@
-389,7
+398,6
@@
void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
SDL_Rect src_rect, dst_rect;
int src_x = x, src_y = y;
int dst_x = x, dst_y = y;
SDL_Rect src_rect, dst_rect;
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;
int alpha_final;
unsigned int time_last, time_current;
float alpha;
int alpha_final;
@@
-463,13
+471,18
@@
void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
/* copy source and target surfaces to temporary surfaces for fading */
if (fade_mode == FADE_MODE_CROSSFADE)
{
/* copy source and target surfaces to temporary surfaces for fading */
if (fade_mode == FADE_MODE_CROSSFADE)
{
- SDL_BlitSurface(surface_cross, &src_rect, surface_source, &src_rect);
+ SDL_BlitSurface(surface_cross,
&src_rect, surface_source, &src_rect);
SDL_BlitSurface(surface_screen, &dst_rect, surface_target, &src_rect);
}
SDL_BlitSurface(surface_screen, &dst_rect, surface_target, &src_rect);
}
- else
+ else if (fade_mode == FADE_MODE_FADE_IN)
+ {
+ SDL_BlitSurface(surface_black, &src_rect, surface_source, &src_rect);
+ SDL_BlitSurface(surface_screen, &dst_rect, surface_target, &src_rect);
+ }
+ else /* FADE_MODE_FADE_OUT */
{
SDL_BlitSurface(surface_screen, &dst_rect, surface_source, &src_rect);
{
SDL_BlitSurface(surface_screen, &dst_rect, surface_source, &src_rect);
- SDL_BlitSurface(surface_black, &src_rect, surface_target, &src_rect);
+ SDL_BlitSurface(surface_black,
&src_rect, surface_target, &src_rect);
}
time_current = SDL_GetTicks();
}
time_current = SDL_GetTicks();
@@
-479,8
+492,7
@@
void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
time_last = time_current;
time_current = SDL_GetTicks();
alpha += 255 * ((float)(time_current - time_last) / fade_delay);
time_last = time_current;
time_current = SDL_GetTicks();
alpha += 255 * ((float)(time_current - time_last) / fade_delay);
- alpha_final = (int)(fade_reverse ? 255.0 - alpha : alpha);
- alpha_final = MIN(MAX(0, alpha_final), 255);
+ alpha_final = MIN(MAX(0, alpha), 255);
/* draw existing (source) image to screen buffer */
SDL_BlitSurface(surface_source, &src_rect, surface_screen, &dst_rect);
/* draw existing (source) image to screen buffer */
SDL_BlitSurface(surface_source, &src_rect, surface_screen, &dst_rect);
@@
-489,6
+501,9
@@
void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
SDL_SetAlpha(surface_target, SDL_SRCALPHA, alpha_final);
SDL_BlitSurface(surface_target, &src_rect, surface_screen, &dst_rect);
SDL_SetAlpha(surface_target, SDL_SRCALPHA, alpha_final);
SDL_BlitSurface(surface_target, &src_rect, surface_screen, &dst_rect);
+ if (draw_border_function != NULL)
+ draw_border_function();
+
#if 1
/* only update the region of the screen that is affected from fading */
SDL_UpdateRect(surface_screen, dst_x, dst_y, width, height);
#if 1
/* only update the region of the screen that is affected from fading */
SDL_UpdateRect(surface_screen, dst_x, dst_y, width, height);