def renderer_init(): """ Initialize libtcod and set up our basic consoles to draw into. """ global _con, _panel, _overlay, _last_frame_time libtcod.console_set_custom_font('arial12x12.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD) # Map the dead space in the TCOD layout to [128...164] # libtcod.console_map_ascii_codes_to_font(256, 21, 11, 1) # libtcod.console_map_ascii_codes_to_font(277, 25, 0, 2) libtcod.console_map_ascii_code_to_font(129, 12, 1) libtcod.console_init_root(config.SCREEN_WIDTH, config.SCREEN_HEIGHT, 'Beyaz Dag', False) libtcod.sys_set_fps(LIMIT_FPS) _con = libtcod.console_new(config.MAP_PANEL_WIDTH, config.MAP_PANEL_HEIGHT) _overlay = libtcod.console_new(config.MAP_PANEL_WIDTH, config.MAP_PANEL_HEIGHT) _panel = libtcod.console_new(config.SCREEN_WIDTH, config.PANEL_HEIGHT) _last_frame_time = time.time() * 1000
def renderer_init(): """ Initialize libtcod and set up our basic consoles to draw into. """ global _con, _panel, _overlay, _last_frame_time libtcod.console_set_custom_font( 'arial12x12.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD) # Map the dead space in the TCOD layout to [128...164] # libtcod.console_map_ascii_codes_to_font(256, 21, 11, 1) # libtcod.console_map_ascii_codes_to_font(277, 25, 0, 2) libtcod.console_map_ascii_code_to_font(129, 12, 1) libtcod.console_init_root(config.SCREEN_WIDTH, config.SCREEN_HEIGHT, 'Beyaz Dag', False) libtcod.sys_set_fps(LIMIT_FPS) _con = libtcod.console_new(config.MAP_PANEL_WIDTH, config.MAP_PANEL_HEIGHT) _overlay = libtcod.console_new(config.MAP_PANEL_WIDTH, config.MAP_PANEL_HEIGHT) _panel = libtcod.console_new(config.SCREEN_WIDTH, config.PANEL_HEIGHT) _last_frame_time = time.time() * 1000
def test_console_font_mapping(console): libtcodpy.console_map_ascii_code_to_font('@', 1, 1) libtcodpy.console_map_ascii_codes_to_font('@', 1, 0, 0) libtcodpy.console_map_string_to_font('@', 0, 0)
mode = _menu.doMenu() if (mode == menu.menu_options.MODE_QUIT): sys.exit() elif (mode > 0): _map = map.Map() _map.generate(mode, MAP_WIDTH, MAP_HEIGHT) _map.initDisplay(DISPLAY_MAP_WIDTH, DISPLAY_MAP_HEIGHT) #_map.generateZoomViews() else: sys.exit() # Map tree characters tcod.console_map_ascii_code_to_font(200, 0, 5) _map.mapTreeChar(_map.CHAR_TREE, chr(200)) tcod.console_map_ascii_code_to_font(201, 1, 5) _map.mapTreeChar(_map.CHAR_TREE_SMALL, chr(201)) tcod.console_map_ascii_code_to_font(202, 2, 5) _map.mapTreeChar(_map.CHAR_TREE_BIG, chr(202)) tcod.console_map_ascii_code_to_font(203, 3, 5) _map.mapTreeChar(_map.CHAR_TREE_DESERT, chr(203)) tcod.console_map_ascii_code_to_font(204, 4, 5) _map.mapTreeChar(_map.CHAR_TREE_PALM, chr(204)) # Main loop while True: mapCon = _map.render() tcod.console_blit(mapCon, 0, 0, DISPLAY_MAP_WIDTH, DISPLAY_MAP_HEIGHT, 0,
import libtcodpy as libtcod import os libtcod.console_set_custom_font(os.path.join('fonts', 'dullard14x14.png'),libtcod.FONT_LAYOUT_TCOD, 32, 32) libtcod.console_init_root(80,50,'test',False) testconsole = libtcod.console_new(80,50) libtcod.console_map_ascii_code_to_font(157,4,5) # Deciduous libtcod.console_map_ascii_code_to_font(156,1,5) # Shrubland libtcod.console_map_ascii_code_to_font(154,2,5) # Cacti libtcod.console_map_ascii_code_to_font(153,3,5) # Heathland libtcod.console_map_ascii_code_to_font(151,0,5) # Broadleaf libtcod.console_map_ascii_code_to_font(150,5,5) # Mixed Forest libtcod.console_map_ascii_code_to_font(149,0,2) # Coniferous libtcod.console_map_ascii_code_to_font(148,6,5) # Evergreen libtcod.console_map_ascii_code_to_font(147,7,5) # Caves libtcod.console_map_ascii_code_to_font(146,8,5) # Tropical Forest key=libtcod.Key() mouse=libtcod.Mouse() while not libtcod.console_is_window_closed(): libtcod.console_clear(None) libtcod.console_print_ex(testconsole,10,40,libtcod.BKGND_NONE,libtcod.LEFT,'@') libtcod.console_print_ex(testconsole,11,40,libtcod.BKGND_NONE,libtcod.LEFT,chr(146)) libtcod.console_put_char(testconsole,12,40,147) libtcod.console_put_char(testconsole,13,40,148) libtcod.console_put_char(testconsole,14,40,149) libtcod.console_put_char(testconsole,15,40,150) libtcod.console_put_char(testconsole,16,40,151) libtcod.console_put_char(testconsole,17,40,153) libtcod.console_put_char(testconsole,18,40,154)