Skip to content

New input API - #33

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

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

Conversation

@kvark

@kvark kvark commented Jun 19, 2017

Copy link
Copy Markdown
Collaborator

Closes #8

r? @vitvakatu

@vitvakatu vitvakatu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Only some minor notes

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

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

Choose a reason for hiding this comment

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

removed now

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And this?

Comment thread 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
Copy Markdown
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
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Comment thread src/input.rs
}

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 };

@vitvakatu vitvakatu Jun 19, 2017

Copy link
Copy Markdown
Member

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
Copy Markdown
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.

Comment thread src/input.rs
@@ -0,0 +1,172 @@
#![allow(missing_docs)] //TODO

Copy link
Copy Markdown
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
Copy Markdown
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!

@kvark kvark left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks!

Comment thread src/input.rs
@@ -0,0 +1,172 @@
#![allow(missing_docs)] //TODO

Copy link
Copy Markdown
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!

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

removed now

Comment thread 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
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Comment thread src/input.rs
}

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
Copy Markdown
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

kvark commented Jun 20, 2017

Copy link
Copy Markdown
Collaborator Author

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

bors Bot commented Jun 20, 2017

Copy link
Copy Markdown
Contributor

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