amethyst / amethyst/bracket-lib
First Q key press is dropped
- Vorherrschende Sprache
- Rust
- Sterne
- 1.7k
- Forks
- 126
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
EDIT EDIT: If I change the exit character from Q to A, then A somehow gets swallowed, this is so weird.
EDIT: Should point out on Windows 11 using WSL2 as my dev environment.
In the following code the first Q is always ignored. I can always get the first of any other character output, but I have to hit Q twice before prints and exits.
Cargo Version:
```
cargo 1.57.0 (b2e52d7ca 2021-10-21)
```
Here is the bracket-lib as reported in my Cargo.lock
```
[[package]]
name = "bracket-lib"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0fb005e908ce2e553277e554c32ab06d8b12bea38660da98f2e77e662dea617"
dependencies = [
"bracket-algorithm-traits",
"bracket-color",
"bracket-geometry",
"bracket-noise",
"bracket-pathfinding",
"bracket-random",
"bracket-terminal",
]
```
```
use bracket_lib::prelude::*;
struct State;
impl GameState for State {
fn tick(&mut self, ctx: &mut BTerm) {
ctx.cls();
if let Some(key) = ctx.key {
println!("Key={:#?}", key);
match key {
VirtualKeyCode::Q => ctx.quitting = true,
_ => {}
};
}
}
}
fn main() {
let state = State;
let ctx = BTermBuilder::simple80x50()
.build()
.expect("Should have worked?");
main_loop(ctx, state).expect("Something happened.");
}
```
In the following I hit A,B,C, etc. once and they displayed, when I hit Q the first is ignored and the second results in the output below and the program terminating as expected.

Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.