Files
osui/examples/hello_world.rs
T
2025-11-20 17:10:12 +01:00

27 lines
514 B
Rust

use osui::{Context, Event, Node};
pub struct ClickEvent;
impl Event for ClickEvent {
fn as_any(&self) -> &dyn std::any::Any {
self
}
}
fn app(cx: &mut Context) -> Node {
// Hooks
cx.event(|_: &ClickEvent| {});
Box::new(|renderer| {
renderer.draw_text("Hello, World!", 0, 0).unwrap();
})
}
fn main() {
let mut osui = osui::Osui::new(Box::new(app));
loop {
osui.render().unwrap();
std::thread::sleep(std::time::Duration::from_millis(10));
}
}