def load_customfont(): #The index of the first custom tile in the file a = 256 #The "y" is the row index, here we load the sixth row in the font file. for y in range(16, 20): libtcod.console_map_ascii_codes_to_font(a, 16, 0, y) a += 16
def load_customfont(): #the index of the first custom tile in the file a = 256 #the y is the row index, this is loading the 6th row in the font file. Increase the 6 to load any new rows from the file (added the 7) for y in range(5, 7): libtcod.console_map_ascii_codes_to_font(a, 32, 0, y) a += 32
def load_customfont(): # The index of the first custom tile in the file a = 256 # The "y" is the row index, here we load the sixth row in the font file. Increase the "8" to load any new rows from the file for y in range(5, 8): libtcod.console_map_ascii_codes_to_font(a, 32, 0, y) a += 32
def load_custom_font(): #index of first custom tile in file a = 256 #the y is the row index, we load the 6th row in font file. Increase the 6 to load any new rows for y in range(5,6): libtcod.console_map_ascii_codes_to_font(a, 32, 0, y) a += 32
def game_initialize(): libtcod.console_set_custom_font('oryx_tiles3.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD, 32, 12) libtcod.console_init_root(data.SCREEN_WIDTH, data.SCREEN_HEIGHT, 'MeFightRogues!', False, libtcod.RENDERER_SDL) libtcod.sys_set_fps(data.LIMIT_FPS) libtcod.console_map_ascii_codes_to_font(256 , 32, 0, 5) #map all characters in 1st row libtcod.console_map_ascii_codes_to_font(256+32, 32, 0, 6) #map all characters in 2nd row Game.con = libtcod.console_new(data.MAP_WIDTH,data.MAP_HEIGHT) Game.panel = libtcod.console_new(data.SCREEN_WIDTH, data.PANEL_HEIGHT) main_menu()
def load_font(use_tiles=False): # default font if not use_tiles: tcod.console_set_custom_font(FONT_PATH, FONT_FLAGS) return # tileset tcod.console_set_custom_font(TILES_SOURCE, FONT_FLAGS, TILES_COLS, TILES_ROWS) a = OFFSET # The "y" is the row index, here we load the sixth row in the font file. Increase the "6" to load any new rows from the file for y in range(TILE_BEGINING_ROW, TILE_END_ROW): # Remap a contiguous set of codes to a contiguous set of tiles. # tcod.console_map_ascii_codes_to_font(firstAsciiCode, nbCodes, fontCharX, fontCharY) tcod.console_map_ascii_codes_to_font(a, TILES_COLS, 0, y) a += TILES_COLS
# another random generator my_random = libtcod.random_new() # a random generator with a specific seed my_determinist_random = libtcod.random_new_from_seed(0xdeadbeef) world = World(nwidth, nheight, alivechar, deadchar, char_option, my_determinist_random) libtcod.console_set_custom_font( 'oryx_tiles3.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD, 32, 12) libtcod.console_init_root(nwidth, nheight, 'johnstein\'s Game of RogueLife!', False, libtcod.RENDERER_SDL) libtcod.sys_set_fps(30) libtcod.console_map_ascii_codes_to_font(256, 32, 0, 5) #map all characters in 1st row libtcod.console_map_ascii_codes_to_font(256 + 32, 32, 0, 6) #map all characters in 2nd row mouse = libtcod.Mouse() key = libtcod.Key() #initialize population #enter game loop and check for user input while not libtcod.console_is_window_closed(): libtcod.sys_check_for_event(libtcod.EVENT_KEY_PRESS | libtcod.EVENT_MOUSE, key, mouse) if key.vk == libtcod.KEY_ESCAPE: break
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)
item = entities.Object(0, 0, "-", "wristguards of the whale", libtcod.gold, equipment=equipment_component) Game.inventory.append(item) def set_map_explored(Game): for y in range(data.MAP_HEIGHT): for x in range(data.MAP_WIDTH): Game.map[x][y].explored = True Game.fov_recompute = True def set_objects_visible(Game): for object in Game.objects: object.always_visible = True ######################################################## # init and main loop ######################################################## libtcod.console_set_custom_font("oryx_tiles3.png", libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD, 32, 12) libtcod.console_init_root(data.SCREEN_WIDTH, data.SCREEN_HEIGHT, "MeFightRogues!", False, libtcod.RENDERER_SDL) libtcod.sys_set_fps(data.LIMIT_FPS) libtcod.console_map_ascii_codes_to_font(256, 32, 0, 5) # map all characters in 1st row libtcod.console_map_ascii_codes_to_font(256 + 32, 32, 0, 6) # map all characters in 2nd row Game.con = libtcod.console_new(data.MAP_WIDTH, data.MAP_HEIGHT) Game.panel = libtcod.console_new(data.SCREEN_WIDTH, data.PANEL_HEIGHT) main_menu()
if choice == 0: #new game new_game() play_game() elif choice == 1: #load last save try: load_game() except: msgbox('\n No saved game to load. \n', 24) continue play_game() elif choice == 2: #quit break ################################ # INITIALIZATION AND MAIN LOOP # ################################ libtcod.console_set_custom_font('tiles.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD, 32, 12) libtcod.console_init_root(SCREEN_WIDTH, SCREEN_HEIGHT, "Rogue-Like, the roguelike game", False, libtcod.RENDERER_SDL) libtcod.sys_set_fps(LIMIT_FPS) libtcod.console_map_ascii_codes_to_font(256, 32, 0, 5) libtcod.console_map_ascii_codes_to_font(256+32, 32, 0, 6) con = libtcod.console_new(MAP_WIDTH, MAP_HEIGHT) panel = libtcod.console_new(SCREEN_WIDTH, PANEL_HEIGHT) mouse = libtcod.Mouse() key = libtcod.Key() main_menu()
def init_custom_font(): index = 256 for row in range(5, 6): libtcodpy.console_map_ascii_codes_to_font(index, 32, 0, row) index += 32
if choice == 0: # new game new_game() play_game() if choice == 1: # load last game try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game() elif choice == 2: # quit break #libtcod.console_set_custom_font('arial10x10.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD) #libtcod.console_set_custom_font('oryx_tiles.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD, 32, 12) libtcod.console_set_custom_font('pr_tileset_32x32.bmp', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD, 40, 40) libtcod.console_init_root(SCREEN_WIDTH, SCREEN_HEIGHT, 'python/libtcod tutorial', False, libtcod.RENDERER_SDL) libtcod.sys_set_fps(LIMIT_FPS) con = libtcod.console_new(MAP_WIDTH, MAP_HEIGHT) panel = libtcod.console_new(SCREEN_WIDTH, PANEL_HEIGHT) #libtcod.console_map_ascii_codes_to_font(256, 32, 0, 5) #map all characters in 1st row #libtcod.console_map_ascii_codes_to_font(256+32, 32, 0, 6) #map all characters in 2nd row libtcod.console_map_ascii_codes_to_font(0, 40 * 40, 0, 0) main_menu()
def __load_custom_font(): a = 256 for y in range(5, 6): libtcod.console_map_ascii_codes_to_font(a, 32, 0, y) a += 32