Bugfix: scrolling wasn't using the delta time.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1376 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2008-01-08 03:40:36 +00:00
parent c56020e0bf
commit 49dc3abc5b
5 changed files with 11 additions and 11 deletions

View File

@ -77,7 +77,7 @@ CreditsMenu::CreditsMenu()
//FIXME: maybe I should make scroll names more consistent
widget_manager->enableWgtScroll( WTOK_CREDITS );
widget_manager->setWgtYScrollPos( WTOK_CREDITS, WGT_SCROLL_START_BOTTOM );
widget_manager->setWgtYScrollSpeed( WTOK_CREDITS, -0.25f );
widget_manager->setWgtYScrollSpeed( WTOK_CREDITS, -100 );
widget_manager->breakLine();
widget_manager->addWgt( WTOK_QUIT, 40, 7);

View File

@ -264,8 +264,8 @@ void Widget::update(const float DELTA)
if(m_enable_scroll)
{
//TODO: constrain speed to sane values
m_scroll_pos_x += m_scroll_speed_x;
m_scroll_pos_y += m_scroll_speed_y;
m_scroll_pos_x += m_scroll_speed_x * DELTA;
m_scroll_pos_y += m_scroll_speed_y * DELTA;
//Y-axis wrapping
if(m_scroll_pos_y * 2 > Y_LIMIT)

View File

@ -154,8 +154,8 @@ class Widget
bool m_enable_scroll;
float m_scroll_pos_x;
float m_scroll_pos_y;
float m_scroll_speed_x;
float m_scroll_speed_y;
int m_scroll_speed_x;
int m_scroll_speed_y;
//The widget calls the Track::drawScaled2D() function to draw a given
//track, and m_track_num tells which track to draw.

View File

@ -87,8 +87,8 @@ bool WidgetManager::addWgt
new_id.widget->m_enable_scroll = m_default_enable_scroll;
new_id.widget->m_scroll_pos_x = (float)m_default_scroll_preset_x;
new_id.widget->m_scroll_pos_y = (float)m_default_scroll_preset_y;
new_id.widget->m_scroll_speed_x = (float)m_default_scroll_x_speed;
new_id.widget->m_scroll_speed_y = (float)m_default_scroll_y_speed;
new_id.widget->m_scroll_speed_x = m_default_scroll_x_speed;
new_id.widget->m_scroll_speed_y = m_default_scroll_y_speed;
new_id.widget->m_enable_track = m_default_show_track;
new_id.widget->m_track_num = m_default_track_num;
@ -1076,7 +1076,7 @@ void WidgetManager::setWgtYScrollPos
}
//-----------------------------------------------------------------------------
void WidgetManager::setWgtXScrollSpeed( const int TOKEN, const float SPEED )
void WidgetManager::setWgtXScrollSpeed( const int TOKEN, const int SPEED )
{
const int ID = findId(TOKEN);
if( ID != WGT_NONE ) m_widgets[ID].widget->m_scroll_speed_x = SPEED;
@ -1088,7 +1088,7 @@ void WidgetManager::setWgtYScrollPos
}
//-----------------------------------------------------------------------------
void WidgetManager::setWgtYScrollSpeed( const int TOKEN, const float SPEED )
void WidgetManager::setWgtYScrollSpeed( const int TOKEN, const int SPEED )
{
const int ID = findId(TOKEN);
if( ID != WGT_NONE ) m_widgets[ID].widget->m_scroll_speed_y = SPEED;

View File

@ -229,8 +229,8 @@ public:
void disableWgtScroll( const int TOKEN );
void setWgtXScrollPos( const int TOKEN, const WidgetScrollPos POS );
void setWgtYScrollPos( const int TOKEN, const WidgetScrollPos POS );
void setWgtXScrollSpeed( const int TOKEN, const float SPEED );
void setWgtYScrollSpeed( const int TOKEN, const float SPEED );
void setWgtXScrollSpeed( const int TOKEN, const int SPEED );
void setWgtYScrollSpeed( const int TOKEN, const int SPEED );
void showWgtTrack( const int TOKEN );
void hideWgtTrack( const int TOKEN );