Tiny gui: reduce font and border size of help strings and tooltips.

This commit is contained in:
Karol Nowak 2006-08-04 13:46:36 +00:00
parent 3d39eb90d0
commit 188f759f04
2 changed files with 19 additions and 2 deletions

View file

@ -80,8 +80,15 @@ void show_tooltip(const tooltip& tip)
const SDL_Color bgcolour = {0,0,0,128};
SDL_Rect area = screen_area();
#ifdef USE_TINY_GUI
unsigned int border = 2;
#else
unsigned int border = 10;
#endif
tooltip_handle = font::add_floating_label(tip.message,font_size,font::NORMAL_COLOUR,
0,0,0,0,-1,area,font::LEFT_ALIGN,&bgcolour,10);
0,0,0,0,-1,area,font::LEFT_ALIGN,&bgcolour,border);
SDL_Rect rect = font::get_floating_label_rect(tooltip_handle);

View file

@ -403,7 +403,11 @@ int CVideo::set_help_string(const std::string& str)
const SDL_Color colour = {0x0,0x00,0x00,0x77};
#ifdef USE_TINY_GUI
int size = font::SIZE_NORMAL;
#else
int size = font::SIZE_LARGE;
#endif
while(size > 0) {
if(font::line_width(str, size) > getx()) {
@ -413,7 +417,13 @@ int CVideo::set_help_string(const std::string& str)
}
}
help_string_ = font::add_floating_label(str,size,font::NORMAL_COLOUR,getx()/2,gety(),0.0,0.0,-1,screen_area(),font::CENTER_ALIGN,&colour,5);
#ifdef USE_TINY_GUI
int border = 2;
#else
int border = 5;
#endif
help_string_ = font::add_floating_label(str,size,font::NORMAL_COLOUR,getx()/2,gety(),0.0,0.0,-1,screen_area(),font::CENTER_ALIGN,&colour,border);
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_;