예제 #1
0
void
Gradient::draw(DrawingContext& context)
{
  context.push_transform();
  context.set_translation(Vector(0, 0));
  context.draw_gradient(gradient_top, gradient_bottom, layer, gradient_direction);
  context.pop_transform();
}
예제 #2
0
void
Gradient::draw(DrawingContext& context)
{
  if(gradient_direction != HORIZONTAL && gradient_direction != VERTICAL)
  {
      auto current_sector = Sector::current();
      auto camera_translation = current_sector->camera->get_translation();
      auto sector_width = current_sector->get_width();
      auto sector_height = current_sector->get_height();
      gradient_region = Rectf(-camera_translation.x, -camera_translation.y, sector_width, sector_height);
  }

  context.push_transform();
  context.set_translation(Vector(0, 0));
  context.draw_gradient(gradient_top, gradient_bottom, layer, gradient_direction, gradient_region);
  context.pop_transform();
}