Add a placeholder for the goban itself

This commit is contained in:
Savanni D'Gerinel 2023-03-24 10:14:01 -04:00
parent b8493b7fe7
commit cbae0f47fc
3 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,30 @@
use glib::Object;
use gtk::{prelude::*, subclass::prelude::*};
#[derive(Default)]
pub struct GobanPrivate;
#[glib::object_subclass]
impl ObjectSubclass for GobanPrivate {
const NAME: &'static str = "Goban";
type Type = Goban;
type ParentType = gtk::DrawingArea;
}
impl ObjectImpl for GobanPrivate {}
impl WidgetImpl for GobanPrivate {}
impl DrawingAreaImpl for GobanPrivate {}
glib::wrapper! {
pub struct Goban(ObjectSubclass<GobanPrivate>) @extends gtk::DrawingArea, gtk::Widget;
}
impl Goban {
pub fn new() -> Self {
let s: Self = Object::builder().build();
s.set_width_request(1024);
s.set_height_request(768);
s
}
}

View File

@ -6,3 +6,6 @@ pub use chat::Chat;
mod playing_field;
pub use playing_field::{playing_field, PlayingField};
mod goban;
pub use goban::Goban;

View File

@ -1,4 +1,4 @@
use crate::ui::{Chat, PlayerCard};
use crate::ui::{Chat, Goban, PlayerCard};
use glib::Object;
use gtk::{prelude::*, subclass::prelude::*};
use kifu_core::{
@ -53,10 +53,12 @@ impl PlayingField {
pub fn new(view: PlayingFieldView) -> PlayingField {
let s: Self = Object::builder().build();
let goban = Goban::new();
let player_card_white = PlayerCard::new(view.player_card_white);
let player_card_black = PlayerCard::new(view.player_card_black);
let chat = Chat::new(view.chat);
s.attach(&goban, 1, 1, 1, 2);
s.attach(&player_card_black, 2, 1, 1, 1);
s.attach(&player_card_white, 3, 1, 1, 1);
s.attach(&chat, 2, 2, 2, 1);