29 lines
842 B
Python
29 lines
842 B
Python
|
import pygame
|
||
|
|
||
|
from common.colors import WHITE
|
||
|
from common.helpers import draw_text
|
||
|
|
||
|
|
||
|
class Screen:
|
||
|
def __init__(self, screen_name, screen, clock):
|
||
|
self.screen_name = screen_name
|
||
|
self.screen = screen
|
||
|
self.clock = clock
|
||
|
|
||
|
def display_screen(self):
|
||
|
"""override this method in order to get specific layout"""
|
||
|
running = True
|
||
|
while running:
|
||
|
self.screen.fill((0, 0, 0))
|
||
|
|
||
|
draw_text(self.screen_name, WHITE, self.screen, 20, 20, 30)
|
||
|
for event in pygame.event.get():
|
||
|
if event.type == pygame.QUIT:
|
||
|
running = False
|
||
|
if event.type == pygame.KEYDOWN:
|
||
|
if event.key == pygame.K_ESCAPE:
|
||
|
running = False
|
||
|
|
||
|
pygame.display.update()
|
||
|
self.clock.tick(60)
|