Added DefaultBpp var to CVideo class

This commit is contained in:
Charles Dang 2015-12-23 17:52:09 +11:00
parent 9ac728cef7
commit 136ca10a9a
3 changed files with 8 additions and 6 deletions

View file

@ -412,7 +412,7 @@ bool game_launcher::init_video()
bool found_matching = preferences::detect_video_settings(video_, resolution, bpp, video_flags);
if (cmdline_opts_.screenshot) {
bpp = 32;
bpp = CVideo::DefaultBpp;
}
if(!found_matching && (video_flags & SDL_FULLSCREEN)) {

View file

@ -63,7 +63,8 @@ bool detect_video_settings(CVideo& video, std::pair<int,int>& resolution, int& b
video_flags = fullscreen() ? SDL_FULLSCREEN : 0;
resolution = preferences::resolution();
int DefaultBPP = 24;
int DefaultBPP = video.DefaultBpp;
#if !SDL_VERSION_ATLEAST(2, 0, 0)
/* This needs to be fixed properly. */
const SDL_VideoInfo* const video_info = SDL_GetVideoInfo();
@ -119,7 +120,7 @@ void set_fullscreen(CVideo& video, const bool ison)
if(video.isFullScreen() != ison) {
const int flags = ison ? SDL_FULLSCREEN : 0;
#if SDL_VERSION_ATLEAST(2, 0, 0)
int bpp = 32;
int bpp = video.DefaultBpp;
#else
int bpp = video.bppForMode(res.first, res.second, flags);
#endif
@ -165,10 +166,10 @@ bool set_resolution(CVideo& video
return true;
}
const int flags = fullscreen() ? SDL_FULLSCREEN : 0;
#if SDL_VERSION_ATLEAST(2, 0, 0)
int bpp = 32;
int bpp = video.DefaultBpp;
#else
const int flags = fullscreen() ? SDL_FULLSCREEN : 0;
int bpp = video.bppForMode(width, height, flags);
#endif

View file

@ -76,6 +76,7 @@ class CVideo : private boost::noncopyable {
CVideo(FAKE_TYPES type = NO_FAKE);
~CVideo();
const static int DefaultBpp = 32;
int bppForMode( int x, int y, int flags);
int modePossible( int x, int y, int bits_per_pixel, int flags, bool current_screen_optimal=false);
@ -143,7 +144,7 @@ class CVideo : private boost::noncopyable {
* @param bpp The bpp of the buffer.
*/
void make_test_fake(const unsigned width = 1024,
const unsigned height = 768, const unsigned bpp = 32);
const unsigned height = 768, const unsigned bpp = DefaultBpp);
bool faked() const { return fake_screen_; }
//functions to set and clear 'help strings'. A 'help string' is like a tooltip, but it appears