Functions | Utilities

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.


overlayNeedsPresent()

  • Checks if the Overlay needs a present. Only required if using event driven render updates.
  • Typically this call is unneeded if your game has a constantly running frame loop that calls the D3D Present API, or OGL SwapBuffers API every frame as is the case in most games. However, if you have a game that only refreshes the screen on an event driven basis then that can break the overlay, as it uses your Present/SwapBuffers calls to drive it's internal frame loop and it may also need to Present() to the screen any time a notification happens or when the overlay is brought up over the game by a user. You can use this API to ask the overlay if it currently need a present in that case, and then you can check for this periodically (roughly 33hz is desirable) and make sure you refresh the screen with Present or SwapBuffers to allow the overlay to do it's work.
  • Returns a bool.

getAPICallFailureReason()

  • Used to get the failure reason of a call result.
  • The primary usage for this function is debugging. The failure reasons are typically out of your control and tend to not be very important. Just keep retrying your API Call until it works.
  • Returns a string.

getAppID()

  • Gets the App ID of the current process.
  • Returns an int. Returns an uint32_t.

getCurrentBatteryPower()

  • Gets the current amount of battery power on the computer.
  • Returns an int.

getImageRGBA( int image )

  • Gets the image bytes from an image handle.
  • Prior to calling this you must get the size of the image by calling getImageSize so that you can create your buffer with an appropriate size. You can then allocate your buffer with the width and height as: width * height * 4. The image is provided in RGBA format. This call can be somewhat expensive as it converts from the compressed type (JPG, PNG, TGA) and provides no internal caching of returned buffer, thus it is highly recommended to only call this once per image handle and cache the result. This function is only used for Steam Avatars and Achievement images and those are not expected to change mid game.
  • Returns a dictionary:
    • buffer (PoolByteArray)
    • success (bool)

getImageSize ( int image )

  • Gets the size of a Steam image handle.
  • This must be called before calling getImageRGBA to create an appropriately sized buffer that will be filled with the raw image data.
  • Returns a dictionary:
    • width (int)
    • height (int)
    • width (uint32)
    • height (uint32)

getIPCCallCount

  • Returns the number of IPC calls made since the last time this function was called.
  • Used for perf debugging so you can determine how many IPC (Inter-Process Communication) calls your game makes per frame.
  • Every IPC call is at minimum a thread context switch if not a process one so you want to rate control how often you do them.
  • Returns an int. Returns an uint32.

getIPCountry()

  • Returns the 2 digit ISO 3166-1-alpha-2 format country code which client is running in. e.g "US" or "UK".
  • This is looked up via an IP-to-location database.
  • Returns a string.

getSecondsSinceAppActive()

  • Returns the number of seconds since the application was active./li>
  • Returns an int.

getSecondsSinceComputerActive()

  • Returns the number of seconds since the user last moved the mouse.
  • Returns an int.

getServerRealTime()

  • Returns the Steam server time in Unix epoch format. (Number of seconds since Jan 1, 1970 UTC).
  • Returns an int.

getSteamUILanguage()

  • Returns the language the steam client is running in.
  • You probably want getCurrentGameLanguage instead, this should only be used in very special cases.
  • For a full list of languages see Supported Languages.
  • Returns a string.

isAPICallCompleted()

  • Checks if an API Call is completed. Provides the backend of the CallResult wrapper.
  • It's generally not recommended that you use this yourself.
  • Returns a dictionary:
    • completed (bool)
    • failed (bool)

isOverlayEnabled()

  • Checks if the Steam Overlay is running & the user can access it.
  • The overlay process could take a few seconds to start & hook the game process, so this function will initially return false while the overlay is loading.
  • Returns a bool.

isSteamChinaLauncher()

  • Returns whether the current launcher is a Steam China launcher. You can cause the client to behave as the Steam China launcher by adding -dev -steamchina to the command line when running Steam.
  • Returns a bool.

initFilterText()

  • Initializes text filtering, loading dictionaries for the language the game is running in.
  • Users can customize the text filter behavior in their Steam Account preferences.
  • Returns a bool.

filterText( int context, int steam_id, string message ) filterText( int context, uint64_t steam_id, string message )

  • Filters the provided input message and returns the filtered result. Legally required filtering is always applied. Additional filtering may occur, based on the context and user settings.
  • Returns a string.

isSteamInBigPictureMode()

  • Checks if Steam & the Steam Overlay are running in Big Picture mode.
  • Games must be launched through the Steam client to enable the Big Picture overlay. During development, a game can be added as a non-steam game to the developers library to test this feature.
  • Returns a bool.

isSteamRunningInVR()

  • Checks if Steam is running in VR mode.
  • Returns a bool.

isVRHeadsetStreamingEnabled()

  • Checks if the HMD view will be streamed via Steam In-Home Streaming.
  • Returns a bool.

setOverlayNotificationInset( int horizontal, int vertical )

  • Sets the inset of the overlay notification from the corner specified by SetOverlayNotificationPosition. Integer should be number of pixels.
  • Returns nothing; void.

setOverlayNotificationPosition( int pos )

  • Set the position where overlay shows notifications. Accepts the following integer inputs:
    • 0 - Top Left
    • 1 - Top Right
    • 2 - Bottom Left
    • 3 - Bottom Right
  • Returns nothing; void.

setVRHeadsetStreamingEnabled()

  • Set whether the HMD content will be streamed via Steam In-Home Streaming.
  • Returns nothing; void.

isSteamRunningOnSteamDeck()

  • Checks if Steam is running on a Steam Deck device.
  • Returns a bool.

setOverlayNotificationInset( int horizontal, int vertical )

  • Sets the inset of the overlay notification from the corner specified by setOverlayNotificationPosition.
  • A value of (0, 0) resets the position into the corner.
  • This position is per-game and is reset each launch.
  • Returns nothing; void.

setOverlayNotificationPosition( int pos )

  • Sets which corner the Steam overlay notification popup should display itself in.
  • You can also set the distance from the specified corner by using setOverlayNotificationInset.
  • This position is per-game and is reset each launch.
  • Returns nothing; void.

setVRHeadsetStreamingEnabled( bool enabled )

  • Set whether the HMD content will be streamed via Steam Remote Play.
  • If this is enabled, then the scene in the HMD headset will be streamed, and remote input will not be allowed. Otherwise if this is disabled, then the application window will be streamed instead, and remote input will be allowed. VR games default to enabled unless "VRHeadsetStreaming" "0" is in the extended appinfo for a game.
  • This is useful for games that have asymmetric multiplayer gameplay.
  • Returns nothing; void.

showGamepadTextInput( int input_mode, int line_input_mode, string description, int max_text, string preset_text ) showGamepadTextInput( int input_mode, int line_input_mode, string description, uint32 max_text, string preset_text )

  • Activates the Big Picture text input dialog which only supports gamepad input.
  • Returns a bool.

showFloatingGamepadTextInput( int input_mode, int text_field_x_position, int text_field_y_position, int text_field_width, int text_field_height )

  • Opens a floating keyboard over the game content and sends OS keyboard keys directly to the game.
  • The text field position is specified in pixels relative the origin of the game window and is used to position the floating keyboard in a way that doesn't cover the text field.
  • Returns a bool.

startVRDashboard()

  • Ask SteamUI to create and render its OpenVR dashboard.
  • Returns nothing; void.

setGameLauncherMode( bool mode)

  • In game launchers that don't have controller support you can call this to have Steam Input translate the controller input into mouse/kb to navigate the launcher
  • Returns nothing; void.