From 06221a4cb3f44e7532e185bc775c73741d32cbf2 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Sun, 18 Sep 2005 01:31:33 +0000 Subject: Made the saveScreenShot makes its screenshots under user home dir in *nices, made it more C++ way to avoid a leak, and made it check for existence of a file with same name before writing; In that case the screenshot's number is incremented until it finds an adequate name. --- src/game.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 4778dae7..5aaf1e8e 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -69,8 +69,6 @@ #include "net/network.h" #include "net/protocol.h" -#include "resources/imagewriter.h" - extern Graphics *graphics; std::string map_path; @@ -580,13 +578,10 @@ void do_input() */ // screenshot (picture, hence the p) case SDLK_p: + //ImageWriter::writePNG(graphics->getScreenshot(), name.str()); + if (!graphics->saveScreenshot()) { - // TODO Fix the counting to start at a sane value. - static int picCount = 1; - std::stringstream name; - name << "Screenshot-" << picCount << ".png"; - ImageWriter::writePNG(graphics->getScreenshot(), name.str()); - picCount++; + logger->log("Error: could not save Screenshot."); } break; // Skill window -- cgit v1.2.3-70-g09d2