Example #1
0
def call_main_menu():
    Objects.drawBoard()
    S.main_menu_setup()
    while True:
        click = False
        for e in p.event.get():
            if e.type == p.MOUSEBUTTONDOWN: click = True
        if S.button("PLAY DAMAS", *C.button_layout[0], click):
            call_play_menu()
        elif S.button("SETTINGS", *C.button_layout[1], click):
            call_settings_menu()
        elif S.button("HELP", *C.button_layout[2], click):
            call_help_menu()
        elif S.button("QUIT GAME", *C.button_layout[3], click):
            break
        p.display.update(C.button_layout)
        clock.tick(C.MAX_FPS)
    p.quit()
    sys.exit(0)
Example #2
0
def call_play_menu():
    humanPlayers = [False, False]
    Objects.drawBoard()
    S.main_menu_setup()
    while True:
        click = False
        for e in p.event.get():
            if e.type == p.KEYDOWN and e.key == p.K_ESCAPE: call_main_menu()
            elif e.type == p.MOUSEBUTTONDOWN: click = True
        if S.button("PLAY AS WHITE", *C.button_layout[0], click):
            humanPlayers[0] = True
            start_new_game(humanPlayers)
        elif S.button("PLAY AS BLACK", *C.button_layout[1], click):
            humanPlayers[1] = True
            start_new_game(humanPlayers)
        elif S.button("PLAY AGAINST A FRIEND", *C.button_layout[2], click):
            humanPlayers[0], humanPlayers[0] = True, True
            start_new_game(humanPlayers)
        elif S.button("WATCH THE COMPUTER PLAY", *C.button_layout[3], click):
            start_new_game(humanPlayers)
        elif S.button("BACK", *C.button_layout[4], click):
            call_main_menu()
        p.display.update(C.button_layout)
        clock.tick(C.MAX_FPS)