wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src dialogs.cpp font.hpp


From: Yann Dirson
Subject: [Wesnoth-cvs-commits] wesnoth/src dialogs.cpp font.hpp
Date: Thu, 04 Nov 2004 16:04:18 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Yann Dirson <address@hidden>    04/11/04 20:58:43

Modified files:
        src            : dialogs.cpp font.hpp 

Log message:
        provide font::relative_size() for easy scaling of gui dimensions; use 
it to make recruit dialog fit on 320x240

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.cpp.diff?tr1=1.65&tr2=1.66&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/font.hpp.diff?tr1=1.45&tr2=1.46&r1=text&r2=text

Patches:
Index: wesnoth/src/dialogs.cpp
diff -u wesnoth/src/dialogs.cpp:1.65 wesnoth/src/dialogs.cpp:1.66
--- wesnoth/src/dialogs.cpp:1.65        Wed Nov  3 22:20:27 2004
+++ wesnoth/src/dialogs.cpp     Thu Nov  4 20:58:43 2004
@@ -1,4 +1,4 @@
-/* $Id: dialogs.cpp,v 1.65 2004/11/03 22:20:27 gruikya Exp $ */
+/* $Id: dialogs.cpp,v 1.66 2004/11/04 20:58:43 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -548,8 +548,10 @@
 
 
 namespace {
-       static const SDL_Rect unit_preview_size = {-200,-370,200,370};
-       static const SDL_Rect weaponless_unit_preview_size = 
{-190,-140,190,140};
+       static const SDL_Rect unit_preview_size = 
{-font::relative_size(200),-font::relative_size(370),
+                                                  
font::relative_size(200),font::relative_size(370)};
+       static const SDL_Rect weaponless_unit_preview_size = 
{-font::relative_size(190),-font::relative_size(140),
+                                                             
font::relative_size(190),font::relative_size(140)};
        static const int unit_preview_border = 10;
 }
 
Index: wesnoth/src/font.hpp
diff -u wesnoth/src/font.hpp:1.45 wesnoth/src/font.hpp:1.46
--- wesnoth/src/font.hpp:1.45   Sat Oct 30 13:18:04 2004
+++ wesnoth/src/font.hpp        Thu Nov  4 20:58:43 2004
@@ -1,4 +1,4 @@
-/* $Id: font.hpp,v 1.45 2004/10/30 13:18:04 gruikya Exp $ */
+/* $Id: font.hpp,v 1.46 2004/11/04 20:58:43 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -49,15 +49,19 @@
 #else
 const int SIZE_NORMAL = 14;
 #endif
+inline int relative_size(int size)
+{
+  return (SIZE_NORMAL * size / 14);
+}
 // automatic computation of other font sizes, to be made a default for 
theme-provided values
 const int
-  SIZE_TINY    = SIZE_NORMAL * 10 / 14,
-  SIZE_SMALL   = SIZE_NORMAL * 12 / 14,
+  SIZE_TINY    = relative_size(10),
+  SIZE_SMALL   = relative_size(12),
 
-  SIZE_15      = SIZE_NORMAL * 15 / 14,
-  SIZE_PLUS    = SIZE_NORMAL * 16 / 14,
-  SIZE_LARGE   = SIZE_NORMAL * 18 / 14,
-  SIZE_XLARGE  = SIZE_NORMAL * 24 / 14
+  SIZE_15      = relative_size(15),
+  SIZE_PLUS    = relative_size(16),
+  SIZE_LARGE   = relative_size(18),
+  SIZE_XLARGE  = relative_size(24)
   ;  
 //function to draw text on the screen. The text will be clipped to area.
 //If the text runs outside of area horizontally, an ellipsis will be displayed




reply via email to

[Prev in Thread] Current Thread [Next in Thread]