23 lines
487 B
Rust
23 lines
487 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::Fullscreen);
|
||
|
} else {
|
||
|
window.set_mode(WindowMode::Windowed);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|