Bevy version
0.7.0
What you did
I might declare a UI node like this:
let title = commands
.spawn_bundle(TextBundle {
style: Style {
margin: Rect {
bottom: Val::Px(75.0),
..default()
},
..default()
},
text: Text::with_section(
"main menu",
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 200.0,
color: Color::WHITE,
},
Default::default(),
),
..default()
})
.insert(MenuTitle)
.id();
Where font_size has to be described in pixels (or point size?).
If my game is in windowed mode and the window is resized, it isn't clear to me how to easily resize the font_size to be responsive to the changes. font_size is responsive to changes in the device scale_factor.
As a side note, the margin (or any element defined in pixels) is not responsive to the window size changing.
I'm not sure if it should be, but it does seem like there should be a way to scale to the size of the window.
A system to handle this is somewhat complicated to write, because different controls might have different sizes and the base size isn't tracked by the TextStyle. One way to do it is to provide a component that tracks this information.
Bevy version
0.7.0
What you did
I might declare a UI node like this:
Where font_size has to be described in pixels (or point size?).
If my game is in windowed mode and the window is resized, it isn't clear to me how to easily resize the font_size to be responsive to the changes. font_size is responsive to changes in the device scale_factor.
As a side note, the margin (or any element defined in pixels) is not responsive to the window size changing.
I'm not sure if it should be, but it does seem like there should be a way to scale to the size of the window.
A system to handle this is somewhat complicated to write, because different controls might have different sizes and the base size isn't tracked by the TextStyle. One way to do it is to provide a component that tracks this information.