Fixed wobbling of the text.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1390 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
3bbb4d1749
commit
2c42105449
@ -89,10 +89,6 @@ void Font::Print(const char *text, int size,
|
||||
int height = top-bottom+1;
|
||||
y = (height - H)/2 + bottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
y -= H/2;
|
||||
}
|
||||
|
||||
m_text_out->begin();
|
||||
m_text_out->setPointSize((float)sz);
|
||||
|
@ -185,6 +185,7 @@ void Widget::update(const float DELTA)
|
||||
m_font->getBBox(m_text.c_str(), m_text_size, false, &left, &right, NULL, NULL);
|
||||
int text_width = (int)(right - left + 0.99);
|
||||
|
||||
|
||||
const int Y_LIMIT = lines * m_text_size + m_height;
|
||||
|
||||
//A work around for yet another bug with multilines: we get the wrong
|
||||
@ -305,6 +306,8 @@ void Widget::update(const float DELTA)
|
||||
size_t line_start = 0;
|
||||
bool draw;
|
||||
bool out_of_rect = false;
|
||||
float top, bottom;
|
||||
int text_height;
|
||||
|
||||
glEnable( GL_SCISSOR_TEST );
|
||||
do
|
||||
@ -330,6 +333,12 @@ void Widget::update(const float DELTA)
|
||||
}
|
||||
|
||||
line_end = m_text.find_first_of('\n', line_start);
|
||||
|
||||
m_font->getBBox(m_text.substr(line_start, line_end - line_start).
|
||||
c_str(), m_text_size, false, NULL, NULL, &top, &bottom);
|
||||
text_height = (int)(bottom - top + 0.99);
|
||||
y_pos -= text_height / 2;
|
||||
|
||||
if( draw )
|
||||
{
|
||||
m_font->Print(m_text.substr(line_start, line_end - line_start).c_str(), m_text_size,
|
||||
|
Loading…
x
Reference in New Issue
Block a user