def render_main_menu(self, menu_img): """ Displays the main menu for the game.""" tcod.image_blit_2x(image=menu_img, console=self.root, dx=0, dy=0) self.root.default_fg = tcod.light_yellow # Display game title title_x = int(config.scr_width / 2) title_y = 3 self.root.print(x=title_x, y=title_y, string=config.game_title, alignment=tcod.CENTER) # Display author author_x = int(config.scr_width / 2) author_y = int(config.scr_height - 2) self.root.print(x=author_x, y=author_y, string='By {}'.format(config.author), alignment=tcod.CENTER) # Display main menu options options = menus.main_menu_options() self.render_menu('', options, 24)
def test_image(console, tmpdir): img = libtcodpy.image_new(16, 16) libtcodpy.image_clear(img, libtcodpy.Color(0, 0, 0)) libtcodpy.image_invert(img) libtcodpy.image_hflip(img) libtcodpy.image_rotate90(img) libtcodpy.image_vflip(img) libtcodpy.image_scale(img, 24, 24) libtcodpy.image_set_key_color(img, libtcodpy.Color(255, 255, 255)) libtcodpy.image_get_alpha(img, 0, 0) libtcodpy.image_is_pixel_transparent(img, 0, 0) libtcodpy.image_get_size(img) libtcodpy.image_get_pixel(img, 0, 0) libtcodpy.image_get_mipmap_pixel(img, 0, 0, 1, 1) libtcodpy.image_put_pixel(img, 0, 0, libtcodpy.Color(255, 255, 255)) libtcodpy.image_blit(img, console, 0, 0, libtcodpy.BKGND_SET, 1, 1, 0) libtcodpy.image_blit_rect(img, console, 0, 0, 16, 16, libtcodpy.BKGND_SET) libtcodpy.image_blit_2x(img, console, 0, 0) libtcodpy.image_save(img, tmpdir.join('test.png').strpath) libtcodpy.image_delete(img) img = libtcodpy.image_from_console(console) libtcodpy.image_refresh_console(img, console) libtcodpy.image_delete(img) libtcodpy.image_delete(libtcodpy.image_load('libtcod/data/img/circle.png'))
def main_menu(): img = libtcod.image_load('menu_background.png') while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and some credits! libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'TOMBS OF THE ANCIENT KINGS') libtcod.console_print_ex(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT - 2, libtcod.BKGND_NONE, libtcod.CENTER, 'By Jotaf') #show options and wait for the player's choice choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) 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
def main_menu(): img = libtcod.image_load('assets/menu.png') while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and some credits! libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(SCREEN_WIDTH/2), int(SCREEN_HEIGHT/2-4), libtcod.BKGND_NONE, libtcod.CENTER, 'TYRMÄ') libtcod.console_print_ex(0, int(SCREEN_WIDTH/2), int(SCREEN_HEIGHT-2), libtcod.BKGND_NONE, libtcod.CENTER, 'By Hakaponttoauto') #show options and wait for the player's choice choice = menu('', ['Uusi peli', 'Jatka tallennuksesta', 'Lopeta'], 24) if choice == 0: #new game new_game() play_game() elif choice == 1: #load last game try: load_game() except: msgbox('\n Ei tallennettua peliä.\n', 24) continue play_game() elif choice == 2: #quit break
def main_menu(): img = libtcod.image_load("menu_background.png") while not libtcod.console_is_window_closed(): # Show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) # Show the game's title and credits libtcod.console_set_default_foreground(0, libtcod.light_blue) libtcod.console_print_ex(0, int(SCREEN_WIDTH / 2), int(SCREEN_HEIGHT / 2 - 6), libtcod.BKGND_NONE, libtcod.CENTER, "Roguelike thinger") libtcod.console_print_ex(0, int(SCREEN_WIDTH / 2), int(SCREEN_HEIGHT / 2 - 4), libtcod.BKGND_NONE, libtcod.CENTER, "Written by Cody Kelly and Roguebasin") # Show options and wait for the player's choice choice = menu("", ["Start a new game", "Continue last game", "Quit"], 24) if choice == 0: # New game new_game() play_game() elif choice == 1: # Load last game load_game() play_game() elif choice == 2: # Quit break
def main_menu(): img = libtcod.image_load('menu_background.png') while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and some credits! libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, SCREEN_WIDTH//2, SCREEN_HEIGHT//2-4, libtcod.BKGND_NONE, libtcod.CENTER, 'TOMBS OF THE ANCIENT KINGS') libtcod.console_print_ex(0, SCREEN_WIDTH//2, SCREEN_HEIGHT-2, libtcod.BKGND_NONE, libtcod.CENTER, 'By Jotaf') #show options and wait for the player's choice choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) 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
def main_menu(con, background_image, screen_width, screen_height): tcod.image_blit_2x(background_image, 0, 0, 0) tcod.console_set_default_foreground(0, tcod.light_yellow) tcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, tcod.BKGND_NONE, tcod.CENTER, "APOCALYPSE LATER") menu(con, '', ['New game', 'Load game', 'Exit'], 24, screen_width, screen_height)
def main_menu(): img = libtcod.image_load('kawaii.png') while not libtcod.console_is_window_closed(): #show bkgnd img at twice the size libtcod.image_blit_2x(img, 0, 0, 0) #show game title and credits libtcod.console_set_default_foreground(0, libtcod.purple) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, libtcod.BKGND_NONE, libtcod.CENTER, '~WOGUEY WIKEY~') libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT-2, libtcod.BKGND_NONE, libtcod.CENTER, 'by n8uv') #show options and wait for the player's choice choice = menu('', ['Pway a new game!', 'Return to Daddy', 'Quit OwO'], 24) if choice == 0: #new game new_game() play_game() if choice == 1: #load last game try: load_game() except: msgbox('\n u dont have saved game \n', 24) continue play_game() elif choice == 2: #quit break
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, con, 0, 0, 0, -1, -1) libtcod.console_set_default_foreground(con, libtcod.light_yellow) libtcod.console_print_ex(con, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'SludgeWorks') libtcod.console_print_ex(con, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'designed by the Supreme Peasant') menu(con, '', ['New game', 'Continue', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height, window_title): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, colors.get('light')) menu(con, window_title, ['Play a new game', 'Continue last game', 'Quit'], int(screen_width / 2) - 8, int(screen_width / 2), screen_height, 'dark', 'light')
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, "ROGUELIKE RPG") libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 4), libtcod.BKGND_NONE, libtcod.CENTER, "By Zoltarr777, 2020") libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, "Version Alpha 1.09") menu(con, '', ["Play a new game", "Continue last game", "Help", "Quit"], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'Dragons & Dungeons') menu(con, '', ['Play a new game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height /2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'TOMBS AND SHIT') libtcod.console_print_ex(0, int(screen_width/2), int(screen_height -2), libtcod.BKGND_NONE, libtcod.CENTER, 'By ItsYaBoi') menu(con, '', ['New Game', 'Continue', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'TOMBS OF THE ANCIENT KINGS') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) + 4, libtcod.BKGND_NONE, libtcod.CENTER, 'By Olly Mills') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'ROGUELIKE') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By Garrett Ng') menu(con, '', ['Play a new game', "Continue last game", 'Quit'], 24, screen_width, screen_height)
def character_select_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.dark_purple) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'Choose your Character...') menu(con, '', ['The Thief', 'The Brute', 'The Occultist'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.dark_purple) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'Quest of Shadows') menu(con, '', ['Play a New Game', 'Continue Last Game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): tc.image_blit_2x(background_image, 0, 0, 0) con.default_fg = tc.light_yellow tc.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, tc.BKGND_NONE, tc.CENTER, 'INSERT NEW TITLE') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'TOMBS OF PLACEHOLDERS') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By Thomas Dupre') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'Deep Cave(RogueLike)') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By N-Kazu') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'Baby\'s First Rougelike') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By Nick Cardullo') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.white) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'The Wizard') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By: The Intern') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): tcod.image_blit_2x(background_image, 0, 0, 0) tcod.console_set_default_foreground(0, tcod.light_yellow) tcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) -4, tcod.BKGND_NONE, tcod.CENTER, 'BioPunkRL') tcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), tcod.BKGND_NONE, tcod.CENTER, 'By Devin Herron') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): tcod.image_blit_2x(background_image, 0, 0, 0) tcod.console_set_default_foreground(0, tcod.light_yellow) tcod.console_print_ex(con, int(screen_width / 2), int(screen_height / 2) - 4, tcod.BKGND_NONE, tcod.CENTER, 'TOMBS OF THE ANCIENT KING BUGS') tcod.console_print_ex(con, int(screen_width / 2), int(screen_height - 2), tcod.BKGND_NONE, tcod.CENTER, "By Mikhail 'ArdRaeiss' Merzlyutin") menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def new_character_screen(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.white) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'Choose your fighter!') menu(con, '', ['Warrior', 'Thief', 'Barbarian', 'Exit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height, root): tcod.image_blit_2x(background_image, root, 0, 0) tcod.console_set_default_foreground(root, tcod.light_yellow) tcod.console_print_ex(root, int(screen_width / 2), int(screen_height / 2) - 4, tcod.BKGND_NONE, tcod.CENTER, 'GOBLINS & CAVERNS') tcod.console_print_ex(root, int(screen_width / 2), int(screen_height - 2), tcod.BKGND_NONE, tcod.CENTER, 'By Nicolas Grobelny') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height, root)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 5, libtcod.BKGND_NONE, libtcod.CENTER, 'Our Glory Shall Not Descend') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By Sam Backus & Dave Sturgis') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, screen_width, screen_height, background_image=None): if background_image: libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'WHERE DID IT GO SO WRONG?') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By Coul33t') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) # libtcod.image_blit_rect(background_image, 0, 0, 3, -1, -1, libtcod.BKGND_LIGHTEN) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'KEVIN\'S FAMOUS CHILLI') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By Pk') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, bg_image, screen_width, screen_height): tcod.image_blit_2x(bg_image, 0, 0, 0) tcod.console_set_default_foreground(0, tcod.light_yellow) tcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, tcod.BKGND_NONE, tcod.CENTER, 'REGULAR AWAKENING') tcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2), tcod.BKGND_NONE, tcod.CENTER, 'By Porp yours truely <3') menu(con, '', ['New Game', 'Load Game', 'Bye Mates'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.white) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'ROGUELIKE ITS MY LIFE!') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By ScythepX') menu(con, '', ['Play game', 'Continue last game', 'Quit', 'Choose your fighter'], 24, screen_width, screen_height)