mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-26 23:05:30 +03:00
Added screen height scaling for vgui_text_display
This commit is contained in:
parent
3656ea3082
commit
4ab87250b2
@ -112,6 +112,15 @@ public:
|
||||
C_BasePlayer *GetPlayerOwner( void );
|
||||
bool IsInputOnlyToOwner( void );
|
||||
|
||||
#ifdef MAPBASE
|
||||
void GetSize( float &width, float &height ) const { width = m_flWidth; height = m_flHeight; }
|
||||
void GetPixelSize( int &width, int &height ) const { width = m_nPixelWidth; height = m_nPixelHeight; }
|
||||
void SetWidth( float flWidth ) { m_flWidth = flWidth; }
|
||||
void SetHeight( float flHeight ) { m_flHeight = flHeight; }
|
||||
void SetPixelWidth( int nWidth ) { m_nPixelWidth = nWidth; }
|
||||
void SetPixelHeight( int nHeight ) { m_nPixelHeight = nHeight; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
// Vgui screen management
|
||||
void CreateVguiScreen( const char *pTypeName );
|
||||
|
@ -157,11 +157,34 @@ void C_TextDisplayPanel::UpdateText()
|
||||
m_pDisplayTextLabel->SetText( m_hScreenEntity->GetDisplayText() );
|
||||
|
||||
//SetSize( m_hScreenEntity->GetTextSize(), m_hScreenEntity->GetTextSize() );
|
||||
SetSize( m_hScreenEntity->GetResolution(), m_hScreenEntity->GetResolution() );
|
||||
m_pDisplayTextLabel->SetSize( m_hScreenEntity->GetResolution(), m_hScreenEntity->GetResolution() );
|
||||
//m_pDisplayTextLabel->SetSize( m_hScreenEntity->GetTextSize(), m_hScreenEntity->GetTextSize() );
|
||||
|
||||
Label::Alignment iAlignment = m_hScreenEntity->GetContentAlignment();
|
||||
|
||||
switch (iAlignment)
|
||||
{
|
||||
// Use a special scaling method when using a south alignment
|
||||
case Label::Alignment::a_southwest:
|
||||
case Label::Alignment::a_south:
|
||||
case Label::Alignment::a_southeast:
|
||||
int lW, lT;
|
||||
m_pDisplayTextLabel->GetContentSize( lW, lT );
|
||||
SetSize( m_hScreenEntity->GetResolution(), lT );
|
||||
m_pDisplayTextLabel->SetSize( m_hScreenEntity->GetResolution(), lT );
|
||||
|
||||
float sW, sT;
|
||||
m_hVGUIScreen->GetSize( sW, sT );
|
||||
//Msg( "Screen width: %f, new height: %f\n", sW, sW * (lT / m_hScreenEntity->GetResolution()) );
|
||||
m_hVGUIScreen->SetHeight( sW * ((float)lT / (float)m_hScreenEntity->GetResolution()) );
|
||||
m_hVGUIScreen->SetPixelHeight( lT );
|
||||
break;
|
||||
|
||||
default:
|
||||
SetSize( m_hScreenEntity->GetResolution(), m_hScreenEntity->GetResolution() );
|
||||
m_pDisplayTextLabel->SetSize( m_hScreenEntity->GetResolution(), m_hScreenEntity->GetResolution() );
|
||||
break;
|
||||
}
|
||||
|
||||
m_pDisplayTextLabel->SetContentAlignment( iAlignment );
|
||||
|
||||
bool bWrap = true;
|
||||
|
Loading…
Reference in New Issue
Block a user