Use the standard word wrapper in tooltips.

Previously used a bad special word wrapper (broken for long words like
in Chinese/Japanese)

The old tooltip had a maximum width of 60 chars (overwritten by long
words, so the bug).

Now the maximum width is 400 pixels and 260 for tiny-gui (+borders)

These arbitray values try to reproduce the previous size with the english fonts.
Feel free to comment/change this choice.
This commit is contained in:
Ali El Gariani 2007-05-09 23:30:35 +00:00
parent 52348f5629
commit 5cee07fe04

View file

@ -36,18 +36,23 @@ namespace {
CVideo* video_ = NULL;
static const int font_size = font::SIZE_SMALL;
#ifdef USE_TINY_GUI
static const int text_width = 260;
#else
static const int text_width = 400;
#endif
struct tooltip
{
tooltip(const SDL_Rect& r, const std::string& msg) : rect(r), message(msg)
{
font::text_to_lines(message,60);
message = font::word_wrap_text(message, font_size, text_width);
}
SDL_Rect rect;
std::string message;
};
static const int font_size = font::SIZE_SMALL;
std::vector<tooltip> tips;
std::vector<tooltip>::const_iterator current_tooltip = tips.end();