@@ -533,7 +533,7 @@ int MainMenuGUI::Create(Controller *pController)
533
533
}
534
534
535
535
// Read all the credits from the file and set the credits label
536
- GUILabel *pCreditsLabel = dynamic_cast <GUILabel *>(m_pGUIController->GetControl (" CreditsLabel" ));
536
+ m_CreditsLabel = dynamic_cast <GUILabel *>(m_pGUIController->GetControl (" CreditsLabel" ));
537
537
Reader creditsReader (" Credits.txt" );
538
538
string creditsText = creditsReader.ReadTo (' #' , true );
539
539
@@ -548,8 +548,8 @@ int MainMenuGUI::Create(Controller *pController)
548
548
if (*sItr == -87 )// '©')
549
549
(*sItr ) = (char )221 ;
550
550
}
551
- pCreditsLabel ->SetText (creditsText);
552
- m_pScrollPanel-> Resize (m_pScrollPanel-> GetWidth (), pCreditsLabel-> ResizeHeightToFit () );
551
+ m_CreditsLabel ->SetText (creditsText);
552
+ m_CreditsLabel-> ResizeHeightToFit ();
553
553
554
554
// Set initial focus, category list, and label settings
555
555
m_ScreenChange = true ;
@@ -827,21 +827,20 @@ void MainMenuGUI::Update()
827
827
m_MainMenuButtons[BACKTOMAIN]->SetVisible (true );
828
828
m_apScreenBox[CREDITSSCREEN]->GUIPanel ::AddChild (m_MainMenuButtons[BACKTOMAIN]);
829
829
m_MainMenuButtons[BACKTOMAIN]->SetPositionRel (240 , 298 );
830
- // Set the scroll panel to be out of sight at the bottom of the credits screen box
831
- m_pScrollPanel ->SetPositionRel (0 , m_apScreenBox[CREDITSSCREEN] ->GetHeight ());
830
+ m_pScrollPanel-> SetPositionRel ( 0 , 0 );
831
+ m_CreditsLabel ->SetPositionRel (0 , m_pScrollPanel ->GetHeight ());
832
832
m_ScrollTimer.Reset ();
833
833
m_ScreenChange = false ;
834
834
}
835
835
836
- long scrollTime = 180000 ;
836
+ long scrollTime = 90000 ;
837
837
float scrollProgress = (float )m_ScrollTimer.GetElapsedRealTimeMS () / (float )scrollTime;
838
- int scrollDist = -m_apScreenBox[CREDITSSCREEN]->GetHeight () + (-m_pScrollPanel->GetHeight ());
839
- // Scroll the scroll panel upwards, GetYPos returns absolute coordinates
840
- m_pScrollPanel->SetPositionRel (0 , m_apScreenBox[CREDITSSCREEN]->GetHeight () + (scrollDist * scrollProgress));
838
+ int scrollDist = m_pScrollPanel->GetHeight () + m_CreditsLabel->GetHeight ();
839
+ m_CreditsLabel->SetPositionRel (0 , m_pScrollPanel->GetHeight () - static_cast <int >(static_cast <float >(scrollDist) * scrollProgress));
841
840
// If we've scrolled through the whole thing, reset to the bottom and restart scroll
842
841
if (m_ScrollTimer.IsPastRealMS (scrollTime))
843
842
{
844
- m_pScrollPanel ->SetPositionRel (0 , m_apScreenBox[CREDITSSCREEN] ->GetHeight ());
843
+ m_CreditsLabel ->SetPositionRel (0 , m_pScrollPanel ->GetHeight ());
845
844
m_ScrollTimer.Reset ();
846
845
}
847
846
0 commit comments