@@ -27,80 +27,80 @@ fn main() {
27
27
] ;
28
28
29
29
let right = {
30
- let mut pxs = background_pixels. clone ( ) ;
31
- pxs[ 31 ] = & red_px;
32
- pxs[ 39 ] = & red_px;
33
- pxs
30
+ let mut pxs = background_pixels. clone ( ) ;
31
+ pxs[ 31 ] = & red_px;
32
+ pxs[ 39 ] = & red_px;
33
+ pxs
34
34
} ;
35
35
let right_up = {
36
- let mut pxs = background_pixels. clone ( ) ;
37
- pxs[ 14 ] = & red_px;
38
- pxs[ 23 ] = & red_px;
39
- pxs
36
+ let mut pxs = background_pixels. clone ( ) ;
37
+ pxs[ 14 ] = & red_px;
38
+ pxs[ 23 ] = & red_px;
39
+ pxs
40
40
} ;
41
41
let right_down = {
42
- let mut pxs = background_pixels. clone ( ) ;
43
- pxs[ 47 ] = & red_px;
44
- pxs[ 54 ] = & red_px;
45
- pxs
42
+ let mut pxs = background_pixels. clone ( ) ;
43
+ pxs[ 47 ] = & red_px;
44
+ pxs[ 54 ] = & red_px;
45
+ pxs
46
46
} ;
47
47
48
48
let up = {
49
- let mut pxs = background_pixels. clone ( ) ;
50
- pxs[ 3 ] = & red_px;
51
- pxs[ 4 ] = & red_px;
52
- pxs
49
+ let mut pxs = background_pixels. clone ( ) ;
50
+ pxs[ 3 ] = & red_px;
51
+ pxs[ 4 ] = & red_px;
52
+ pxs
53
53
} ;
54
54
55
55
let up_left = {
56
- let mut pxs = background_pixels. clone ( ) ;
57
- pxs[ 2 ] = & red_px;
58
- pxs[ 9 ] = & red_px;
59
- pxs
56
+ let mut pxs = background_pixels. clone ( ) ;
57
+ pxs[ 2 ] = & red_px;
58
+ pxs[ 9 ] = & red_px;
59
+ pxs
60
60
} ;
61
61
let up_right = {
62
- let mut pxs = background_pixels. clone ( ) ;
63
- pxs[ 5 ] = & red_px;
64
- pxs[ 14 ] = & red_px;
65
- pxs
62
+ let mut pxs = background_pixels. clone ( ) ;
63
+ pxs[ 5 ] = & red_px;
64
+ pxs[ 14 ] = & red_px;
65
+ pxs
66
66
} ;
67
67
68
68
let left = {
69
- let mut pxs = background_pixels. clone ( ) ;
70
- pxs[ 24 ] = & red_px;
71
- pxs[ 32 ] = & red_px;
72
- pxs
69
+ let mut pxs = background_pixels. clone ( ) ;
70
+ pxs[ 24 ] = & red_px;
71
+ pxs[ 32 ] = & red_px;
72
+ pxs
73
73
} ;
74
74
let left_up = {
75
- let mut pxs = background_pixels. clone ( ) ;
76
- pxs[ 9 ] = & red_px;
77
- pxs[ 16 ] = & red_px;
78
- pxs
75
+ let mut pxs = background_pixels. clone ( ) ;
76
+ pxs[ 9 ] = & red_px;
77
+ pxs[ 16 ] = & red_px;
78
+ pxs
79
79
} ;
80
80
let left_down = {
81
- let mut pxs = background_pixels. clone ( ) ;
82
- pxs[ 40 ] = & red_px;
83
- pxs[ 49 ] = & red_px;
84
- pxs
81
+ let mut pxs = background_pixels. clone ( ) ;
82
+ pxs[ 40 ] = & red_px;
83
+ pxs[ 49 ] = & red_px;
84
+ pxs
85
85
} ;
86
86
87
87
let down = {
88
- let mut pxs = background_pixels. clone ( ) ;
89
- pxs[ 59 ] = & red_px;
90
- pxs[ 60 ] = & red_px;
91
- pxs
88
+ let mut pxs = background_pixels. clone ( ) ;
89
+ pxs[ 59 ] = & red_px;
90
+ pxs[ 60 ] = & red_px;
91
+ pxs
92
92
} ;
93
93
let down_left = {
94
- let mut pxs = background_pixels. clone ( ) ;
95
- pxs[ 49 ] = & red_px;
96
- pxs[ 58 ] = & red_px;
97
- pxs
94
+ let mut pxs = background_pixels. clone ( ) ;
95
+ pxs[ 49 ] = & red_px;
96
+ pxs[ 58 ] = & red_px;
97
+ pxs
98
98
} ;
99
99
let down_right = {
100
- let mut pxs = background_pixels. clone ( ) ;
101
- pxs[ 54 ] = & red_px;
102
- pxs[ 61 ] = & red_px;
103
- pxs
100
+ let mut pxs = background_pixels. clone ( ) ;
101
+ pxs[ 54 ] = & red_px;
102
+ pxs[ 61 ] = & red_px;
103
+ pxs
104
104
} ;
105
105
let bg_frame = FrameLine :: from_pixels ( & background_pixels) ;
106
106
let left_frame = FrameLine :: from_pixels ( & left) ;
@@ -127,40 +127,42 @@ fn main() {
127
127
match needle. as_degrees ( ) {
128
128
angle if angle > -15.0 && angle <= 15.0 => {
129
129
screen. write_frame ( & right_frame) ;
130
- } ,
130
+ }
131
131
angle if angle > 15.0 && angle <= 45.0 => {
132
132
screen. write_frame ( & right_up_frame) ;
133
- } ,
133
+ }
134
134
angle if angle > 45.0 && angle <= 75.0 => {
135
135
screen. write_frame ( & up_right_frame) ;
136
- } ,
136
+ }
137
137
angle if angle > 75.0 && angle <= 105.0 => {
138
138
screen. write_frame ( & up_frame) ;
139
- } ,
139
+ }
140
140
angle if angle > 105.0 && angle <= 135.0 => {
141
141
screen. write_frame ( & up_left_frame) ;
142
- } ,
142
+ }
143
143
angle if angle > 135.0 && angle <= 165.0 => {
144
144
screen. write_frame ( & left_up_frame) ;
145
- } ,
146
- angle if ( angle > 165.0 && angle <= 180.0 ) || ( angle < -165.0 && angle >= -180.0 ) => {
145
+ }
146
+ angle
147
+ if ( angle > 165.0 && angle <= 180.0 ) || ( angle < -165.0 && angle >= -180.0 ) =>
148
+ {
147
149
screen. write_frame ( & left_frame) ;
148
- } ,
150
+ }
149
151
angle if angle < -15.0 && angle >= -45.0 => {
150
152
screen. write_frame ( & right_down_frame) ;
151
- } ,
153
+ }
152
154
angle if angle < -45.0 && angle >= -75.0 => {
153
155
screen. write_frame ( & down_right_frame) ;
154
- } ,
156
+ }
155
157
angle if angle < -75.0 && angle >= -105.0 => {
156
158
screen. write_frame ( & down_frame) ;
157
- } ,
159
+ }
158
160
angle if angle < -105.0 && angle >= -135.0 => {
159
161
screen. write_frame ( & down_left_frame) ;
160
- } ,
162
+ }
161
163
angle if angle < -135.0 && angle >= -165.0 => {
162
164
screen. write_frame ( & left_down_frame) ;
163
- } ,
165
+ }
164
166
_ => screen. write_frame ( & bg_frame) ,
165
167
}
166
168
}
0 commit comments