Skip to content

Commit

Permalink
Add a Gamepad Viewer tool to examples (bevyengine#6074)
Browse files Browse the repository at this point in the history
# 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)
  • Loading branch information
rparrett authored and james7132 committed Oct 19, 2022
1 parent 634bc50 commit 93d7ed0
Show file tree
Hide file tree
Showing 3 changed files with 530 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Cargo.toml
Expand Up @@ -1340,6 +1340,16 @@ description = "A simple way to view glTF models with Bevy. Just run `cargo run -
category = "Tools"
wasm = true

[[example]]
name = "gamepad_viewer"
path = "examples/tools/gamepad_viewer.rs"

[package.metadata.example.gamepad_viewer]
name = "Gamepad Viewer"
description = "Shows a visualization of gamepad buttons, sticks, and triggers"
category = "Tools"
wasm = false

# Transforms
[[example]]
name = "global_vs_local_translation"
Expand Down
1 change: 1 addition & 0 deletions examples/README.md
Expand Up @@ -291,6 +291,7 @@ Example | Description

Example | Description
--- | ---
[Gamepad Viewer](../examples/tools/gamepad_viewer.rs) | Shows a visualization of gamepad buttons, sticks, and triggers
[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

## Transforms
Expand Down

0 comments on commit 93d7ed0

Please sign in to comment.