-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
61 lines (48 loc) · 1.67 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
49
50
51
52
53
54
55
56
57
58
59
60
61
# -*- coding: utf-8 -*-
#importing libraries
import os,threading
#removing Pygame welcome notice
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
#importing pygame and its extensions
import pygame
from pygame.locals import *
#importing functions
from funcs import loadPathTexture
# initializing pygame
pygame.init()
#init screen
screen = pygame.display.set_mode((1024, 576))
pygame.display.set_caption("ShootBox")
pygame.mouse.set_visible(False)
clock = pygame.time.Clock()
#configuring essential paths
from paths import uiTexturesPath
#loading logo
logo = loadPathTexture(uiTexturesPath, "logo.png")
#setting essential for startup variables
loadingScreenSize = (screen.get_width(), screen.get_height())
loadingRect_base = pygame.Rect(loadingScreenSize[0]//2-200, loadingScreenSize[1]-88, 400, 24)
loadingRect = pygame.Rect(loadingRect_base.x+4, loadingRect_base.y+4, 0, 16)
loadingLogoRect = logo.get_rect()
loadingLogoRect.x = loadingScreenSize[0]//2-224
loadingLogoRect.y = loadingRect_base.y - 112
loadingScreen = True
#defining loading screen
def renderLoadScreen():
global loadingRect
while loadingScreen:
screen.fill((11, 9, 24))
clock.tick(30)
pygame.draw.rect(screen, (255, 255, 255), loadingRect_base, 2)
pygame.draw.rect(screen, (255, 255, 255), loadingRect)
pygame.display.update()
#setting up and starting loading screen thread
loadingDisplayThread = threading.Thread(target=renderLoadScreen)
loadingDisplayThread.setDaemon(True)
loadingDisplayThread.start()
cursor = loadPathTexture(uiTexturesPath, "cursor.png", True, (64, 64))
#stopping loading screen after setting things up
loadingScreen = False
if __name__ == '__main__':
from mainMenu import mainMenu
mainMenu()