1个不稳定版本

0.1.0 2023年5月25日

#343 in 渲染


用于 ren

MIT 协议

7KB
52

glfw-ext

Latest Version Docs License

GLFW的实用工具和扩展方法。

将窗口置于主显示器中央。

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();

将窗口置于主显示器

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);
    }
});

参见 examples/center_window.rs 获取完整示例。

依赖项

~2MB
~44K SLoC