diff --git a/kifu/kifu-gtk/Cargo.toml b/kifu/kifu-gtk/Cargo.toml index 4e9d149..1f7487f 100644 --- a/kifu/kifu-gtk/Cargo.toml +++ b/kifu/kifu-gtk/Cargo.toml @@ -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" ] diff --git a/kifu/kifu-gtk/src/bin/screenplay.rs b/kifu/kifu-gtk/src/bin/screenplay.rs index 58b07ce..28f16cb 100644 --- a/kifu/kifu-gtk/src/bin/screenplay.rs +++ b/kifu/kifu-gtk/src/bin/screenplay.rs @@ -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::(), + widget: PlayingField::new(playing_field_view()).upcast::(), adjustments: vec![], }, ]; diff --git a/kifu/kifu-gtk/src/ui/mod.rs b/kifu/kifu-gtk/src/ui/mod.rs index cd9a856..49630c7 100644 --- a/kifu/kifu-gtk/src/ui/mod.rs +++ b/kifu/kifu-gtk/src/ui/mod.rs @@ -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; diff --git a/kifu/kifu-gtk/src/ui/playing_field.rs b/kifu/kifu-gtk/src/ui/playing_field.rs index 7e6eac2..0dc4be6 100644 --- a/kifu/kifu-gtk/src/ui/playing_field.rs +++ b/kifu/kifu-gtk/src/ui/playing_field.rs @@ -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()));