From 670a56679216ddd00d0c8c188f239db1da0f90c8 Mon Sep 17 00:00:00 2001
From: Louis Capitanchik <contact@louiscap.co>
Date: Sat, 22 Jul 2023 23:55:17 +0100
Subject: [PATCH] Debug gamepad info

---
 Cargo.lock                 | 2 +-
 game_core/src/debug/mod.rs | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index ee925fb..5c5bf6d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1455,7 +1455,7 @@ version = "0.5.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
 dependencies = [
- "libloading 0.7.4",
+ "libloading 0.8.0",
 ]
 
 [[package]]
diff --git a/game_core/src/debug/mod.rs b/game_core/src/debug/mod.rs
index 81957b1..1d663d5 100644
--- a/game_core/src/debug/mod.rs
+++ b/game_core/src/debug/mod.rs
@@ -1,7 +1,9 @@
 mod _plugin {
 	use crate::system::AppState;
 	use bevy::prelude::*;
+	use bevy::time::common_conditions::on_fixed_timer;
 	use bevy_rapier2d::prelude::*;
+	use std::time::Duration;
 
 	pub struct DebugPlugin;
 	impl Plugin for DebugPlugin {
@@ -12,7 +14,12 @@ mod _plugin {
 					RigidBody::Fixed,
 					Collider::cuboid(200.0, 50.0),
 				));
-			});
+			})
+			.add_systems(
+				Update,
+				(|gamepads: Res<Gamepads>| info!("{:?}", gamepads))
+					.run_if(on_fixed_timer(Duration::from_secs(5))),
+			);
 		}
 	}
 }
-- 
GitLab