From 70ce8c388769613b0a6fdfc7d47c2bf2e46d67a5 Mon Sep 17 00:00:00 2001 From: Zhao Yunlong Date: Thu, 2 Jan 2025 23:58:07 +0800 Subject: [PATCH] Add gamepad --- src/main.rs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9c2a5bb..5a82522 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ -use bevy::{prelude::*, window::{PrimaryMonitor, PrimaryWindow}}; +use bevy::{prelude::*, window::PrimaryWindow}; use rand::{rngs::ThreadRng, thread_rng, Rng}; + fn main() { App::new() .add_plugins( @@ -104,7 +105,7 @@ fn update_obstacles( } fn spawn_obstacles( - mut commands: &mut Commands, + commands: &mut Commands, rand: &mut ThreadRng, window_width: f32, pipe_image: &Handle @@ -155,9 +156,23 @@ fn update_bird( time: Res