Changed: only check screenshot folder presence one time

This commit is contained in:
kervala 2010-07-17 18:47:38 +02:00
parent 2a91013055
commit 4441f54bba
3 changed files with 9 additions and 3 deletions

View file

@ -595,12 +595,16 @@ void displayScreenShotSavedInfo(const string &filename)
pIM->displaySystemInfo(msg);
}
void initScreenshot()
{
if (!CFile::isExists(ScreenshotsDirectory)) CFile::createDirectory(ScreenshotsDirectory);
}
void screenShotTGA()
{
CBitmap btm;
getBuffer (btm);
if(!ScreenshotsDirectory.empty() && !CFile::isExists(ScreenshotsDirectory)) CFile::createDirectory(ScreenshotsDirectory);
string filename = CFile::findNewFile (ScreenshotsDirectory+"screenshot.tga");
COFile fs(filename);
btm.writeTGA(fs, 24, false);
@ -613,7 +617,6 @@ void screenShotPNG()
CBitmap btm;
getBuffer (btm);
if(!ScreenshotsDirectory.empty() && !CFile::isExists(ScreenshotsDirectory)) CFile::createDirectory(ScreenshotsDirectory);
string filename = CFile::findNewFile (ScreenshotsDirectory+"screenshot.png");
COFile fs(filename);
if (!btm.writePNG(fs, 24))
@ -634,7 +637,6 @@ void screenShotJPG()
CBitmap btm;
getBuffer (btm);
if(!ScreenshotsDirectory.empty() && !CFile::isExists(ScreenshotsDirectory)) CFile::createDirectory(ScreenshotsDirectory);
string filename = CFile::findNewFile (ScreenshotsDirectory+"screenshot.jpg");
COFile fs(filename);
btm.writeJPG(fs);

View file

@ -174,6 +174,7 @@ public:
/** Capture current content of framebuffer and save the result. If a custom size is asked in ClientCfg, then the scene is rendered again
* instead (possibly multiple time)
*/
void initScreenshot();
void screenShotTGA();
void screenShotPNG();
void screenShotJPG();

View file

@ -1443,6 +1443,9 @@ bool mainLoop()
// initialize the structure for the ping.
Ping.init();
// initialize screenshots directory
initScreenshot();
// Call a function for a demo to init.
if (ClientCfg.Local)