2022-03-04 15:15:24 +01:00
|
|
|
import pygame
|
|
|
|
|
|
|
|
pygame.init()
|
|
|
|
|
2022-03-04 16:45:30 +01:00
|
|
|
GAME_TITLE = 'WMICraft'
|
|
|
|
WINDOW_HEIGHT = 900
|
|
|
|
WINDOW_WIDTH = 900
|
|
|
|
GRID_CELL_PADDING = 3
|
|
|
|
GRID_CELL_WIDTH = 42
|
|
|
|
GRID_CELL_HEIGHT = 42
|
|
|
|
GREEN = (0, 255, 0)
|
2022-03-04 15:15:24 +01:00
|
|
|
|
2022-03-04 16:45:30 +01:00
|
|
|
screen = pygame.display.set_mode((WINDOW_HEIGHT, WINDOW_WIDTH))
|
|
|
|
pygame.display.set_caption(GAME_TITLE)
|
2022-03-04 15:15:24 +01:00
|
|
|
icon = pygame.image.load('resources/icons/sword.png')
|
|
|
|
pygame.display.set_icon(icon)
|
|
|
|
|
2022-03-04 16:45:30 +01:00
|
|
|
|
|
|
|
def draw_grid():
|
|
|
|
for row in range(20):
|
|
|
|
for column in range(20):
|
|
|
|
box_rect = [(GRID_CELL_PADDING + GRID_CELL_WIDTH) * column + GRID_CELL_PADDING,
|
|
|
|
(GRID_CELL_PADDING + GRID_CELL_HEIGHT) * row + GRID_CELL_PADDING,
|
|
|
|
GRID_CELL_WIDTH,
|
|
|
|
GRID_CELL_HEIGHT]
|
|
|
|
pygame.draw.rect(screen, GREEN, box_rect)
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
running = True
|
|
|
|
|
|
|
|
while running:
|
|
|
|
for event in pygame.event.get():
|
|
|
|
if event.type == pygame.QUIT:
|
|
|
|
running = False
|
|
|
|
draw_grid()
|
|
|
|
pygame.display.update()
|
|
|
|
|
|
|
|
pygame.quit()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|