amethyst / amethyst/bracket-lib

First Q key press is dropped

Đang mở
#253 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
1.7k
Fork
126
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

![image](https://user-images.githubusercontent.com/1381210/147891236-0e5d5e99-5fe5-44bb-bad3-d76c46147b19.png)

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.