bevy-playground/src/main.rs

42 lines
975 B
Rust

use bevy::prelude::*;
mod assets;
mod camera;
mod movement;
mod player;
fn main() {
let mut app = App::new();
app.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
title: "Kodo Tag".into(),
resolution: (800., 600.).into(),
..Default::default()
}),
..Default::default()
}))
.add_plugins((
camera::Camera,
assets::AssetPlugin,
player::Player,
movement::Movement,
))
.add_systems(Update, keyboard_input_system)
.insert_resource(ClearColor(Color::rgb(0.3, 0., 0.5)))
.insert_resource(AmbientLight {
color: Color::rgb(1., 1., 1.),
brightness: 1.,
});
app.run()
}
fn keyboard_input_system(
keyboard_input: Res<Input<KeyCode>>,
mut app_exit_events: ResMut<Events<bevy::app::AppExit>>,
) {
if keyboard_input.pressed(KeyCode::Escape) {
app_exit_events.send(bevy::app::AppExit);
}
}