set window title at startup instead of a system
This commit is contained in:
parent
bdf0cb5caa
commit
76d4ddd7db
1 changed files with 8 additions and 10 deletions
18
src/main.rs
18
src/main.rs
|
@ -1,5 +1,5 @@
|
||||||
#![windows_subsystem = "windows"]
|
#![windows_subsystem = "windows"]
|
||||||
use bevy::{prelude::*, window::PrimaryWindow, winit::WinitSettings};
|
use bevy::{prelude::*, winit::WinitSettings};
|
||||||
use bevy_egui::{
|
use bevy_egui::{
|
||||||
egui::{self},
|
egui::{self},
|
||||||
EguiContexts, EguiPlugin,
|
EguiContexts, EguiPlugin,
|
||||||
|
@ -25,21 +25,19 @@ fn main() {
|
||||||
output_value: "".to_string(),
|
output_value: "".to_string(),
|
||||||
needs_update: false,
|
needs_update: false,
|
||||||
})
|
})
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
||||||
|
primary_window: Some(Window {
|
||||||
|
title: "dsort".to_string(),
|
||||||
|
..Default::default()
|
||||||
|
}),
|
||||||
|
..Default::default()
|
||||||
|
}))
|
||||||
.add_plugins(EguiPlugin)
|
.add_plugins(EguiPlugin)
|
||||||
.add_systems(Startup, set_window_title)
|
|
||||||
.add_systems(Update, ui_system)
|
.add_systems(Update, ui_system)
|
||||||
.add_systems(Update, process_text)
|
.add_systems(Update, process_text)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: move this into init
|
|
||||||
fn set_window_title(mut window_query: Query<&mut Window, With<PrimaryWindow>>) {
|
|
||||||
if let Ok(mut window) = window_query.get_single_mut() {
|
|
||||||
window.title = "dsort".to_string();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn process_text(mut state: ResMut<State>) {
|
fn process_text(mut state: ResMut<State>) {
|
||||||
if state.needs_update {
|
if state.needs_update {
|
||||||
println!("updating sort");
|
println!("updating sort");
|
||||||
|
|
Loading…
Add table
Reference in a new issue