def __init__(self, console_height, console_width): """Create a main screen. :param console_height: the height of the console :param console_width: the width of the console :return: null """ # List should be two smaller in each direction because of surrounding border. self._dungeon_height, self._dungeon_width = console_height-2, console_width-2 # Center the window based on the size of the console. display_start_y, display_start_x = util.center(console_height, console_width, self._dungeon_height, self._dungeon_width) # Create window that will act as main visual. self._dungeon_display = curses.newwin(self._dungeon_height, self._dungeon_width, display_start_y, display_start_x) # Add visual detail to window. self._dungeon_display.bkgd(' ', curses.color_pair(1)) util.color_border(self._dungeon_display, 0, 0, self._dungeon_height - 1, self._dungeon_width - 1, 3) # Initializes help window for use in pause(). help_height, help_width = 12, 50 help_y, help_x = util.center(console_height, console_width, help_height, help_width) self.help_window = curses.newwin(help_height, help_width, help_y, help_x)
def clear_screen(self): """Clear the contents of the screen. :return: a reference to the main screen """ self._dungeon_display.clear() # Add back border and show display util.color_border(self._dungeon_display, 0, 0, self._dungeon_height - 1, self._dungeon_width - 1, 3) self._dungeon_display.refresh() return self