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

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

[Wesnoth-cvs-commits] wesnoth/src display.cpp


From: Philippe Plantier
Subject: [Wesnoth-cvs-commits] wesnoth/src display.cpp
Date: Wed, 27 Oct 2004 17:16:56 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Philippe Plantier <address@hidden>      04/10/27 21:11:32

Modified files:
        src            : display.cpp 

Log message:
        Made help strings be displayed in a smaller font if they do not fit in 
the screen.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.269&tr2=1.270&r1=text&r2=text

Patches:
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.269 wesnoth/src/display.cpp:1.270
--- wesnoth/src/display.cpp:1.269       Tue Oct 19 20:49:09 2004
+++ wesnoth/src/display.cpp     Wed Oct 27 21:11:31 2004
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.269 2004/10/19 20:49:09 gruikya Exp $ */
+/* $Id: display.cpp,v 1.270 2004/10/27 21:11:31 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -2169,7 +2169,18 @@
        font::remove_floating_label(help_string_);
 
        const SDL_Color colour = {0x0,0x00,0x00,0x77};
-       help_string_ = 
font::add_floating_label(str,font::SIZE_LARGE,font::NORMAL_COLOUR,x()/2,y(),0.0,0.0,-1,screen_area(),font::CENTER_ALIGN,&colour,5);
+
+       int size = font::SIZE_LARGE;
+
+       while(size > 0) {
+               if(font::line_width(str, size) > x()) {
+                       size--;
+               } else {
+                       break;
+               }
+       }
+
+       help_string_ = 
font::add_floating_label(str,size,font::NORMAL_COLOUR,x()/2,y(),0.0,0.0,-1,screen_area(),font::CENTER_ALIGN,&colour,5);
        const SDL_Rect& rect = font::get_floating_label_rect(help_string_);
        font::move_floating_label(help_string_,0.0,-double(rect.h));
        return help_string_;




reply via email to

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