show tabs in debug overlay

This commit is contained in:
Chris Danford
2009-04-07 11:02:35 +00:00
parent cd96e36ee4
commit c07a71bacf
3 changed files with 59 additions and 19 deletions
@@ -1 +1 @@
_venacti bold 15px _venacti Bold 15px
+57 -18
View File
@@ -84,6 +84,8 @@ ScreenDebugOverlay::~ScreenDebugOverlay()
{ {
this->RemoveAllChildren(); this->RemoveAllChildren();
FOREACH( BitmapText*, m_vptextPages, p )
SAFE_DELETE( *p );
FOREACH( BitmapText*, m_vptextButton, p ) FOREACH( BitmapText*, m_vptextButton, p )
SAFE_DELETE( *p ); SAFE_DELETE( *p );
m_vptextButton.clear(); m_vptextButton.clear();
@@ -133,6 +135,20 @@ static RString GetDebugButtonName( const IDebugLine *pLine )
} }
} }
template<typename U, typename V>
static bool GetKeyFromMap( const map<U, V> &m, const V &val, U &key )
{
FOREACHM_CONST( U, V, m, iter )
{
if( iter->second == val )
{
key = iter->first;
return true;
}
}
return false;
}
static LocalizedString DEBUG_MENU( "ScreenDebugOverlay", "Debug Menu" ); static LocalizedString DEBUG_MENU( "ScreenDebugOverlay", "Debug Menu" );
void ScreenDebugOverlay::Init() void ScreenDebugOverlay::Init()
{ {
@@ -214,30 +230,49 @@ void ScreenDebugOverlay::Init()
m_textHeader.LoadFromFont( THEME->GetPathF("Common", "normal") ); m_textHeader.LoadFromFont( THEME->GetPathF("Common", "normal") );
m_textHeader.SetHorizAlign( align_left ); m_textHeader.SetHorizAlign( align_left );
m_textHeader.SetX( SCREEN_LEFT+20 ); m_textHeader.SetXY( SCREEN_LEFT+20, SCREEN_TOP+20 );
m_textHeader.SetY( SCREEN_TOP+20 );
m_textHeader.SetText( DEBUG_MENU ); m_textHeader.SetText( DEBUG_MENU );
this->AddChild( &m_textHeader ); this->AddChild( &m_textHeader );
FOREACH_CONST( RString, m_asPages, s )
{
int iPage = s - m_asPages.begin();
DeviceInput di;
bool b = GetKeyFromMap( g_Mappings.pageButton, iPage, di );
ASSERT( b );
RString sButton = INPUTMAN->GetDeviceSpecificInputString( di );
BitmapText *p = new BitmapText;
vector<BitmapText*> ;
p->LoadFromFont( THEME->GetPathF("Common", "normal") );
p->SetXY( SCREEN_CENTER_X-100+iPage*100, SCREEN_TOP+20 );
p->SetText( *s + " (" + sButton + ")" );
p->SetShadowLength( 2 );
m_vptextPages.push_back( p );
this->AddChild( p );
}
FOREACH_CONST( IDebugLine*, *g_pvpSubscribers, p ) FOREACH_CONST( IDebugLine*, *g_pvpSubscribers, p )
{ {
{ {
BitmapText *pT1 = new BitmapText; BitmapText *p = new BitmapText;
pT1->LoadFromFont( THEME->GetPathF("Common", "normal") ); p->LoadFromFont( THEME->GetPathF("Common", "normal") );
pT1->SetHorizAlign( align_right ); p->SetHorizAlign( align_right );
pT1->SetText( "blah" ); p->SetText( "blah" );
pT1->SetShadowLength( 2 ); p->SetShadowLength( 2 );
m_vptextButton.push_back( pT1 ); m_vptextButton.push_back( p );
this->AddChild( pT1 ); this->AddChild( p );
} }
{ {
BitmapText *pT2 = new BitmapText; BitmapText *p = new BitmapText;
pT2->LoadFromFont( THEME->GetPathF("Common", "normal") ); p->LoadFromFont( THEME->GetPathF("Common", "normal") );
pT2->SetHorizAlign( align_left ); p->SetHorizAlign( align_left );
pT2->SetText( "blah" ); p->SetText( "blah" );
pT2->SetShadowLength( 2 ); p->SetShadowLength( 2 );
m_vptextFunction.push_back( pT2 ); m_vptextFunction.push_back( p );
this->AddChild( pT2 ); this->AddChild( p );
} }
} }
@@ -290,12 +325,16 @@ void ScreenDebugOverlay::Update( float fDeltaTime )
void ScreenDebugOverlay::UpdateText() void ScreenDebugOverlay::UpdateText()
{ {
m_textHeader.SetText( ssprintf("%s: %s", DEBUG_MENU.GetValue().c_str(), GetCurrentPageName().c_str()) );
/* Highlight options that aren't the default. */ /* Highlight options that aren't the default. */
const RageColor off(0.6f, 0.6f, 0.6f, 1.0f); const RageColor off(0.6f, 0.6f, 0.6f, 1.0f);
const RageColor on(1, 1, 1, 1); const RageColor on(1, 1, 1, 1);
FOREACH_CONST( RString, m_asPages, s )
{
int iPage = s - m_asPages.begin();
m_vptextPages[iPage]->SetDiffuse( (iPage == m_iCurrentPage) ? on : off );
}
int iOffset = 0; int iOffset = 0;
FOREACH_CONST( IDebugLine*, *g_pvpSubscribers, p ) FOREACH_CONST( IDebugLine*, *g_pvpSubscribers, p )
{ {
+1
View File
@@ -27,6 +27,7 @@ private:
Quad m_Quad; Quad m_Quad;
BitmapText m_textHeader; BitmapText m_textHeader;
vector<BitmapText*> m_vptextPages;
vector<BitmapText*> m_vptextButton; vector<BitmapText*> m_vptextButton;
vector<BitmapText*> m_vptextFunction; vector<BitmapText*> m_vptextFunction;
}; };