forked from fishingguy456/HospitalHub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hospital_Check.py
65 lines (44 loc) · 1.49 KB
/
Hospital_Check.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
import Grid_Setup
import pygame, pygame.font, pygame.event, pygame.draw
from pygame.locals import *
pygame.init()
Black = [0, 0, 0]
White = [255, 255, 255]
Red = [255, 0, 0]
Green = [0, 255, 0]
Blue = [0, 0, 255]
Light_Blue = [102, 255, 255]
grid, gridStatus, hospitals, locations, xMax, xMin, yMax, yMin, = Grid_Setup.buildGrid()
arial_font = pygame.font.SysFont('arial', 30)
arial_font_small = pygame.font.SysFont('arial', 18)
sizex = 1500
sizey = 1000
win = pygame.display.set_mode((sizex, sizey))
gridy = len(grid)
gridx = len(grid[0])
#print(gridStatus)
def redraw_game_window():
win.fill(Black)
drawcolors()
drawH()
pygame.display.update()
def drawcolors():
for y in range(gridy):
for x in range(gridx):
pygame.draw.rect(win, (round((1-gridStatus[y][x])*255), round(gridStatus[y][x]*255), 0), (round(sizex/gridx)*x, round(sizey/gridy)*y, round(sizex/gridx), round(sizey/gridy)))
def drawH():
for i in range(len(hospitals)):
txtSurface = arial_font.render(hospitals[i], True, Black)
win.blit(txtSurface, (sizex*(locations[i][0]-xMin)/(xMax - xMin), sizey*(locations[i][1]-yMin)/(yMax - yMin)))
inPlay = True
while inPlay:
redraw_game_window()
clickPos = pygame.mouse.get_pos()
pygame.time.delay(10)
for event in pygame.event.get():
if event.type == pygame.QUIT:
inPlay = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
inPlay = False
pygame.quit()