def write_main_handler(self, msg, player_name=None, row=1, col=1): """ checks if curses is available and sends the text to the main ouput screen otherwise send the msg to the multi_printer """ if USE_CURSES: game_ui.write_main(msg, player_name, row, col) else: helpers.multi_printer(msg, player_name)
def write_main_bottom_handler(self, msg): """ checks if curses is available and writes to the last line of the main window otherwise sends to the multi_printer """ if USE_CURSES: game_ui.write_main_bottom(msg) else: helpers.multi_printer(msg)
def exitGame(self): """ prints a good bye message and exits """ if USE_CURSES: game_ui.end_windows() helpers.multi_printer("Thanks for playing") exit()
def validate_object(self, obj, title): if not isinstance(obj, dict): if USE_CURSES: game_ui.end_windows() text = 'The file: ' + title + ', in the temp_save_game directory.' text += ' May be malformed and we cannot continue.' text += ' Exiting the game.' helpers.multi_printer(text) exit(1)
def validate_curses(self): """ check throughout the game cycle if the terminal size is too small and if so end curses if it was running to begin with """ global USE_CURSES if USE_CURSES and game_ui.terminal_size() == False: USE_CURSES = False game_ui.end_windows() helpers.multi_printer('TERMINAL WINDOW TOO SMALL. EXITING CURSES')
def main(): if USE_CURSES: curses.wrapper(game_ui.init_windows) else: text = [' ', 'Not using curses. ' + 'Requires linux and '+str(helpers.MIN_COLS)+' columns' + ' by ' + str(helpers.MIN_ROWS) + ' rows.',' '] helpers.multi_printer(text) random.seed() current_game = Game() current_game.startGame(True)
def input_handler_no_lower(self, msg=''): """ prints the message to screen and returns input with out lower """ if USE_CURSES: text = game_ui.get_input(msg) else: text = raw_input('\n'+msg+'\n') if MIRROR_INPUT: helpers.multi_printer(text) return text
def input_handler(self, msg=''): """ prints the message to screen and returns the input received """ if USE_CURSES: text = game_ui.get_input(msg).lower() else: text = raw_input('\n'+msg+'\n->').lower() if MIRROR_INPUT: helpers.multi_printer(text) return text
def write_main_artifact_handler(self, content): """ if curses sends to the artifact writer otherwise sends it to the multi_printer """ if USE_CURSES: game_ui.write_main_artifact(content) else: helpers.multi_printer(content)
def write_stat_handler(self, text): """ delegates writing to the stat window or to the multi_printer """ if USE_CURSES: game_ui.write_stat(text) else: helpers.multi_printer(text)
def write_main_mid_handler(self, msg): """ write to the middle of the main screen """ if USE_CURSES: game_ui.write_main_mid(msg) else: helpers.multi_printer(msg)