From d919a1e6350d6d5ec409391cbddd8cbf2fb5b603 Mon Sep 17 00:00:00 2001 From: kurozael Date: Sat, 18 Jan 2020 22:38:34 +0000 Subject: [PATCH] Added a method to retrieve the glyph location for a provided controller and action --- Facepunch.Steamworks/SteamInput.cs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Facepunch.Steamworks/SteamInput.cs b/Facepunch.Steamworks/SteamInput.cs index baba1c1..5d897dc 100644 --- a/Facepunch.Steamworks/SteamInput.cs +++ b/Facepunch.Steamworks/SteamInput.cs @@ -70,7 +70,30 @@ namespace Steamworks } } - internal static Dictionary DigitalHandles = new Dictionary(); + + /// + /// Return an absolute path to the PNG image glyph for the provided digital action name. The current + /// action set in use for the controller will be used for the lookup. You should cache the result and + /// maintain your own list of loaded PNG assets. + /// + /// + /// + /// + public static string GetDigitalActionGlyph( Controller controller, string action ) + { + InputActionOrigin origin = InputActionOrigin.None; + + Internal.GetDigitalActionOrigins( + controller.Handle, + Internal.GetCurrentActionSet(controller.Handle), + GetDigitalActionHandle(action), + ref origin + ); + + return Internal.GetGlyphForActionOrigin(origin); + } + + internal static Dictionary DigitalHandles = new Dictionary(); internal static InputDigitalActionHandle_t GetDigitalActionHandle( string name ) { if ( DigitalHandles.TryGetValue( name, out var val ) )