diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-09-18 11:22:27 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-09-18 11:22:27 +0000 |
commit | f22625d0e79cd943acf117c1e5bd32e4bbef5a2a (patch) | |
tree | 6996be4ae3914affbc40bdec951beba55d9e6603 /src/graphics.cpp | |
parent | 7329e1e48c9366695121eb32a18eecd91846354b (diff) | |
download | mana-f22625d0e79cd943acf117c1e5bd32e4bbef5a2a.tar.gz mana-f22625d0e79cd943acf117c1e5bd32e4bbef5a2a.tar.bz2 mana-f22625d0e79cd943acf117c1e5bd32e4bbef5a2a.tar.xz mana-f22625d0e79cd943acf117c1e5bd32e4bbef5a2a.zip |
Move the writing logic out of the Graphics class once again... Some cleanups in the screenshot filename selection code.
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r-- | src/graphics.cpp | 45 |
1 files changed, 1 insertions, 44 deletions
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 <physfs.h> -#include <sstream> -#include <string> -#include <fstream> -#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 |