From 7d2e0567525188f50a1e422f2aa7d714c07a5f2e Mon Sep 17 00:00:00 2001 From: cosmosninja Date: Sun, 3 Feb 2008 05:59:40 +0000 Subject: [PATCH] Removed a warning and fixed a bug with text scrolling introduced in the previous commit. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1437 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/widget.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/widget.cpp b/src/widget.cpp index ab59bb5ce..387e15da0 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -313,7 +313,7 @@ void Widget::update(const float DELTA) std::cerr << "(Did you set the text?)\n"; } - int x_pos = (int)m_scroll_pos_x - m_width * 0.5f; + int x_pos = (int)(m_scroll_pos_x - m_width * 0.5f); int y_pos = - (int)m_scroll_pos_y + (lines - 1 )* m_text_size / 2; size_t line_start = 0; @@ -324,18 +324,18 @@ void Widget::update(const float DELTA) do { draw = true; - if(y_pos + m_text_size / 2 > m_height ) + if(y_pos + m_text_size / 2 > m_height / 2 ) { - if(y_pos - m_text_size / 2 > m_height) draw = false; + if(y_pos - m_text_size / 2 > m_height / 2) draw = false; else { out_of_rect = true; glScissor(m_x, m_y, m_width, m_height); } } - else if(y_pos - m_text_size / 2 < 0) + else if(y_pos + (m_height - m_text_size) / 2 < 0) { - if(y_pos + m_text_size / 2 < 0) draw = false; + if(y_pos + (m_height + m_text_size) / 2 < 0) draw = false; else { out_of_rect = true;