Uh oh!
There was an error while loading. Please reload this page.
Conversation
vitvakatu
requested changes
Jun 19, 2017
| #[allow(dead_code)] | ||
| struct InputDiff { | ||
| time_delta: TimerDuration, | ||
| //time_delta_focused: time::Duration, |
| #[derive(Clone, Copy, Debug, PartialEq)] | ||
| pub struct Timer { | ||
| start: time::Instant, | ||
| //focus_only: bool, |
| impl Button { | ||
| pub fn count_hits(&self, input: &Input) -> u8 { | ||
| match *self { | ||
| Button::Key(button) => input.1.keys_hit.iter().filter(|&&key| key == button).take(0xFF).count() as u8, |
Member
There was a problem hiding this comment.
Any reason to use hex number instead of decimal?
Also, maybe we should use constant for this?
| } | ||
| pub const AXIS_LEFT_RIGHT: KeyAxis = KeyAxis{ neg: Key::Left, pos: Key::Right }; | ||
| pub const AXIS_DOWN_UP: KeyAxis = KeyAxis{ neg: Key::Down, pos: Key::Up }; |
Member
There was a problem hiding this comment.
It seems irregular for me. Maybe AXIS_UP_DOWN? People usually look from the top to the bottom.
CollaboratorAuthor
There was a problem hiding this comment.
The axis go from DOWN (negative) to UP (positive), hence the name AXIS_DOWN_UP, which is consistent with AXIS_LEFT_RIGHT.
| @@ -0,0 +1,172 @@ | |||
| #![allow(missing_docs)] //TODO | |||
kvark
commented
Jun 20, 2017
| @@ -0,0 +1,172 @@ | |||
| #![allow(missing_docs)] //TODO | |||
| #[allow(dead_code)] | ||
| struct InputDiff { | ||
| time_delta: TimerDuration, | ||
| //time_delta_focused: time::Duration, |
| impl Button { | ||
| pub fn count_hits(&self, input: &Input) -> u8 { | ||
| match *self { | ||
| Button::Key(button) => input.1.keys_hit.iter().filter(|&&key| key == button).take(0xFF).count() as u8, |
| } | ||
| pub const AXIS_LEFT_RIGHT: KeyAxis = KeyAxis{ neg: Key::Left, pos: Key::Right }; | ||
| pub const AXIS_DOWN_UP: KeyAxis = KeyAxis{ neg: Key::Down, pos: Key::Up }; |
CollaboratorAuthor
There was a problem hiding this comment.
The axis go from DOWN (negative) to UP (positive), hence the name AXIS_DOWN_UP, which is consistent with AXIS_LEFT_RIGHT.
kvark
commented
Jun 20, 2017
CollaboratorAuthor
Comments addressed, unleashing bors. |
borsBot
added a commit
that referenced
this pull request
Jun 20, 2017
33: New input API r=kvark Closes#8 r? @vitvakatu
Contributor
Build succeeded |
kvark pushed a commit
that referenced
this pull request
Nov 10, 2017
33: New input API r=kvark Closes#8 r? @vitvakatu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes#8
r? @vitvakatu