33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
import pygame
|
|
from glob import glob
|
|
|
|
from grid import Grid
|
|
from constants import GAME_TITLE, WINDOW_WIDTH, WINDOW_HEIGHT, FPS_COUNT
|
|
|
|
|
|
class Game:
|
|
def __init__(self):
|
|
pygame.init()
|
|
pygame.display.set_caption(GAME_TITLE)
|
|
pygame.display.set_icon(pygame.image.load('resources/icons/sword.png'))
|
|
|
|
self.screen = pygame.display.set_mode((WINDOW_HEIGHT, WINDOW_WIDTH))
|
|
self.clock = pygame.time.Clock()
|
|
|
|
self.textures = []
|
|
for texture_path in glob('resources/textures/*.jpg'):
|
|
converted_texture = pygame.image.load(texture_path).convert_alpha()
|
|
self.textures.append((texture_path, converted_texture))
|
|
|
|
def start(self):
|
|
running = True
|
|
grid = Grid(self.textures)
|
|
while running:
|
|
for event in pygame.event.get():
|
|
if event.type == pygame.QUIT:
|
|
running = False
|
|
grid.draw(self.screen)
|
|
pygame.display.update()
|
|
self.clock.tick(FPS_COUNT)
|
|
pygame.quit()
|