17cupsofcoffee / tetra

🎮 A simple 2D game framework written in Rust
MIT License
909 stars 63 forks source link

set_key_down() not sets the key pressed in key repeat is enabled #279

Closed Tairesh closed 3 years ago

Tairesh commented 3 years ago

It seems like a bug, if key_repeat is enabled and you hold a key you can get event Event::KeyPressed every SDL "repeat tick" but if you using input::get_keys_pressed() this key will show up only one time. I fixed it by adding check is_key_repeat_enabled() to input::set_key_down()

17cupsofcoffee commented 3 years ago

This seems reasonable/more consistent to me - I'll give some thought to whether there could be any unexpected side effects to making this change, but I'm in favour of it at first glance.

17cupsofcoffee commented 3 years ago

Finally working my way through the PR backlog - this looks fine to me, and I'm always a fan of making APIs more consistent. Merged :)