pub struct SnowSettings {
pub open: bool,
pub active: bool,
pub color: Color32,
pub density: usize,
pub size_min: f32,
pub size_max: f32,
pub speed_min: f32,
pub speed_max: f32,
pub wind: Vec2,
pub layer: ParticleLayer,
}Expand description
User-facing knobs for Snow.
The defaults match the upstream egui-snow demo, so
Snow::from_settings("snow", &SnowSettings::default()) reproduces the
upstream look.
Fields§
§open: boolSettings-window visibility. Default false (the example opens it).
active: boolWhether the effect is drawn at all.
color: Color32Snowflake color.
density: usizeNumber of snowflakes.
size_min: f32Minimum snowflake size in pixels.
size_max: f32Maximum snowflake size in pixels.
speed_min: f32Minimum fall speed in pixels per second.
speed_max: f32Maximum fall speed in pixels per second.
wind: Vec2Global wind vector (x = horizontal, y = vertical).
layer: ParticleLayerLayer the effect is painted on.
Implementations§
Source§impl SnowSettings
impl SnowSettings
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Knobs back to defaults; open is preserved (a reset must not close the window).
Sourcepub fn show_window(&mut self, ctx: &Context) -> Option<Response>
pub fn show_window(&mut self, ctx: &Context) -> Option<Response>
Themed floating settings window; returns the window’s outer Response when open.
Window chrome plus a vertical scroll area around Self::body_ui, so a
viewport shorter than the controls scrolls instead of clipping them.
Sourcepub fn body_ui(&mut self, ui: &mut Ui)
pub fn body_ui(&mut self, ui: &mut Ui)
Draw the settings controls into ui — no window chrome.
Render them in your own container (egui::Window, SidePanel, ScrollArea, …)
instead of using Self::show_window. If that container can be shorter than the
controls, wrap it in an egui::ScrollArea.
Trait Implementations§
Source§impl Clone for SnowSettings
impl Clone for SnowSettings
Source§impl Debug for SnowSettings
impl Debug for SnowSettings
Source§impl Default for SnowSettings
impl Default for SnowSettings
Source§impl PartialEq for SnowSettings
impl PartialEq for SnowSettings
impl StructuralPartialEq for SnowSettings
Auto Trait Implementations§
impl Freeze for SnowSettings
impl RefUnwindSafe for SnowSettings
impl Send for SnowSettings
impl Sync for SnowSettings
impl Unpin for SnowSettings
impl UnsafeUnpin for SnowSettings
impl UnwindSafe for SnowSettings
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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