Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ViciousSquid authored May 12, 2024
1 parent 7fcf42d commit f49717c
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import pygame
from data.timer import Timer
from data.timer_manager import TimerManager
from data.ui import UI
from data.server import start_server, stop_server
from data.constants import WINDOW_WIDTH, WINDOW_HEIGHT, TIMERS

# Initialize Pygame
pygame.init()

# Set up the initial window
window = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT), pygame.RESIZABLE)
pygame.display.set_caption("ShowTime")

# Create the TimerManager and UI objects
timer_manager = TimerManager(TIMERS)
ui = UI(window, timer_manager)

# Main loop
running = True
clock = pygame.time.Clock()
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.MOUSEBUTTONUP:
pos = pygame.mouse.get_pos()
ui.handle_mouse_event(pos)
elif event.type == pygame.VIDEORESIZE:
window = pygame.display.set_mode((event.w, event.h), pygame.RESIZABLE)
ui.window = window
ui.update_button_positions()

timer_manager.update_timers()
ui.update()
pygame.display.flip()
clock.tick(60)

pygame.quit()

0 comments on commit f49717c

Please sign in to comment.