2021-03-11 00:47:14 +01:00
|
|
|
# libraries
|
2021-03-10 14:01:17 +01:00
|
|
|
import pygame
|
2021-03-11 18:51:43 +01:00
|
|
|
from pyglet.gl import * # for blocky textures
|
2021-03-10 14:01:17 +01:00
|
|
|
|
2021-03-11 00:47:14 +01:00
|
|
|
# other files of this project
|
|
|
|
import project_constants
|
|
|
|
import event_interpreter
|
2021-03-12 11:49:19 +01:00
|
|
|
import minefield as mf
|
2021-03-11 00:47:14 +01:00
|
|
|
|
|
|
|
|
2021-03-10 14:01:17 +01:00
|
|
|
|
2021-03-12 09:55:59 +01:00
|
|
|
def main():
|
2021-03-11 00:47:14 +01:00
|
|
|
|
|
|
|
|
2021-03-10 14:01:17 +01:00
|
|
|
pygame.init()
|
2021-03-11 00:47:14 +01:00
|
|
|
pygame.display.set_caption(project_constants.V_NAME_OF_WINDOW)
|
|
|
|
|
2021-03-11 18:51:43 +01:00
|
|
|
# for blocky textures
|
|
|
|
glEnable(GL_TEXTURE_2D)
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
|
|
|
|
|
2021-03-11 00:47:14 +01:00
|
|
|
|
|
|
|
# loading minefields
|
2021-03-12 11:49:19 +01:00
|
|
|
# create an instance of Minefield, pass necessary data
|
|
|
|
minefield = mf.Minefield()
|
2021-03-11 00:47:14 +01:00
|
|
|
|
|
|
|
|
2021-03-10 14:01:17 +01:00
|
|
|
running = True
|
2021-03-11 00:47:14 +01:00
|
|
|
while running:
|
|
|
|
|
|
|
|
|
|
|
|
# ================ #
|
|
|
|
# === GRAPHICS === #
|
|
|
|
# ================ #
|
|
|
|
|
|
|
|
# background grid (fills frame with white, blits grid)
|
|
|
|
project_constants.SCREEN.fill((255, 255, 255))
|
|
|
|
project_constants.SCREEN.blit\
|
|
|
|
(
|
|
|
|
project_constants.ASSET_BACKGROUND,
|
|
|
|
(
|
|
|
|
project_constants.V_SCREEN_PADDING,
|
|
|
|
project_constants.V_SCREEN_PADDING
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# tiles
|
|
|
|
# TODO : call to tile blitting function goes here
|
|
|
|
|
|
|
|
# mines
|
|
|
|
# TODO : call to a mine blitting function goes here
|
2021-03-12 11:49:19 +01:00
|
|
|
minefield.draw(project_constants.SCREEN)
|
2021-03-11 00:47:14 +01:00
|
|
|
pygame.display.update()
|
|
|
|
|
|
|
|
|
2021-03-11 03:30:38 +01:00
|
|
|
|
2021-03-11 00:47:14 +01:00
|
|
|
# ============== #
|
|
|
|
# === EVENTS === #
|
|
|
|
# ============== #
|
|
|
|
|
|
|
|
for event in pygame.event.get():
|
|
|
|
|
|
|
|
if event.type == pygame.QUIT:
|
|
|
|
running = False
|
|
|
|
|
|
|
|
else: event_interpreter.interpret( event )
|
2021-03-12 09:55:59 +01:00
|
|
|
|
2021-03-12 11:49:19 +01:00
|
|
|
|
2021-03-12 09:55:59 +01:00
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|