summaryrefslogtreecommitdiff
path: root/game/client/tf/vgui/sc_hinticon.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/tf/vgui/sc_hinticon.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/client/tf/vgui/sc_hinticon.cpp')
-rw-r--r--game/client/tf/vgui/sc_hinticon.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/game/client/tf/vgui/sc_hinticon.cpp b/game/client/tf/vgui/sc_hinticon.cpp
new file mode 100644
index 0000000..703c121
--- /dev/null
+++ b/game/client/tf/vgui/sc_hinticon.cpp
@@ -0,0 +1,70 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#include "cbase.h"
+#include "sc_hinticon.h"
+#include <vgui/IVGui.h>
+#include "inputsystem/iinputsystem.h"
+
+using namespace vgui;
+
+DECLARE_BUILD_FACTORY( CSCHintIcon );
+
+//-----------------------------------------------------------------------------
+CSCHintIcon::CSCHintIcon( vgui::Panel *parent, const char* panelName ) :
+ vgui::Label( parent, panelName, L"" )
+ , m_bIsActionMapped( false )
+ , m_actionSetHandle( 0 )
+{
+ m_szActionName[0] = '\0';
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void CSCHintIcon::ApplySettings( KeyValues *inResourceData )
+{
+ BaseClass::ApplySettings( inResourceData );
+
+ auto szActionName = inResourceData->GetString( "actionName", "" );
+ Q_strncpy( m_szActionName, szActionName, nMaxActionNameLength );
+
+ auto szActionSet = inResourceData->GetString( "actionSet", nullptr );
+ if ( szActionSet )
+ {
+ m_actionSetHandle = g_pInputSystem->GetActionSetHandle( szActionSet );
+ }
+ else
+ {
+ m_actionSetHandle = 0;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void CSCHintIcon::ApplySchemeSettings( IScheme *pScheme )
+{
+ BaseClass::ApplySchemeSettings( pScheme );
+
+ const wchar_t* iconText = L"";
+ m_bIsActionMapped = false;
+ if ( m_actionSetHandle )
+ {
+ auto origin = g_pInputSystem->GetSteamControllerActionOrigin( m_szActionName, m_actionSetHandle );
+ if ( origin != k_EControllerActionOrigin_None )
+ {
+ iconText = g_pInputSystem->GetSteamControllerFontCharacterForActionOrigin( origin );
+ if ( iconText && iconText[0] )
+ {
+ m_bIsActionMapped = true;
+ }
+ }
+ }
+
+ SetText( iconText );
+} \ No newline at end of file