package ocelot.desktop.ui.particle

import ocelot.desktop.graphics.Graphics
import ocelot.desktop.ui.widget.Widget

/**
  * Everything a single particle needs to live and thrive.
  * @param time    current lifetime of the particle
  * @param speed   speed modifier
  * @param ttl     when the `time` will reach this value - the particle is going to be discarded
  * @param origin  optional, marks the widget that "spawned" this particle
  */

case class Particle(
  var time: Float = 0.0f,
  var speed: Float = 1.0f,
  var ttl: Float = 1.0f,
  origin: Option[Widget] = None,
) {
  def expired: Boolean = time >= ttl

  def update(dt: Float): Unit = {
    time += speed * dt
  }

  def draw(g: Graphics): Unit = {}
}
