Restrict view model screenplay functions behind the screenplay feature

This commit is contained in:
Savanni D'Gerinel 2023-03-24 10:24:46 -04:00
parent cbae0f47fc
commit 62a178e168
4 changed files with 16 additions and 4 deletions

View File

@ -3,6 +3,9 @@ name = "kifu-gtk"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
[features]
screenplay = []
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
@ -16,3 +19,8 @@ screenplay = { path = "../../screenplay" }
[[bin]] [[bin]]
name = "kifu-gtk" name = "kifu-gtk"
path = "src/main.rs" 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}, ui::{ChatElement, PlayerCardElement, PlayingFieldView},
Color, Color,
}; };
use kifu_gtk::ui::{playing_field, Chat, PlayerCard, PlayingField}; use kifu_gtk::ui::{playing_field_view, Chat, PlayerCard, PlayingField};
use screenplay::{Screen, Screenplay}; use screenplay::{Screen, Screenplay};
fn main() { fn main() {
@ -38,7 +38,7 @@ fn main() {
}, },
Screen { Screen {
title: "PlayingField".to_owned(), title: "PlayingField".to_owned(),
widget: PlayingField::new(playing_field()).upcast::<gtk::Widget>(), widget: PlayingField::new(playing_field_view()).upcast::<gtk::Widget>(),
adjustments: vec![], adjustments: vec![],
}, },
]; ];

View File

@ -5,7 +5,10 @@ mod chat;
pub use chat::Chat; pub use chat::Chat;
mod playing_field; mod playing_field;
pub use playing_field::{playing_field, PlayingField}; pub use playing_field::PlayingField;
mod goban; mod goban;
pub use goban::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(); let mut spaces = Vec::new();
(0..19).for_each(|_| spaces.push(Vec::new())); (0..19).for_each(|_| spaces.push(Vec::new()));