Struct steamworks::Utils

source ·
pub struct Utils<Manager> { /* private fields */ }
Expand description

Access to the steam utils interface

Implementations§

source§

impl<Manager> Utils<Manager>

source

pub fn app_id(&self) -> AppId

Returns the app ID of the current process

source

pub fn ip_country(&self) -> String

Returns the country code of the current user based on their IP

source

pub fn ui_language(&self) -> String

Returns the language the steam client is currently running in.

Generally you want Apps::current_game_language instead of this

source

pub fn get_server_real_time(&self) -> u32

Returns the current real time on the Steam servers in Unix epoch format (seconds since 1970/1/1 UTC).

source

pub fn set_overlay_notification_position(&self, position: NotificationPosition)

Sets the position on the screen where popups from the steam overlay should appear and display themselves in.

source

pub fn set_warning_callback<F>(&self, cb: F)
where F: Fn(i32, &CStr) + Send + Sync + 'static,

Sets the Steam warning callback, which is called to emit warning messages.

The passed-in function takes two arguments: a severity level (0 = info, 1 = warning) and the message itself.

See Steamwork’s debugging page for more info.

source

pub fn get_entered_gamepad_text_input( &self, dismissed_data: &GamepadTextInputDismissed ) -> Option<String>

Gets the gamepad text input from the Big Picture overlay.

This must be called within the show_gamepad_text_input callback. Returns Some(String) if user submitted the text, and None otherwise

source

pub fn is_steam_running_on_steam_deck(&self) -> bool

Checks if Steam is running on a Steam Deck device.

source

pub fn show_gamepad_text_input<F>( &self, input_mode: GamepadTextInputMode, input_line_mode: GamepadTextInputLineMode, description: &str, max_characters: u32, existing_text: Option<&str>, dismissed_cb: F ) -> bool
where F: FnMut(GamepadTextInputDismissed) + 'static + Send,

Activates the Big Picture text input dialog which only supports gamepad input.

source

pub fn show_floating_gamepad_text_input<F>( &self, keyboard_mode: FloatingGamepadTextInputMode, x: i32, y: i32, width: i32, height: i32, dismissed_cb: F ) -> bool
where F: FnMut() + 'static + Send,

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.

Callback is triggered when user dismisses the text input

Auto Trait Implementations§

§

impl<Manager> RefUnwindSafe for Utils<Manager>
where Manager: RefUnwindSafe,

§

impl<Manager> !Send for Utils<Manager>

§

impl<Manager> !Sync for Utils<Manager>

§

impl<Manager> Unpin for Utils<Manager>

§

impl<Manager> UnwindSafe for Utils<Manager>
where Manager: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.