| Class | Joyau::Scrolling |
| In: |
Drawable.cpp
|
| Parent: | Joyau::Drawable |
Class which displays a Sprite twice, making it scroll in one of the four direction.
| LEFT | = | INT2FIX(Sprite::LEFT) |
| RIGHT | = | INT2FIX(Sprite::RIGHT) |
| UP | = | INT2FIX(Sprite::UP) |
| DOWN | = | INT2FIX(Sprite::DOWN) |
Creates a new Scrolling. You can eventually load a picture during this creation.
/*
call-seq: new
new(filename)
Creates a new Scrolling. You can eventually load a picture during this
creation.
*/
VALUE wrap<Scrolling>(int argc, VALUE *argv, VALUE info)
{
Scrolling *ptr = new Scrolling;
if (argc >= 1)
ptr->setSprite(StringValuePtr(argv[0]));
VALUE tdata = Data_Wrap_Struct(info, 0, wrapped_free<Scrolling>, ptr);
return tdata;
}
Returns the scrolling’s directory.
/*
Returns the scrolling's directory.
*/
VALUE Scrolling_dir(VALUE self)
{
Scrolling &ref = getRef<Scrolling>(self);
return INT2FIX(ref.getDir());
}
Moves the scrolling,a nd wraps it automatically.
/*
Moves the scrolling,a nd wraps it automatically.
*/
VALUE Scrolling_play(VALUE self)
{
Scrolling &ref = getRef<Scrolling>(self);
ref.play();
return Qnil;
}
Sets the scrolling direction
/*
call-seq: setDir(dir)
Sets the scrolling direction
*/
VALUE Scrolling_setDir(VALUE self, VALUE dir)
{
Scrolling &ref = getRef<Scrolling>(self);
int _dir = FIX2INT(dir);
ref.setDir(_dir);
return dir;
}
Sets the scrolling speed. The speed is the distance that is done by the scrolling at each call to play.
/*
call-seq: setSpeed(s)
Sets the scrolling speed.
The speed is the distance that is done by the scrolling at each call to
play.
*/
VALUE Scrolling_setSpeed(VALUE self, VALUE s)
{
Scrolling &ref = getRef<Scrolling>(self);
int speed = FIX2INT(s);
ref.setSpeed(speed);
return s;
}
Loads a picture for the scrolling.
/*
call-seq: setSprite(filename)
Loads a picture for the scrolling.
*/
VALUE Scrolling_setSprite(VALUE self, VALUE spr)
{
Scrolling &ref = getRef<Scrolling>(self);
char *str = StringValuePtr(spr);
ref.setSprite(str);
return spr;
}