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

Methods

boundingRect   bounding_rect   cancelMove   cancel_move   clearMove   clear_move   collide   collide?   draw   getH   getW   getX   getY   h   isOn   is_on?   move   movedX   movedY   moved_x   moved_y   pos=   setPos   to_buf   w   x   x=   y   y=  

Public Instance methods

Returns a Drawable’s bounding rect.

[Source]

/*
  Returns a Drawable's bounding rect.
*/
VALUE Drawable_boundingRect(VALUE self)
{
   Drawable &ref = getRef<Drawable>(self);
   Rect rect = ref.boundingRect();
  
   return createObject(getClass("Rect"), rect);
}
bounding_rect()

Alias for boundingRect

Cancels all the moves done since the last call to clear move. May be called once a collision occur.

[Source]

/*
  Cancels all the moves done since the last call to clear move.
  May be called once a collision occur.
*/
VALUE Drawable_cancelMove(VALUE self)
{
   Drawable &ref = getRef<Drawable>(self);
   ref.cancelMove();

   return Qnil;
}
cancel_move()

Alias for cancelMove

Clears all the moves done since the last call to this function. They can no longer be cancelled.

[Source]

/*
  Clears all the moves done since the last call to this function. They can no
  longer be cancelled.
*/
VALUE Drawable_clearMove(VALUE self)
{
   Drawable &ref = getRef<Drawable>(self);
   ref.clearMove();

   return Qnil;
}
clear_move()

Alias for clearMove

Returns whether two items collide.

[Source]

/*
  call-seq: collide(item)
            collide?(item)

  Returns whether two items collide.
*/
VALUE Drawable_collide(VALUE self, VALUE item)
{
   Drawable &ref = getRef<Drawable>(self);
   RubyDrawable val(item);
   if (ref.collide(val))
      return Qtrue;
   return Qfalse;
}
collide?(p1)

Alias for collide

Draws the drawable, and clear its moves.

[Source]

/*
  Draws the drawable, and clear its moves.
*/
VALUE Drawable_draw(VALUE self)
{
   Drawable &ref = getRef<Drawable>(self);
   ref.clearMove(); // So, we don't have to change the draw methods
   ref.draw();
   
   return Qnil;
}

Returns a drawable’s height.

[Source]

/*
  Returns a drawable's height.
*/
VALUE Drawable_getH(VALUE self)
{
   Drawable &ref = getRef<Drawable>(self);
   return INT2FIX(ref.getH());
}

Returns a drawable’s width.

[Source]

/*
  Returns a drawable's width.
*/
VALUE Drawable_getW(VALUE self)
{
   Drawable &ref = getRef<Drawable>(self);
   return INT2FIX(ref.getW());
}

Returns a drawable’s abscissa.

[Source]

/*
  Returns a drawable's abscissa.
*/
VALUE Drawable_getX(VALUE self)
{
   Drawable &ref = getRef<Drawable>(self);
   return INT2FIX(ref.getX());
}

Returns a drawable’s ordinate.

[Source]

/*
  Returns a drawable's ordinate.
*/
VALUE Drawable_getY(VALUE self)
{
   Drawable &ref = getRef<Drawable>(self);
   return INT2FIX(ref.getY());
}
h()

Alias for getH

Returns whether a point is on the drawable.

[Source]

/*
  call-seq: isOn(x, y)
            is_on?(x, y)

  Returns whether a point is on the drawable.
*/
VALUE Drawable_isOn(VALUE self, VALUE x, VALUE y)
{
   Drawable &ref = getRef<Drawable>(self);
   int _x = FIX2INT(x);
   int _y = FIX2INT(y);

   if (ref.isOn(_x, _y))
      return Qtrue;
   return Qfalse;
}
is_on?(p1, p2)

Alias for isOn

Moves a drawable.

[Source]

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

  Moves a drawable.
*/
VALUE Drawable_move(VALUE self, VALUE x, VALUE y)
{
   Drawable &ref = getRef<Drawable>(self);
   int _x = FIX2INT(x);
   int _y = FIX2INT(y);

   ref.move(_x, _y);
   return Qnil;
}

Returns the difference between the actual abscissa, and the one when clearMove was called.

[Source]

/*
  Returns the difference between the actual abscissa, and the one when
  clearMove was called.
*/
VALUE Drawable_movedX(VALUE self)
{
   Drawable &ref = getRef<Drawable>(self);
   return INT2FIX(ref.getMovedX());
}

Returns the difference between the actual ordinate, and the one when clearMove was called.

[Source]

/*
  Returns the difference between the actual ordinate, and the one when
  clearMove was called.
*/
VALUE Drawable_movedY(VALUE self)
{
   Drawable &ref = getRef<Drawable>(self);
   return INT2FIX(ref.getMovedY());
}
moved_x()

Alias for movedX

moved_y()

Alias for movedY

Sets a drawable’s position.

[Source]

/*
  call-seq: pos=(p)

  Sets a drawable's position.
*/
VALUE Drawable_setPoint(VALUE self, VALUE p)
{
   Drawable &ref = getRef<Drawable>(self);
   Point &pRef = getRef<Point>(p);
   ref.setPos(pRef);

   return p;
}

Sets a drawable’s position.

[Source]

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

  Sets a drawable's position.
*/
VALUE Drawable_setPos(VALUE self, VALUE x, VALUE y)
{
   Drawable &ref = getRef<Drawable>(self);
   int _x = FIX2INT(x);
   int _y = FIX2INT(y);

   ref.setPos(_x, _y);
   return Qnil;
}

Converts the drawable in a Buffer.

[Source]

/*
  Converts the drawable in a Buffer.
*/
VALUE Drawable_to_buf(VALUE self) 
w()

Alias for getW

x()

Alias for getX

Sets the drawable’s abscissa.

[Source]

/*
  call-seq: x=(x)

  Sets the drawable's abscissa.
*/
VALUE Drawable_setX(VALUE self, VALUE x)
{
   Drawable &ref = getRef<Drawable>(self);
   ref.setX(INT2FIX(x));

   return x;
}
y()

Alias for getY

Sets the drawable’s ordinate.

[Source]

/*
  call-seq: y=(y)

  Sets the drawable's ordinate.
*/
VALUE Drawable_setY(VALUE self, VALUE y)
{
   Drawable &ref = getRef<Drawable>(self);
   ref.setY(INT2FIX(y));

   return y;
}

[Validate]