diff --git a/src/player_control/actions/game_control.rs b/src/player_control/actions/game_control.rs
index ac005e2d..ecfd6f0c 100644
--- a/src/player_control/actions/game_control.rs
+++ b/src/player_control/actions/game_control.rs
@@ -53,30 +53,88 @@ pub fn get_movement(control: GameControl, input: &Res>) -> f32 {
}
}
+// MacOS: sampled by hand
+// Windows:
+// Linux:
generate_bindings! {
GameControl::Up => [
- ScanCode(13), // W
- ScanCode(126), // Up arrow
+ // W
+ ScanCode(
+ #[cfg(target_os = "macos")] 13,
+ #[cfg(target_os = "windows")] 0x11,
+ #[cfg(target_os = "linux")] 0x11,
+ ),
+ // Up arrow
+ ScanCode(
+ #[cfg(target_os = "macos")] 126,
+ #[cfg(target_os = "windows")] 0x48,
+ #[cfg(target_os = "linux")] 0x48,
+ ),
],
GameControl::Down => [
- ScanCode(1), // S
- ScanCode(125), // Down arrow
+ // S
+ ScanCode(
+ #[cfg(target_os = "macos")] 1,
+ #[cfg(target_os = "windows")] 0x1F,
+ #[cfg(target_os = "linux")] 0x1F,
+ ),
+ // Down arrow
+ ScanCode(
+ #[cfg(target_os = "macos")] 125,
+ #[cfg(target_os = "windows")] 0x50,
+ #[cfg(target_os = "linux")] 0x50,
+ ),
],
GameControl::Left => [
- ScanCode(0), // A
- ScanCode(123), // Left arrow
+ // A
+ ScanCode(
+ #[cfg(target_os = "macos")] 0,
+ #[cfg(target_os = "windows")] 0x1E,
+ #[cfg(target_os = "linux")] 0x1E,
+ ),
+ // Left arrow
+ ScanCode(
+ #[cfg(target_os = "macos")] 123,
+ #[cfg(target_os = "windows")] 0x4B,
+ #[cfg(target_os = "linux")] 0x4B,
+ ),
],
GameControl::Right => [
- ScanCode(2), // D
- ScanCode(124), // Right arrow
+ // D
+ ScanCode(
+ #[cfg(target_os = "macos")] 2,
+ #[cfg(target_os = "windows")] 0x20,
+ #[cfg(target_os = "linux")] 0x20,
+ ),
+ // Right arrow
+ ScanCode(
+ #[cfg(target_os = "macos")] 124,
+ #[cfg(target_os = "windows")] 0x4D,
+ #[cfg(target_os = "linux")] 0x4D,
+ ),
],
GameControl::Jump => [
- ScanCode(49), // Space
+ // Space
+ ScanCode(
+ #[cfg(target_os = "macos")] 49,
+ #[cfg(target_os = "windows")] 0x39,
+ #[cfg(target_os = "linux")] 0x39,
+ ),
],
GameControl::ToggleEditor => [
- ScanCode(12), // Q
+ // Q
+ ScanCode(
+ #[cfg(target_os = "macos")] 12,
+ #[cfg(target_os = "windows")] 0x10,
+ #[cfg(target_os = "linux")] 0x10,
+ ),
],
GameControl::Interact => [
- ScanCode(14), // E
+ // E
+ ScanCode(
+ #[cfg(target_os = "macos")] 14,
+ #[cfg(target_os = "windows")] 0x12,
+ #[cfg(target_os = "linux")] 0x12,
+ ),
],
}