Skip to content

Commit

Permalink
cargo fmt examples/compass_screen.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Joaquin Rosales committed Apr 7, 2018
1 parent 8212f44 commit fedde57
Showing 1 changed file with 63 additions and 61 deletions.
124 changes: 63 additions & 61 deletions examples/compass_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,80 +27,80 @@ fn main() {
];

let right = {
let mut pxs = background_pixels.clone();
pxs[31] = &red_px;
pxs[39] = &red_px;
pxs
let mut pxs = background_pixels.clone();
pxs[31] = &red_px;
pxs[39] = &red_px;
pxs
};
let right_up = {
let mut pxs = background_pixels.clone();
pxs[14] = &red_px;
pxs[23] = &red_px;
pxs
let mut pxs = background_pixels.clone();
pxs[14] = &red_px;
pxs[23] = &red_px;
pxs
};
let right_down = {
let mut pxs = background_pixels.clone();
pxs[47] = &red_px;
pxs[54] = &red_px;
pxs
let mut pxs = background_pixels.clone();
pxs[47] = &red_px;
pxs[54] = &red_px;
pxs
};

let up = {
let mut pxs = background_pixels.clone();
pxs[3] = &red_px;
pxs[4] = &red_px;
pxs
let mut pxs = background_pixels.clone();
pxs[3] = &red_px;
pxs[4] = &red_px;
pxs
};

let up_left = {
let mut pxs = background_pixels.clone();
pxs[2] = &red_px;
pxs[9] = &red_px;
pxs
let mut pxs = background_pixels.clone();
pxs[2] = &red_px;
pxs[9] = &red_px;
pxs
};
let up_right = {
let mut pxs = background_pixels.clone();
pxs[5] = &red_px;
pxs[14] = &red_px;
pxs
let mut pxs = background_pixels.clone();
pxs[5] = &red_px;
pxs[14] = &red_px;
pxs
};

let left = {
let mut pxs = background_pixels.clone();
pxs[24] = &red_px;
pxs[32] = &red_px;
pxs
let mut pxs = background_pixels.clone();
pxs[24] = &red_px;
pxs[32] = &red_px;
pxs
};
let left_up = {
let mut pxs = background_pixels.clone();
pxs[9] = &red_px;
pxs[16] = &red_px;
pxs
let mut pxs = background_pixels.clone();
pxs[9] = &red_px;
pxs[16] = &red_px;
pxs
};
let left_down = {
let mut pxs = background_pixels.clone();
pxs[40] = &red_px;
pxs[49] = &red_px;
pxs
let mut pxs = background_pixels.clone();
pxs[40] = &red_px;
pxs[49] = &red_px;
pxs
};

let down = {
let mut pxs = background_pixels.clone();
pxs[59] = &red_px;
pxs[60] = &red_px;
pxs
let mut pxs = background_pixels.clone();
pxs[59] = &red_px;
pxs[60] = &red_px;
pxs
};
let down_left = {
let mut pxs = background_pixels.clone();
pxs[49] = &red_px;
pxs[58] = &red_px;
pxs
let mut pxs = background_pixels.clone();
pxs[49] = &red_px;
pxs[58] = &red_px;
pxs
};
let down_right = {
let mut pxs = background_pixels.clone();
pxs[54] = &red_px;
pxs[61] = &red_px;
pxs
let mut pxs = background_pixels.clone();
pxs[54] = &red_px;
pxs[61] = &red_px;
pxs
};
let bg_frame = FrameLine::from_pixels(&background_pixels);
let left_frame = FrameLine::from_pixels(&left);
Expand All @@ -127,40 +127,42 @@ fn main() {
match needle.as_degrees() {
angle if angle > -15.0 && angle <= 15.0 => {
screen.write_frame(&right_frame);
},
}
angle if angle > 15.0 && angle <= 45.0 => {
screen.write_frame(&right_up_frame);
},
}
angle if angle > 45.0 && angle <= 75.0 => {
screen.write_frame(&up_right_frame);
},
}
angle if angle > 75.0 && angle <= 105.0 => {
screen.write_frame(&up_frame);
},
}
angle if angle > 105.0 && angle <= 135.0 => {
screen.write_frame(&up_left_frame);
},
}
angle if angle > 135.0 && angle <= 165.0 => {
screen.write_frame(&left_up_frame);
},
angle if (angle > 165.0 && angle <= 180.0) || (angle < -165.0 && angle >= -180.0) => {
}
angle
if (angle > 165.0 && angle <= 180.0) || (angle < -165.0 && angle >= -180.0) =>
{
screen.write_frame(&left_frame);
},
}
angle if angle < -15.0 && angle >= -45.0 => {
screen.write_frame(&right_down_frame);
},
}
angle if angle < -45.0 && angle >= -75.0 => {
screen.write_frame(&down_right_frame);
},
}
angle if angle < -75.0 && angle >= -105.0 => {
screen.write_frame(&down_frame);
},
}
angle if angle < -105.0 && angle >= -135.0 => {
screen.write_frame(&down_left_frame);
},
}
angle if angle < -135.0 && angle >= -165.0 => {
screen.write_frame(&left_down_frame);
},
}
_ => screen.write_frame(&bg_frame),
}
}
Expand Down

0 comments on commit fedde57

Please sign in to comment.