diff --git a/src/game_launcher.cpp b/src/game_launcher.cpp index 292118e713bb..6242b6efdf47 100644 --- a/src/game_launcher.cpp +++ b/src/game_launcher.cpp @@ -433,7 +433,9 @@ bool game_launcher::init_video() std::cerr << "Setting mode to " << resolution.first << "x" << resolution.second << "x" << bpp << "\n"; const int res = video_.setMode(resolution.first,resolution.second,bpp,video_flags); +#if !SDL_VERSION_ATLEAST(2, 0, 0) video_.setBpp(bpp); +#endif if(res == 0) { std::cerr << "Required video mode, " << resolution.first << "x" << resolution.second << "x" << bpp << " is not supported\n"; diff --git a/src/preferences_display.cpp b/src/preferences_display.cpp index f62116fb1434..00778f331f83 100644 --- a/src/preferences_display.cpp +++ b/src/preferences_display.cpp @@ -85,8 +85,12 @@ bool detect_video_settings(CVideo& video, std::pair& resolution, int& b res_list.push_back(res_t(1920, 1080)); } +#if SDL_VERSION_ATLEAST(2, 0, 0) + bpp = DefaultBPP; +#else bpp = video.modePossible(resolution.first, resolution.second, DefaultBPP, video_flags, true); +#endif BOOST_REVERSE_FOREACH(const res_t &res, res_list) { @@ -96,8 +100,12 @@ bool detect_video_settings(CVideo& video, std::pair& resolution, int& b << " is not supported; attempting " << res.first << 'x' << res.second << 'x' << DefaultBPP << "...\n"; resolution = res; +#if SDL_VERSION_ATLEAST(2, 0, 0) + bpp = DefaultBPP; +#else bpp = video.modePossible(resolution.first, resolution.second, DefaultBPP, video_flags); +#endif } return bpp != 0; @@ -158,7 +166,11 @@ bool set_resolution(CVideo& video } const int flags = fullscreen() ? SDL_FULLSCREEN : 0; +#if SDL_VERSION_ATLEAST(2, 0, 0) + int bpp = 32; +#else int bpp = video.bppForMode(width, height, flags); +#endif if(bpp != 0) { //video.setMode(width, height, bpp, flags); diff --git a/src/video.cpp b/src/video.cpp index b201cbc22aca..3623e459ab89 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -511,6 +511,7 @@ void CVideo::make_test_fake(const unsigned width, } +#if !SDL_VERSION_ATLEAST(2, 0, 0) int CVideo::bppForMode( int x, int y, int flags) { int test_values[3] = {getBpp(), 32, 16}; @@ -522,6 +523,7 @@ int CVideo::bppForMode( int x, int y, int flags) return 0; } +#endif int CVideo::modePossible( int x, int y, int bits_per_pixel, int flags, bool current_screen_optimal ) { @@ -847,6 +849,7 @@ surface& CVideo::getSurface() bool CVideo::isFullScreen() const { return fullScreen; } +#if !SDL_VERSION_ATLEAST(2, 0, 0) void CVideo::setBpp( int bpp ) { bpp_ = bpp; @@ -856,6 +859,7 @@ int CVideo::getBpp() { return bpp_; } +#endif int CVideo::set_help_string(const std::string& str) { diff --git a/src/video.hpp b/src/video.hpp index cce9f43f9312..57a24fafca80 100644 --- a/src/video.hpp +++ b/src/video.hpp @@ -129,8 +129,10 @@ class CVideo : private boost::noncopyable { }; //functions to allow changing video modes when 16BPP is emulated +#if !SDL_VERSION_ATLEAST(2, 0, 0) void setBpp( int bpp ); int getBpp(); +#endif void make_fake(); /**