From 80636afd0e7b0697e149611a975fa67cd4e7dde1 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sun, 2 Mar 2014 16:17:00 +0100 Subject: [PATCH] Add a work-around for SDL_GetVideoSurface in SDL2. For now simply assume the surface returned is NULL and everything compiles nicely. --- src/font.cpp | 8 ++++++++ src/video.cpp | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/font.cpp b/src/font.cpp index 08e7a3d46294..729f5ea28634 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -1139,7 +1139,11 @@ SDL_Rect get_floating_label_rect(int handle) floating_label_context::floating_label_context() { +#if SDL_VERSION_ATLEAST(2, 0, 0) + surface const screen = NULL; +#else surface const screen = SDL_GetVideoSurface(); +#endif if(screen != NULL) { draw_floating_labels(screen); } @@ -1156,7 +1160,11 @@ floating_label_context::~floating_label_context() label_contexts.pop(); +#if SDL_VERSION_ATLEAST(2, 0, 0) + surface const screen = NULL; +#else surface const screen = SDL_GetVideoSurface(); +#endif if(screen != NULL) { undraw_floating_labels(screen); } diff --git a/src/video.cpp b/src/video.cpp index 370954d55070..625107a3dfbc 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -223,16 +223,22 @@ bool non_interactive() { if (fake_interactive) return false; +#if SDL_VERSION_ATLEAST(2, 0, 0) + return false; +#else return SDL_GetVideoSurface() == NULL; +#endif } surface display_format_alpha(surface surf) { +#if !SDL_VERSION_ATLEAST(2, 0, 0) if(SDL_GetVideoSurface() != NULL) return SDL_DisplayFormatAlpha(surf); else if(frameBuffer != NULL) return SDL_ConvertSurface(surf,frameBuffer->format,0); else +#endif return NULL; } @@ -258,7 +264,11 @@ void update_rect(const SDL_Rect& rect_value) SDL_Rect rect = rect_value; +#if SDL_VERSION_ATLEAST(2, 0, 0) + surface const fb = NULL; +#else surface const fb = SDL_GetVideoSurface(); +#endif if(fb != NULL) { if(rect.x < 0) { if(rect.x*-1 >= int(rect.w))