示例#1
0
    def __init__(self, height, path):
        self.w, self.h, self.frame = image2term(path, height=height)
        self.x = self.y = 0

        tw, th = get_terminal_size_in_pixels()
        self.set_pos(tw / 2 - self.w / 2, th / 2 - self.h / 2)

        bapho_head = image2term('img/baphomet_head.gif',
                                height=0.8 * self.h,
                                invert=True)
        self.frame.extend(
            set_pos(bapho_head[2], self.x + self.w / 2 - bapho_head[0] / 2,
                    self.y + self.h / 2 - bapho_head[1] / 2))

        bapho_title = image2term('img/baphomet_title.jpg',
                                 height=85,
                                 invert=True)
        self.frame.extend(
            set_pos(bapho_title[2], self.x + self.w / 2 - bapho_title[0] / 2,
                    self.y - 20 - bapho_title[1] / 2))

        # Generate seeds.
        random.seed(datetime.now())
        self.seeds = self.generate_seeds(NUM_SEEDS)
        self.reset_seeds_frame()

        # Snakes.
        self.snakes = None
示例#2
0
def load_arena():
    arena = []
    baphomet_head = image2term('img/baphomet_head.gif', ratio=0.48, invert=True)
    tw,th = get_terminal_size_in_pixels()

    arena.extend(set_pos(baphomet_head,tw/2 - 105,th/2 - 105))
    arena.extend(image2term('img/arena.png',ratio=1.0))

    return arena
示例#3
0
    def __init__(self,height,path):
        self.w, self.h, self.frame = image2term(path,height=height)
        self.x = self.y = 0

        tw, th = get_terminal_size_in_pixels()
        self.set_pos(tw/2 - self.w/2,th/2 - self.h/2)

        bapho_head = image2term('img/baphomet_head.gif', height=0.8*self.h, invert=True)
        self.frame.extend(set_pos(bapho_head[2],self.x + self.w/2 - bapho_head[0]/2,self.y + self.h/2 - bapho_head[1]/2))

        bapho_title = image2term('img/baphomet_title.jpg', height=85,invert=True)
        self.frame.extend(set_pos(bapho_title[2],self.x + self.w/2 - bapho_title[0]/2,self.y - 20 - bapho_title[1]/2))

        # Generate seeds.
        random.seed(datetime.now())
        self.seeds = self.generate_seeds(NUM_SEEDS)
        self.reset_seeds_frame()

        # Snakes.
        self.snakes = None