Class: SFML::ParticleSystem::Particle

Inherits:
Struct
  • Object
show all
Defined in:
lib/sfml/graphics/particle_system.rb

Overview

A single particle. Plain Struct so allocations stay cheap; mutated in-place from #update.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#a ⇒ Object

Returns the value of attribute a

Returns:

  • (Object) —

    the current value of a



41
42
43
# File 'lib/sfml/graphics/particle_system.rb', line 41

def a
  @a
end

#age ⇒ Object

Returns the value of attribute age

Returns:

  • (Object) —

    the current value of age



41
42
43
# File 'lib/sfml/graphics/particle_system.rb', line 41

def age
  @age
end

#b ⇒ Object

Returns the value of attribute b

Returns:

  • (Object) —

    the current value of b



41
42
43
# File 'lib/sfml/graphics/particle_system.rb', line 41

def b
  @b
end

#g ⇒ Object

Returns the value of attribute g

Returns:

  • (Object) —

    the current value of g



41
42
43
# File 'lib/sfml/graphics/particle_system.rb', line 41

def g
  @g
end

#lifetime ⇒ Object

Returns the value of attribute lifetime

Returns:

  • (Object) —

    the current value of lifetime



41
42
43
# File 'lib/sfml/graphics/particle_system.rb', line 41

def lifetime
  @lifetime
end

#r ⇒ Object

Returns the value of attribute r

Returns:

  • (Object) —

    the current value of r



41
42
43
# File 'lib/sfml/graphics/particle_system.rb', line 41

def r
  @r
end

#size ⇒ Object

Returns the value of attribute size

Returns:

  • (Object) —

    the current value of size



41
42
43
# File 'lib/sfml/graphics/particle_system.rb', line 41

def size
  @size
end

#vx ⇒ Object

Returns the value of attribute vx

Returns:

  • (Object) —

    the current value of vx



41
42
43
# File 'lib/sfml/graphics/particle_system.rb', line 41

def vx
  @vx
end

#vy ⇒ Object

Returns the value of attribute vy

Returns:

  • (Object) —

    the current value of vy



41
42
43
# File 'lib/sfml/graphics/particle_system.rb', line 41

def vy
  @vy
end

#x ⇒ Object

Returns the value of attribute x

Returns:

  • (Object) —

    the current value of x



41
42
43
# File 'lib/sfml/graphics/particle_system.rb', line 41

def x
  @x
end

#y ⇒ Object

Returns the value of attribute y

Returns:

  • (Object) —

    the current value of y



41
42
43
# File 'lib/sfml/graphics/particle_system.rb', line 41

def y
  @y
end

Instance Method Details

#alive? ⇒ Boolean

true if alive.

Returns:

  • (Boolean)


49
50
# File 'lib/sfml/graphics/particle_system.rb', line 49

def alive? = age < lifetime
# Returns the normalized age.

#normalized_age ⇒ Object

Returns the normalized age.



51
# File 'lib/sfml/graphics/particle_system.rb', line 51

def normalized_age = age / lifetime