Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn get_chessboard(cells_size: u32, initial_position: &str) -> Option<RefCell<ChessBoard>>
- {
- let drawing_area = DrawingArea::new();
- let logic = ChessGame::new_from_fen(initial_position);
- match logic {
- Some(game_logic) => {
- let chess_board = ChessBoard {
- drawing_area,
- reversed: false,
- logic: game_logic,
- cells_size,
- };
- let chess_board_ref = RefCell::new(chess_board);
- let chess_board_ref_2 = chess_board_ref.clone();
- chess_board_ref.borrow().drawing_area.connect_draw(move |_drawing_area, cr|{
- chess_board_ref_2.borrow().paint(cr);
- Inhibit(false)
- });
- Some(chess_board_ref)
- },
- _ => None
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement