コード例 #1
0
ファイル: editTools.py プロジェクト: blackmius/pgame
 def do_fillAll(self, minmax, button):
     tiles = self.game.ocean.tiles
     newTile = self.palette.tileName
     if newTile == "water" or button == 3:
         ab = AxisAlignedBoundingBox(*minmax)
         for (col,row) in ab.enumerate():
             if (col,row) in tiles:
                 del tiles[(col,row)]
     elif button == 1:
         ab = AxisAlignedBoundingBox(*minmax)
         for (col,row) in ab.enumerate():
             tiles[(col,row)] = newTile
     self.ocean.dirty = True
     self.map.dirty = True
コード例 #2
0
ファイル: editPalettes.py プロジェクト: blackmius/pgame
    def cut(self):
        self.curClip = len(self.clips)
        box = AxisAlignedBoundingBox(*self.selection[2:4])
        tiles = dict([((x-box.min.x, y-box.min.y),
                       self.tiles.get((x,y),"water"))
                      for (x,y) in box.enumerate()])
        item = ClipboardItem(tiles, box.size, self.map)
        self.clips.append(item)

        for (x,y) in box.enumerate():
            if (x,y) in self.tiles:
                del self.tiles[(x,y)]

        self.selectionId = self.edit.selectionId

        self.window.map.dirty = True
        self.window.dialogMessage("Cut selection.")