From 1efadcf2d9281869e8b5c9acb39f8d3636939696 Mon Sep 17 00:00:00 2001 From: Alexander Baranov Date: Tue, 9 Jun 2026 20:21: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 --- snake-game/examples/schedules_test.rs | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/snake-game/examples/schedules_test.rs b/snake-game/examples/schedules_test.rs index 9e3cb9a..66e1b2b 100644 --- a/snake-game/examples/schedules_test.rs +++ b/snake-game/examples/schedules_test.rs @@ -1,15 +1,16 @@ -use bevy::{app::FixedMain, prelude::*}; +use bevy::prelude::*; fn main() { App::new() // .add_plugins(DefaultPlugins) .add_systems(StateTransition, state_transition) .add_systems(PreStartup, pre_startup) - .add_systems(Startup, startup) + .add_systems(Startup, (startup, setup)) .add_systems(PostStartup, post_startup) .add_systems(First, first) .add_systems(PreUpdate, pre_update) - .add_systems(FixedMain, fixed_main) + .add_systems(Update, (update, check_space_pressed)) + .add_systems(PostUpdate, post_update) .run(); } @@ -37,6 +38,21 @@ fn pre_update() { info!("PreUpdate"); } -fn fixed_main() { - info!("FixedMain"); +fn update() { + info!("Update"); } + +fn post_update() { + info!("PostUpdate"); +} + +fn check_space_pressed(input: Res>, mut commands: Commands) { + if input.just_pressed(KeyCode::Space) { + commands.trigger(TestEvent0); + } +} + +fn setup(mut commands: Commands) {} + +#[derive(Event)] +struct TestEvent0;