46 lines
1.8 KiB
Rust
46 lines
1.8 KiB
Rust
|
// ▄████████▄ + ███ + ▄█████████ ███ +
|
||
|
// ███▀ ▀███ + + ███ ███▀ + ███ + +
|
||
|
// ███ + ███ ███ ███ █████████ ███ ███ ███ ███
|
||
|
// ███ +███ ███ ███ ███ ███▐██████ ███ ███ ███
|
||
|
// ███ + ███ ███+ ███ +███ ███ + ███ ███ + ███
|
||
|
// ███▄ ▄███ ███▄ ███ ███ + ███ + ███ ███▄ ███
|
||
|
// ▀████████▀ + ▀███████ ███▄ ███▄ ▀████ ▀███████
|
||
|
// + + + ███
|
||
|
// + ▀████████████████████████████████████████████████████▀
|
||
|
//
|
||
|
// Various common functions
|
||
|
|
||
|
use bevy::prelude::*;
|
||
|
|
||
|
#[inline]
|
||
|
pub fn bool2vis(boolean: bool) -> bevy::prelude::Visibility {
|
||
|
if boolean {
|
||
|
bevy::prelude::Visibility::Inherited
|
||
|
} else {
|
||
|
bevy::prelude::Visibility::Hidden
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#[inline]
|
||
|
pub fn style_fullscreen() -> Style {
|
||
|
Style {
|
||
|
width: Val::Vw(100.0),
|
||
|
height: Val::Vh(100.0),
|
||
|
position_type: PositionType::Absolute,
|
||
|
top: Val::Px(0.0),
|
||
|
left: Val::Px(0.0),
|
||
|
..default()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#[inline]
|
||
|
pub fn style_centered() -> Style {
|
||
|
Style {
|
||
|
width: Val::Percent(100.0),
|
||
|
height: Val::Percent(100.0),
|
||
|
align_items: AlignItems::Center,
|
||
|
justify_content: JustifyContent::SpaceAround,
|
||
|
..default()
|
||
|
}
|
||
|
}
|