-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.py
48 lines (42 loc) · 1.44 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import pygame
import sys
from language_menu import language_call
from help_menu import help_call
pygame.init()
# Set up the screen
screen_width = 1000
screen_height = 1000
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption("Omilia")
# Load images
bg_img = pygame.image.load("menuAssets/oi.png")
start_button_img = pygame.image.load("menuAssets/start1.png")
help_button_img = pygame.image.load("menuAssets/help1.png")
pygame.mixer.music.load("menuAssets/menubg.wav")
pygame.mixer.music.play(-1)
# Create Rect objects for the buttons
start_button_rect = pygame.Rect(
380, 430, start_button_img.get_width(), start_button_img.get_height()
)
help_button_rect = pygame.Rect(
380, 550, help_button_img.get_width(), help_button_img.get_height()
)
# Main loop
while True:
# Draw the background and buttons
screen.blit(bg_img, (0, 0))
screen.blit(start_button_img, start_button_rect)
screen.blit(help_button_img, help_button_rect)
# Check for events
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
elif event.type == pygame.MOUSEBUTTONDOWN:
# Check if the mouse clicked on a button
if start_button_rect.collidepoint(event.pos):
language_call()
elif help_button_rect.collidepoint(event.pos):
help_call()
# Update the screen
pygame.display.update()