feat(startscreen): add exit/quit functionality
This commit is contained in:
+13
-1
@@ -7,6 +7,7 @@ class Startscreen:
|
|||||||
self.font_title = pygame.font.SysFont("Arial", 36)
|
self.font_title = pygame.font.SysFont("Arial", 36)
|
||||||
self.font_label = pygame.font.SysFont("Arial", 20)
|
self.font_label = pygame.font.SysFont("Arial", 20)
|
||||||
|
|
||||||
|
# todo buttons must be initialized here
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# set background color
|
# set background color
|
||||||
@@ -17,5 +18,16 @@ class Startscreen:
|
|||||||
self.screen.blit(title, (10, 10))
|
self.screen.blit(title, (10, 10))
|
||||||
message = self.font_label.render("Welcome to FH - Study with purpose", True, (0, 255, 255))
|
message = self.font_label.render("Welcome to FH - Study with purpose", True, (0, 255, 255))
|
||||||
|
|
||||||
|
# todo buttons must be drawn here
|
||||||
|
# todo check button events/click
|
||||||
|
|
||||||
return None
|
# check key down events - exit/quit
|
||||||
|
for event in pygame.event.get():
|
||||||
|
if event.type == pygame.QUIT:
|
||||||
|
return "quit"
|
||||||
|
|
||||||
|
if event.type == pygame.KEYDOWN:
|
||||||
|
if event.key == pygame.K_ESCAPE:
|
||||||
|
return "quit"
|
||||||
|
|
||||||
|
return "startscreen"
|
||||||
Reference in New Issue
Block a user