1 unstable release

0.1.0 May 25, 2023

#13 in #khronos

25 downloads per month
Used in ren

MIT license

7KB
52 lines

glfw-ext

Latest Version Docs License

Utilities and extension methods for glfw.

Center window on the dominant monitor.

use glfw_ext::WindowExt;

// Center the window on the dominant monitor, i.e. if
// the window is 20% on monitor A and 80% on monitor B,
// then the window is centered onto monitor B
wnd.try_center();

Center window on primary monitor:

use glfw_ext::WindowExt;

// Center the window on the primary monitor
glfw.with_primary_monitor(|_glfw, monitor| {
    if let Some(monitor) = monitor {
        wnd.try_center_on_monitor(monitor);
    }
});

See examples/center_window.rs for a complete example.

Dependencies

~2.5MB
~47K SLoC