A workaround to allow users not using 16BPP to change video mode
This commit is contained in:
parent
0f0cdbb175
commit
1a77a34d75
4 changed files with 24 additions and 2 deletions
|
@ -315,6 +315,7 @@ int play_game(int argc, char** argv)
|
|||
|
||||
std::cerr << "setting mode to " << resolution.first << "x" << resolution.second << "\n";
|
||||
const int res = video.setMode(resolution.first,resolution.second,16,video_flags);
|
||||
video.setBpp(bpp);
|
||||
if(res != 16) {
|
||||
std::cerr << "required video mode, " << resolution.first << "x"
|
||||
<< resolution.second << "x16 is not supported\n";
|
||||
|
|
|
@ -595,6 +595,7 @@ bool show_video_mode_dialog(display& disp)
|
|||
std::vector<std::string> options;
|
||||
|
||||
CVideo& video = disp.video();
|
||||
video.setBitsPerPixel(video.getBpp());
|
||||
SDL_Rect** modes = SDL_ListModes(video.getSurface()->format,FULL_SCREEN);
|
||||
|
||||
//the SDL documentation says that a return value of -1 if no dimension
|
||||
|
|
|
@ -128,7 +128,7 @@ void update_whole_screen()
|
|||
{
|
||||
update_all = true;
|
||||
}
|
||||
CVideo::CVideo() : frameBuffer(NULL)
|
||||
CVideo::CVideo() : frameBuffer(NULL), bpp(0)
|
||||
{
|
||||
const int res = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE);
|
||||
|
||||
|
@ -139,7 +139,7 @@ CVideo::CVideo() : frameBuffer(NULL)
|
|||
}
|
||||
|
||||
CVideo::CVideo( int x, int y, int bits_per_pixel, int flags)
|
||||
: frameBuffer(NULL)
|
||||
: frameBuffer(NULL), bpp(0)
|
||||
{
|
||||
const int res = SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE);
|
||||
if(res < 0) {
|
||||
|
@ -245,3 +245,18 @@ SDL_Surface* CVideo::getSurface( void )
|
|||
}
|
||||
|
||||
bool CVideo::isFullScreen() const { return fullScreen; }
|
||||
|
||||
void CVideo::setBitsPerPixel( int bpp )
|
||||
{
|
||||
frameBuffer->format->BitsPerPixel = bpp;
|
||||
}
|
||||
|
||||
void CVideo::setBpp( int bpp )
|
||||
{
|
||||
this->bpp = bpp;
|
||||
}
|
||||
|
||||
int CVideo::getBpp( void )
|
||||
{
|
||||
return bpp;
|
||||
}
|
||||
|
|
|
@ -57,9 +57,14 @@ class CVideo {
|
|||
|
||||
struct quit {};
|
||||
|
||||
//functions to allow changing video modes when 16BPP is emulated
|
||||
void setBitsPerPixel( int bpp );
|
||||
void setBpp( int bpp );
|
||||
int getBpp();
|
||||
private:
|
||||
|
||||
SDL_Surface* frameBuffer;
|
||||
int bpp; // Store real bits per pixel
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue