Merge pull request #350 from kurozael/ft/steam-input-glyph

Added a method to retrieve the glyph location for a provided controller and action
This commit is contained in:
Garry Newman 2020-01-21 22:26:35 +00:00 committed by GitHub
commit 6e896c2085
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,7 +70,30 @@ namespace Steamworks
}
}
internal static Dictionary<string, InputDigitalActionHandle_t> DigitalHandles = new Dictionary<string, InputDigitalActionHandle_t>();
/// <summary>
/// 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.
/// </summary>
/// <param name="controller"></param>
/// <param name="action"></param>
/// <returns></returns>
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<string, InputDigitalActionHandle_t> DigitalHandles = new Dictionary<string, InputDigitalActionHandle_t>();
internal static InputDigitalActionHandle_t GetDigitalActionHandle( string name )
{
if ( DigitalHandles.TryGetValue( name, out var val ) )