Functions | Input

Here is a list of all the functions available in the GodotSteam module. The descriptions are pulled from the official Steamworks SDK documentation with modifications made to fit GodotSteam's implementation of the functions. Naturally, any GodotSteam-specific functions will be noted as such.


activateActionSet( int input_handle, int action_set_handle ) activateActionSet( uint64_t input_handle, uint64_t action_set_handle )

  • Reconfigure the controller to use the specified action set (i.e. "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.
  • Returns nothing; void.

activateActionSetLayer( int input_handle, int action_set_layer_handle ) activateActionSetLayer( uint64_t input_handle, uint64_t action_set_layer_handle )

  • Reconfigure the controller to use the specified action set layer.
  • See the Action Set Layers article for full details and an in-depth practical example.
  • Returns nothing; void.

deactivateActionSetLayer( int input_handle, int action_set_handle ) deactivateActionSetLayer( uint64_t input_handle, uint64_t action_set_handle )

  • Reconfigure the controller to stop using the specified action set.
  • Returns nothing; void.

deactivateAllActionSetLayers( int input_handle ) deactivateAllActionSetLayers( uint64_t input_handle )

  • Reconfigure the controller to stop using all action set layers.
  • Returns nothing; void.

getActiveActionSetLayers( int input_handle) getActiveActionSetLayers( uint64_t input_handle)

  • Fill an array with all of the currently active action set layers for a specified controller handle.
  • Returns an array that contains int handles. Returns an array that contains uint64_t handles<.

getActionSetHandle( string action_set_name )

  • Fill an array with all of the currently active action set layers for a specified controller handle.
  • Returns an int. Returns an uint64_t.

getActionOriginFromXboxOrigin( int input_handle, int origin ) getActionOriginFromXboxOrigin( uint64_t input_handle, int origin )

  • Get an action origin that you can use in your glyph look up table or passed into getGlyphForActionOrigin or getStringForActionOrigin.
  • Returns an int.

getAnalogActionData( int input_handle, int analog_action_handle ) getAnalogActionData( uint64_t input_handle, uint64_t analog_action_handle )

  • Gets the current state of the supplied analog game action.
  • Returns a dictionary:
    • mode (int)
    • x (float)
    • y (float)
    • active (bool)

getAnalogActionHandle( string action_name )

  • Get the handle of the specified analog action.
  • Note: 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.
  • Returns an int. Returns an uint64_t.

getAnalogActionOrigins( int input_handle, int action_set_handle, int analog_action_handle ) getAnalogActionOrigins( uint64_t input_handle, uint64_t action_set_handle, uint64_t analog_action_handle )

  • Get the origin(s) for an analog action within an action set by filling the return array with handles. Use this to display the appropriate on-screen prompt for the action.
  • Returns an array contains int handles.

getConnectedControllers()

  • Enumerates currently connected controllers by filling returned array with controller handles.
  • Returns an array of int controller handles. Returns an array of uint64_t controller handles.

getControllerForGamepadIndex( int index )

  • Returns the associated controller handle for the specified emulated gamepad. Can be used with getInputTypeForHandle to determine the type of controller using Steam Input Gamepad Emulation.
  • Returns an int. Returns an uint64_t.

getCurrentActionSet( int input_handle ) getCurrentActionSet( uint64_t input_handle )

  • Get the currently active action set for the specified controller.
  • Returns an int. Returns an uint64_t.

getDeviceBindingRevision( int input_handle ) getDeviceBindingRevision( uint64_t input_handle )

  • Get's the major and minor device binding revisions for Steam Input API configurations. Minor revisions are for small changes such as adding a new option action or updating localization in the configuration. When updating a Minor revision only one new configuration needs to be update with the "Use Action Block" flag set. 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 disagree's 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.
  • Returns an array containing:
    • major (int)
    • minor (int)

getDigitalActionData( int input_handle, int digital_action_handle ) getDigitalActionData( uint64_t input_handle, uint64_t digital_action_handle )

  • Returns the current state of the supplied digital game action.
  • Returns a dictionary:
    • state (bool)
    • active (bool)

getDigitalActionHandle( string action_name )

  • Get the handle of the specified digital action.
  • Note: 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.
  • Returns an int. Returns an uint64_t.

getDigitalActionOrigins( int input_handle, int action_set_handle, int digital_action_handle ) getDigitalActionOrigins( uint64_t input_handle, uint64_t action_set_handle, uint64_t digital_action_handle )

  • Get the origin(s) for a digital action within an action set by filling return array with input handles. Use this to display the appropriate on-screen prompt for the action.
  • Returns an array containing int handles.

getGamepadIndexForController( int input_handle ) getGamepadIndexForController( uint64_t input_handle )

  • Returns the associated gamepad index for the specified controller, if emulating a gamepad.
  • Returns an int.

getGlyphForActionOrigin( int origin )

  • Get a local path to art for on-screen glyph for a particular origin.
  • Returns a string.

getInputTypeForHandle( int input_handle ) getInputTypeForHandle( uint64_t input_handle )

  • 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.
  • Returns a string.

getMotionData( int input_handle ) getMotionData( uint64_t input_handle )

  • Returns raw motion data for the specified controller.
  • Returns a dictionary:
    • rot_quat_x (float)
    • rot_quat_y (float)
    • rot_quat_z (float)
    • rot_quat_w (float)
    • pos_accel_x (float)
    • pos_accel_y (float)
    • pos_accel_z (float)
    • rot_vel_x (float)
    • rot_vel_y (float)
    • rot_vel_z (float)

getRemotePlaySessionID( int input_handle ) getRemotePlaySessionID( uint64_t input_handle )

  • 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.
  • Returns an int.

getStringforActionOrigin( int origin )

  • Returns a localized string (from Steam's language setting) for the specified origin.
  • Returns a string.

inputInit( bool explicitly_call_runframe )

  • inputInit and inputShutdown must be called when starting/ending use of this interface.
  • If explicitly_call_runframe is called then you will need to manually call runFrame each frame, otherwise Steam Input will updated when run_callbacks is called.
  • Returns a bool.

inputShutdown()

  • inputInit and inputShutdown must be called when starting/ending use of this interface.
  • Returns a bool.

runFrame()

  • Synchronize API state with the latest Steam Controller inputs available. This is performed automatically by run_callbacks, but for the absolute lowest possible latency, you can call this directly before reading controller state.
  • Returns nothing; void.

setLEDColor( int input_handle, int color_r, int color_g, int color_b, int flags ) setLEDColor( uint64_t input_handle, int color_r, int color_g, int color_b, int flags )

  • Set the controller LED color on supported controllers.
  • Notes: 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.
  • Returns nothing; void.

showBindingPanel( int input_handle ) showBindingPanel( uint64_t input_handle )

  • Invokes the Steam overlay and brings up the binding screen.
  • Returns a bool.

stopAnalogActionMomentum( int input_handle, int action ) stopAnalogActionMomentum( uint64_t input_handle, uint64_t action )

  • Stops the momentum of an analog action (where applicable, ie a touchpad w/ virtual trackball settings).
  • Note: 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.
  • Returns nothing; void.

translateActionOrigin( int destination_input, int source_origin )

  • 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 destination_input is 0. This action origin can be used in your glyph look up table or passed into getGlyphForActionOrigin or getStringForActionOrigin.
  • Returns an int.

triggerHapticPulse( int input_handle, int target_pad, int duration ) triggerHapticPulse( uint64_t input_handle, int target_pad, int duration )

  • Triggers a (low-level) haptic pulse on supported controllers.
  • Currently only the VSC supports haptic pulses. This API call will be ignored for all other controller models. The typical max value of an unsigned short is 65535, which means the longest haptic pulse you can trigger with this method has a duration of 0.065535 seconds (ie, less than 1/10th of a second). This function should be thought of as a low-level primitive meant to be repeatedly used in higher-level user functions to generate more sophisticated behavior.
  • Returns nothing; void.

triggerRepeatedHapticPulse( int input_handle, int target_pad, int duration, int offset, int repeat, int flags ) triggerRepeatedHapticPulse( uint64_t input_handle, int target_pad, int duration, int offset, int repeat, int flags )

  • Triggers a repeated haptic pulse on supported controllers.
  • Notes: Currently only the VSC supports haptic pulses. This API call will be ignored for incompatible controller models. This is a more user-friendly function to call than TriggerHapticPulse as it can generate pulse patterns long enough to be actually noticed by the user. Changing the usDurationMicroSec and usOffMicroSec parameters will change the "texture" of the haptic pulse.
  • Returns nothing; void.

triggerVibration( int input_handle, int left_speed, int right_speed ) triggerVibration( uint64_t input_handle, uint16_t left_speed, uint16_t right_speed )

  • Trigger a vibration event on supported controllers.
  • Notes: 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.
  • Returns nothing; void.