Пример #1
0
Image::Image(Entity *entity) : AComponent(entity, T_IMAGE, 0, 1)
{
  POSITION(entity);
  VISIBILITY(entity);
  ROTATION(entity);
  this->bitmap = NULL;
}
Пример #2
0
static int add_method_if_matching(ID method_name, NODE *body, add_method_if_matching_arg_t *arg) {
  /* This entry is for the internal allocator function. */
  if (method_name == ID_ALLOCATOR)
    return ST_CONTINUE;

  /* Module#undef_method sets body->nd_body to NULL. */
  if (!body || !body->nd_body)
    return ST_CONTINUE;

  if (VISIBILITY(body) == arg->visibility)
    rb_ary_push(arg->names, ID2SYM(method_name));
  return ST_CONTINUE;
}
Пример #3
0
void					Image::draw()
{
  Position				*position = POSITION(this->entity);
  unsigned char				opacity = VISIBILITY(this->entity)->opacity;
  float					angle = ROTATION(this->entity)->angle;

  if (this->bitmap)
    al_draw_tinted_rotated_bitmap(this->bitmap,
				  al_map_rgba(opacity, opacity, opacity, opacity),
				  angle == 0 ? 0 : al_get_bitmap_width(this->bitmap) / 2,
				  angle == 0 ? 0 : al_get_bitmap_height(this->bitmap) / 2,
				  angle == 0 ? position->x : position->x + al_get_bitmap_width(this->bitmap) / 2,
				  angle == 0 ? position->y : position->y + al_get_bitmap_height(this->bitmap) / 2,
				  angle,
				  0);
}