def __init__(self, hmap, material_couples, actual_frames, outsides, restrict_size): self.material_couples = material_couples self.zoom_levels = list(range(len(material_couples[0].tilers))) self.current_zoom_level = 0 self.actual_frames = actual_frames if restrict_size is None: nx, ny = len(hmap), len(hmap[0]) else: nx, ny = restrict_size BaseGrid.__init__(self, int(nx), int(ny)) self.current_x = 0 self.current_y = 0 self.graphical_maps = [] #list of maps, index = zoom level self.cell_sizes = [] for z in self.zoom_levels: cell_size = material_couples[0].get_cell_size(z) gm = GraphicalMap(nx, ny, cell_size, z, actual_frames[z], outsides[z]) self.graphical_maps.append(gm) self.cell_sizes.append(cell_size) self.current_gm = self.graphical_maps[0] # self.layers = [] # self.nframes = len(material_couples[0].get_tilers(0)) self.t = 0 #in unit of materials frame self.tot_time = 0 #in unit of pygame frame self.frame_slowness = 20 # self.refresh_cell_heights(hmap) self.refresh_cell_types() self.colorkey = None #used at build_surface() self.static_objects = [] self.me = None
def __init__(self, nx, ny, cell_size, topleft=(0,0), periodicity=(False, False)): BaseGrid.__init__(self, nx, ny, periodicity) self.cell_w = cell_size[0] self.cell_h = cell_size[1] self.frame = pygame.Rect(topleft, (self.nx*self.cell_w, self.ny*self.cell_h)) self.cell_rect = self.build_cell_rect()
def __init__(self, nx, ny, cell_size, topleft=(0,0), value=None, periodicity=(False, False)): BaseGrid.__init__(self, nx, ny, value, periodicity) self.cell_w = cell_size[0] self.cell_h = cell_size[1] self.frame = pygame.Rect(topleft, (self.nx*self.cell_w, self.ny*self.cell_h)) self.cell_rect = self.build_cell_rect()
def __init__(self, hmap, material_couples, outsides, restrict_size): self.material_couples = material_couples self.zoom_levels = list(range(len(material_couples[0].tilers))) self.current_zoom_level = 0 if restrict_size is None: nx, ny = len(hmap), len(hmap[0]) else: nx, ny = restrict_size BaseGrid.__init__(self, int(nx), int(ny)) self.current_x = 0 self.current_y = 0 self.graphical_maps = [] #list of maps, index = zoom level self.cell_sizes = [] for z in self.zoom_levels: cell_size = material_couples[0].get_cell_size(z) gm = GraphicalMap(nx, ny, cell_size, z, outsides[z]) gm.lm = self self.graphical_maps.append(gm) self.cell_sizes.append(cell_size) self.current_gm = self.graphical_maps[0] # self.nframes = len(material_couples[0].get_tilers(0)) self.t = 0 #in unit of materials frame self.t1 = 0 #used for default animated graphics self.t2 = 0 #used for fast animated graphics self.t3 = 0 #used for slow animated graphics self.t4 = 0 self.tot_time = 0 #in unit of pygame frame self.frame_slowness1 = None #associated to t1. Reset in mapbuilding !!! self.frame_slowness2 = None #associated to t2 self.frame_slowness3 = None self.frame_slowness4 = None # self.refresh_cell_heights(hmap) self.refresh_cell_types() self.colorkey = None #used at build_surface() self.static_objects = [] self.me = None self.chunk = None
def __init__(self, actual_frames, outsides, zoom_sizes, nframes, restrict_size, white_value=(255, 255, 255)): self.zoom_levels = list(range(len(zoom_sizes))) self.current_zoom_level = 0 self.cell_sizes = zoom_sizes self.actual_frames = actual_frames nx, ny = restrict_size BaseGrid.__init__(self, int(nx), int(ny)) self.current_x = 0 self.current_y = 0 self.graphical_maps = [] self.whites = [] self.white_value = white_value for z in self.zoom_levels: cell_size = self.cell_sizes[z] gm = GraphicalMap(nx, ny, cell_size, z, actual_frames[z], outsides[z]) self.graphical_maps.append(gm) white = pygame.Surface((cell_size, ) * 2) white.fill(self.white_value) self.whites.append(white) self.current_gm = self.graphical_maps[0] self.layers = [] # self.nframes = nframes self.t = 0 self.tot_time = 0 self.frame_slowness = 20 # self.refresh_cell_heights() self.refresh_cell_types() self.colorkey = white_value self.static_objects = []