pub struct Particle {
pub x: i16,
pub y: i16,
pub x_frac: u8,
pub y_frac: u8,
pub vx: i16,
pub vy: i16,
pub r: u8,
pub g: u8,
pub b: u8,
pub ttl: u8,
pub spawn_ttl: u8,
}Expand description
One live particle.
Positions are in screen-space pixels (i16). Velocities are
Q4.4 sub-pixel – vx = 32 means 2 px / frame. That keeps
enough resolution for slow drift + fast bursts out of the
same i16 channel.
Fields§
§x: i16Top-left x position in pixels.
y: i16Top-left y position in pixels.
x_frac: u8Fraction of a pixel x has advanced, in sixteenths (0..=15). The
pool carries the part of vx that does not fill a whole pixel here,
so slow particles drift instead of freezing.
y_frac: u8Fraction of a pixel y has advanced, in sixteenths (0..=15).
vx: i16Velocity along x, Q4.4 pixels/frame.
vy: i16Velocity along y, Q4.4 pixels/frame. Positive = downward.
r: u8Colour at spawn – the renderer scales this by
ttl / spawn_ttl for a fade-out.
g: u8Green at spawn.
b: u8Blue at spawn.
ttl: u8Frames remaining. 0 = slot empty.
spawn_ttl: u8TTL originally passed at spawn. Kept so the fade ratio is correct when different bursts have different lifespans.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Particle
impl RefUnwindSafe for Particle
impl Send for Particle
impl Sync for Particle
impl Unpin for Particle
impl UnsafeUnpin for Particle
impl UnwindSafe for Particle
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)