pub struct Panel {
pub x: f32,
pub y: f32,
pub width: f32,
pub height: f32,
pub color: [f32; 4],
pub corner_radius: f32,
pub title: String,
pub title_font: String,
pub title_color: [f32; 3],
pub title_scale: f32,
pub padding: f32,
}Expand description
A titled background container for grouping UI overlay elements.
Panel is a build-time shorthand: it expands into a filled, optionally
rounded background Sprite and, when title is set, a
TextLabel heading inset from the top-left corner. Place other
overlay elements over it to frame a group (a settings card, a dialog body).
Like the other build-time UI shorthands, generated names are prefixed with
this asset’s name (<name>_bg, <name>_title), so a panel named with a
screen prefix (pause_card) puts its children in that Screen
(pause) via the <screen>_* rule and they never clash with hand-authored
assets.
Panel {
title: "Paused".into(),
x: 440.0,
y: 220.0,
width: 400.0,
height: 280.0,
..Default::default()
};Fields§
§x: f32Left edge of the panel in window pixels.
y: f32Top edge of the panel in window pixels.
width: f32Panel width in window pixels.
height: f32Panel height in window pixels.
color: [f32; 4]RGBA fill of the background box, each channel in [0, 1].
corner_radius: f32Corner rounding radius of the background box, in panel pixels. 0 keeps sharp corners.
title: StringHeading text drawn at the top-left. Empty draws no heading.
title_font: StringFont for the title. Empty uses the built-in font.
title_color: [f32; 3]Linear-space RGB colour of the title text.
title_scale: f32Scale applied to the title text.
padding: f32Inset of the title from the panel’s top-left corner, in pixels.
Trait Implementations§
impl BuildOnlyAsset for Panel
Source§impl<'de> Deserialize<'de> for Panel
impl<'de> Deserialize<'de> for Panel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Panel
impl RefUnwindSafe for Panel
impl Send for Panel
impl Sync for Panel
impl Unpin for Panel
impl UnsafeUnpin for Panel
impl UnwindSafe for Panel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more