def __init__(self): global debug, font_width, font_height, con, panel, ps, fov_noise, savefiles, baseitems, prefix, suffix, tiles, monsters IO.load_settings() debug = dbg.Debug() debug.enable = True for key, value in fonts.items(): if setting_font == key: libtcod.console_set_custom_font(value['file'], libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_ASCII_INROW) font_width = value['width'] font_height = value['height'] self.init_root_console() #libtcod.console_init_root(SCREEN_WIDTH, SCREEN_HEIGHT, 'Immortal ' + VERSION, False) con = libtcod.console_new(MAP_WIDTH, MAP_HEIGHT) panel = libtcod.console_new(MESSAGE_WIDTH, MESSAGE_HEIGHT) ps = libtcod.console_new(PLAYER_STATS_WIDTH, PLAYER_STATS_HEIGHT) fov_noise = libtcod.noise_new(1, 1.0, 1.0) savefiles = [f for f in os.listdir('saves') if os.path.isfile(os.path.join('saves', f))] IO.load_high_scores() baseitems = BaseItemList() baseitems.init_parser() prefix = PrefixList() prefix.init_parser() suffix = SuffixList() suffix.init_parser() tiles = mapgen.TileList() tiles.init_parser() monsters = MonsterList() monsters.init_parser() self.main_menu()
def show_high_scores(self): if os.path.exists('highscores.dat'): IO.load_high_scores() contents = [] for (score, line1, line2) in highscore: contents.append(str(score).ljust(6) + line1) contents.append(' ' + line2) contents.append(' ') messages.box('High scores', None, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, contents, input=False) else: contents = ['The high scores file is empty.'] messages.box('High scores', None, 'center_screenx', 'center_screeny', len(max(contents, key=len)) + 16, len(contents) + 4, contents, input=False, align=libtcod.CENTER)