| Class | Joyau::CollisionType |
| In: |
Drawable.cpp
|
| Parent: | Object |
Allows to tell where collisions should be checked for an object (e.g. tiles).
Creates a new collision type. The arguments are either true or false, indicating where the collision should be checked.
/*
call-seq: new()
new(content [, left, right, up, down])
Creates a new collision type. The arguments are either true or false,
indicating where the collision should be checked.
*/
VALUE wrap<CollisionType>(int argc, VALUE *argv, VALUE info)
{
CollisionType *ptr = new CollisionType;
if (argc >= 1)
{
ptr->content = argv[0] == Qtrue;
if (argc >= 5)
{
ptr->left = argv[1] == Qtrue;
ptr->right = argv[2] == Qtrue;
ptr->up = argv[3] == Qtrue;
ptr->down = argv[4] == Qtrue;
}
}
VALUE tdata = Data_Wrap_Struct(info, 0, wrapped_free<CollisionType>, ptr);
return tdata;
}
Returns whether collisions are checked for the item’s content.
/*
Returns whether collisions are checked for the item's content.
*/
VALUE CollisionType_content(VALUE self)
{
CollisionType &ref = getRef<CollisionType>(self);
return ref.content ? Qtrue : Qfalse;
}
Sets whether collision should be checked for the item’s content.
/*
call-seq: content=(val)
Sets whether collision should be checked for the item's content.
*/
VALUE CollisionType_setContent(VALUE self, VALUE val)
{
CollisionType &ref = getRef<CollisionType>(self);
ref.content = val == Qtrue;
return val;
}
Returns whether collisions are checked for the downer side.
/*
Returns whether collisions are checked for the downer side.
*/
VALUE CollisionType_down(VALUE self)
{
CollisionType &ref = getRef<CollisionType>(self);
return ref.down ? Qtrue : Qfalse;
}
Sets whether collision should be checked for the downer side.
/*
call-seq: down=(val)
Sets whether collision should be checked for the downer side.
*/
VALUE CollisionType_setDown(VALUE self, VALUE val)
{
CollisionType &ref = getRef<CollisionType>(self);
ref.down = val == Qtrue;
return val;
}
Returns whether collisions are checked for the left side.
/*
Returns whether collisions are checked for the left side.
*/
VALUE CollisionType_left(VALUE self)
{
CollisionType &ref = getRef<CollisionType>(self);
return ref.left ? Qtrue : Qfalse;
}
cal0l-seq: left=(val)
Sets whether collision should be checked for the left side.
/*
cal0l-seq: left=(val)
Sets whether collision should be checked for the left side.
*/
VALUE CollisionType_setLeft(VALUE self, VALUE val)
{
CollisionType &ref = getRef<CollisionType>(self);
ref.left = val == Qtrue;
return val;
}
Returns whether collisions are checked for the right side.
/*
Returns whether collisions are checked for the right side.
*/
VALUE CollisionType_right(VALUE self)
{
CollisionType &ref = getRef<CollisionType>(self);
return ref.right ? Qtrue : Qfalse;
}
Sets whether collision should be checked for the right side.
/*
call-seq: right=(val)
Sets whether collision should be checked for the right side.
*/
VALUE CollisionType_setRight(VALUE self, VALUE val)
{
CollisionType &ref = getRef<CollisionType>(self);
ref.right = val == Qtrue;
return val;
}
Returns whether collisions are checked for the upper side.
/*
Returns whether collisions are checked for the upper side.
*/
VALUE CollisionType_up(VALUE self)
{
CollisionType &ref = getRef<CollisionType>(self);
return ref.up ? Qtrue : Qfalse;
}