Tuix Guide logo Tuix Guide


The layout system in tuix is based on…

Units

All layout properties use the same Units type. The Units type is defined as:

pub enum Units {
    Auto,
    Pixels(f32),
    Percentage(f32),
    Stretch(f32),
}

To see how the units work with the layout system, let’s take a look at an example:

Button::new().build(state, window.entity(), |builder| 
    builder
        .set_width(Units::Pixels(100.0))
        .set_height(Units::Pixels(30.0))
        .set_background_color(Color::rgb(200,80,20))
);
}