mappainter.py 文件源码

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

项目:nautical-combat 作者: horstjens 项目源码 文件源码
def __init__(self, width=640, height=400, fps=30, filename = "level1.txt", tilew = 20, tileh = 20):
        """Initialize pygame, window, background, font,...
           default arguments 
        """
        pygame.init()
        pygame.display.set_caption("--- MAP-VIEWER ---")
        PygView.width = width    # make global readable
        PygView.height = height
        self.filename = filename
        self.tilew = tilew
        self.tileh = tileh

        self.lines = 32
        self.chars = 64
        self.tiles = []


        print(self.lines, self.chars) 
        print(self.tiles)
        PygView.width = self.chars * self.tilew
        PygView.height = self.lines * self.tileh

        self.screen = pygame.display.set_mode((self.width, self.height), pygame.DOUBLEBUF)
        self.background = pygame.Surface(self.screen.get_size()).convert()  
        self.background.fill((255,255,255)) # fill background white

        #self.clock = pygame.time.Clock()
        #self.fps = fps
        #self.playtime = 0.0
        #self.font = pygame.font.SysFont('mono', 24, bold=True)
        self.paint()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号