Touched up vgui_text_display code, added Toggle input

This commit is contained in:
Blixibon 2021-03-13 16:42:47 -06:00
parent 57774c2a79
commit 303b0552e9
2 changed files with 15 additions and 5 deletions

View File

@ -111,7 +111,7 @@ private:
DECLARE_VGUI_SCREEN_FACTORY( C_TextDisplayPanel, "text_display_panel" );
CUtlVector <C_TextDisplayPanel *> g_WorldTextDisplays;
CUtlVector <C_TextDisplayPanel *> g_TextDisplays;
//-----------------------------------------------------------------------------
// Constructor:
@ -120,7 +120,7 @@ C_TextDisplayPanel::C_TextDisplayPanel( vgui::Panel *parent, const char *panelNa
: BaseClass( parent, "C_TextDisplayPanel"/*, vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/WorldTextPanel.res", "WorldTextPanel" )*/ )
{
// Add ourselves to the global list of movie displays
g_WorldTextDisplays.AddToTail( this );
g_TextDisplays.AddToTail( this );
}
//-----------------------------------------------------------------------------
@ -129,7 +129,7 @@ C_TextDisplayPanel::C_TextDisplayPanel( vgui::Panel *parent, const char *panelNa
C_TextDisplayPanel::~C_TextDisplayPanel( void )
{
// Remove ourselves from the global list of movie displays
g_WorldTextDisplays.FindAndRemove( this );
g_TextDisplays.FindAndRemove( this );
}
//-----------------------------------------------------------------------------
@ -186,7 +186,7 @@ void C_TextDisplayPanel::UpdateText()
m_pDisplayTextLabel->SetWrap( bWrap );
m_pDisplayTextLabel->SetCenterWrap( bCenterWrap );
Msg( "Resolution is %i\n", m_hScreenEntity->GetResolution() );
//Msg( "Resolution is %i\n", m_hScreenEntity->GetResolution() );
const char *pszFontName = m_hScreenEntity->GetFontName();
if (pszFontName && pszFontName[0] != '\0')

View File

@ -43,6 +43,7 @@ public:
void InputDisable( inputdata_t &inputdata );
void InputEnable( inputdata_t &inputdata );
void InputToggle( inputdata_t &inputdata );
void InputSetMessage( inputdata_t &inputdata );
void InputSetTextAlignment( inputdata_t &inputdata );
@ -95,6 +96,7 @@ BEGIN_DATADESC( CVGuiTextDisplay )
DEFINE_INPUTFUNC( FIELD_VOID, "Disable", InputDisable ),
DEFINE_INPUTFUNC( FIELD_VOID, "Enable", InputEnable ),
DEFINE_INPUTFUNC( FIELD_VOID, "Toggle", InputToggle ),
DEFINE_INPUTFUNC( FIELD_STRING, "SetMessage", InputSetMessage ),
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetTextAlignment", InputSetTextAlignment ),
@ -116,7 +118,7 @@ CVGuiTextDisplay::CVGuiTextDisplay()
{
m_flTextSize = 100.0f;
m_iResolution = 200;
m_iContentAlignment = 6; // a_southwest
m_iContentAlignment = 7; // a_south
}
CVGuiTextDisplay::~CVGuiTextDisplay()
@ -295,6 +297,14 @@ void CVGuiTextDisplay::InputEnable( inputdata_t &inputdata )
Enable();
}
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void CVGuiTextDisplay::InputToggle( inputdata_t &inputdata )
{
m_bEnabled ? Disable() : Enable();
}
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------