area.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:PointlessMaker 作者: aboood40091 项目源码 文件源码
def loadTileset(self, mode, theme):
        globals.Tiles = []

        widths = {"M1": 16, "M3": 16, "MW": 16, "WU": 64}
        themes = {0: "plain", 1: "underground", 2: "castle", 3: "airship", 4: "water", 5: "hauntedhouse"}

        width = widths[mode]

        Tileset = QtGui.QPixmap('tilesets/%s_Field_%s.png' % (mode, themes[theme]))
        xcount = Tileset.width() // width
        ycount = Tileset.height() // width
        sourcex = 0
        sourcey = 0

        for y in range(ycount):
            for x in range(xcount):
                if mode == "WU":
                    if globals.TileWidth != 60:
                        bmp = Tileset.copy(sourcex + 2, sourcey + 2,
                                           width - 4, width - 4).scaledToWidth(globals.TileWidth, Qt.SmoothTransformation)

                    else:
                        bmp = Tileset.copy(sourcex + 2, sourcey + 2, width - 4, width - 4)

                else:
                    if globals.TileWidth != width:
                        bmp = Tileset.copy(sourcex, sourcey,
                                           width, width).scaledToWidth(globals.TileWidth, Qt.SmoothTransformation)

                    else:
                        bmp = Tileset.copy(sourcex, sourcey, width, width)

                globals.Tiles.append(bmp)
                sourcex += width
            sourcex = 0
            sourcey += width
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号