示例#1
0
def makeDMI():

    dmi = DMI('snowfx.dmi')

    # LAYER 1
    state_name = 'snowlayer1'
    state = State(state_name)
    state.dirs = 1
    state.frames = 31
    state.icons = animate_layer(Image.open('snow1.png'), layer1_op, 31)
    # Add state to DMI
    dmi.states[state_name] = state

    # LAYER 2
    state_name = 'snowlayer2'
    state = State(state_name)
    state.dirs = 1
    state.frames = 15
    state.icons = animate_layer(Image.open('snow2.png'), layer2_op, 15)
    # Add state to DMI
    dmi.states[state_name] = state

    #save
    dmi.save('snowfx.dmi', sort=False)
示例#2
0
def makeDMI():
    
    dmi = DMI('snowfx.dmi')
    
    # LAYER 1
    state_name='snowlayer1'
    state=State(state_name)
    state.dirs=1
    state.frames=31
    state.icons=animate_layer(Image.open('snow1.png'),layer1_op,31)
    # Add state to DMI
    dmi.states[state_name]=state
    
    # LAYER 2
    state_name='snowlayer2'
    state=State(state_name)
    state.dirs=1
    state.frames=15
    state.icons=animate_layer(Image.open('snow2.png'),layer2_op,15)
    # Add state to DMI
    dmi.states[state_name]=state
    
    #save
    dmi.save('snowfx.dmi', sort=False)
示例#3
0
def makeDMI():
    dmi = DMI('state_limit.dmi')
    #
    for i in range(513):
        # Make a new tile
        img = Image.new('RGBA', (32, 32))
        # Set up PIL's drawing stuff
        draw = ImageDraw.Draw(img)
        # Define a font.
        font = ImageFont.truetype('arial.ttf', 10)
        # Draw the tile number
        draw.text((10, 0), str(i + 1), (0, 0, 0), font=font)
        # Make state
        state_name = 'state {0}'.format(i + 1)
        state = State(state_name)
        state.dirs = 1
        state.frames = 1
        state.icons = [img]
        # Add state to DMI
        dmi.states[state_name] = state
    #save
    dmi.save('state_limit.dmi', sort=False)
示例#4
0
def makeDMI():
    dmi = DMI('state_limit.dmi')
    #
    for i in range(513):
        # Make a new tile
        img = Image.new('RGBA', (32, 32))
        # Set up PIL's drawing stuff
        draw = ImageDraw.Draw(img)
        # Define a font.
        font = ImageFont.truetype('arial.ttf', 10)
        # Draw the tile number
        draw.text((10, 0), str(i + 1), (0, 0, 0), font=font)
        # Make state
        state_name='state {0}'.format(i+1)
        state=State(state_name)
        state.dirs=1
        state.frames=1
        state.icons=[img]
        # Add state to DMI
        dmi.states[state_name]=state
    #save
    dmi.save('state_limit.dmi', sort=False)
示例#5
0
nfloors = DMI('nfloors.dmi')
for tileName,tileDef in tileDefs.items():
    base = floors.getFrame(tileDef['base'],directions.SOUTH,0)
    for color in tileDef['colors']:
        for arrangement in tileDef['arrangements']:
            arrname=''
            arrange=[False,False,False,False]
            if isinstance(arrangement,str):
                arrange=arrangements[arrangement]
                arrname=arrangement
            elif isinstance(arrangement,list):
                arrange=arrangement[1:]
                arrname=arrangement[0]
            state='{base} {color} {arrangement}'.format(base=tileDef['base'],color=color,arrangement=arrname)
            nstate=State(state)
            nstate.dirs=len(arrange)
            nstate.frames=1
            nstate.icons=[None for _ in range(nstate.dirs)]
            #statedebug = DMI(state+'.dmi')
            nfloors.states[state]=nstate
            for d in range(len(arrange)):
                cmap = arrange[d]
                dirf = 0
                dirn = 'SOUTH'
                if len(arrange) > 1:
                    dirf = directions.IMAGE_INDICES[d]
                    dirn = directions.getNameFromDir(dirf)
                print(' Generating state {0} ({1})...'.format(repr(state),dirn))
                #print(repr(arrange))
                img=Image.new('RGBA',(32,32))
                img.paste(base)
示例#6
0
 base = floors.getFrame(tileDef['base'], directions.SOUTH, 0)
 for color in tileDef['colors']:
     for arrangement in tileDef['arrangements']:
         arrname = ''
         arrange = [False, False, False, False]
         if isinstance(arrangement, str):
             arrange = arrangements[arrangement]
             arrname = arrangement
         elif isinstance(arrangement, list):
             arrange = arrangement[1:]
             arrname = arrangement[0]
         state = '{base} {color} {arrangement}'.format(base=tileDef['base'],
                                                       color=color,
                                                       arrangement=arrname)
         nstate = State(state)
         nstate.dirs = len(arrange)
         nstate.frames = 1
         nstate.icons = [None for _ in range(nstate.dirs)]
         #statedebug = DMI(state+'.dmi')
         nfloors.states[state] = nstate
         for d in range(len(arrange)):
             cmap = arrange[d]
             dirf = 0
             dirn = 'SOUTH'
             if len(arrange) > 1:
                 dirf = directions.IMAGE_INDICES[d]
                 dirn = directions.getNameFromDir(dirf)
             print(' Generating state {0} ({1})...'.format(
                 repr(state), dirn))
             #print(repr(arrange))
             img = Image.new('RGBA', (32, 32))