Add the playing field to the main app

This commit is contained in:
Savanni D'Gerinel 2023-03-25 09:24:36 -04:00
parent d430fd82e6
commit c2e7399e55
2 changed files with 10 additions and 3 deletions

View File

@ -1,5 +1,6 @@
use gtk::prelude::*; use gtk::prelude::*;
use kifu_core::{CoreApp, Request, Response}; use kifu_core::{CoreApp, Request, Response};
use kifu_gtk::ui::PlayingField;
use std::{ use std::{
sync::{Arc, Mutex}, sync::{Arc, Mutex},
time::Duration, time::Duration,
@ -62,8 +63,14 @@ fn main() {
let window = gtk::ApplicationWindow::new(app); let window = gtk::ApplicationWindow::new(app);
window.present(); window.present();
gtk_rx.attach(None, |message| { gtk_rx.attach(None, move |message| {
println!("message: {:?}", message); println!("message: {:?}", message);
match message {
Response::PlayingFieldView(view) => {
let playing_field = PlayingField::new(view);
window.set_child(Some(&playing_field));
}
}
Continue(true) Continue(true)
}); });

View File

@ -56,8 +56,8 @@ impl ObjectImpl for GobanPrivate {
}); });
context.set_source_rgb(0.1, 0.1, 0.0); context.set_source_rgb(0.1, 0.1, 0.0);
vec![4, 9, 15].into_iter().for_each(|col| { vec![3, 9, 15].into_iter().for_each(|col| {
vec![4, 9, 15].into_iter().for_each(|row| { vec![3, 9, 15].into_iter().for_each(|row| {
pen.star_point(context, col, row); pen.star_point(context, col, row);
}); });
}); });