monorepo/kifu/kifu-gtk/src/bin/screenplay.rs

44 lines
1.4 KiB
Rust
Raw Normal View History

use glib::Object;
use gtk::{prelude::*, subclass::prelude::*};
use kifu_core::{ui::ChatElement, ui::PlayerCardElement, Color};
use kifu_gtk::ui::{Chat, PlayerCard};
use screenplay::{Screen, Screenplay};
use std::{cell::RefCell, rc::Rc};
fn main() {
let app = gtk::Application::builder()
.application_id("com.luminescent-dreams.kifu-gtk.screenplay")
.build();
app.connect_activate(|app| {
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![],
},
];
let screenplay = Screenplay::new(&app, screens).unwrap();
});
app.run();
}