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:
Dustin Brown 2023-11-15 15:29:33 +01:00 committed by GitHub
parent ab300d0ed9
commit 60bbfd78ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}