gilrs_core/platform/
mod.rs

1// Copyright 2016-2018 Mateusz Sieczko and other GilRs Developers
2//
3// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
4// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
5// http://opensource.org/licenses/MIT>, at your option. This file may not be
6// copied, modified, or distributed except according to those terms.
7
8//! Module which exports the platform-specific types.
9//!
10//! Each backend has to provide:
11//!
12//! * A `FfDevice` (a struct which handles force feedback)
13//! * A `Gilrs` context
14//! * A `Gamepad` struct
15//! * A static `str` which specifies the name of the SDL input mapping
16//! * A constant which define whether Y axis of sticks points upwards or downwards
17//! * A module with the platform-specific constants for common gamepad buttons
18//!   called `native_ev_codes`
19
20#![allow(clippy::module_inception)]
21
22pub use self::platform::*;
23
24#[cfg(target_os = "linux")]
25#[path = "linux/mod.rs"]
26mod platform;
27
28#[cfg(target_os = "macos")]
29#[path = "macos/mod.rs"]
30mod platform;
31
32#[cfg(all(not(feature = "xinput"), not(feature = "wgi")))]
33compile_error!(
34    "Windows needs one of the features `gilrs/xinput` or `gilrs/wgi` enabled. \nEither don't use \
35     'default-features = false' or add one of the features back."
36);
37
38#[cfg(all(feature = "wgi", feature = "xinput"))]
39compile_error!("features `gilrs/xinput` and `gilrs/wgi` are mutually exclusive");
40
41#[cfg(all(target_os = "windows", feature = "xinput", not(feature = "wgi")))]
42#[path = "windows_xinput/mod.rs"]
43mod platform;
44
45#[cfg(all(target_os = "windows", feature = "wgi"))]
46#[path = "windows_wgi/mod.rs"]
47mod platform;
48
49#[cfg(target_arch = "wasm32")]
50#[path = "wasm/mod.rs"]
51mod platform;
52
53#[cfg(all(
54    not(any(target_os = "linux")),
55    not(target_os = "macos"),
56    not(target_os = "windows"),
57    not(target_arch = "wasm32")
58))]
59#[path = "default/mod.rs"]
60mod platform;