试图理解pygame中参数的含义。

时间:2014-12-26 23:42:07

标签: python pygame

这是我想要理解的功能:

def load_image(name, colorkey=None):
    fullname = os.path.join('data', name)
    try:
        image = pygame.image.load(fullname)
    except pygame.error, message:
        print 'Cannot load image:', name
        raise SystemExit, message
    image = image.convert()
    if colorkey is not None:
        if colorkey is -1:
            colorkey = image.get_at((0,0))
        image.set_colorkey(colorkey, RLEACCEL)
    return image, image.get_rect()

除了这行之外,我几乎了解所有这些:

        image.set_colorkey(colorkey, RLEACCEL)

这条线上的RLEACCEL是什么?它只是一个变量的随机名称,所以rbg值可以适合这里或其他什么?

这是教程的链接,我看到了这段代码:link

1 个答案:

答案 0 :(得分:0)

RLE表示行程编码。 http://en.wikipedia.org/wiki/Run-length_encoding

RLEACCEL是表示RLE编码的Surface的标志。 http://www.pygame.org/docs/ref/surface.html