aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Collins <[email protected]>2018-02-24 12:52:45 +0000
committerMatthew Collins <[email protected]>2018-02-24 12:52:45 +0000
commitdfbbc13d91a77a2052c8ad02c559e08d86bb7ebf (patch)
treef7e35082d58bf89ae5c1751b99e22d366742d8da
parentInitial work on lobbies + A clean up (diff)
downloadsteamworks-rs-dfbbc13d91a77a2052c8ad02c559e08d86bb7ebf.tar.xz
steamworks-rs-dfbbc13d91a77a2052c8ad02c559e08d86bb7ebf.zip
Add a way to move notifications
-rw-r--r--src/utils.rs21
-rw-r--r--steamworks-sys/src/lib.rs9
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;