amethyst / amethyst/bracket-lib
First Q key press is dropped
- 主要语言
- Rust
- 星标
- 1.7k
- 派生
- 126
- PR 合并指标
- 30 天内没有已合并 PR
描述
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.

贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。