diff --git a/snake-game/examples/bevy_learning.rs b/snake-game/examples/bevy_learning.rs new file mode 100644 index 0000000..7d9f143 --- /dev/null +++ b/snake-game/examples/bevy_learning.rs @@ -0,0 +1,25 @@ +/// Эксперименты в ходе прохождения туториала: +/// https://github.com/fogarecious/bevy_tutorial +use bevy::prelude::*; + +fn main() { + App::new() + .add_plugins( + DefaultPlugins + .build() + .set(bevy::log::LogPlugin { + fmt_layer: |_| snake_game::define_log_layer(), + ..Default::default() + }) + .set(TaskPoolPlugin { + task_pool_options: TaskPoolOptions::with_num_threads(1), + }), + ) + .insert_resource(ClearColor(Color::srgb(0.3, 0.6, 0.8))) + .add_systems(Startup, setup) + .run(); +} + +fn setup(mut commands: Commands) { + commands.spawn(Camera2d); +} diff --git a/snake-game/src/main.rs b/snake-game/src/main.rs index 8b7e11a..ce2f6ad 100644 --- a/snake-game/src/main.rs +++ b/snake-game/src/main.rs @@ -1,5 +1,3 @@ -use bevy::ecs::system::command::*; -use bevy::math::bounding::*; use bevy::prelude::*; fn main() { @@ -15,16 +13,11 @@ fn main() { task_pool_options: TaskPoolOptions::with_num_threads(1), }), ) - .insert_resource(ClearColor(Color::srgb(0.8, 0.8, 1.0))) + .insert_resource(ClearColor(Color::srgb(0.0, 0.75, 1.0))) .add_systems(Startup, setup) - // config .run(); } -fn setup( - mut commands: Commands, - mut meshes: ResMut>, - mut materials: ResMut>, -) { +fn setup(mut commands: Commands) { commands.spawn(Camera2d); }