Lift the sceenshot() and get_zoom_facotor() functions.
This commit is contained in:
parent
63e81a6a31
commit
1960c1e1a7
2 changed files with 27 additions and 29 deletions
|
@ -111,6 +111,28 @@ bool display::outside_area(const SDL_Rect& area, const int x, const int y) const
|
|||
y < area.y || y > area.y + area.h - y_thresh);
|
||||
}
|
||||
|
||||
void map_display::screenshot()
|
||||
{
|
||||
std::string datadir = get_screenshot_dir();
|
||||
static 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());
|
||||
}
|
||||
|
||||
// Methods for superclass aware of units go here
|
||||
|
||||
|
@ -563,29 +585,6 @@ void display::set_default_zoom()
|
|||
set_zoom(DefaultZoom - zoom_);
|
||||
}
|
||||
|
||||
void display::screenshot()
|
||||
{
|
||||
std::string datadir = get_screenshot_dir();
|
||||
static 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(const gamemap::location& loc, SCROLL_TYPE scroll_type, bool check_fogged)
|
||||
{
|
||||
if(screen_.update_locked() || (check_fogged && fogged(loc))) {
|
||||
|
|
|
@ -95,6 +95,11 @@ public:
|
|||
//(from top tip to bottom tip or left edge to right edge)
|
||||
int hex_size() const { return zoom_; }
|
||||
|
||||
// Returns the current zoom factor.
|
||||
double get_zoom_factor() { return double(zoom_)/double(image::tile_size); }
|
||||
//function to make a screenshot and save it in a default location
|
||||
void screenshot();
|
||||
|
||||
protected:
|
||||
CVideo& screen_;
|
||||
const gamemap& map_;
|
||||
|
@ -132,12 +137,6 @@ public:
|
|||
// sets the zoom amount to the default.
|
||||
void set_default_zoom();
|
||||
|
||||
// Returns the current zoom factor.
|
||||
double get_zoom_factor() { return double(zoom_)/double(image::tile_size); }
|
||||
|
||||
//function to make a screenshot and save it in a default location
|
||||
void screenshot();
|
||||
|
||||
enum SCROLL_TYPE { SCROLL, WARP, ONSCREEN };
|
||||
|
||||
//function which will scroll such that location loc is on-screen.
|
||||
|
|
Loading…
Add table
Reference in a new issue