22 lines
497 B
Rust
22 lines
497 B
Rust
|
|
use bevy::prelude::*;
|
|
|
|
// this seems to crash
|
|
|
|
pub fn toggle_fullscreeen(
|
|
input: Res<Input<KeyCode>>,
|
|
mut windows: ResMut<Windows>,
|
|
) {
|
|
let window = windows
|
|
.get_primary_mut()
|
|
.unwrap();
|
|
|
|
if input.pressed(KeyCode::F) /*&& input.just_pressed(KeyCode::Return) */ {
|
|
if window.mode() == WindowMode::Windowed {
|
|
window.set_mode(WindowMode::BorderlessFullscreen);
|
|
} else {
|
|
window.set_mode(WindowMode::Windowed);
|
|
}
|
|
}
|
|
}
|
|
|