Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def refresh(): # final to root and flush
libtcod.console_blit(con_final(), 0,0,window_w(),window_h(), 0, 0,0)
libtcod.console_flush()
#@debug.printr
def draw_window(window, caption, window_x, window_y, width, height, show_cancel_option):
draw_console_borders(window, color=colors.white)
tcod.console_print(window, 2, 0, caption)
if show_cancel_option:
#tcod.console_print(window, 0, height - 1, '')
string = ''
x = center_x_for_text(width, '')
tcod.console_print(window, x, height - 1, string)
tcod.console_blit(window, 0, 0, width, height, 0, window_x, window_y, 1, 1)
tcod.console_flush()
print_string(window,width - 12, 0, f'Page {pagecount}')
print_string(window, 1, height - 1, '')
print_string(window, width - 15, height - 1, '')
offset_y = 2
for p, paragraph in enumerate(page):
print_string(window, 1, p + offset_y, paragraph)
#window.draw_str( fg=colors.white, bg=None)
# lines_wrapped = textwrap.wrap(paragraph, (width-padding_x//2))
# for l, line in enumerate(lines_wrapped):
# window.draw_str(1,p + offset_y, line, fg=colors.white, bg=None)
# offset_y += 1
tcod.console_blit(window, 0, 0, width, height, 0, x, y, 1, 1)
tcod.console_flush()
return window
def render_animation(game:Game, anim_delay:float):
render_map_screen(game, game.fov_map, debug=game.debug['reveal_map'])
tcod.console_flush()
time.sleep(anim_delay)
game_map,
fov_map,
fov_recompute,
message_log,
constants["screen_width"],
constants["screen_height"],
constants["bar_width"],
constants["panel_height"],
constants["panel_y"],
mouse,
constants["colors"],
game_state,
)
fov_recompute = False
tcod.console_flush()
clear_all(con, entities)
action = handle_keys(key, game_state)
mouse_action = handle_mouse(mouse)
move = action.get("move")
wait = action.get("wait")
pickup = action.get("pickup")
show_inventory = action.get("show_inventory")
drop_inventory = action.get("drop_inventory")
inventory_index = action.get("inventory_index")
take_stairs = action.get("take_stairs")
level_up = action.get("level_up")
show_character_screen = action.get("show_character_screen")
exit_game = action.get("exit")
full_screen = action.get("full_screen")
def render_all(game, fov_map, debug=False):
render_map_screen(game, fov_map, debug=debug)
render_panels(game)
if game.state == GameState.CURSOR_ACTIVE:
render_description_window(game) # Description window is drawn under the cursor if active
tcod.console_flush()
else :
libtcod.sys_save_screenshot()
print ("png")
elif key.vk == libtcod.KEY_ESCAPE:
break
elif key.vk == libtcod.KEY_F1:
libtcod.sys_set_renderer(libtcod.RENDERER_GLSL)
elif key.vk == libtcod.KEY_F2:
libtcod.sys_set_renderer(libtcod.RENDERER_OPENGL)
elif key.vk == libtcod.KEY_F3:
libtcod.sys_set_renderer(libtcod.RENDERER_SDL)
elif key.vk == libtcod.KEY_F4:
libtcod.sys_set_renderer(libtcod.RENDERER_SDL2)
elif key.vk == libtcod.KEY_F5:
libtcod.sys_set_renderer(libtcod.RENDERER_OPENGL2)
libtcod.console_flush()
def flush(self) -> None:
"""Push drawn state to screen.
"""
tcod.console_flush()