diff options
| -rw-r--r-- | src/utils.rs | 21 | ||||
| -rw-r--r-- | steamworks-sys/src/lib.rs | 9 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/utils.rs b/src/utils.rs index 2ad34f1..aa19d46 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -7,6 +7,13 @@ pub struct Utils { pub(crate) _client: Arc<ClientInner>, } +pub enum NotificationPosition { + TopLeft, + TopRight, + BottomLeft, + BottomRight, +} + impl Utils { /// Returns the app ID of the current process pub fn app_id(&self) -> AppId { @@ -26,4 +33,18 @@ impl Utils { lang.to_string_lossy() } } + + /// Sets the position on the screen where popups from the steam overlay + /// should appear and display themselves in. + pub fn set_overlay_notification_position(&self, position: NotificationPosition) { + unsafe { + let position = match position { + NotificationPosition::TopLeft => sys::NotificationPosition::TopLeft, + NotificationPosition::TopRight => sys::NotificationPosition::TopRight, + NotificationPosition::BottomLeft => sys::NotificationPosition::BottomLeft, + NotificationPosition::BottomRight => sys::NotificationPosition::BottomRight, + }; + sys::SteamAPI_ISteamUtils_SetOverlayNotificationPosition(self.utils, position); + } + } }
\ No newline at end of file diff --git a/steamworks-sys/src/lib.rs b/steamworks-sys/src/lib.rs index 1173b34..604d12e 100644 --- a/steamworks-sys/src/lib.rs +++ b/steamworks-sys/src/lib.rs @@ -61,6 +61,14 @@ pub struct LobbyMatchList { } #[repr(C)] +pub enum NotificationPosition { + TopLeft = 0, + TopRight = 1, + BottomLeft = 2, + BottomRight = 3, +} + +#[repr(C)] #[derive(Debug, Ord, PartialOrd, Eq, PartialEq)] pub enum SResult { Ok = 1, @@ -220,6 +228,7 @@ extern "C" { pub fn SteamAPI_ISteamUtils_GetAppID(instance: *mut ISteamUtils) -> u32; pub fn SteamAPI_ISteamUtils_GetSteamUILanguage(instance: *mut ISteamUtils) -> *const c_char; pub fn SteamAPI_ISteamUtils_IsAPICallCompleted(instance: *mut ISteamUtils, api_call: SteamAPICall, failed: *mut bool) -> bool; + pub fn SteamAPI_ISteamUtils_SetOverlayNotificationPosition(instance: *mut ISteamUtils, position: NotificationPosition); pub fn SteamAPI_ISteamApps_BIsAppInstalled(instance: *mut ISteamApps, app_id: AppId) -> u8; pub fn SteamAPI_ISteamApps_BIsDlcInstalled(instance: *mut ISteamApps, app_id: AppId) -> u8; |