# Maria Mauco
# 6/18/24
# Shows the high score

import pygame, sys
from pygame.locals import *
import random
import mariogame

SCORE_W = 600
SCORE_H = 600



def show(MAXSCORE):
    pygame.init()
    pygame.init()
    font = pygame.font.SysFont("Arial", 36)
    DISPLAYSURF = pygame.display.set_mode((SCORE_W, SCORE_H))
    pygame.display.set_caption("Mario Game High Score")
    
    clock = pygame.time.Clock()

    # Button for getting back to the main menu
    button = pygame.Rect(SCORE_W//2-200,SCORE_H-100, 400, 100)

    while True:
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()
            if event.type == MOUSEBUTTONDOWN:

                # Just look at left mouse button.
                if pygame.mouse.get_pressed()[0]:

                    pos = pygame.mouse.get_pos()

                    # We just finish this function and go to the main menu.
                    if button.collidepoint(pos):
                        return

        DISPLAYSURF.fill("white")
        pygame.draw.rect(DISPLAYSURF, "green", button)
        mariogame.draw("Return to main menu", font, "black", DISPLAYSURF, SCORE_W//2-135, SCORE_H-70)

        mariogame.draw("High score is: "+ str(MAXSCORE), font, "blue", DISPLAYSURF, 150,70)

        pygame.display.update()
        clock.tick(30)
        
