Class Joyau::Particles
In: Drawable.cpp
Parent: Joyau::Drawable

Class representing a particles generator. The steps of a particle’s life are saved in a picture.

Methods

addParticles   file=   getGravity   getMinSpeed   getSpeed   getTime   gravity   minSpeed   new   setFile   setParam   speed   time  

Public Class methods

Creates a new particles generator.

[Source]

/*
  call-seq: new
            new(filename)

  Creates a new particles generator.
 */
VALUE wrap<Particles>(int argc, VALUE *argv, VALUE info)
{
   Particles *ptr = new Particles;
   VALUE tdata;
   
   if (argc >= 1)
      ptr->setFile(StringValuePtr(argv[0]));
   
   tdata = Data_Wrap_Struct(info, 0, wrapped_free<Particles>, ptr);
   return tdata;
}

Public Instance methods

Adds a particle at the specified position.

[Source]

/*
  call-seq: addParticles(x, y)

  Adds a particle at the specified position.
*/
VALUE Particles_addParticles(VALUE self, VALUE x, VALUE y)
{
   Particles &ref = getRef<Particles>(self);
   int _x = FIX2INT(x);
   int _y = FIX2INT(y);

   ref.addParticles(_x, _y);
   return Qnil;
}
file=(p1)

Alias for setFile

Returns the particles generator’s gravity.

[Source]

/*
  Returns the particles generator's gravity.
*/
VALUE Particles_getGravity(VALUE self)
{
   Particles &ref = getRef<Particles>(self);
   return FIX2INT(ref.getGravity());
}

Returns a particle’s minimum speed.

[Source]

/*
  Returns a particle's minimum speed.
*/
VALUE Particles_getMinSpeed(VALUE self)
{
   Particles &ref = getRef<Particles>(self);
   return FIX2INT(ref.getMinSpeed());
}

Returns a particle’s speed.

[Source]

/*
  Returns a particle's speed.
*/
VALUE Particles_getSpeed(VALUE self)
{
   Particles &ref = getRef<Particles>(self);
   return FIX2INT(ref.getSpeed());
}

Returns a particle’s lifetime.

[Source]

/*
  Returns a particle's lifetime.
*/
VALUE Particles_getTime(VALUE self)
{
   Particles &ref = getRef<Particles>(self);
   return FIX2INT(ref.getTime());
}
gravity()

Alias for getGravity

minSpeed()

Alias for getMinSpeed

Sets the particle’s file (from which particles are loaded)

[Source]

/*
  call-seq: setFile(filename)

  Sets the particle's file (from which particles are loaded)
*/
VALUE Particles_setFile(VALUE self, VALUE str)
{
   Particles &ref = getRef<Particles>(self);
   char *val = StringValuePtr(str);

   ref.setFile(val);
   return Qnil;
}

Sets the particles generator’s parameters. Can only be called once.

[Source]

/*
  call-seq: setParam(time, speed, gravity, minimum_speed)

  Sets the particles generator's parameters. Can only be called once. 
*/
VALUE Particles_setParam(VALUE self, VALUE time, VALUE speed, VALUE gravity,
                         VALUE mspeed)
{
   Particles &ref = getRef<Particles>(self);
   int _time = FIX2INT(time);
   int _speed = FIX2INT(speed);
   int _gravity = FIX2INT(gravity);
   int _mspeed = FIX2INT(mspeed);

   ref.setParam(_time, _speed, _gravity, _mspeed);
   return Qnil;
}
speed()

Alias for getSpeed

time()

Alias for getTime

[Validate]