Render the playing field #35

Merged
savanni merged 3 commits from feature/kifu-render-playing-area into main 2023-03-25 03:59:22 +00:00
4 changed files with 16 additions and 4 deletions
Showing only changes of commit 62a178e168 - Show all commits

View File

@ -3,6 +3,9 @@ name = "kifu-gtk"
version = "0.1.0"
edition = "2021"
[features]
screenplay = []
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@ -16,3 +19,8 @@ screenplay = { path = "../../screenplay" }
[[bin]]
name = "kifu-gtk"
path = "src/main.rs"
[[bin]]
name = "screenplay"
path = "src/bin/screenplay.rs"
required-features = [ "screenplay" ]

View File

@ -3,7 +3,7 @@ use kifu_core::{
ui::{ChatElement, PlayerCardElement, PlayingFieldView},
Color,
};
use kifu_gtk::ui::{playing_field, Chat, PlayerCard, PlayingField};
use kifu_gtk::ui::{playing_field_view, Chat, PlayerCard, PlayingField};
use screenplay::{Screen, Screenplay};
fn main() {
@ -38,7 +38,7 @@ fn main() {
},
Screen {
title: "PlayingField".to_owned(),
widget: PlayingField::new(playing_field()).upcast::<gtk::Widget>(),
widget: PlayingField::new(playing_field_view()).upcast::<gtk::Widget>(),
adjustments: vec![],
},
];

View File

@ -5,7 +5,10 @@ mod chat;
pub use chat::Chat;
mod playing_field;
pub use playing_field::{playing_field, PlayingField};
pub use playing_field::PlayingField;
mod goban;
pub use goban::Goban;
#[cfg(feature = "screenplay")]
pub use playing_field::playing_field_view;

View File

@ -71,7 +71,8 @@ impl PlayingField {
}
}
pub fn playing_field() -> PlayingFieldView {
#[cfg(feature = "screenplay")]
pub fn playing_field_view() -> PlayingFieldView {
let mut spaces = Vec::new();
(0..19).for_each(|_| spaces.push(Vec::new()));