New video setup path, using -1bpp

This commit is contained in:
James Turk 2003-01-24 19:41:54 +00:00
parent e5415d344f
commit 10036ece1f
2 changed files with 10 additions and 7 deletions

View File

@ -13,7 +13,7 @@
File: ZE_ZEngine.h <br> File: ZE_ZEngine.h <br>
Description: Header file for ZEngine class, the core of the ZEngine. <br> Description: Header file for ZEngine class, the core of the ZEngine. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZEngine.h,v 1.15 2003/01/24 11:05:25 cozman Exp $<br> $Id: ZE_ZEngine.h,v 1.16 2003/01/24 19:43:59 cozman Exp $<br>
\file ZE_ZEngine.h \file ZE_ZEngine.h
\brief Definition file for core ZEngine class. \brief Definition file for core ZEngine class.
@ -117,7 +117,7 @@ class ZEngine
\param width Desired width of screen or window. \param width Desired width of screen or window.
\param height Desired height of screen or window. \param height Desired height of screen or window.
\param bpp Desired BPP for screen (generally use 32). \param bpp Desired BPP for screen, generally use 8,16 or 32, pass -1 if you want ZEngine to guess the best choice.
\param fullscreen A bool for fullscreen setting. \param fullscreen A bool for fullscreen setting.
**/ **/
void SetupDisplay(int width, int height, int bpp, bool fullscreen); void SetupDisplay(int width, int height, int bpp, bool fullscreen);
@ -139,7 +139,7 @@ class ZEngine
SetupDisplay and SetupSound should be called prior to this to change settings, settings from those do not go into effect SetupDisplay and SetupSound should be called prior to this to change settings, settings from those do not go into effect
until this function is called. Specify no icon file to use default icon. Returns result of setting up ZEngine, and logs until this function is called. Specify no icon file to use default icon. Returns result of setting up ZEngine, and logs
error if false is returned (returns bool in versions >= 0.8.2). error if false is returned (Trys not to fail + returns bool in versions >= 0.8.2).
\param title Window Title. \param title Window Title.
\param icon Path to Icon File. \param icon Path to Icon File.

View File

@ -13,7 +13,7 @@
File: ZE_ZEngine.cpp <br> File: ZE_ZEngine.cpp <br>
Description: Implementation source file for ZEngine library main singleton class. <br> Description: Implementation source file for ZEngine library main singleton class. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZEngine.cpp,v 1.21 2003/01/24 11:05:25 cozman Exp $<br> $Id: ZE_ZEngine.cpp,v 1.22 2003/01/24 19:41:54 cozman Exp $<br>
\file ZE_ZEngine.cpp \file ZE_ZEngine.cpp
\brief Central source file for ZEngine. \brief Central source file for ZEngine.
@ -124,13 +124,16 @@ bool ZEngine::CreateDisplay(string title, string icon)
//set flags and bpp// //set flags and bpp//
if(mFullscreen) if(mFullscreen)
flags |= SDL_FULLSCREEN; flags |= SDL_FULLSCREEN;
if(mBPP != 8 && mBPP != 15 && mBPP != 16 && mBPP != 24 && mBPP !=32) if(mBPP != -1 && mBPP != 8 && mBPP != 15 && mBPP != 16 && mBPP != 24 && mBPP !=32)
{ {
ReportError(ZERR_VIDMODE,FormatStr("%d is invalid BPP, must be 8,15,16,24 or 32, trying desktop BPP.",mBPP)); ReportError(ZERR_VIDMODE,FormatStr("%d is invalid BPP, must be 8,15,16,24 or 32, trying best BPP.",mBPP));
mBPP = 0; mBPP = -1;
} }
else else
{ {
if(mBPP == -1)
mBPP = SDL_GetVideoInfo()->vfmt->BitsPerPixel;
bpp = SDL_VideoModeOK(mWidth, mHeight, mBPP, flags); bpp = SDL_VideoModeOK(mWidth, mHeight, mBPP, flags);
if(!bpp) if(!bpp)
{ {