Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added binding for SDL_GetDisplayUsableBounds. #1100

Merged
merged 2 commits into from
Apr 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/sdl2/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,19 @@ impl VideoSubsystem {
}
}

#[doc(alias = "SDL_GetDisplayUsableBounds")]
pub fn display_usable_bounds(&self, display_index: i32) -> Result<Rect, String> {
let mut out = mem::MaybeUninit::uninit();
let result =
unsafe { sys::SDL_GetDisplayUsableBounds(display_index as c_int, out.as_mut_ptr()) };
if result == 0 {
let out = unsafe { out.assume_init() };
Ok(Rect::from_ll(out))
} else {
Err(get_error())
}
}

#[doc(alias = "SDL_GetNumDisplayModes")]
pub fn num_display_modes(&self, display_index: i32) -> Result<i32, String> {
let result = unsafe { sys::SDL_GetNumDisplayModes(display_index as c_int) };
Expand Down