summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/tilefont.cc24
-rw-r--r--crawl-ref/source/tilefont.h3
-rw-r--r--crawl-ref/source/tilesdl.cc3
3 files changed, 21 insertions, 9 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;
diff --git a/crawl-ref/source/tilefont.h b/crawl-ref/source/tilefont.h
index 8ca50c9d18..8ec1356903 100644
--- a/crawl-ref/source/tilefont.h
+++ b/crawl-ref/source/tilefont.h
@@ -42,7 +42,8 @@ public:
const coord_def &min_pos, const coord_def &max_pos,
unsigned char font_colour, bool drop_shadow = false,
unsigned char box_alpha = 0,
- unsigned char box_colour = 0, unsigned int outline = 0);
+ unsigned char box_colour = 0, unsigned int outline = 0,
+ bool tooltip = false);
// FontBuffer helper functions
void store(FontBuffer &buf, float &x, float &y,
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index 07d36c948b..5610a8341a 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -1313,7 +1313,8 @@ void TilesFramework::redraw()
FTFont *font = m_fonts[m_tip_font].font;
font->render_string(m_mouse.x, m_mouse.y - 2, m_tooltip.c_str(),
- min_pos, m_windowsz, WHITE, false, 220, BLUE, 5);
+ min_pos, m_windowsz, WHITE, false, 220, BLUE, 5,
+ true);
}
SDL_GL_SwapBuffers();