blob: aa19d465777625ee9e2ad3b7adfa07c72430ef9b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
use super::*;
/// Access to the steam utils interface
pub struct Utils {
pub(crate) utils: *mut sys::ISteamUtils,
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 {
unsafe {
AppId(sys::SteamAPI_ISteamUtils_GetAppID(self.utils))
}
}
/// Returns the language the steam client is currently
/// running in.
///
/// Generally you want `Apps::current_game_language` instead of this
pub fn ui_language(&self) -> Cow<str> {
unsafe {
let lang = sys::SteamAPI_ISteamUtils_GetSteamUILanguage(self.utils);
let lang = CStr::from_ptr(lang);
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);
}
}
}
|