bevy-playground/src/main.rs

42 lines
975 B
Rust
Raw Normal View History

2023-12-19 11:17:49 -06:00
use bevy::prelude::*;
mod assets;
mod camera;
2023-12-20 13:36:34 -06:00
mod movement;
mod player;
2023-12-19 11:17:49 -06:00
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()
}))
2023-12-20 22:08:40 -06:00
.add_plugins((
camera::Camera,
2023-12-20 22:40:13 -06:00
assets::AssetPlugin,
2023-12-20 22:08:40 -06:00
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.,
});
2023-12-19 11:17:49 -06:00
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);
2023-12-19 11:17:49 -06:00
}
}