rayui is the Gizlet launcher's look as a library for Rust and raylib. Describe screens declaratively; rayui lays them out, moves the focus with the D-pad and draws them, on a 640×480 handheld, a desktop window or right here in your browser.
Directions move the focus to the nearest element on screen, so grids, lists, sidebars and keyboards need no focus order.
The short side is always 720 units. A 640×480 handheld, a 4K monitor and a portrait panel all get the same layout at their own scale.
Material-style color roles, type scale, shape, elevation, motion and density: switch the theme, brand color or touch density at run time.
Once input stops and animations settle, nothing is redrawn — it matters on software-rendered handhelds.
Your state, a view that turns it into elements, and an update for the messages they send. The hint bar, focus ring, sounds and A/B swap come for free.
# Cargo.toml [dependencies] rayui = { git = "https://github.com/gizlet/rayui", tag = "v0.1.0" }
impl App for Counter { type Msg = Msg; fn view(&self) -> Element<Msg> { page("Counter") .body(column([ text(self.n.to_string()).style(Type::Display), row([ button("-1").on_press(Msg::Add(-1)), button("+1").on_press(Msg::Add(1)), ]).gap(16.0), ]).gap(24.0).center().fill()) .into() } fn update(&mut self, msg: Msg, _: &mut Cx) { match msg { Msg::Add(d) => self.n += d } } }