-
Notifications
You must be signed in to change notification settings - Fork 13
Change KeyState
#53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change KeyState
#53
Conversation
Renaming the |
Fair, I've removed the rename from the PR. Still think there is value in the helper methods, but now I'm even more unsure what they should be called? |
Either |
I've changed it to use |
Use an inherent method instead, since that allows using in more contexts (as the return type is now a static str), and because it's semantically more correct (the key state isn't intrinsically tied to being an event type).
These allow you to use KeyState without having to import it.
Remove
Display
impl, rename variants and add helper methods, see each commit for details.The motivation is to make this match
winit::event::ElementState
.Unsure about the helper method names, whether
is_pressed
orpressed
is cleaner? I went withis_pressed
to match what's used in the wild for e.g. Bevy'sButtonState
, and since it also more closely matches Rust conventions on enums (is_some
,is_poisoned
,is_ne
, ...). But that's inconsistent with e.g.Modifiers::shift
(so maybe we should change the latter too?).