Improved resolution detection system

git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@218 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
gerstrong
2009-08-09 13:52:35 +00:00
parent 7c529bec6d
commit 843be847eb
4 changed files with 47 additions and 21 deletions

View File

@@ -8,7 +8,7 @@
#ifndef CLOGFILE_H_
#define CLOGFILE_H_
#define REVISION "Commander Genius Prerelease v0.3 Pre9"
#define REVISION "Commander Genius Release v0.3"
#include "CSingleton.h"
#define g_pLogFile CLogFile::Get()

View File

@@ -111,15 +111,42 @@ void CVideoDriver::initResolutionList()
}
else
{
// Init SDL in order to check, if the resolutions are really supported
if(SDL_Init(SDL_INIT_VIDEO) < 0)
{
g_pLogFile->textOut(RED,"Could not initialize SDL for mode detection: %s<br>", SDL_GetError());
return;
}
else
g_pLogFile->textOut(GREEN,"SDL-Video was successfully initialized for mode detections!<br>");
std::list<st_resolution> :: iterator i;
while(!ResolutionFile.eof())
{
ResolutionFile.getline(buf,256);
if(sscanf(buf,"%hdx%hdx%hd", &resolution.width,
&resolution.height,
&resolution.depth) == 3)
m_Resolutionlist.push_back(resolution);
// Now check if it's possible to use this resolution
resolution.depth = SDL_VideoModeOK(resolution.width, resolution.height,
resolution.depth, SDL_FULLSCREEN);
if(resolution.depth)
{
for( i = m_Resolutionlist.begin() ; i != m_Resolutionlist.end() ; i++ )
if(i->width == resolution.width &&
i->height == resolution.height &&
i->depth == resolution.depth) break;
if(i == m_Resolutionlist.end())
m_Resolutionlist.push_back(resolution);
}
}
ResolutionFile.close();
SDL_Quit();
// shutdown SDL, so the game can initialize it correctly
}
if(m_Resolutionlist.empty()) {