5 releases (3 stable)
1.0.2 | Dec 3, 2023 |
---|---|
1.0.1 | Mar 28, 2023 |
1.0.0 | Jan 8, 2023 |
0.1.1 | Jun 18, 2021 |
0.1.0 | Jun 17, 2021 |
#4 in #full-screen
Used in mage-core
19KB
winit-fullscreen
This is a simple crate that manages toggling of fullscreen in a winit-based
application. Given a borrowed immutable reference to your
winit::window::Window
instance, you can call:
window.toggle_fullscreen();
If your window is not fullscreen, it will be now, otherwise the reverse will be true.
Motivation
I found the fullscreen interface difficult to remember, the documentation lacking and there are some complexities involving different platforms (some do not support full exclusive mode, for example). So I decided to wrap up the functionality under a simple, argumentless, single function.
I am happy to contribute this back into the Winit crate if there is interest.
Issues and ideas
Please post any issues or ideas on the GitHub site on https://github.com/Cthutu/winit-fullscreen.
Credits
Written by Matt Davies, copyright ©2021, all rights reserved.
lib.rs
:
This crate uses an extension trait to add a method winit::window::Window
to allow for easy fullscreen toggling.
window.toggle_fullscreen()
Check the example for a minimal winit app that can toggle to fullscreen on pressing ENTER.
Future work
I plan to add an enum to allow a hint for exclusive or borderless.
Dependencies
~2–19MB
~229K SLoC