Merge pull request #269 from zhykzhykzhyk/master

Add UIContext::DrawTextShadow for drawing text correctly under Qt
This commit is contained in:
Henrik Rydgård 2015-05-07 23:20:31 +02:00
commit dfa3a93d02
2 changed files with 7 additions and 0 deletions

View File

@ -152,6 +152,12 @@ void UIContext::DrawText(const char *str, float x, float y, uint32_t color, int
}
}
void UIContext::DrawTextShadow(const char *str, float x, float y, uint32_t color, int align) {
uint32_t alpha = (color >> 1) & 0xFF000000;
DrawText(str, x + 2, y + 2, alpha, align);
DrawText(str, x, y, color, align);
}
void UIContext::DrawTextRect(const char *str, const Bounds &bounds, uint32_t color, int align) {
if (!textDrawer_ || (align & FLAG_DYNAMIC_ASCII)) {
float sizeFactor = (float)fontStyle_->sizePts / 24.0f;

View File

@ -61,6 +61,7 @@ public:
void MeasureTextCount(const UI::FontStyle &style, const char *str, int count, float *x, float *y, int align = 0) const;
void MeasureText(const UI::FontStyle &style, const char *str, float *x, float *y, int align = 0) const;
void DrawText(const char *str, float x, float y, uint32_t color, int align = 0);
void DrawTextShadow(const char *str, float x, float y, uint32_t color, int align = 0);
void DrawTextRect(const char *str, const Bounds &bounds, uint32_t color, int align = 0);
void FillRect(const UI::Drawable &drawable, const Bounds &bounds);