mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Make ButtonSettings.is_pressed/released public (#10534)
In gamepad.rs, `ButtonSettings` `is_pressed` and `is_released` are both private, but their implementations use publicly available values. Keeping them private forces consumers to unnecessarily re-implement this logic, so just make them public.
This commit is contained in:
parent
ab300d0ed9
commit
60bbfd78ac
1 changed files with 2 additions and 2 deletions
|
@ -516,14 +516,14 @@ impl ButtonSettings {
|
|||
/// Returns `true` if the button is pressed.
|
||||
///
|
||||
/// A button is considered pressed if the `value` passed is greater than or equal to the press threshold.
|
||||
fn is_pressed(&self, value: f32) -> bool {
|
||||
pub fn is_pressed(&self, value: f32) -> bool {
|
||||
value >= self.press_threshold
|
||||
}
|
||||
|
||||
/// Returns `true` if the button is released.
|
||||
///
|
||||
/// A button is considered released if the `value` passed is lower than or equal to the release threshold.
|
||||
fn is_released(&self, value: f32) -> bool {
|
||||
pub fn is_released(&self, value: f32) -> bool {
|
||||
value <= self.release_threshold
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue