summaryrefslogtreecommitdiff
path: root/src/types
diff options
context:
space:
mode:
Diffstat (limited to 'src/types')
-rw-r--r--src/types/controller.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/types/controller.rs b/src/types/controller.rs
index 76b77e3..42d3f8c 100644
--- a/src/types/controller.rs
+++ b/src/types/controller.rs
@@ -1,11 +1,15 @@
use crate::*;
+#[cfg(feature = "gamepad")]
pub use gilrs::{Gilrs, GamepadId};
pub struct OwnedGamepad {
tag: usize,
+ #[cfg(feature = "gamepad")]
id: Option<GamepadId>,
+ #[cfg(not(feature = "gamepad"))]
+ id: Option<()>,
gamepad: Gamepad,
}
@@ -15,6 +19,7 @@ impl OwnedGamepad {
}
/// Returns Some if the ID owns this gamepad.
+ #[cfg(feature = "gamepad")]
pub fn register(&mut self, new_id: GamepadId) -> Option<&mut Gamepad> {
if let Some(id) = self.id {
match id == new_id {
@@ -102,6 +107,7 @@ impl Gamepad {
}
// Returns true if the state changed.
+ #[cfg(feature = "gamepad")]
pub fn process_event(&mut self, event: &gilrs::Event) -> bool {
macro_rules! schmitt {
($name_neg:ident, $name_pos:ident, $v:expr) => {{