2023-03-22 14:59:44 +00:00
|
|
|
use gtk::{prelude::*, subclass::prelude::*};
|
2023-03-24 13:59:04 +00:00
|
|
|
use kifu_core::{
|
|
|
|
ui::{ChatElement, PlayerCardElement, PlayingFieldView},
|
|
|
|
Color,
|
|
|
|
};
|
|
|
|
use kifu_gtk::ui::{playing_field, Chat, PlayerCard, PlayingField};
|
2023-03-22 14:59:44 +00:00
|
|
|
use screenplay::{Screen, Screenplay};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let app = gtk::Application::builder()
|
|
|
|
.application_id("com.luminescent-dreams.kifu-gtk.screenplay")
|
|
|
|
.build();
|
|
|
|
|
|
|
|
app.connect_activate(|app| {
|
2023-03-23 03:11:56 +00:00
|
|
|
let screens = vec![
|
|
|
|
Screen {
|
|
|
|
title: "PlayerCard".to_owned(),
|
|
|
|
widget: PlayerCard::new(PlayerCardElement {
|
|
|
|
color: Color::Black,
|
|
|
|
name: "Opal".to_owned(),
|
|
|
|
rank: "10 kyu".to_owned(),
|
|
|
|
clock: "25:00".to_owned(),
|
|
|
|
})
|
|
|
|
.upcast::<gtk::Widget>(),
|
|
|
|
adjustments: vec![],
|
|
|
|
},
|
|
|
|
Screen {
|
|
|
|
title: "ChatArea".to_owned(),
|
|
|
|
widget: Chat::new(ChatElement {
|
|
|
|
messages: vec![
|
|
|
|
"message 1".to_owned(),
|
|
|
|
"message 2".to_owned(),
|
|
|
|
"message 3".to_owned(),
|
|
|
|
],
|
|
|
|
})
|
|
|
|
.upcast::<gtk::Widget>(),
|
|
|
|
adjustments: vec![],
|
|
|
|
},
|
2023-03-24 13:59:04 +00:00
|
|
|
Screen {
|
|
|
|
title: "PlayingField".to_owned(),
|
|
|
|
widget: PlayingField::new(playing_field()).upcast::<gtk::Widget>(),
|
|
|
|
adjustments: vec![],
|
|
|
|
},
|
2023-03-23 03:11:56 +00:00
|
|
|
];
|
2023-03-24 13:59:04 +00:00
|
|
|
Screenplay::new(&app, screens).unwrap();
|
2023-03-22 14:59:44 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
app.run();
|
|
|
|
}
|