ImGui: Add safe wrapper around igGetWindowSize

This commit is contained in:
Malik Olivier Boussejra 2018-03-25 23:08:15 +09:00
parent 72ddc788b1
commit d6897b1556

View File

@ -384,6 +384,14 @@ impl<'a> Ui<'a> {
// Window
impl<'ui> Ui<'ui> {
pub fn window<'p>(&self, name: &'p ImStr) -> Window<'ui, 'p> { Window::new(self, name) }
/// Get current window's size in pixels
pub fn get_window_size(&self) -> (f32, f32) {
let mut out = ImVec2::new(0.0, 0.0);
unsafe {
sys::igGetWindowSize(&mut out as *mut ImVec2);
}
(out.x, out.y)
}
}
// Layout