-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathabout.py
78 lines (69 loc) · 2.84 KB
/
about.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import pygame
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import sys
import os
class about:
def make(self, gameDisplay, sound):
check = 0
myimage = pygame.image.load("images/me.jpg").convert()
background = pygame.image.load("images/background.jpg").convert()
background = pygame.transform.scale(background, (900, 715))
myimage = pygame.transform.scale(myimage, (80, 80))
crashed = False
clock = pygame.time.Clock()
font_path = "fonts/arial.ttf"
font_size = 50
font1 = pygame.font.Font(font_path, font_size)
back = pygame.image.load("buts/welcomescreen/back.png")
back = pygame.transform.scale(back, (100, 50))
font2 = pygame.font.Font(font_path, 20)
font3 = pygame.font.Font(font_path, 25)
Dev = font1.render("Developer", 1, (161, 55, 2))
name = font3.render("Utkarsh Tiwari", 1, (161, 55, 2))
college = font2.render("Institute: JIIT, India", 1, (161, 55, 2))
contact = font2.render(
"Contact: https://facebook.com/iamutkarshtiwari", 1, (161, 55, 2))
if sound:
s1 = pygame.mixer.Sound("sound/button.ogg")
s2 = pygame.mixer.Sound("sound/success.ogg")
s2.play(0)
while not crashed:
# Gtk events
while Gtk.events_pending():
Gtk.main_iteration()
event = pygame.event.poll()
if event.type == pygame.QUIT:
crashed = True
mos_x, mos_y = pygame.mouse.get_pos()
gameDisplay.blit(background, (0 + 280 - 50, 0))
if back.get_rect(center=(455 + 280, 535 + 80 + 15)).collidepoint(mos_x, mos_y): # BACK
gameDisplay.blit(pygame.transform.scale(
back, (110, 55)), (440 + 280, 520 + 80 + 15))
if (pygame.mouse.get_pressed())[0] == 1 and check == 0:
if sound:
s1.play()
check = 1
return
if event.type == pygame.MOUSEBUTTONUP:
check = 0
else:
gameDisplay.blit(back, (440 + 280, 520 + 80 + 15))
gameDisplay.blit(myimage, (340 + 280, 340 + 80))
gameDisplay.blit(Dev, (420 + 280, 260 + 80))
gameDisplay.blit(name, (460 + 280, 380 + 80))
gameDisplay.blit(college, (320 + 280, 440 + 80))
gameDisplay.blit(contact, (320 + 280, 480 + 80))
pygame.display.update()
clock.tick(50)
# Game crash or Close check
if crashed == True:
pygame.quit()
sys.exit()
event1 = pygame.event.poll()
if event1.type == pygame.QUIT:
crashed = True
if crashed == True:
pygame.quit()
sys.exit()