fix hud toggling when starting the game with disabled hud
This commit is contained in:
parent
377c2a4f0b
commit
20e17e8faa
43
src/hud.rs
43
src/hud.rs
|
@ -442,6 +442,7 @@ pub fn setup(
|
||||||
},
|
},
|
||||||
gauge.clone(),
|
gauge.clone(),
|
||||||
GaugeLength(bar_length),
|
GaugeLength(bar_length),
|
||||||
|
ToggleableHudElement,
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -465,29 +466,35 @@ pub fn setup(
|
||||||
))
|
))
|
||||||
.with_children(|builder| {
|
.with_children(|builder| {
|
||||||
// The gauge symbol
|
// The gauge symbol
|
||||||
builder.spawn((ImageBundle {
|
builder.spawn((
|
||||||
image: UiImage::new(asset_server.load(sprite.to_string())),
|
ImageBundle {
|
||||||
style: Style {
|
image: UiImage::new(asset_server.load(sprite.to_string())),
|
||||||
width: Val::Px(icon_size),
|
style: Style {
|
||||||
height: Val::Px(icon_size),
|
width: Val::Px(icon_size),
|
||||||
|
height: Val::Px(icon_size),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
visibility,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
visibility,
|
ToggleableHudElement,
|
||||||
..Default::default()
|
));
|
||||||
},));
|
|
||||||
// The gauge bar border
|
// The gauge bar border
|
||||||
builder.spawn((ImageBundle {
|
builder.spawn((
|
||||||
image: UiImage::new(gauges_handle.clone()),
|
ImageBundle {
|
||||||
style: Style {
|
image: UiImage::new(gauges_handle.clone()),
|
||||||
width: Val::Px(bar_length),
|
style: Style {
|
||||||
height: Val::Px(10.0),
|
width: Val::Px(bar_length),
|
||||||
bottom: Val::Px(8.0),
|
height: Val::Px(10.0),
|
||||||
left: Val::Px(gauge_bar_padding_left),
|
bottom: Val::Px(8.0),
|
||||||
|
left: Val::Px(gauge_bar_padding_left),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
visibility,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
visibility,
|
ToggleableHudElement,
|
||||||
..Default::default()
|
));
|
||||||
},));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue