def main(): random.seed() pygame.init() #generates a random world seed and initializes pygame screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT)) #generates a display window i_store = image_store.load_images(IMAGE_LIST_FILE_NAME, TILE_WIDTH, TILE_HEIGHT) #Acquires all the images? num_cols = SCREEN_WIDTH // TILE_WIDTH * WORLD_WIDTH_SCALE num_rows = SCREEN_HEIGHT // TILE_HEIGHT * WORLD_HEIGHT_SCALE #Sets a number of vertical and horizontal tiles default_background = create_default_background( image_store.get_images(i_store, image_store.DEFAULT_IMAGE_NAME)) #Sets the default background to an instance of the Background class world = worldmodel.WorldModel(num_rows, num_cols, default_background) #Sets world to an instance of the WorldModel class view = worldview.WorldView(SCREEN_WIDTH // TILE_WIDTH, SCREEN_HEIGHT // TILE_HEIGHT, screen, world, TILE_WIDTH, TILE_HEIGHT) #Sets view to an instance of the WorldView class load_world(world, i_store, WORLD_FILE) #Loads the world view.update_view() #Updates the image on-screen controller.activity_loop(view, world)
def main(): random.seed() pygame.init() screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT)) i_store = image_store.load_images(IMAGE_LIST_FILE_NAME, TILE_WIDTH, TILE_HEIGHT) num_cols = SCREEN_WIDTH // TILE_WIDTH * WORLD_WIDTH_SCALE num_rows = SCREEN_HEIGHT // TILE_HEIGHT * WORLD_HEIGHT_SCALE default_background = create_default_background( image_store.get_images(i_store, image_store.DEFAULT_IMAGE_NAME)) world = worldmodel.WorldModel(num_rows, num_cols, default_background) view = worldview.WorldView(SCREEN_WIDTH // TILE_WIDTH, SCREEN_HEIGHT // TILE_HEIGHT, screen, world, TILE_WIDTH, TILE_HEIGHT) view.update_view() builder_controller.activity_loop(view, world, i_store)