Place a stone onto the drawing area #38

Merged
savanni merged 7 commits from feature/place-stone into main 2023-04-07 12:14:04 +00:00
1 changed files with 17 additions and 0 deletions
Showing only changes of commit 481226e8c6 - Show all commits

View File

@ -165,7 +165,24 @@ impl ObjectImpl for BoardPrivate {
}); });
} }
let gesture = gtk::GestureClick::new();
{
let board = self.board.clone();
let cursor = self.cursor_location.clone();
gesture.connect_released(move |_, _, _, _| {
let board = board.borrow();
let cursor = cursor.borrow();
match board.stone(cursor.row, cursor.column) {
IntersectionElement::Empty(request) => {
println!("need to send request: {:?}", request)
}
_ => {}
}
});
}
self.drawing_area.add_controller(motion_controller); self.drawing_area.add_controller(motion_controller);
self.drawing_area.add_controller(gesture);
} }
} }
impl WidgetImpl for BoardPrivate {} impl WidgetImpl for BoardPrivate {}