1 use starry_client::base::color::Color; 2 use starry_server::core::{SCREEN_HEIGHT, SCREEN_WIDTH}; 3 use starry_toolkit::{ 4 base::{panel::Panel, rect::Rect}, 5 layout::grid::Grid, 6 traits::text::Text, 7 widgets::label::Label, 8 }; 9 10 fn main() { 11 let panel = Panel::new( 12 Rect::new(0, 0, SCREEN_WIDTH as u32, SCREEN_HEIGHT as u32), 13 "Title", 14 Color::rgb(255, 255, 255), 15 ); 16 17 let label1 = Label::new(); 18 label1.set_text("abc"); 19 20 let label2 = Label::new(); 21 label2.set_text("...."); 22 23 let label3 = Label::new(); 24 label3.set_text("12.g"); 25 26 let grid = Grid::new(); 27 grid.set_space(10, 10); 28 grid.set_upper_limit(2); 29 grid.add(&label1); 30 grid.add(&label2); 31 grid.add(&label3); 32 33 panel.add_child(&grid); 34 35 // // Image 36 // let image = Image::from_path(IMAGE_PATH).unwrap(); 37 // image.reposition(0, SCREEN_HEIGHT as i32 / 2); 38 // image.resize(SCREEN_WIDTH as u32, SCREEN_HEIGHT as u32 / 2); 39 // panel.add_child(&image); 40 41 panel.draw(); 42 43 // 便于观察结果 44 loop {} 45 } 46