浏览代码

Fix build with older SDL

Ivan Savenko 1 年之前
父节点
当前提交
5409936509
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      client/renderSDL/SDL_Extensions.cpp

+ 6 - 0
client/renderSDL/SDL_Extensions.cpp

@@ -19,6 +19,8 @@
 #include "../../lib/GameConstants.h"
 #include "../../lib/GameConstants.h"
 
 
 #include <SDL_render.h>
 #include <SDL_render.h>
+#include <SDL_surface.h>
+#include <SDL_version.h>
 
 
 Rect CSDL_Ext::fromSDL(const SDL_Rect & rect)
 Rect CSDL_Ext::fromSDL(const SDL_Rect & rect)
 {
 {
@@ -630,7 +632,11 @@ SDL_Surface * CSDL_Ext::scaleSurface(SDL_Surface * surf, int width, int height)
 	SDL_Surface * intermediate = SDL_ConvertSurface(surf, screen->format, 0);
 	SDL_Surface * intermediate = SDL_ConvertSurface(surf, screen->format, 0);
 	SDL_Surface * ret = newSurface(width, height, intermediate);
 	SDL_Surface * ret = newSurface(width, height, intermediate);
 
 
+#if SDL_VERSION_ATLEAST(2,0,16)
 	SDL_SoftStretchLinear(intermediate, nullptr, ret, nullptr);
 	SDL_SoftStretchLinear(intermediate, nullptr, ret, nullptr);
+#else
+	SDL_SoftStretch(intermediate, nullptr, ret, nullptr);
+#endif
 	SDL_FreeSurface(intermediate);
 	SDL_FreeSurface(intermediate);
 
 
 	return ret;
 	return ret;