def __init__(self): CombatMapGroup.textures = TextureGroup.get_group('wmap') self.idxs = array.array('L', open(config.resource('data', 'warfld.idx'), 'rb').read()) self.idxs.append(0) # utils.debug('idxs:', self.idxs) # utils.debug('idxs diff:', utils.diff(self.idxs)) # utils.debug('idxs len:', len(self.idxs) - 1) self.grpData = open(config.resource('data', 'warfld.grp'), 'rb').read() self._combatMaps = pyxlru.lru(config.combatMapCacheNum) self.blockByteSize = config.combatMapXMax * config.combatMapYMax * 2 * 2
def __init__(self): CombatMapGroup.textures = TextureGroup.get_group('wmap') self.idxs = array.array( 'L', open(config.resource('data', 'warfld.idx'), 'rb').read()) self.idxs.append(0) # utils.debug('idxs:', self.idxs) # utils.debug('idxs diff:', utils.diff(self.idxs)) # utils.debug('idxs len:', len(self.idxs) - 1) self.grpData = open(config.resource('data', 'warfld.grp'), 'rb').read() self._combatMaps = pyxlru.lru(config.combatMapCacheNum) self.blockByteSize = config.combatMapXMax * config.combatMapYMax * 2 * 2
def __init__(self, xmax, ymax, textures): super().__init__() self.textures = textures size = ( config.screenWidth + self.PAD_X * 2, config.screenHeight + self.PAD_Y * 2 + config.bottomPadding, ) innerSize = ( config.screenWidth - 2 * config.debugMargin, config.screenHeight - 2 * config.debugMargin, ) self.rect = pg.Rect((-self.PAD_X, -self.PAD_Y), size) self.image = utils.new_surface(size) self.drawImage = self.image.copy() self.floorImage = self.image.copy() if CLIP: clip_rect = ( (self.PAD_X + config.debugMargin - self.GX, self.PAD_Y + config.debugMargin - self.GY), add(innerSize, (2 * self.GX, 2 * self.GY)), ) self.image.set_clip(clip_rect) self.drawImage.set_clip(clip_rect) self.currentPos = (0, 0) self.directionQueue = [] self.xmax = xmax self.ymax = ymax self.looper = ScrollLooper( # (config.screenWidth, config.screenHeight), # size innerSize, # size (self.GX, self.GY), # grid size ) self._gridTextureCache = pyxlru.lru(config.mainMapCacheSize) # self._gridTextureCache = {} self._dirty = threading.Condition() self._swapped = False self._drawnPos = (-1, -1) self._rows = deque() self._quit = False self.drawLock = threading.RLock() if config.smoothTicks > 1: self.drawerThread = threading.Thread(target=self.drawer) self.drawerThread.daemon = True self.drawerThread.start() self.rAdjuster = SimpleRateAdjuster()