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.
Creates a new particles generator.
/* 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; }
Adds a particle at the specified position.
/* 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; }
Returns the particles generator’s gravity.
/* 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.
/* 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.
/* Returns a particle's speed. */ VALUE Particles_getSpeed(VALUE self) { Particles &ref = getRef<Particles>(self); return FIX2INT(ref.getSpeed()); }
Returns a particle’s lifetime.
/* Returns a particle's lifetime. */ VALUE Particles_getTime(VALUE self) { Particles &ref = getRef<Particles>(self); return FIX2INT(ref.getTime()); }
Sets the particle’s file (from which particles are loaded)
/* 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.
/* 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; }