[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src display.cpp display.hpp filesystem....
From: |
Philippe Plantier |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src display.cpp display.hpp filesystem.... |
Date: |
Sun, 17 Apr 2005 16:42:10 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Philippe Plantier <address@hidden> 05/04/17 20:42:10
Modified files:
src : display.cpp display.hpp filesystem.cpp
filesystem.hpp hotkeys.cpp hotkeys.hpp
playturn.cpp show_dialog.cpp
Log message:
Commited patch #3880 from grzywacz: "make screenshot" hotkey.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.315&tr2=1.316&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.hpp.diff?tr1=1.102&tr2=1.103&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/filesystem.cpp.diff?tr1=1.67&tr2=1.68&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/filesystem.hpp.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/hotkeys.cpp.diff?tr1=1.73&tr2=1.74&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/hotkeys.hpp.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.358&tr2=1.359&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/show_dialog.cpp.diff?tr1=1.125&tr2=1.126&r1=text&r2=text
Patches:
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.315 wesnoth/src/display.cpp:1.316
--- wesnoth/src/display.cpp:1.315 Wed Apr 13 18:47:20 2005
+++ wesnoth/src/display.cpp Sun Apr 17 20:42:10 2005
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.315 2005/04/13 18:47:20 gruikya Exp $ */
+/* $Id: display.cpp,v 1.316 2005/04/17 20:42:10 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -17,6 +17,7 @@
#include "cursor.hpp"
#include "display.hpp"
#include "events.hpp"
+#include "filesystem.hpp"
#include "font.hpp"
#include "game_config.hpp"
#include "gamestatus.hpp"
@@ -452,6 +453,29 @@
zoom(DefaultZoom - zoom_);
}
+void display::screenshot()
+{
+ std::string datadir = get_screenshot_dir();
+ unsigned int counter = 0;
+ std::string name;
+
+ do {
+ std::stringstream filename;
+
+ filename << datadir << "/" << _("Screenshot") << "_";
+ filename.width(5);
+ filename.fill('0');
+ filename.setf(std::ios_base::right);
+ filename << counter << ".bmp";
+
+ counter++;
+ name = filename.str();
+
+ } while(file_exists(name));
+
+ SDL_SaveBMP(screen_.getSurface().get(), name.c_str());
+}
+
void display::scroll_to_tile(int x, int y, SCROLL_TYPE scroll_type, bool
check_fogged)
{
if(screen_.update_locked() || (check_fogged && fogged(x,y)))
Index: wesnoth/src/display.hpp
diff -u wesnoth/src/display.hpp:1.102 wesnoth/src/display.hpp:1.103
--- wesnoth/src/display.hpp:1.102 Wed Apr 13 18:47:20 2005
+++ wesnoth/src/display.hpp Sun Apr 17 20:42:10 2005
@@ -1,4 +1,4 @@
-/* $Id: display.hpp,v 1.102 2005/04/13 18:47:20 gruikya Exp $ */
+/* $Id: display.hpp,v 1.103 2005/04/17 20:42:10 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -85,6 +85,9 @@
//function to take the zoom amount to the default.
void default_zoom();
+ //function to make a screenshot and save it in a default location
+ void screenshot();
+
//function which returns the size of a hex in pixels
//(from top tip to bottom tip or left edge to right edge)
int hex_size() const;
Index: wesnoth/src/filesystem.cpp
diff -u wesnoth/src/filesystem.cpp:1.67 wesnoth/src/filesystem.cpp:1.68
--- wesnoth/src/filesystem.cpp:1.67 Tue Apr 5 21:47:27 2005
+++ wesnoth/src/filesystem.cpp Sun Apr 17 20:42:10 2005
@@ -1,4 +1,4 @@
-/* $Id: filesystem.cpp,v 1.67 2005/04/05 21:47:27 Sirp Exp $ */
+/* $Id: filesystem.cpp,v 1.68 2005/04/17 20:42:10 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -276,6 +276,12 @@
return res;
}
+std::string get_screenshot_dir()
+{
+ const std::string dir_path = get_user_data_dir() + "/screenshots";
+ return get_dir(dir_path);
+}
+
std::string get_dir(const std::string& dir_path)
{
#ifdef _WIN32
Index: wesnoth/src/filesystem.hpp
diff -u wesnoth/src/filesystem.hpp:1.35 wesnoth/src/filesystem.hpp:1.36
--- wesnoth/src/filesystem.hpp:1.35 Sat Mar 26 14:07:16 2005
+++ wesnoth/src/filesystem.hpp Sun Apr 17 20:42:10 2005
@@ -1,4 +1,4 @@
-/* $Id: filesystem.hpp,v 1.35 2005/03/26 14:07:16 silene Exp $ */
+/* $Id: filesystem.hpp,v 1.36 2005/04/17 20:42:10 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -50,6 +50,7 @@
std::string get_saves_dir();
std::string get_cache_dir();
std::string get_intl_dir();
+std::string get_screenshot_dir();
std::string get_user_data_dir();
std::string get_cwd();
Index: wesnoth/src/hotkeys.cpp
diff -u wesnoth/src/hotkeys.cpp:1.73 wesnoth/src/hotkeys.cpp:1.74
--- wesnoth/src/hotkeys.cpp:1.73 Sat Apr 16 19:52:10 2005
+++ wesnoth/src/hotkeys.cpp Sun Apr 17 20:42:10 2005
@@ -1,4 +1,4 @@
-/* $Id: hotkeys.cpp,v 1.73 2005/04/16 19:52:10 ott Exp $ */
+/* $Id: hotkeys.cpp,v 1.74 2005/04/17 20:42:10 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -51,6 +51,7 @@
{ hotkey::HOTKEY_ZOOM_OUT, "zoomout", N_("Zoom Out"), false },
{ hotkey::HOTKEY_ZOOM_DEFAULT, "zoomdefault", N_("Default Zoom"), false
},
{ hotkey::HOTKEY_FULLSCREEN, "fullscreen", N_("Toggle Full Screen"),
false },
+ { hotkey::HOTKEY_SCREENSHOT, "screenshot", N_("Screenshot"), false },
{ hotkey::HOTKEY_ACCELERATED, "accelerated", N_("Accelerated"), false },
{ hotkey::HOTKEY_UNIT_DESCRIPTION, "describeunit", N_("Unit
Description"), false },
{ hotkey::HOTKEY_RENAME_UNIT, "renameunit", N_("Rename Unit"), false },
@@ -394,6 +395,9 @@
case HOTKEY_FULLSCREEN:
preferences::set_fullscreen(!preferences::fullscreen());
break;
+ case HOTKEY_SCREENSHOT:
+ disp.screenshot();
+ break;
case HOTKEY_ACCELERATED:
preferences::set_turbo(!preferences::turbo());
break;
Index: wesnoth/src/hotkeys.hpp
diff -u wesnoth/src/hotkeys.hpp:1.58 wesnoth/src/hotkeys.hpp:1.59
--- wesnoth/src/hotkeys.hpp:1.58 Wed Mar 23 08:52:10 2005
+++ wesnoth/src/hotkeys.hpp Sun Apr 17 20:42:10 2005
@@ -1,4 +1,4 @@
-/* $Id: hotkeys.hpp,v 1.58 2005/03/23 08:52:10 silene Exp $ */
+/* $Id: hotkeys.hpp,v 1.59 2005/04/17 20:42:10 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -31,7 +31,7 @@
HOTKEY_CYCLE_UNITS, HOTKEY_END_UNIT_TURN, HOTKEY_LEADER,
HOTKEY_UNDO, HOTKEY_REDO,
HOTKEY_ZOOM_IN, HOTKEY_ZOOM_OUT, HOTKEY_ZOOM_DEFAULT,
- HOTKEY_FULLSCREEN, HOTKEY_ACCELERATED,
+ HOTKEY_FULLSCREEN, HOTKEY_SCREENSHOT, HOTKEY_ACCELERATED,
HOTKEY_UNIT_DESCRIPTION, HOTKEY_RENAME_UNIT, HOTKEY_SAVE_GAME,
HOTKEY_LOAD_GAME,
HOTKEY_RECRUIT, HOTKEY_REPEAT_RECRUIT, HOTKEY_RECALL, HOTKEY_ENDTURN,
HOTKEY_TOGGLE_GRID, HOTKEY_STATUS_TABLE, HOTKEY_MUTE,
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.358 wesnoth/src/playturn.cpp:1.359
--- wesnoth/src/playturn.cpp:1.358 Sun Apr 17 14:35:14 2005
+++ wesnoth/src/playturn.cpp Sun Apr 17 20:42:10 2005
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.358 2005/04/17 14:35:14 gruikya Exp $ */
+/* $Id: playturn.cpp,v 1.359 2005/04/17 20:42:10 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1040,6 +1040,7 @@
case hotkey::HOTKEY_ZOOM_OUT:
case hotkey::HOTKEY_ZOOM_DEFAULT:
case hotkey::HOTKEY_FULLSCREEN:
+ case hotkey::HOTKEY_SCREENSHOT:
case hotkey::HOTKEY_ACCELERATED:
case hotkey::HOTKEY_TOGGLE_GRID:
case hotkey::HOTKEY_STATUS_TABLE:
Index: wesnoth/src/show_dialog.cpp
diff -u wesnoth/src/show_dialog.cpp:1.125 wesnoth/src/show_dialog.cpp:1.126
--- wesnoth/src/show_dialog.cpp:1.125 Sat Apr 16 19:43:47 2005
+++ wesnoth/src/show_dialog.cpp Sun Apr 17 20:42:10 2005
@@ -1,4 +1,4 @@
-/* $Id: show_dialog.cpp,v 1.125 2005/04/16 19:43:47 ott Exp $ */
+/* $Id: show_dialog.cpp,v 1.126 2005/04/17 20:42:10 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -294,7 +294,7 @@
bool can_execute_command(hotkey::HOTKEY_COMMAND cmd) const
{
- return topic_.empty() == false && cmd == hotkey::HOTKEY_HELP;
+ return (topic_.empty() == false && cmd == hotkey::HOTKEY_HELP)
|| cmd == hotkey::HOTKEY_SCREENSHOT;
}
display& disp_;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src display.cpp display.hpp filesystem....,
Philippe Plantier <=