# Ian Binstock
# 6/5/2026
# Showing off mouse click events, and showing how to draw images and text

import pygame, sys

# Setup
pygame.init()
screen = pygame.display.set_mode((600, 600))
pygame.display.set_caption("Click Test")
clock = pygame.time.Clock()

# Text details
font = pygame.font.Font(None, 48)
score = 0

# Colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)

# Game Loop
while True:
    # Reset screen
    screen.fill(BLACK)

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
            
        # Check for mouse clicks
        if event.type == pygame.MOUSEBUTTONDOWN:
            if pygame.mouse.get_pressed()[0]:
                score += 1
                # Drawing images on-screen
                boom = pygame.image.load("boom.png")
                boom = pygame.transform.scale(boom, (87, 87))
                xPos = event.pos[0]
                yPos = event.pos[1]
                screen.blit(boom, (xPos - 44, yPos - 44))

    # Drawing text on-screen
    # render(text, antialias, color)
    score_surface = font.render(f"Score: {score}", True, WHITE)
    screen.blit(score_surface, (20, 20))

    pygame.display.update()
    clock.tick(20)