bevy/examples/window/window_settings.rs
François 76cc25823d
can change window settings at runtime (#644)
can change window settings at runtime
2020-10-15 11:42:19 -07:00

27 lines
755 B
Rust

use bevy::prelude::*;
/// This example illustrates how to customize the default window settings
fn main() {
App::build()
.add_resource(WindowDescriptor {
title: "I am a window!".to_string(),
width: 500,
height: 300,
vsync: true,
resizable: false,
..Default::default()
})
.add_default_plugins()
.add_system(change_title.system())
.run();
}
/// This system will then change the title during execution
fn change_title(time: Res<Time>, mut windows: ResMut<Windows>) {
let window = windows.get_primary_mut().unwrap();
window.set_title(format!(
"Seconds since startup: {}",
time.seconds_since_startup.round()
));
}