mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
working towards #861 -
Use scancodes for (at minimum) key remapping added ScanCode fallback for when winit doesn't provide a VirtualKeyCode renamed SKey to ScanKey
This commit is contained in:
parent
55c49f88e6
commit
5f9984df12
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Reflective LoD water
|
||||
- Map indicators for group members
|
||||
- Hot-reloading for i18n, sounds, loot lotteries, and more
|
||||
- Initial support for alternate style keyboards
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -311,6 +311,7 @@ pub type EventLoop = winit::event_loop::EventLoop<()>;
|
||||
pub enum KeyMouse {
|
||||
Key(winit::event::VirtualKeyCode),
|
||||
Mouse(winit::event::MouseButton),
|
||||
ScanKey(winit::event::ScanCode),
|
||||
}
|
||||
|
||||
impl fmt::Display for KeyMouse {
|
||||
@ -487,6 +488,7 @@ impl fmt::Display for KeyMouse {
|
||||
Mouse(MouseButton::Other(button)) =>
|
||||
// Additional mouse buttons after middle click start at 1
|
||||
return write!(f, "M{}", button + 3),
|
||||
ScanKey(_) => "Unknown",
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -992,12 +994,14 @@ impl Window {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(key) = input.virtual_keycode {
|
||||
if let Some(game_inputs) = Window::map_input(
|
||||
KeyMouse::Key(key),
|
||||
controls,
|
||||
&mut self.remapping_keybindings,
|
||||
) {
|
||||
let input_key = match input.virtual_keycode {
|
||||
Some(key) => KeyMouse::Key(key),
|
||||
None => KeyMouse::ScanKey(input.scancode),
|
||||
};
|
||||
|
||||
if let Some(game_inputs) =
|
||||
Window::map_input(input_key, controls, &mut self.remapping_keybindings)
|
||||
{
|
||||
for game_input in game_inputs {
|
||||
match game_input {
|
||||
GameInput::Fullscreen => {
|
||||
@ -1035,7 +1039,6 @@ impl Window {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
WindowEvent::Focused(state) => {
|
||||
self.focused = state;
|
||||
|
Loading…
Reference in New Issue
Block a user