lily/src/main.rs

36 lines
809 B
Rust

use bevy::app::AppExit;
use bevy::prelude::*;
use bevy_egui::EguiPlugin;
use std::env::consts::OS;
const VERSION: &'static str = "0.0-a1";
mod setup;
fn main() {
App::build()
.insert_resource(WindowDescriptor {
width: 1600.,
height: 1200.,
title: format!("Lily {}", VERSION),
vsync: false,
..Default::default()
})
.add_plugins(DefaultPlugins)
.add_plugin(EguiPlugin)
.add_plugin(setup::SetupPlugin)
.add_system(keyboard_exit.system())
.run();
}
fn keyboard_exit(keys: Res<Input<KeyCode>>, mut exit: EventWriter<AppExit>) {
// Cmd+W or Cmd+Q do the same here
if OS == "macos"
&& (keys.pressed(KeyCode::LWin) && (keys.pressed(KeyCode::W) || keys.pressed(KeyCode::Q)))
{
exit.send(AppExit);
}
}
fn test_egui(mut parent_query: Query<(Entity, &Children), With<Node>>) {}