Skip to content

New input API#33

Merged
bors[bot] merged 1 commit intomasterfrom
input
Jun 20, 2017
Merged

New input API#33
bors[bot] merged 1 commit intomasterfrom
input

Conversation

@kvark
Copy link
Collaborator

@kvark kvark commented Jun 19, 2017

Closes #8

r? @vitvakatu

Copy link
Member

@vitvakatu vitvakatu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only some minor notes

src/input.rs Outdated
#[allow(dead_code)]
struct InputDiff {
time_delta: TimerDuration,
//time_delta_focused: time::Duration,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed now

src/input.rs Outdated
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Timer {
start: time::Instant,
//focus_only: bool,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this?

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to use hex number instead of decimal?
Also, maybe we should use constant for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

}

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 };
Copy link
Member

@vitvakatu vitvakatu Jun 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems irregular for me. Maybe AXIS_UP_DOWN? People usually look from the top to the bottom.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to fix it asap.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, and no rush!

Copy link
Collaborator Author

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -0,0 +1,172 @@
#![allow(missing_docs)] //TODO
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, and no rush!

src/input.rs Outdated
#[allow(dead_code)]
struct InputDiff {
time_delta: TimerDuration,
//time_delta_focused: time::Duration,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed now

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,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

}

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 };
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The axis go from DOWN (negative) to UP (positive), hence the name AXIS_DOWN_UP, which is consistent with AXIS_LEFT_RIGHT.

@kvark
Copy link
Collaborator Author

kvark commented Jun 20, 2017

Comments addressed, unleashing bors.
bors r+

bors bot added a commit that referenced this pull request Jun 20, 2017
33: New input API r=kvark

Closes #8

r? @vitvakatu
@bors
Copy link
Contributor

bors bot commented Jun 20, 2017

Build succeeded

@bors bors bot merged commit bf87746 into master Jun 20, 2017
@kvark kvark deleted the input branch June 20, 2017 01:49
kvark pushed a commit that referenced this pull request Nov 10, 2017
33: New input API r=kvark

Closes #8

r? @vitvakatu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants