Conversation
src/input.rs
Outdated
| #[allow(dead_code)] | ||
| struct InputDiff { | ||
| time_delta: TimerDuration, | ||
| //time_delta_focused: time::Duration, |
src/input.rs
Outdated
| #[derive(Clone, Copy, Debug, PartialEq)] | ||
| pub struct Timer { | ||
| start: time::Instant, | ||
| //focus_only: bool, |
src/input.rs
Outdated
| 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, |
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 }; |
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.
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 | |||
There was a problem hiding this comment.
thanks, and no rush!
| @@ -0,0 +1,172 @@ | |||
| #![allow(missing_docs)] //TODO | |||
There was a problem hiding this comment.
thanks, and no rush!
src/input.rs
Outdated
| #[allow(dead_code)] | ||
| struct InputDiff { | ||
| time_delta: TimerDuration, | ||
| //time_delta_focused: time::Duration, |
src/input.rs
Outdated
| 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 }; |
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.
|
Comments addressed, unleashing bors. |
33: New input API r=kvark Closes #8 r? @vitvakatu
Build succeeded |
33: New input API r=kvark Closes #8 r? @vitvakatu
Closes #8
r? @vitvakatu