-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindow.py
27 lines (22 loc) · 931 Bytes
/
window.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
import pygame
import math
import tools
class Window:
def __init__(self):
self.pygame = pygame
self.pygame.init()
self.pygame.display.set_caption("Bomber man v0.1.322")
self.cell_size = tools.get_val_config('cell_size')
self.cell_amount = tools.get_val_config('cell_amount')
self.screen_size = [self.cell_amount[0] * self.cell_size, self.cell_amount[1] * self.cell_size]
self.screen = pygame.display.set_mode(self.screen_size)
self.grid_color = (200,200,200)
self.clear_color = (255,255,255)
def draw_grid(self):
for y in range(self.cell_amount[1]):
pygame.draw.line(self.screen, self.grid_color, [0, y * self.cell_size], [self.screen_size[0], y * self.cell_size], 1)
for x in range(self.cell_amount[0]):
pygame.draw.line(self.screen, self.grid_color, [x * self.cell_size, 0], [x * self.cell_size, self.screen_size[1]], 1)
def clear(self):
self.screen.fill(self.clear_color)
self.draw_grid()