Crates.io | too |
lib.rs | too |
version | 0.2.0 |
source | src |
created_at | 2024-09-27 03:04:30.02947 |
updated_at | 2024-11-17 21:32:54.783025 |
description | too - a tui framework |
homepage | |
repository | https://github.com/museun/too |
max_upload_size | |
id | 1388207 |
size | 497,174 |
too -- a different kind of tui library
fn main() -> std::io::Result<()> {
too::run(|ui| {
ui.center(|ui| ui.label("hello world"));
})
}
fn main() -> std::io::Result<()> {
let mut counter = 0;
too::run(|ui| {
ui.vertical(|ui|{
ui.horizontal(|ui|{
if ui.button("add 1").clicked() {
counter += 1;
}
if ui.button("subtract 1").clicked() {
counter -= 1;
}
});
ui.label(counter)
});
})
}
use too::view::Ui;
#[derive(Default)]
struct App {
value: f32
}
impl App {
fn view(&mut self, ui: &Ui) {
ui.slider(&mut value);
}
}
fn main() -> std::io::Result<()> {
let mut app = App::default()
too::run(|ui| app.view(ui))
}
use too::view::Ui;
#[derive(Default)]
struct State {
value: f32
}
struct App ;
impl App {
fn view(&self, state: &mut State, ui: &Ui) {
ui.slider(&mut state.value);
}
}
fn main() -> std::io::Result<()> {
let app = App;
let mut state = State::default();
too::run(|ui| app.view(&mut state, ui))
}
Some pre-made views are provided in: too::views
License: MIT OR Apache-2.0