Пример #1
0
def main_screen(screen):
    clock = pygame.time.Clock()
    game_surface = pygame.Surface((600, 600), 0, screen)
    score_surface = pygame.Surface((200, 600), 0, screen)
    start_button = Button((180, 430), 'start.png', 'start_covered.png')
    exit_button = Button((420, 430), 'exit.png', 'exit_covered.png')
    hiscores = HiScores()
    while True:
        clock.tick(FPS)
        game_surface.blit(IMG_DARTSBOARD_OFF, (0, 0))
        score_surface.blit(IMG_CHALKBOARD, (0, 0))
        for e in pygame.event.get():
            if e.type == QUIT:
                raise GameInterruptedError
            elif e.type == MOUSEBUTTONDOWN:
                if start_button.covered():
                    return
                if exit_button.covered():
                    raise GameInterruptedError
        start_button.render(game_surface)
        exit_button.render(game_surface)
        hiscores.render(score_surface)
        screen.blit(game_surface, (0, 0))
        screen.blit(score_surface, (600, 0))
        # update
        pygame.display.update()
Пример #2
0
def main_screen(screen):
    clock = pygame.time.Clock()
    game_surface = pygame.Surface((600, 600), 0, screen)
    score_surface = pygame.Surface((200, 600), 0, screen)
    start_button = Button((180, 430), 'start.png', 'start_covered.png')
    exit_button = Button((420, 430), 'exit.png', 'exit_covered.png')
    hiscores = HiScores()
    while True:
        clock.tick(FPS)
        game_surface.blit(IMG_DARTSBOARD_OFF, (0, 0))
        score_surface.blit(IMG_CHALKBOARD, (0, 0))
        for e in pygame.event.get():
            if e.type == QUIT:
                raise GameInterruptedError
            elif e.type == MOUSEBUTTONDOWN:
                if start_button.covered():
                    return
                if exit_button.covered():
                    raise GameInterruptedError
        start_button.render(game_surface)
        exit_button.render(game_surface)
        hiscores.render(score_surface)
        screen.blit(game_surface, (0, 0))
        screen.blit(score_surface, (600, 0))
        # update
        pygame.display.update()