diff options
author | Johanna Ploog <j-p-e-g@users.sourceforge.net> | 2010-01-11 15:25:50 +0100 |
---|---|---|
committer | Johanna Ploog <j-p-e-g@users.sourceforge.net> | 2010-01-11 16:18:08 +0100 |
commit | e31ea7d79da677a7cb752d863cdb8f2942984b4f (patch) | |
tree | 38d50ebde47b4cdbaa4f9235b8f500121bf37982 /crawl-ref/source/tilefont.cc | |
parent | 40b5e8b46a50b9f3f23099983f3799534ff7e211 (diff) | |
download | crawl-ref-e31ea7d79da677a7cb752d863cdb8f2942984b4f.tar.gz crawl-ref-e31ea7d79da677a7cb752d863cdb8f2942984b4f.zip |
Experimentally draw tool tip below the mouse pointer rather than above.
It's a bit less distracting this way and doesn't cover up the inventory
header line (description).
Diffstat (limited to 'crawl-ref/source/tilefont.cc')
-rw-r--r-- | crawl-ref/source/tilefont.cc | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/crawl-ref/source/tilefont.cc b/crawl-ref/source/tilefont.cc index d8cec9c22f..e7e7bde04d 100644 --- a/crawl-ref/source/tilefont.cc +++ b/crawl-ref/source/tilefont.cc @@ -576,7 +576,8 @@ void FTFont::render_string(unsigned int px, unsigned int py, unsigned char font_colour, bool drop_shadow, unsigned char box_alpha, unsigned char box_colour, - unsigned int outline) + unsigned int outline, + bool tooltip) { ASSERT(text); @@ -626,13 +627,22 @@ void FTFont::render_string(unsigned int px, unsigned int py, int wx = string_width(text); int wy = max_rows * char_height(); - // text starting location - int tx = px - wx / 2; - int ty = py - wy - outline; + int sx, sy; // box starting location, uses extra buffer + int tx, ty; // text starting location - // box with extra buffer to test against min_pos/max_pos window size - int sx = tx - buffer; - int sy = ty - buffer; + tx = px - wx / 2; + sx = tx - buffer; + if (tooltip) + { + sy = py + outline; + ty = sy + buffer; + } + else + { + ty = py - wy - outline; + sy = ty - buffer; + } + // box ending position int ex = tx + wx + buffer; int ey = ty + wy + buffer; |