metric lookup update

better abstraction
This commit is contained in:
Glenn Maynard
2003-11-16 21:44:42 +00:00
parent dfee4589c2
commit 758381eecd
4 changed files with 27 additions and 36 deletions
+7 -3
View File
@@ -37,11 +37,15 @@ CourseContentsList::CourseContentsList()
m_quad.SetUseZBuffer( true );
for( int i = 0; i < MAX_TOTAL_CONTENTS; ++i )
{
m_CourseContentDisplays[i].SetName( "CourseEntryDisplay" );
m_CourseContentDisplays[i].Load();
m_CourseContentDisplays[i].SetUseZBuffer( true );
}
/* These are all the same; grab the dimensions. */
ContentsBarHeight = m_CourseContentDisplays[0].m_sprFrame.GetTexture()->GetSourceFrameHeight();
ContentsBarWidth = m_CourseContentDisplays[0].m_sprFrame.GetTexture()->GetSourceFrameWidth();
ContentsBarHeight = m_CourseContentDisplays[0].GetUnzoomedHeight();
ContentsBarWidth = m_CourseContentDisplays[0].GetUnzoomedWidth();
}
@@ -102,7 +106,7 @@ void CourseContentsList::DrawPrimitives()
// write to z buffer so that top and bottom are clipped
m_quad.SetZ( 1 );
RectI rectBarSize(-ContentsBarWidth/2, -ContentsBarHeight/2,
RectF rectBarSize(-ContentsBarWidth/2, -ContentsBarHeight/2,
ContentsBarWidth/2, ContentsBarHeight/2);
m_quad.StretchTo( rectBarSize );
+1 -1
View File
@@ -43,7 +43,7 @@ protected:
int m_iNumContents;
CourseEntryDisplay m_CourseContentDisplays[MAX_TOTAL_CONTENTS];
int ContentsBarHeight, ContentsBarWidth;
float ContentsBarHeight, ContentsBarWidth;
float m_fTimeUntilScroll;
float m_fItemAtTopOfList; // between 0 and m_iNumContents
+17 -31
View File
@@ -23,55 +23,41 @@
#include "Steps.h"
#include "GameState.h"
#include "StyleDef.h"
#include "ActorUtil.h"
#define TEXT_BANNER_X THEME->GetMetricF("CourseEntryDisplay","TextBannerX")
#define TEXT_BANNER_Y THEME->GetMetricF("CourseEntryDisplay","TextBannerY")
#define TEXT_BANNER_ZOOM THEME->GetMetricF("CourseEntryDisplay","TextBannerZoom")
#define NUMBER_X THEME->GetMetricF("CourseEntryDisplay","NumberX")
#define NUMBER_Y THEME->GetMetricF("CourseEntryDisplay","NumberY")
#define NUMBER_ZOOM THEME->GetMetricF("CourseEntryDisplay","NumberZoom")
#define FOOT_X THEME->GetMetricF("CourseEntryDisplay","FootX")
#define FOOT_Y THEME->GetMetricF("CourseEntryDisplay","FootY")
#define FOOT_ZOOM THEME->GetMetricF("CourseEntryDisplay","FootZoom")
#define DIFFICULTY_X THEME->GetMetricF("CourseEntryDisplay","DifficultyX")
#define DIFFICULTY_Y THEME->GetMetricF("CourseEntryDisplay","DifficultyY")
#define DIFFICULTY_ZOOM THEME->GetMetricF("CourseEntryDisplay","DifficultyZoom")
#define MODIFIERS_X THEME->GetMetricF("CourseEntryDisplay","ModifiersX")
#define MODIFIERS_Y THEME->GetMetricF("CourseEntryDisplay","ModifiersY")
#define MODIFIERS_ZOOM THEME->GetMetricF("CourseEntryDisplay","ModifiersZoom")
#define MODIFIERS_HORIZ_ALIGN THEME->GetMetricI("CourseEntryDisplay","ModifiersHorizAlign")
CourseEntryDisplay::CourseEntryDisplay()
void CourseEntryDisplay::Load()
{
m_sprFrame.SetName( "Bar" );
m_sprFrame.Load( THEME->GetPathToG("CourseEntryDisplay bar") );
SET_XY_AND_ON_COMMAND( &m_sprFrame );
this->AddChild( &m_sprFrame );
this->m_size.x = (float) m_sprFrame.GetTexture()->GetSourceFrameWidth();
this->m_size.y = (float) m_sprFrame.GetTexture()->GetSourceFrameHeight();
m_textNumber.SetName( "Number" );
m_textNumber.LoadFromFont( THEME->GetPathToF("CourseEntryDisplay number") );
m_textNumber.SetXY( NUMBER_X, NUMBER_Y );
m_textNumber.EnableShadow( false );
SET_XY_AND_ON_COMMAND( &m_textNumber );
this->AddChild( &m_textNumber );
m_TextBanner.SetXY( TEXT_BANNER_X, TEXT_BANNER_Y );
m_TextBanner.SetName( "TextBanner" );
SET_XY_AND_ON_COMMAND( &m_TextBanner );
this->AddChild( &m_TextBanner );
m_textFoot.SetName( "Foot" );
m_textFoot.LoadFromTextureAndChars( THEME->GetPathToG("CourseEntryDisplay difficulty 2x1"),"10" );
m_textFoot.SetXY( FOOT_X, FOOT_Y );
m_textFoot.EnableShadow( false );
SET_XY_AND_ON_COMMAND( &m_textFoot );
this->AddChild( &m_textFoot );
m_textDifficultyNumber.SetName( "Difficulty" );
m_textDifficultyNumber.LoadFromFont( THEME->GetPathToF("Common normal") );
m_textDifficultyNumber.SetXY( DIFFICULTY_X, DIFFICULTY_Y );
m_textDifficultyNumber.SetZoom( DIFFICULTY_ZOOM );
m_textDifficultyNumber.EnableShadow( false );
SET_XY_AND_ON_COMMAND( &m_textDifficultyNumber );
this->AddChild( &m_textDifficultyNumber );
m_textModifiers.SetName( "Modifiers" );
m_textModifiers.LoadFromFont( THEME->GetPathToF("Common normal") );
m_textModifiers.SetXY( MODIFIERS_X, MODIFIERS_Y );
m_textModifiers.SetZoom( MODIFIERS_ZOOM );
m_textModifiers.SetHorizAlign( (Actor::HorizAlign)MODIFIERS_HORIZ_ALIGN );
m_textModifiers.EnableShadow( false );
SET_XY_AND_ON_COMMAND( &m_textModifiers );
this->AddChild( &m_textModifiers );
}
+2 -1
View File
@@ -25,12 +25,13 @@ class Steps;
class CourseEntryDisplay : public ActorFrame
{
public:
CourseEntryDisplay();
void Load();
void LoadFromSongAndNotes( int iNum, Song* pSong, Steps* pNotes, CString sModifiers );
void LoadFromDifficulty( int iNum, Difficulty dc, CString sModifiers );
void LoadFromMeterRange( int iNum, int iLow, int iHigh, CString sModifiers );
private:
Sprite m_sprFrame;
BitmapText m_textNumber;
TextBanner m_TextBanner;