コード例 #1
0
ファイル: function.py プロジェクト: JerseyJackal/PyGG2-old
def load_mask(filename, give_orig=False):
    if filename in masks:
        if give_orig: return masks[filename]
        else: return masks[filename].copy()

    # first try to load the sprite from the sprite folder, fall back to our zipped sprites
    # this allows users to override sprites, and makes testing/developing easier
    try:
        bitmask = mask.from_image(spritesfolder +  filename + ".png")
    except:
        sprites = zipfile.ZipFile(spriteszip, "r")
        spritefile = cStringIO.StringIO(sprites.open("sprites/" + filename + ".png", "r").read())
        bitmask = mask.from_image(spritefile)
        spritefile.close()

    masks[filename] = bitmask

    if give_orig: return bitmask
    else: return bitmask.copy()
コード例 #2
0
ファイル: function.py プロジェクト: 0xluis/PyGG2
def load_mask(filename, give_orig=False):
    if filename in masks:
        if give_orig: return masks[filename]
        else: return masks[filename].copy()

    bitmask = mask.from_image(filename)

    masks[filename] = bitmask

    if give_orig: return bitmask
    else: return bitmask.copy()
コード例 #3
0
def load_mask(filename, give_orig=False):
    if filename in masks:
        if give_orig: return masks[filename]
        else: return masks[filename].copy()

    bitmask = mask.from_image(filename)

    masks[filename] = bitmask

    if give_orig: return bitmask
    else: return bitmask.copy()