https://github.com/vallentin/glfw-ext
https://github.com/vallentin/glfw-ext
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/vallentin/glfw-ext
- Owner: vallentin
- License: mit
- Created: 2023-05-25T17:23:16.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-25T17:27:09.000Z (about 3 years ago)
- Last Synced: 2025-02-28T13:31:20.806Z (over 1 year ago)
- Language: Rust
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# glfw-ext
[](https://crates.io/crates/glfw-ext)
[](https://docs.rs/glfw-ext)
[](https://github.com/vallentin/glfw-ext)
Utilities and extension methods for [`glfw`].
*The version of [`glfw-ext`] follows the version of [`glfw`].*
Center window on the dominant monitor.
```rust
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:
```rust
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.
[`glfw`]: https://crates.io/crates/glfw
[`glfw-ext`]: https://crates.io/crates/glfw-ext
[examples/center_window.rs]: https://github.com/vallentin/glfw-ext/blob/master/examples/center_window.rs