Files
itgmania212121/stepmania/src/ScrollBar.cpp
T

54 lines
1.7 KiB
C++
Raw Normal View History

2002-05-01 19:14:55 +00:00
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
Class: ScrollBar
Desc: See header.
2002-05-19 01:59:48 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
2002-05-01 19:14:55 +00:00
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ScrollBar.h"
2002-07-23 01:41:40 +00:00
#include "PrefsManager.h"
2002-05-01 19:14:55 +00:00
#include "GameConstantsAndTypes.h"
const float BAR_HEIGHT = 376;
ScrollBar::ScrollBar()
{
m_sprBackground.Load( THEME->GetPathTo("Graphics","select music scrollbar") );
2002-05-01 19:14:55 +00:00
m_sprBackground.StopAnimating();
2002-07-23 01:41:40 +00:00
m_sprBackground.SetState( 1 );
2002-05-01 19:14:55 +00:00
m_sprBackground.SetZoomY( BAR_HEIGHT/m_sprBackground.GetUnzoomedHeight() );
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_sprBackground );
2002-05-01 19:14:55 +00:00
m_sprTopButton.Load( THEME->GetPathTo("Graphics","select music scrollbar") );
2002-05-01 19:14:55 +00:00
m_sprTopButton.StopAnimating();
m_sprTopButton.SetState( 0 );
m_sprTopButton.SetY( -BAR_HEIGHT/2 );
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_sprTopButton );
2002-05-01 19:14:55 +00:00
m_sprBottomButton.Load( THEME->GetPathTo("Graphics","select music scrollbar") );
2002-05-01 19:14:55 +00:00
m_sprBottomButton.StopAnimating();
2002-07-23 01:41:40 +00:00
m_sprBottomButton.SetState( 2 );
2002-05-01 19:14:55 +00:00
m_sprBottomButton.SetY( BAR_HEIGHT/2 );
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_sprBottomButton );
2002-05-01 19:14:55 +00:00
m_sprScrollThumb.Load( THEME->GetPathTo("Graphics","select music scrollbar") );
2002-05-01 19:14:55 +00:00
m_sprScrollThumb.StopAnimating();
2002-07-23 01:41:40 +00:00
m_sprScrollThumb.SetState( 3 );
2002-05-01 19:14:55 +00:00
m_sprScrollThumb.SetY( CENTER_Y );
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_sprScrollThumb );
2002-05-01 19:14:55 +00:00
}
void ScrollBar::SetPercentage( float fPercentageFromTop )
{
if( fPercentageFromTop < 0 ) fPercentageFromTop += 1;
fPercentageFromTop = fmodf( fPercentageFromTop, 1 );
float fY = -BAR_HEIGHT/2+16 + fPercentageFromTop*(BAR_HEIGHT-32);
m_sprScrollThumb.SetY( (float)roundf(fY) );
2002-05-01 19:14:55 +00:00
}