Relegate some unneeded Bpp-related functions to SDL1
This commit is contained in:
parent
9e9622687c
commit
9ac728cef7
4 changed files with 20 additions and 0 deletions
|
@ -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";
|
||||
|
|
|
@ -85,8 +85,12 @@ bool detect_video_settings(CVideo& video, std::pair<int,int>& 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<int,int>& 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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue