[Merged by Bors] - add documentation on Input#1781
[Merged by Bors] - add documentation on Input#1781mockersf wants to merge 3 commits intobevyengine:mainfrom
Input#1781Conversation
|
Looks good. I like the |
crates/bevy_input/src/input.rs
Outdated
| /// Check if `input` has been just pressed, and clear it so that it won't be processed further. | ||
| pub fn just_pressed_and_clear(&mut self, input: T) -> bool { | ||
| self.just_pressed.remove(&input); | ||
| self.just_pressed.contains(&input) |
There was a problem hiding this comment.
This will always return false because we just removed input in the previous line. I'll just fix this now because its easy.
There was a problem hiding this comment.
Sometime I really miss the 🤦♂️ emoji reaction on GitHub... sorry about that one
There was a problem hiding this comment.
Haha no worries. This is a class of mistake that we all make 😄
|
I renamed |
|
bors r+ |
related to #1700 This PR: * documents all methods on `Input<T>` * adds documentation on the struct about how to use it, and how to implement it for a new input type * renames method `update` to a easier to understand `clear` * adds two methods to check for state and clear it after, allowing easier use in the case of #1700 Co-authored-by: Carter Anderson <mcanders1@gmail.com>
|
Pull request successfully merged into main. Build succeeded: |
InputInput
related to bevyengine#1700 This PR: * documents all methods on `Input<T>` * adds documentation on the struct about how to use it, and how to implement it for a new input type * renames method `update` to a easier to understand `clear` * adds two methods to check for state and clear it after, allowing easier use in the case of bevyengine#1700 Co-authored-by: Carter Anderson <mcanders1@gmail.com>
| /// but only one should react, for example in the case of triggering | ||
| /// [`State`] change, you should consider clearing the input state, either by: | ||
| /// | ||
| /// * Using [`Input::just_pressed_and_clear`] or [`Input::just_released_and_clear`] instead. |
There was a problem hiding this comment.
I wanted to note that these no longer exist with the changes that @cart pushed to this PR (just_pressed_and_clear -> clear_just_pressed).
It might be a good idea to enable rustdoc linting on the CI to catch issues like there?
fix a few dead links * Links in `Input` missed a refactor * `Reflect::downcast` can't use the intra doc link format, as it's not a link to a trait function, but to a function implemented on `dyn Reflect` noticed in #1781 (comment)
related to bevyengine#1700 This PR: * documents all methods on `Input<T>` * adds documentation on the struct about how to use it, and how to implement it for a new input type * renames method `update` to a easier to understand `clear` * adds two methods to check for state and clear it after, allowing easier use in the case of bevyengine#1700 Co-authored-by: Carter Anderson <mcanders1@gmail.com>
fix a few dead links * Links in `Input` missed a refactor * `Reflect::downcast` can't use the intra doc link format, as it's not a link to a trait function, but to a function implemented on `dyn Reflect` noticed in bevyengine#1781 (comment)
related to #1700
This PR:
Input<T>updateto a easier to understandclear