Skip to content

Commit e7cd9c1

Browse files
committed
Add a Gamepad Viewer tool to examples (#6074)
# Objective Give folks an easy way to test their gamepad with bevy. ~~This is a lot of very boring code for an example. Maybe it belongs in the "tools" directory?~~ ## Solution https://user-images.githubusercontent.com/200550/191884342-ace213c0-b423-449a-9295-530cbceaa19e.mp4 ## Notes This has brought to light (to me, anyway) some fairly major issues with gamepads on the web. See: [WASM mappings (gilrs issue 107)](https://gitlab.com/gilrs-project/gilrs/-/issues/107) [Inaccurate value for trigger button of Xbox gamepad with WASM (gilrs issue 121)](https://gitlab.com/gilrs-project/gilrs/-/issues/121)
1 parent b91945b commit e7cd9c1

File tree

3 files changed

+530
-0
lines changed

3 files changed

+530
-0
lines changed

Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,16 @@ description = "A simple way to view glTF models with Bevy. Just run `cargo run -
13401340
category = "Tools"
13411341
wasm = true
13421342

1343+
[[example]]
1344+
name = "gamepad_viewer"
1345+
path = "examples/tools/gamepad_viewer.rs"
1346+
1347+
[package.metadata.example.gamepad_viewer]
1348+
name = "Gamepad Viewer"
1349+
description = "Shows a visualization of gamepad buttons, sticks, and triggers"
1350+
category = "Tools"
1351+
wasm = false
1352+
13431353
# Transforms
13441354
[[example]]
13451355
name = "global_vs_local_translation"

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ Example | Description
291291

292292
Example | Description
293293
--- | ---
294+
[Gamepad Viewer](../examples/tools/gamepad_viewer.rs) | Shows a visualization of gamepad buttons, sticks, and triggers
294295
[Scene Viewer](../examples/tools/scene_viewer.rs) | A simple way to view glTF models with Bevy. Just run `cargo run --release --example scene_viewer /path/to/model.gltf#Scene0`, replacing the path as appropriate. With no arguments it will load the FieldHelmet glTF model from the repository assets subdirectory
295296

296297
## Transforms

0 commit comments

Comments
 (0)