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
@ -516,14 +516,14 @@ impl ButtonSettings {
|
|||||||
/// Returns `true` if the button is pressed.
|
/// 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.
|
/// 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
|
value >= self.press_threshold
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if the button is released.
|
/// 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.
|
/// 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
|
value <= self.release_threshold
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user