rename RoomWheelData to RoomWheelItemData, move visual elements out of WheelItemBaseData
This commit is contained in:
@@ -126,7 +126,7 @@ void RoomInfoDisplay::Load( RString sType )
|
||||
m_state = LOCKED;
|
||||
}
|
||||
|
||||
void RoomInfoDisplay::SetRoom( const RoomWheelData* roomData )
|
||||
void RoomInfoDisplay::SetRoom( const RoomWheelItemData* roomData )
|
||||
{
|
||||
RequestRoomInfo(roomData->m_sText);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
~RoomInfoDisplay();
|
||||
virtual void Load( RString sType );
|
||||
virtual void Update( float fDeltaTime );
|
||||
void SetRoom( const RoomWheelData* roomData );
|
||||
void SetRoom( const RoomWheelItemData* roomData );
|
||||
void SetRoomInfo( const RoomInfo& info);
|
||||
void DeployInfoBox();
|
||||
void RetractInfoBox();
|
||||
|
||||
@@ -11,6 +11,11 @@ AutoScreenMessage( SM_BackFromRoomName )
|
||||
AutoScreenMessage( SM_RoomInfoRetract )
|
||||
AutoScreenMessage( SM_RoomInfoDeploy )
|
||||
|
||||
ThemeMetric<float> TEXT_X;
|
||||
ThemeMetric<float> TEXT_Y;
|
||||
ThemeMetric<float> TEXT_WIDTH;
|
||||
ThemeMetric<apActorCommands> TEXT_ON_COMMAND;
|
||||
|
||||
ThemeMetric<float> DESC_X;
|
||||
ThemeMetric<float> DESC_Y;
|
||||
ThemeMetric<float> DESC_WIDTH;
|
||||
@@ -29,7 +34,7 @@ void RoomWheel::Load( RString sType )
|
||||
m_offset = 0;
|
||||
LOG->Trace( "RoomWheel::Load('%s')", sType.c_str() );
|
||||
|
||||
AddPerminateItem( new RoomWheelData(TYPE_GENERIC, "Create Room", "Create a new game room", THEME->GetMetricC( m_sName, "CreateRoomColor")) );
|
||||
AddPerminateItem( new RoomWheelItemData(TYPE_GENERIC, "Create Room", "Create a new game room", THEME->GetMetricC( m_sName, "CreateRoomColor")) );
|
||||
|
||||
BuildWheelItemsData( m_CurWheelItemData );
|
||||
RebuildWheelItems();
|
||||
@@ -48,13 +53,36 @@ RoomWheelItem::RoomWheelItem( RString sType ):
|
||||
|
||||
RoomWheelItem::RoomWheelItem( const RoomWheelItem &cpy ):
|
||||
WheelItemBase( cpy ),
|
||||
m_sprBar( cpy.m_sprBar ),
|
||||
m_text( cpy.m_text ),
|
||||
m_Desc( cpy.m_Desc )
|
||||
{
|
||||
this->AddChild( &m_Desc );
|
||||
if( cpy.GetNumChildren() != 0 )
|
||||
{
|
||||
this->AddChild( m_sprBar );
|
||||
this->AddChild( &m_text );
|
||||
this->AddChild( &m_Desc );
|
||||
}
|
||||
}
|
||||
|
||||
void RoomWheelItem::Load( RString sType )
|
||||
{
|
||||
TEXT_X .Load(sType,"TextX");
|
||||
TEXT_Y .Load(sType,"TextY");
|
||||
TEXT_ON_COMMAND .Load(sType,"TextOnCommand");
|
||||
|
||||
m_sprBar.Load( THEME->GetPathG(sType,"bar") );
|
||||
m_sprBar->SetXY( 0, 0 );
|
||||
this->AddChild( m_sprBar );
|
||||
m_sprBar->SetVisible(false);
|
||||
|
||||
m_text.LoadFromFont( THEME->GetPathF(sType,"text") );
|
||||
m_text.SetShadowLength( 0 );
|
||||
m_text.SetXY( TEXT_X, TEXT_Y );
|
||||
m_text.RunCommands( TEXT_ON_COMMAND );
|
||||
this->AddChild( &m_text );
|
||||
|
||||
|
||||
DESC_X .Load(sType,"DescX");
|
||||
DESC_Y .Load(sType,"DescY");
|
||||
DESC_WIDTH .Load(sType,"DescWidth");
|
||||
@@ -77,10 +105,10 @@ void RoomWheelItem::Load( RString sType )
|
||||
void RoomWheel::BuildWheelItemsData( vector<WheelItemBaseData*> &arrayWheelItemDatas )
|
||||
{
|
||||
if( arrayWheelItemDatas.empty() )
|
||||
arrayWheelItemDatas.push_back( new RoomWheelData(TYPE_GENERIC, "- EMPTY -", "", RageColor(1,0,0,1)) );
|
||||
arrayWheelItemDatas.push_back( new RoomWheelItemData(TYPE_GENERIC, "- EMPTY -", "", RageColor(1,0,0,1)) );
|
||||
}
|
||||
|
||||
void RoomWheel::AddPerminateItem( RoomWheelData *itemdata )
|
||||
void RoomWheel::AddPerminateItem( RoomWheelItemData *itemdata )
|
||||
{
|
||||
++m_offset;
|
||||
AddItem( itemdata );
|
||||
@@ -149,18 +177,22 @@ bool RoomWheel::Select()
|
||||
|
||||
void RoomWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pWID, int iIndex, bool bHasFocus )
|
||||
{
|
||||
const RoomWheelData *tmpdata = dynamic_cast<const RoomWheelData*>( pWID );
|
||||
WheelItemBase::LoadFromWheelItemData( pWID, iIndex, bHasFocus );
|
||||
|
||||
m_text.SetText( pWID->m_sText );
|
||||
m_text.SetDiffuseColor( pWID->m_color );
|
||||
|
||||
const RoomWheelItemData *tmpdata = dynamic_cast<const RoomWheelItemData*>( pWID );
|
||||
WheelItemBase::LoadFromWheelItemData( pWID, iIndex, bHasFocus );
|
||||
m_Desc.SetText( tmpdata->m_sDesc );
|
||||
m_Desc.SetDiffuseColor( pWID->m_color );
|
||||
m_text.SetDiffuseColor( pWID->m_color );
|
||||
}
|
||||
|
||||
void RoomWheel::Move( int n )
|
||||
{
|
||||
if( n == 0 && m_iSelection >= m_offset )
|
||||
{
|
||||
const RoomWheelData* data = GetItem( m_iSelection-m_offset );
|
||||
const RoomWheelItemData* data = GetItem( m_iSelection-m_offset );
|
||||
if( data != NULL )
|
||||
SCREENMAN->PostMessageToTopScreen( SM_RoomInfoDeploy, 0 );
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
#include "WheelItemBase.h"
|
||||
#include "ThemeMetric.h"
|
||||
|
||||
struct RoomWheelData : public WheelItemBaseData
|
||||
struct RoomWheelItemData : public WheelItemBaseData
|
||||
{
|
||||
RoomWheelData() : m_iFlags(0) { }
|
||||
RoomWheelData( WheelItemType wit, const RString& sTitle, const RString& sDesc, RageColor color ):
|
||||
WheelItemBaseData( wit, sTitle, color ), m_sDesc(sDesc), m_iFlags(0) { };
|
||||
RoomWheelItemData() : m_iFlags(0) { }
|
||||
RoomWheelItemData( WheelItemDataType type, const RString& sTitle, const RString& sDesc, RageColor color ):
|
||||
WheelItemBaseData( type, sTitle, color ), m_sDesc(sDesc), m_iFlags(0) { };
|
||||
|
||||
RString m_sDesc;
|
||||
unsigned int m_iFlags;
|
||||
@@ -28,7 +28,9 @@ public:
|
||||
virtual RoomWheelItem *Copy() const { return new RoomWheelItem(*this); }
|
||||
|
||||
private:
|
||||
BitmapText m_Desc;
|
||||
AutoActor m_sprBar;
|
||||
BitmapText m_text;
|
||||
BitmapText m_Desc;
|
||||
};
|
||||
|
||||
struct RoomInfo
|
||||
@@ -51,8 +53,8 @@ public:
|
||||
virtual bool Select();
|
||||
virtual void Move( int n );
|
||||
|
||||
inline RoomWheelData *GetItem( unsigned int i ) { return dynamic_cast<RoomWheelData*>( WheelBase::GetItem(i + m_offset) ); }
|
||||
void AddPerminateItem( RoomWheelData *itemdata );
|
||||
inline RoomWheelItemData *GetItem( unsigned int i ) { return dynamic_cast<RoomWheelItemData*>( WheelBase::GetItem(i + m_offset) ); }
|
||||
void AddPerminateItem( RoomWheelItemData *itemdata );
|
||||
int GetCurrentIndex() const { return m_iSelection; }
|
||||
int GetPerminateOffset() const { return m_offset; }
|
||||
void AddItem( WheelItemBaseData *itemdata );
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "global.h"
|
||||
#include "WheelItemBase.h"
|
||||
|
||||
WheelItemBaseData::WheelItemBaseData( WheelItemType wit, RString sText, RageColor color )
|
||||
WheelItemBaseData::WheelItemBaseData( WheelItemDataType type, RString sText, RageColor color )
|
||||
{
|
||||
m_Type = wit;
|
||||
m_Type = type;
|
||||
m_sText = sText;
|
||||
m_color = color;
|
||||
}
|
||||
@@ -11,69 +11,31 @@ WheelItemBaseData::WheelItemBaseData( WheelItemType wit, RString sText, RageColo
|
||||
WheelItemBase::WheelItemBase( const WheelItemBase &cpy ):
|
||||
ActorFrame( cpy ),
|
||||
m_bExpanded( cpy.m_bExpanded ),
|
||||
m_sprBar( cpy.m_sprBar ),
|
||||
m_text( cpy.m_text ),
|
||||
m_Type( cpy.m_Type ),
|
||||
m_color( cpy.m_color )
|
||||
m_pData( cpy.m_pData )
|
||||
{
|
||||
if( cpy.m_pBar == cpy.m_sprBar )
|
||||
m_pBar = m_sprBar;
|
||||
|
||||
if( cpy.GetNumChildren() != 0 )
|
||||
{
|
||||
this->AddChild( m_sprBar );
|
||||
this->AddChild( &m_text );
|
||||
}
|
||||
// FIXME
|
||||
//if( cpy.m_pGrayBar == cpy.m_sprBar )
|
||||
// m_pGrayBar = m_sprBar;
|
||||
}
|
||||
|
||||
WheelItemBase::WheelItemBase(RString sType)
|
||||
{
|
||||
m_bExpanded = false;
|
||||
SetName( sType );
|
||||
m_pBar = NULL;
|
||||
m_pData = NULL;
|
||||
m_bExpanded = false;
|
||||
m_pGrayBar = NULL;
|
||||
Load(sType);
|
||||
}
|
||||
|
||||
void WheelItemBase::Load( RString sType )
|
||||
{
|
||||
TEXT_X .Load(sType,"TextX");
|
||||
TEXT_Y .Load(sType,"TextY");
|
||||
TEXT_ON_COMMAND .Load(sType,"TextOnCommand");
|
||||
|
||||
m_colorLocked = RageColor(0,0,0,0);
|
||||
|
||||
m_sprBar.Load( THEME->GetPathG(sType,"bar") );
|
||||
m_sprBar->SetXY( 0, 0 );
|
||||
this->AddChild( m_sprBar );
|
||||
m_pBar = m_sprBar;
|
||||
|
||||
m_text.LoadFromFont( THEME->GetPathF(sType,"text") );
|
||||
m_text.SetShadowLength( 0 );
|
||||
m_text.SetXY( TEXT_X, TEXT_Y );
|
||||
m_text.RunCommands( TEXT_ON_COMMAND );
|
||||
this->AddChild( &m_text );
|
||||
}
|
||||
|
||||
void WheelItemBase::LoadFromWheelItemData( const WheelItemBaseData* pWID, int iIndex, bool bHasFocus )
|
||||
{
|
||||
ASSERT( pWID != NULL );
|
||||
|
||||
data = pWID;
|
||||
|
||||
m_text.SetText(pWID->m_sText);
|
||||
m_Type = pWID->m_Type;
|
||||
m_color = pWID->m_color;
|
||||
|
||||
// init type specific stuff
|
||||
switch( pWID->m_Type )
|
||||
{
|
||||
case TYPE_GENERIC:
|
||||
m_text.SetText( data->m_sText );
|
||||
m_text.SetDiffuse( data->m_color );
|
||||
break;
|
||||
default:
|
||||
ASSERT( 0 ); // invalid type
|
||||
}
|
||||
m_pData = pWID;
|
||||
}
|
||||
|
||||
void WheelItemBase::DrawGrayBar( Actor& bar )
|
||||
@@ -97,8 +59,8 @@ void WheelItemBase::DrawPrimitives()
|
||||
{
|
||||
ActorFrame::DrawPrimitives();
|
||||
|
||||
if( m_pBar != NULL )
|
||||
DrawGrayBar( *m_pBar );
|
||||
if( m_pGrayBar != NULL )
|
||||
DrawGrayBar( *m_pGrayBar );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
struct WheelItemBaseData;
|
||||
|
||||
enum WheelItemType
|
||||
enum WheelItemDataType
|
||||
{
|
||||
TYPE_GENERIC,
|
||||
TYPE_SECTION,
|
||||
@@ -23,10 +23,20 @@ enum WheelItemType
|
||||
TYPE_SORT
|
||||
};
|
||||
|
||||
struct WheelItemBaseData
|
||||
{
|
||||
WheelItemBaseData() {}
|
||||
WheelItemBaseData( WheelItemDataType type, RString sText, RageColor color );
|
||||
virtual ~WheelItemBaseData() {}
|
||||
WheelItemDataType m_Type;
|
||||
RString m_sText;
|
||||
RageColor m_color; // either text color or section background color
|
||||
};
|
||||
|
||||
class WheelItemBase : public ActorFrame
|
||||
{
|
||||
public:
|
||||
WheelItemBase( RString sType = "WheelItemBase" );
|
||||
WheelItemBase( RString sType );
|
||||
WheelItemBase( const WheelItemBase &cpy );
|
||||
virtual void DrawPrimitives();
|
||||
virtual WheelItemBase *Copy() const { return new WheelItemBase(*this); }
|
||||
@@ -37,34 +47,15 @@ public:
|
||||
|
||||
virtual void LoadFromWheelItemData( const WheelItemBaseData* pWID, int iIndex, bool bHasFocus );
|
||||
|
||||
RageColor m_colorLocked;
|
||||
RageColor m_colorLocked;
|
||||
|
||||
protected:
|
||||
void SetGrayBar( Actor *pBar ) { m_pBar = pBar; }
|
||||
void SetGrayBar( Actor *pBar ) { m_pGrayBar = pBar; }
|
||||
|
||||
const WheelItemBaseData* data;
|
||||
const WheelItemBaseData* m_pData;
|
||||
bool m_bExpanded; // if TYPE_SECTION, whether this section is expanded
|
||||
|
||||
Actor* m_pBar;
|
||||
AutoActor m_sprBar;
|
||||
BitmapText m_text;
|
||||
WheelItemType m_Type;
|
||||
RageColor m_color;
|
||||
|
||||
ThemeMetric<float> TEXT_X;
|
||||
ThemeMetric<float> TEXT_Y;
|
||||
ThemeMetric<float> TEXT_WIDTH;
|
||||
ThemeMetric<apActorCommands> TEXT_ON_COMMAND;
|
||||
};
|
||||
|
||||
struct WheelItemBaseData
|
||||
{
|
||||
WheelItemBaseData() {}
|
||||
WheelItemBaseData( WheelItemType wit, RString sText, RageColor color );
|
||||
virtual ~WheelItemBaseData() {}
|
||||
WheelItemType m_Type;
|
||||
RString m_sText;
|
||||
RageColor m_color; // either text color or section background color
|
||||
Actor* m_pGrayBar;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user