Struct moon_engine::particle::ParticleSystem
source · [−]pub struct ParticleSystem {
pub transform: Transform2D,
pub alive: bool,
/* private fields */
}
Expand description
A ParticleSystem
deals with the emission, and creation of Particles
.
Fields
transform: Transform2D
The Transform2D
of the ParticleSystem
.
alive: bool
A ParticleSystem
needs to be alive to emit and update Particles
.
Implementations
sourceimpl ParticleSystem
impl ParticleSystem
sourcepub fn new_from_emission(emission: ParticleProps) -> Self
pub fn new_from_emission(emission: ParticleProps) -> Self
Create a new ParticleSystem
using a ParticleProps
for the emission.
sourcepub fn new_from_emission_and_position(
emission: ParticleProps,
pos_x: f32,
pos_y: f32
) -> Self
pub fn new_from_emission_and_position(
emission: ParticleProps,
pos_x: f32,
pos_y: f32
) -> Self
Create a new ParticleSystem
using a ParticleProps
for the emission, and X
and Y
components for its position.
sourcepub fn toggle_alive(&mut self)
pub fn toggle_alive(&mut self)
Toggle the alive
field of the ParticleSystem
.
sourcepub fn emit(&mut self)
pub fn emit(&mut self)
Emit a single Particle
, according to the defined ParticleProps
for emission.
sourcepub fn emit_many(&mut self, count: u32)
pub fn emit_many(&mut self, count: u32)
Emit multiple Particles
, according to the defined ParticleProps
for emission.
Trait Implementations
sourceimpl Clone for ParticleSystem
impl Clone for ParticleSystem
sourcefn clone(&self) -> ParticleSystem
fn clone(&self) -> ParticleSystem
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Component for ParticleSystem
impl Component for ParticleSystem
sourcefn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Borrow the Component
as a &mut dyn Any
.
sourcefn as_mut_any(&mut self) -> &mut dyn Any
fn as_mut_any(&mut self) -> &mut dyn Any
sourceimpl Debug for ParticleSystem
impl Debug for ParticleSystem
Auto Trait Implementations
impl RefUnwindSafe for ParticleSystem
impl Send for ParticleSystem
impl Sync for ParticleSystem
impl Unpin for ParticleSystem
impl UnwindSafe for ParticleSystem
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.