Ctrl + <key> combination is only detected if <key> is kept pressed first and then ctrl instead of the other way around.
This happens running the tutorial 74 under Ubuntu 20.10. Expected behaviour would be to keep pressing ctrl first and then the key, but then the bracket-lib only detects
A workaround is to turn on the "advanced input API" (call with_advanced_input(true) on the BTermBuilder) and add the following code to the game-loop:
let mut input = INPUT.lock();
ctx.shift = input.key_pressed_set().contains(&VirtualKeyCode::LShift)
|| input.key_pressed_set().contains(&VirtualKeyCode::RShift);
#[allow(clippy::single_match)]
input.for_each_message(|event| match event {
BEvent::CloseRequested => ctx.quitting = true,
_ => (),
});
Do the equivalent for ctx.ctrl. This isn't 100% correct though, but works ok for me (once in a while the release of the shift-key goes missing for some reason, I've not yet debugged why as I intend to switch all the input handling to the advanced input API).
A workaround is to turn on the "advanced input API" (call
with_advanced_input(true)on the BTermBuilder) and add the following code to the game-loop:let mut input = INPUT.lock(); ctx.shift = input.key_pressed_set().contains(&VirtualKeyCode::LShift) || input.key_pressed_set().contains(&VirtualKeyCode::RShift); #[allow(clippy::single_match)] input.for_each_message(|event| match event { BEvent::CloseRequested => ctx.quitting = true, _ => (), });Do the equivalent for
ctx.ctrl. This isn't 100% correct though, but works ok for me (once in a while the release of the shift-key goes missing for some reason, I've not yet debugged why as I intend to switch all the input handling to the advanced input API).
Thanks for your help! This works well for shift and control. I haven't yet reproduced the missing shift release, but will keep an eye on it, so thank you for bringing that up.
Labeling this as an enhancement because the library really needs modifier key handling revisited. Advanced input is the way to go for a lot of this if you want really slick results (I tried to keep the normal mode simple), but hopefully I can find some middle ground. I'll try to get to this after 0.8.2 ships.