Friendly interface for key inputs
👋 Hello! I'm relatively new to Rust and gradually refreshing my memory of GBA programming (it's been about a decade!). I've been messing around with this library and thought I might contribute back some of the key input abstractions I wrote if this is the sort of thing you're looking for.
This branch adds:
- A typed
Keys::read()function to eliminate the need for.into()s (closes #130) - An
.update()method to update aKeysin place - A
Keyenum withBitOrimpls so you can do things likeif keys.any_pressed(Key::A | Key::B) { ... } - A type for keeping track of key inputs across 2 frames. I called this
KeyMonitor, but I'm definitely open to other thoughts on naming—I don't like calling something a "monitor" when it has to be manually updated, but I also didn't have a better idea.
Having the keys value update itself in place seems strange to me, but I guess it's not strictly wrong.
Otherwise, things seem basically okay so far, but probably there should be a doc comment on anything that isn't just a getter
The KeyInput type is now naturally storing the low-active data, so key data should naturally be much easier to work with. I'll close this.