Skip to content

Commit 1a70c74

Browse files
committed
Updated to account for new API changes to poll_event and background color
1 parent 827639e commit 1a70c74

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/reversi/main.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct Dimensions {
2525

2626
fn main() {
2727
let mut turtle = Turtle::new();
28-
turtle.set_background_color("#B3E5FC");
28+
turtle.drawing_mut().set_background_color("#B3E5FC");
2929
turtle.set_pen_color("#757575");
3030
turtle.set_pen_size(2.0);
3131
turtle.set_speed(8);
@@ -106,7 +106,7 @@ fn play_game(turtle: &mut Turtle, mut board: Board, dim: &Dimensions) {
106106

107107
let mut mouse = [0.0, 0.0];
108108
loop {
109-
let event = turtle.poll_event();
109+
let event = turtle.drawing_mut().poll_event();
110110
// Sometimes it is more convenient to use `if let` instead of `match`. In this case, it's
111111
// really up to your personal preference. We chose to demonstrate what `if let` would look
112112
// like if used for this code.
@@ -132,7 +132,7 @@ fn play_game(turtle: &mut Turtle, mut board: Board, dim: &Dimensions) {
132132
move_to_tile(turtle, (row, col), &dim);
133133
draw_piece(turtle, current, &dim);
134134

135-
let background = turtle.background_color();
135+
let background = turtle.drawing().background_color();
136136
draw_tile_circles(turtle, 0.9, background, dim, flipped.iter());
137137
draw_tile_circles(turtle, 0.8, current.color(), dim, flipped.iter());
138138

@@ -162,7 +162,7 @@ fn move_to_tile(turtle: &mut Turtle, (row, col): (usize, usize), dim: &Dimension
162162
}
163163

164164
fn erase_valid_moves(turtle: &mut Turtle, board: &Board, dim: &Dimensions) {
165-
let background = turtle.background_color();
165+
let background = turtle.drawing().background_color();
166166
draw_tile_circles(
167167
turtle,
168168
0.5,
@@ -239,5 +239,5 @@ fn circle(turtle: &mut Turtle, radius: f64) {
239239

240240
/// Clear out all events that may have accumulated
241241
fn drain_events(turtle: &mut Turtle) {
242-
while let Some(_) = turtle.poll_event() {}
242+
while let Some(_) = turtle.drawing_mut().poll_event() {}
243243
}

0 commit comments

Comments
 (0)