From ea20dd09620de5b4e92a8357eceb9455be66e784 Mon Sep 17 00:00:00 2001 From: Alexander Baranov Date: Thu, 28 May 2026 14:08:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20-=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bevy learning --- snake-game/examples/bevy_learning.rs | 25 +++++++++++++++++++++++++ snake-game/src/main.rs | 11 ++--------- 2 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 snake-game/examples/bevy_learning.rs 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); }