mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-12 14:48:02 +03:00
Add bindings for retrieving InputActionOrigins for a Controller.
This commit is contained in:
parent
7c62042af2
commit
d19f420a24
@ -1,5 +1,6 @@
|
|||||||
using Steamworks.Data;
|
using Steamworks.Data;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
@ -30,6 +31,40 @@ namespace Steamworks
|
|||||||
public void ActivateLayer( string layer ) => SteamInput.Internal.ActivateActionSetLayer( Handle, SteamInput.Internal.GetActionSetHandle( layer ) );
|
public void ActivateLayer( string layer ) => SteamInput.Internal.ActivateActionSetLayer( Handle, SteamInput.Internal.GetActionSetHandle( layer ) );
|
||||||
public void ClearLayers() => SteamInput.Internal.DeactivateAllActionSetLayers( Handle );
|
public void ClearLayers() => SteamInput.Internal.DeactivateAllActionSetLayers( Handle );
|
||||||
|
|
||||||
|
#region Action Origins
|
||||||
|
|
||||||
|
internal const int STEAM_INPUT_MAX_ORIGINS = 8;
|
||||||
|
internal InputActionSetHandle_t ActionSetHandle => SteamInput.Internal.GetCurrentActionSet( Handle );
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the origin(s) for an analog action within an action set.
|
||||||
|
/// Use this to display the appropriate on-screen prompt for the action.
|
||||||
|
/// <para>
|
||||||
|
/// This is cheap, and Valve recommends you re-gather the origins each frame to update your ingame prompts in case they have changed.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<InputActionOrigin> GetAnalogActionOrigins( string actionName )
|
||||||
|
{
|
||||||
|
InputActionOrigin[] actionOrigins = new InputActionOrigin[STEAM_INPUT_MAX_ORIGINS];
|
||||||
|
int numOrigins = SteamInput.Internal.GetAnalogActionOrigins( Handle, ActionSetHandle, SteamInput.Internal.GetAnalogActionHandle( actionName ), ref actionOrigins[0] );
|
||||||
|
return actionOrigins.Take( numOrigins );
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the origin(s) for a digital action within an action set.
|
||||||
|
/// Use this to display the appropriate on-screen prompt for the action.
|
||||||
|
/// <para>
|
||||||
|
/// This is cheap, and Valve recommends you re-gather the origins each frame to update your ingame prompts in case they have changed.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<InputActionOrigin> GetDigitalActionOrigins( string actionName )
|
||||||
|
{
|
||||||
|
InputActionOrigin[] actionOrigins = new InputActionOrigin[STEAM_INPUT_MAX_ORIGINS];
|
||||||
|
int numOrigins = SteamInput.Internal.GetDigitalActionOrigins( Handle, ActionSetHandle, SteamInput.Internal.GetDigitalActionHandle( actionName ), ref actionOrigins[0] );
|
||||||
|
return actionOrigins.Take( numOrigins );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Action Origins
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the current state of the supplied digital game action
|
/// Returns the current state of the supplied digital game action
|
||||||
|
Loading…
x
Reference in New Issue
Block a user