bevy-playground/src/main.rs

35 lines
874 B
Rust
Raw Normal View History

2023-12-19 11:17:49 -06:00
use bevy::prelude::*;
mod assets;
mod camera;
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()
}))
.add_plugins((camera::Camera, assets::AssetLoader))
.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
}
}