class Game_System
  def draw_line(bitmap, x1, y1, x2, y2, colour)
    w = (x1 - x2).abs
    h = (y1 - y2).abs
    
    sx = 0
    sy = 0
    
    if (x1 < x2)
      sx = 1
    else
      sx = -1
    end
    if (y1 < y2)
      sy = 1
    else
      sy = -1
    end
    
    err = (w - h).to_f
    
    while(true)
      bitmap.set_pixel(x1, y1, colour)
      
      break if ((x1 == x2) && (y1 == y2))
      
      e2 = (2 * err).to_f
      
      if (e2 > -h)
        err -= h
        x1 += sx
      end
      
      if (e2 < w)
        err += w
        y1 += sy
      end
    end
  end
end