All pastes #20138 Raw Edit

Something

public text v1 · immutable
#20138 ·published 2005-08-16 06:25 UTC
rendered paste body
  def draw_actor_bar(actor, value, maxvalue, x, y, width = 142, height = 10, bar_color = Color.new(0, 0, 128, 255))
    self.contents.fill_rect(x-1, y-1, width+3, height+2, Color.new(0, 0, 0, 255))
    return if maxvalue == 0
    w = width * value / maxvalue
    return if w = 0
    for i in 0..w
      r = bar_color.red   * (w -i)/w  + 0   * i/w
      g = bar_color.green * (w -i)/w  + 0   * i/w
      b = bar_color.blue  * (w -i)/w  + 255 * i/w
      self.contents.fill_rect(x + i, y, 1, height, Color.new(r, g, b, 255)) 
    end
  end