Input.Client
Last updated
Last updated
Support us as a GitHub Sponsor and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!
Steam Input API is a flexible action-based API that supports all major controller types - Xbox, Playstation, Nintendo Switch Pro, and Steam Controllers.
To learn more about Steam Input in Heathen's Steamworks Complete read this article on the core concept.
When the Update method is ran and a controller has 1 or more input changes since its last test this event will raise and will carry with it information about the controller and all actions on it including all changes since the last update was ran.
The handler would take the form of
Indicates rather or not the Seam Input API has been initialized. You must initialize the Steam Input API before it can be used. This is handled automatically for you if you have defined Inputs in the Steam Settings object.
Returns the array of controller handles currently connected to the game.
Adds an input action to the list of tracted input actions, if your using a SteamSettings object this will be done for you for all InputActions defined in the SteamSettings. Once an action is added it can be updated by the API and tools such as the SteamInputManager can be used to track changes.
Removes an input from the list of tracked inputs, its safe to try to remove and input that was not currently tracked.
Updates the internal state of the indicated controller. Typically you would use the Steam Input Controller which would handle the update of each controller tracked.
Reconfigures the controller to use the specified action set (ie "Menu", "Walk", or "Drive").
This is cheap, and can be safely called repeatedly. It's often easier to repeatedly call it in your state loops, instead of trying to place it in all of your state transitions.
Reconfigures the controller to use the specified action set layer. See the Action Set Layers article for full details and an in-depth practical example.
Reconfigures the controller to stop using the specified action set layer.
Fill an array with all of the currently active action set layers for a specified controller handle.
Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls.
Returns the action data for the indicated input action, this works for Input Actions that have been added to the Input API via the AddInput method.
The first option assumes the first controller in the list of available controllers
The second takes a controller as input and returns the data for that controller
Returns the current state of the supplied analog game action.
Get the handle of the specified Analog action.
This function does not take an action set handle parameter. That means that each action in your VDF file must have a unique string identifier. In other words, if you use an action called "up" in two different action sets, this function will only ever return one of them and the other will be ignored.
Use this to display the appropriate on-screen prompt for the action.
Returns the handles for the connected controllers
Returns the associated controller handle for the specified emulated gamepad. Can be used with GetInputTypeForHandle to determine the controller type of a controller using Steam Input Gamepad Emulation.
Get the currently active action set for the specified controller.
Returns the current state of the supplied digital game action.
Get the handle of the specified digital action.
This function does not take an action set handle parameter. That means that each action in your VDF file must have a unique string identifier. In other words, if you use an action called "up" in two different action sets, this function will only ever return one of them and the other will be ignored.
Use this to display the appropriate on-screen prompt for the action.
Returns the associated gamepad index for the specified controller, if emulating a gamepad.
Gets the local path to the art for an on-screen glyph of a particular origin
Returns the input type (device model) for the specified controller. This tells you if a given controller is a Steam controller, XBox 360 controller, PS4 controller, etc. For more details, see Steam's Supported Controller Database.
Returns raw motion data for the specified controller.
Returns the localized string for the specified origin.
This must be called before using API.Interface. It takes a single parameter explicitlyCallRunFrame
which if true would require you to call RunFrame()
to synchronize the state data.
If you chose to initialize with explicitly run frame enabled you should call this before testing for input. In most cases you will initialize API.Input.Client.Init(false);
and so this will be called for you each Update via the Steamworks Behaviour
.
Set the controller LED color on supported controllers.
The VSC does not support any color but white, and will interpret the RGB values as a greyscale value affecting the brightness of the Steam button LED.
The DS4 responds to full color information and uses the values to set the color & brightness of the lightbar.
Resets the controllers LED color to the user's default.
This must be called when your done using the Input interface.
Invokes the Steam overlay and brings up the binding screen.
Stops the momentum of an analog action (where applicable, ie a touchpad w/ virtual trackball settings).
This will also stop all associated haptics. This is useful for situations where you want to indicate to the user that the limit of an action has been reached, such as spinning a carousel or scrolling a webpage.
Trigger a vibration event on supported controllers.
This API call will be ignored for incompatible controller models.
This generates the traditional "rumble" vibration effect.
The VSC will emulate traditional rumble using its haptics.
Get the equivalent origin for a given controller type or the closest controller type that existed in the SDK you built into your game if eDestinationInputType is k_ESteamInputType_Unknown. This action origin can be used in your glyph look up table or passed into GetGlyphForActionOrigin or GetStringForActionOrigin
Gets the major and minor device binding revisions for Steam Input API configurations. Major revisions are to be used when changing the number of action sets or otherwise reworking configurations to the degree that older configurations are no longer usable. When a user's binding disagrees with the major revision of the current official configuration Steam will forcibly update the user to the new configuration. New configurations will need to be made for every controller when updating the major revision. Minor revisions are for small changes such as adding a new optional action or updating localization in the configuration. When updating the minor revision you generally can update a single configuration and check the "Use Action Block" to apply the action block changes to the other configurations.
Get the Steam Remote Play session ID associated with a device, or 0 if there is no session associated with it. See isteamremoteplay.h for more information on Steam Remote Play sessions.