projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed screen rotation for newer SDL versions on Android
[rocksndiamonds.git]
/
src
/
libgame
/
sdl.c
diff --git
a/src/libgame/sdl.c
b/src/libgame/sdl.c
index 1184acd84a4b227af94424e920b8b201bdb42344..add67e5b06afe4f6575cf1668d8eb213885deb8e 100644
(file)
--- a/
src/libgame/sdl.c
+++ b/
src/libgame/sdl.c
@@
-273,7
+273,7
@@
static void SDLSetWindowIcon(char *basename)
if ((surface = IMG_Load(filename)) == NULL)
{
if ((surface = IMG_Load(filename)) == NULL)
{
- Error(ERR_WARN, "IMG_Load(
) failed: %s"
, SDL_GetError());
+ Error(ERR_WARN, "IMG_Load(
'%s') failed: %s", basename
, SDL_GetError());
return;
}
return;
}
@@
-353,6
+353,11
@@
SDL_Surface *SDLGetNativeSurface(SDL_Surface *surface)
if (new_surface == NULL)
Error(ERR_EXIT, "SDL_ConvertSurface() failed: %s", SDL_GetError());
if (new_surface == NULL)
Error(ERR_EXIT, "SDL_ConvertSurface() failed: %s", SDL_GetError());
+ // workaround for a bug in SDL 2.0.12 (which does not convert the color key)
+ if (SDLHasColorKey(surface) && !SDLHasColorKey(new_surface))
+ SDL_SetColorKey(new_surface, SET_TRANSPARENT_PIXEL,
+ SDLGetColorKey(surface));
+
return new_surface;
}
return new_surface;
}
@@
-492,7
+497,7
@@
static boolean SDLCreateScreen(boolean fullscreen)
{
SDL_Surface *new_surface = NULL;
{
SDL_Surface *new_surface = NULL;
- int surface_flags_window = SURFACE_FLAGS
| SDL_WINDOW_RESIZABLE
;
+ int surface_flags_window = SURFACE_FLAGS;
int surface_flags_fullscreen = SURFACE_FLAGS | SDL_WINDOW_FULLSCREEN_DESKTOP;
#if 1
int surface_flags_fullscreen = SURFACE_FLAGS | SDL_WINDOW_FULLSCREEN_DESKTOP;
#if 1
@@
-1028,6
+1033,17
@@
void SDLFadeRectangle(int x, int y, int width, int height,
time_current = SDL_GetTicks();
time_current = SDL_GetTicks();
+ if (fade_delay <= 0)
+ {
+ // immediately draw final target frame without delay
+ fade_mode &= (FADE_MODE_FADE | FADE_MODE_TRANSFORM);
+ fade_delay = 1;
+ time_current -= 1;
+
+ // when fading without delay, also skip post delay
+ post_delay = 0;
+ }
+
if (fade_mode == FADE_MODE_MELT)
{
boolean done = FALSE;
if (fade_mode == FADE_MODE_MELT)
{
boolean done = FALSE;
@@
-2239,7
+2255,8
@@
Bitmap *SDLLoadImage(char *filename)
// load image to temporary surface
if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
// load image to temporary surface
if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
- Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
+ Error(ERR_EXIT, "IMG_Load('%s') failed: %s", getBaseNamePtr(filename),
+ SDL_GetError());
print_timestamp_time("IMG_Load");
print_timestamp_time("IMG_Load");
@@
-2523,7
+2540,7
@@
static void setJoystickButton(int nr, int button_id_raw, int button_state)
void HandleJoystickEvent(Event *event)
{
void HandleJoystickEvent(Event *event)
{
- switch(event->type)
+ switch
(event->type)
{
case SDL_CONTROLLERDEVICEADDED:
#if DEBUG_JOYSTICKS
{
case SDL_CONTROLLERDEVICEADDED:
#if DEBUG_JOYSTICKS