[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src display.cpp
From: |
Yann Dirson |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src display.cpp |
Date: |
Thu, 04 Nov 2004 18:32:23 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Yann Dirson <address@hidden> 04/11/04 23:26:46
Modified files:
src : display.cpp
Log message:
consistently compute minimum allowed zoom value according to screen size
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.271&tr2=1.272&r1=text&r2=text
Patches:
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.271 wesnoth/src/display.cpp:1.272
--- wesnoth/src/display.cpp:1.271 Mon Nov 1 18:47:09 2004
+++ wesnoth/src/display.cpp Thu Nov 4 23:26:46 2004
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.271 2004/11/01 18:47:09 gruikya Exp $ */
+/* $Id: display.cpp,v 1.272 2004/11/04 23:26:46 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -44,10 +44,16 @@
std::map<gamemap::location,double> display::debugHighlights_;
namespace {
- const int MinZoom = 36;
const int DefaultZoom = 72;
const int MaxZoom = 200;
+ const int MinZoom(const gamemap& map, const SDL_Rect& viewport)
+ {
+ const int min_zoom1 = viewport.w/((map.x()*3)/4);
+ const int min_zoom2 = viewport.h/map.y();
+ const int min_zoom = maximum<int>(min_zoom1,min_zoom2);
+ }
+
const size_t SideBarGameStatus_x = 16;
const size_t SideBarGameStatus_y = 220;
@@ -370,7 +376,7 @@
const int orig_zoom = zoom_;
zoom_ += amount;
- if(zoom_ < MinZoom || zoom_ > MaxZoom) {
+ if(zoom_ < MinZoom(map_,map_area()) || zoom_ > MaxZoom) {
zoom_ = orig_zoom;
xpos_ = orig_xpos;
ypos_ = orig_ypos;
@@ -477,9 +483,7 @@
void display::bounds_check_position()
{
- const int min_zoom1 = map_area().w/((map_.x()*3)/4);
- const int min_zoom2 = map_area().h/map_.y();
- const int min_zoom = maximum<int>(min_zoom1,min_zoom2);
+ const int min_zoom = MinZoom(map_,map_area());
const int orig_zoom = zoom_;