Skip to content

Commit

Permalink
def win_screen function
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekCamilo committed Dec 2, 2024
1 parent 27e5dcc commit 0eb4038
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
7 changes: 5 additions & 2 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

WIDTH = 850
HEIGHT = 1000
BG_COLOR_1 = (255,255, 255) #White
BG_COLOR_1 = (125, 248, 255) #Light Blue
BG_COLOR_2 = (150, 10, 255) #Purple *IF NECCESSARY*
WIN_BG = (125, 255, 125) # Green
LOSE_BG = (250, 52, 52) # Red
TEXT = (0, 0, 0) #Black
TITLE_TEXT = (255, 10, 200) #Pink
BUTTON_COLOR = (255, 10, 200) #Pink
BUTTON_TEXT = (255,255, 255)
BUTTON_COLOR_2 = (255, 255, 255)
BUTTON_TEXT = (125, 248, 255) #Light Blue
EASY = 30
MEDIUM = 40
HARD = 50
41 changes: 40 additions & 1 deletion sudoku.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,45 @@ def during_game(screen, difficulty):
elif exit_rectangle.collidepoint(event.pos):
sys.exit()
pygame.display.update()


def win_screen(screen):
# Title/Button font init
title_font = pygame.font.Font(None, 100)
button_font = pygame.font.Font(None, 100)

# Background coloring
screen.fill(WIN_BG)

# Creating title text
title_surface = title_font.render("YOU WON!!!", 0, TEXT)
title_rectangle = title_surface.get_rect(center=(WIDTH // 2, HEIGHT // 2 - 300))
screen.blit(title_surface, title_rectangle)

# Init Buttons
exit_text = button_font.render("EXIT", 0, TEXT)

# Init Easy/Medium/Hard Button Text Box Background
exit_surface = pygame.Surface((exit_text.get_size()[0] + 40, exit_text.get_size()[1] + 40))
exit_surface.fill(BG_COLOR_2)
exit_surface.blit(exit_text, (20, 20))

# Init Button Rectangle
exit_rectangle = exit_surface.get_rect(center=(WIDTH // 2, HEIGHT // 2))

# Draw Buttons
screen.blit(exit_surface, exit_rectangle)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
if event.type == pygame.MOUSEBUTTONDOWN:
if exit_rectangle.collidepoint(event.pos):
sys.exit()
pygame.display.update()

def lose_screen(screen):
pass



def main ():
Expand All @@ -136,6 +174,7 @@ def main ():
dif = "HARD"
screen.fill(BG_COLOR_1)
during_game(screen, dif)
win_screen(screen)

#board.print_board()
#For debugging ^
Expand Down

0 comments on commit 0eb4038

Please sign in to comment.