From f22625d0e79cd943acf117c1e5bd32e4bbef5a2a Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Sun, 18 Sep 2005 11:22:27 +0000 Subject: Move the writing logic out of the Graphics class once again... Some cleanups in the screenshot filename selection code. --- src/graphics.cpp | 45 +-------------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) (limited to 'src/graphics.cpp') diff --git a/src/graphics.cpp b/src/graphics.cpp index f179eff2..33f25468 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -28,17 +28,11 @@ #include "graphic/imagerect.h" #include "resources/image.h" -#include -#include -#include -#include -#include "resources/imagewriter.h" extern volatile int framesToDraw; Graphics::Graphics(): - mScreen(0), - screenshotsCount(1) + mScreen(0) { } @@ -246,43 +240,6 @@ void Graphics::updateScreen() } } -bool Graphics::saveScreenshot() -{ - std::stringstream pictureFilename; - // Write it under user home dir on *nices. - #ifdef __USE_UNIX98 - pictureFilename << PHYSFS_getUserDir() << "/"; - #endif - pictureFilename << "TMW_Screenshot_" << screenshotsCount << ".png"; - - // While these screenshots files already exists, increment the - // screenshots count. - std::fstream testExists; - testExists.open(std::string(pictureFilename.str()).c_str(), std::ios::in); - while ( testExists.is_open() ) - { - testExists.close(); - screenshotsCount++; - pictureFilename.str(""); - #ifdef __USE_UNIX98 - pictureFilename << PHYSFS_getUserDir() << "/"; - #endif - pictureFilename << "TMW_Screenshot_" << screenshotsCount << ".png"; - testExists.open(std::string(pictureFilename.str()).c_str(), std::ios::in); - } - testExists.close(); - - if ( ImageWriter::writePNG(getScreenshot(), pictureFilename.str()) ) - { - screenshotsCount++; - return true; - } - else - { - return false; - } -} - SDL_Surface* Graphics::getScreenshot() { #if SDL_BYTEORDER == SDL_BIG_ENDIAN -- cgit v1.2.3-70-g09d2