Module pix_engine::gui::layout
source · Expand description
UI spacing & layout rendering methods.
Provided PixState
methods:
PixState::same_line
PixState::next_width
PixState::tab_bar
PixState::spacing
PixState::indent
PixState::separator
Example
fn on_update(&mut self, s: &mut PixState) -> PixResult<()> {
s.text("Text")?;
s.same_line(None);
s.text("Same line")?;
s.same_line([20, 0]);
s.text("Same line with a +20 horizontal pixel offset")?;
s.separator();
s.spacing()?;
s.indent()?;
s.text("Indented!")?;
s.next_width(200);
if s.button("Button")? {
// was clicked
}
s.tab_bar(
"Tab bar",
&["Tab 1", "Tab 2"],
&mut self.selected,
|tab: &&str, s: &mut PixState| {
match tab {
&"Tab 1" => {
s.text("Tab 1 Content")?;
},
&"Tab 2" => {
s.text("Tab 2 Content")?;
},
_ => (),
}
Ok(())
}
)?;
Ok(())
}