Add SteamInput call to retrieve analog action glyphs and clarify documentation for retrieving both analog and digital glyphs using information from the official docs.

This commit is contained in:
Herman Groenenboom 2023-04-07 10:50:11 +02:00
parent 4e7e0ef8c4
commit a0cb27f324

View File

@ -55,6 +55,10 @@ public static IEnumerable<Controller> Controllers
/// Return an absolute path to the PNG image glyph for the provided digital action name. The current /// 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 /// 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. /// maintain your own list of loaded PNG assets.
/// <para>
/// Valve recommends that you continuously check the action origins using <see cref="Controller.GetDigitalActionOrigins(string)"/>
/// in case the bindings have changed. When that happens you can update the prompts displayed in your game.
/// </para>
/// </summary> /// </summary>
/// <param name="controller"></param> /// <param name="controller"></param>
/// <param name="action"></param> /// <param name="action"></param>
@ -65,12 +69,39 @@ public static string GetDigitalActionGlyph( Controller controller, string action
Internal.GetDigitalActionOrigins( Internal.GetDigitalActionOrigins(
controller.Handle, controller.Handle,
Internal.GetCurrentActionSet(controller.Handle), Internal.GetCurrentActionSet( controller.Handle ),
GetDigitalActionHandle(action), GetDigitalActionHandle( action ),
ref origin ref origin
); );
return Internal.GetGlyphForActionOrigin_Legacy(origin); return Internal.GetGlyphForActionOrigin_Legacy( origin );
}
/// <summary>
/// Return an absolute path to the PNG image glyph for the provided analog 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.
/// <para>
/// Valve recommends that you continuously check the action origins using <see cref="Controller.GetAnalogActionOrigins(string)"/>
/// in case the bindings have changed. When that happens you can update the prompts displayed in your game.
/// </para>
/// </summary>
/// <param name="controller"></param>
/// <param name="action"></param>
/// <returns></returns>
public static string GetAnalogActionGlyph( Controller controller, string action )
{
InputActionOrigin origin = InputActionOrigin.None;
Internal.GetAnalogActionOrigins(
controller.Handle,
Internal.GetCurrentActionSet( controller.Handle ),
GetAnalogActionHandle( action ),
ref origin
);
return Internal.GetGlyphForActionOrigin_Legacy( origin );
} }