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;
|
m_state = LOCKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomInfoDisplay::SetRoom( const RoomWheelData* roomData )
|
void RoomInfoDisplay::SetRoom( const RoomWheelItemData* roomData )
|
||||||
{
|
{
|
||||||
RequestRoomInfo(roomData->m_sText);
|
RequestRoomInfo(roomData->m_sText);
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public:
|
|||||||
~RoomInfoDisplay();
|
~RoomInfoDisplay();
|
||||||
virtual void Load( RString sType );
|
virtual void Load( RString sType );
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
void SetRoom( const RoomWheelData* roomData );
|
void SetRoom( const RoomWheelItemData* roomData );
|
||||||
void SetRoomInfo( const RoomInfo& info);
|
void SetRoomInfo( const RoomInfo& info);
|
||||||
void DeployInfoBox();
|
void DeployInfoBox();
|
||||||
void RetractInfoBox();
|
void RetractInfoBox();
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ AutoScreenMessage( SM_BackFromRoomName )
|
|||||||
AutoScreenMessage( SM_RoomInfoRetract )
|
AutoScreenMessage( SM_RoomInfoRetract )
|
||||||
AutoScreenMessage( SM_RoomInfoDeploy )
|
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_X;
|
||||||
ThemeMetric<float> DESC_Y;
|
ThemeMetric<float> DESC_Y;
|
||||||
ThemeMetric<float> DESC_WIDTH;
|
ThemeMetric<float> DESC_WIDTH;
|
||||||
@@ -29,7 +34,7 @@ void RoomWheel::Load( RString sType )
|
|||||||
m_offset = 0;
|
m_offset = 0;
|
||||||
LOG->Trace( "RoomWheel::Load('%s')", sType.c_str() );
|
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 );
|
BuildWheelItemsData( m_CurWheelItemData );
|
||||||
RebuildWheelItems();
|
RebuildWheelItems();
|
||||||
@@ -48,13 +53,36 @@ RoomWheelItem::RoomWheelItem( RString sType ):
|
|||||||
|
|
||||||
RoomWheelItem::RoomWheelItem( const RoomWheelItem &cpy ):
|
RoomWheelItem::RoomWheelItem( const RoomWheelItem &cpy ):
|
||||||
WheelItemBase( cpy ),
|
WheelItemBase( cpy ),
|
||||||
|
m_sprBar( cpy.m_sprBar ),
|
||||||
|
m_text( cpy.m_text ),
|
||||||
m_Desc( cpy.m_Desc )
|
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 )
|
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_X .Load(sType,"DescX");
|
||||||
DESC_Y .Load(sType,"DescY");
|
DESC_Y .Load(sType,"DescY");
|
||||||
DESC_WIDTH .Load(sType,"DescWidth");
|
DESC_WIDTH .Load(sType,"DescWidth");
|
||||||
@@ -77,10 +105,10 @@ void RoomWheelItem::Load( RString sType )
|
|||||||
void RoomWheel::BuildWheelItemsData( vector<WheelItemBaseData*> &arrayWheelItemDatas )
|
void RoomWheel::BuildWheelItemsData( vector<WheelItemBaseData*> &arrayWheelItemDatas )
|
||||||
{
|
{
|
||||||
if( arrayWheelItemDatas.empty() )
|
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;
|
++m_offset;
|
||||||
AddItem( itemdata );
|
AddItem( itemdata );
|
||||||
@@ -149,18 +177,22 @@ bool RoomWheel::Select()
|
|||||||
|
|
||||||
void RoomWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pWID, int iIndex, bool bHasFocus )
|
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 );
|
WheelItemBase::LoadFromWheelItemData( pWID, iIndex, bHasFocus );
|
||||||
m_Desc.SetText( tmpdata->m_sDesc );
|
m_Desc.SetText( tmpdata->m_sDesc );
|
||||||
m_Desc.SetDiffuseColor( pWID->m_color );
|
m_Desc.SetDiffuseColor( pWID->m_color );
|
||||||
m_text.SetDiffuseColor( pWID->m_color );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomWheel::Move( int n )
|
void RoomWheel::Move( int n )
|
||||||
{
|
{
|
||||||
if( n == 0 && m_iSelection >= m_offset )
|
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 )
|
if( data != NULL )
|
||||||
SCREENMAN->PostMessageToTopScreen( SM_RoomInfoDeploy, 0 );
|
SCREENMAN->PostMessageToTopScreen( SM_RoomInfoDeploy, 0 );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
#include "WheelItemBase.h"
|
#include "WheelItemBase.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
|
||||||
struct RoomWheelData : public WheelItemBaseData
|
struct RoomWheelItemData : public WheelItemBaseData
|
||||||
{
|
{
|
||||||
RoomWheelData() : m_iFlags(0) { }
|
RoomWheelItemData() : m_iFlags(0) { }
|
||||||
RoomWheelData( WheelItemType wit, const RString& sTitle, const RString& sDesc, RageColor color ):
|
RoomWheelItemData( WheelItemDataType type, const RString& sTitle, const RString& sDesc, RageColor color ):
|
||||||
WheelItemBaseData( wit, sTitle, color ), m_sDesc(sDesc), m_iFlags(0) { };
|
WheelItemBaseData( type, sTitle, color ), m_sDesc(sDesc), m_iFlags(0) { };
|
||||||
|
|
||||||
RString m_sDesc;
|
RString m_sDesc;
|
||||||
unsigned int m_iFlags;
|
unsigned int m_iFlags;
|
||||||
@@ -28,7 +28,9 @@ public:
|
|||||||
virtual RoomWheelItem *Copy() const { return new RoomWheelItem(*this); }
|
virtual RoomWheelItem *Copy() const { return new RoomWheelItem(*this); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BitmapText m_Desc;
|
AutoActor m_sprBar;
|
||||||
|
BitmapText m_text;
|
||||||
|
BitmapText m_Desc;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RoomInfo
|
struct RoomInfo
|
||||||
@@ -51,8 +53,8 @@ public:
|
|||||||
virtual bool Select();
|
virtual bool Select();
|
||||||
virtual void Move( int n );
|
virtual void Move( int n );
|
||||||
|
|
||||||
inline RoomWheelData *GetItem( unsigned int i ) { return dynamic_cast<RoomWheelData*>( WheelBase::GetItem(i + m_offset) ); }
|
inline RoomWheelItemData *GetItem( unsigned int i ) { return dynamic_cast<RoomWheelItemData*>( WheelBase::GetItem(i + m_offset) ); }
|
||||||
void AddPerminateItem( RoomWheelData *itemdata );
|
void AddPerminateItem( RoomWheelItemData *itemdata );
|
||||||
int GetCurrentIndex() const { return m_iSelection; }
|
int GetCurrentIndex() const { return m_iSelection; }
|
||||||
int GetPerminateOffset() const { return m_offset; }
|
int GetPerminateOffset() const { return m_offset; }
|
||||||
void AddItem( WheelItemBaseData *itemdata );
|
void AddItem( WheelItemBaseData *itemdata );
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "WheelItemBase.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_sText = sText;
|
||||||
m_color = color;
|
m_color = color;
|
||||||
}
|
}
|
||||||
@@ -11,69 +11,31 @@ WheelItemBaseData::WheelItemBaseData( WheelItemType wit, RString sText, RageColo
|
|||||||
WheelItemBase::WheelItemBase( const WheelItemBase &cpy ):
|
WheelItemBase::WheelItemBase( const WheelItemBase &cpy ):
|
||||||
ActorFrame( cpy ),
|
ActorFrame( cpy ),
|
||||||
m_bExpanded( cpy.m_bExpanded ),
|
m_bExpanded( cpy.m_bExpanded ),
|
||||||
m_sprBar( cpy.m_sprBar ),
|
m_pData( cpy.m_pData )
|
||||||
m_text( cpy.m_text ),
|
|
||||||
m_Type( cpy.m_Type ),
|
|
||||||
m_color( cpy.m_color )
|
|
||||||
{
|
{
|
||||||
if( cpy.m_pBar == cpy.m_sprBar )
|
// FIXME
|
||||||
m_pBar = m_sprBar;
|
//if( cpy.m_pGrayBar == cpy.m_sprBar )
|
||||||
|
// m_pGrayBar = m_sprBar;
|
||||||
if( cpy.GetNumChildren() != 0 )
|
|
||||||
{
|
|
||||||
this->AddChild( m_sprBar );
|
|
||||||
this->AddChild( &m_text );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WheelItemBase::WheelItemBase(RString sType)
|
WheelItemBase::WheelItemBase(RString sType)
|
||||||
{
|
{
|
||||||
m_bExpanded = false;
|
|
||||||
SetName( sType );
|
SetName( sType );
|
||||||
m_pBar = NULL;
|
m_pData = NULL;
|
||||||
|
m_bExpanded = false;
|
||||||
|
m_pGrayBar = NULL;
|
||||||
Load(sType);
|
Load(sType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WheelItemBase::Load( RString 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_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 )
|
void WheelItemBase::LoadFromWheelItemData( const WheelItemBaseData* pWID, int iIndex, bool bHasFocus )
|
||||||
{
|
{
|
||||||
ASSERT( pWID != NULL );
|
ASSERT( pWID != NULL );
|
||||||
|
m_pData = pWID;
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WheelItemBase::DrawGrayBar( Actor& bar )
|
void WheelItemBase::DrawGrayBar( Actor& bar )
|
||||||
@@ -97,8 +59,8 @@ void WheelItemBase::DrawPrimitives()
|
|||||||
{
|
{
|
||||||
ActorFrame::DrawPrimitives();
|
ActorFrame::DrawPrimitives();
|
||||||
|
|
||||||
if( m_pBar != NULL )
|
if( m_pGrayBar != NULL )
|
||||||
DrawGrayBar( *m_pBar );
|
DrawGrayBar( *m_pGrayBar );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
struct WheelItemBaseData;
|
struct WheelItemBaseData;
|
||||||
|
|
||||||
enum WheelItemType
|
enum WheelItemDataType
|
||||||
{
|
{
|
||||||
TYPE_GENERIC,
|
TYPE_GENERIC,
|
||||||
TYPE_SECTION,
|
TYPE_SECTION,
|
||||||
@@ -23,10 +23,20 @@ enum WheelItemType
|
|||||||
TYPE_SORT
|
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
|
class WheelItemBase : public ActorFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WheelItemBase( RString sType = "WheelItemBase" );
|
WheelItemBase( RString sType );
|
||||||
WheelItemBase( const WheelItemBase &cpy );
|
WheelItemBase( const WheelItemBase &cpy );
|
||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
virtual WheelItemBase *Copy() const { return new WheelItemBase(*this); }
|
virtual WheelItemBase *Copy() const { return new WheelItemBase(*this); }
|
||||||
@@ -37,34 +47,15 @@ public:
|
|||||||
|
|
||||||
virtual void LoadFromWheelItemData( const WheelItemBaseData* pWID, int iIndex, bool bHasFocus );
|
virtual void LoadFromWheelItemData( const WheelItemBaseData* pWID, int iIndex, bool bHasFocus );
|
||||||
|
|
||||||
RageColor m_colorLocked;
|
RageColor m_colorLocked;
|
||||||
|
|
||||||
protected:
|
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
|
bool m_bExpanded; // if TYPE_SECTION, whether this section is expanded
|
||||||
|
|
||||||
Actor* m_pBar;
|
Actor* m_pGrayBar;
|
||||||
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
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user