Skip to content

Commit f78ffa7

Browse files
committed
press ESC
1 parent 749e748 commit f78ffa7

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

pygame/stage-example/main.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,25 +206,40 @@ class StartScreen(Stage):
206206

207207
def __init__(self, screen, config):
208208
Stage.__init__(self, screen, config)
209+
210+
self.font = pygame.font.Font(None, 40)
211+
self.text = self.font.render("START SCREEN: Press ESC", True, BLACK)
212+
self.text_rect = self.text.get_rect(center=self.screen_rect.center)
209213

210214
def draw(self, surface):
211215
surface.fill(RED)
216+
surface.blit(self.text, self.text_rect)
212217

213218
class EndScreen(Stage):
214219

215220
def __init__(self, screen, config):
216221
Stage.__init__(self, screen, config)
222+
223+
self.font = pygame.font.Font(None, 40)
224+
self.text = self.font.render("END SCREEN: Press ESC", True, BLACK)
225+
self.text_rect = self.text.get_rect(center=self.screen_rect.center)
217226

218227
def draw(self, surface):
219228
surface.fill(GREEN)
229+
surface.blit(self.text, self.text_rect)
220230

221231
class Game(Stage):
222232

223233
def __init__(self, screen, config):
224234
Stage.__init__(self, screen, config)
235+
236+
self.font = pygame.font.Font(None, 40)
237+
self.text = self.font.render("GAME: Press ESC", True, BLACK)
238+
self.text_rect = self.text.get_rect(center=self.screen_rect.center)
225239

226240
def draw(self, surface):
227241
surface.fill(BLUE)
242+
surface.blit(self.text, self.text_rect)
228243

229244
# === MAIN === (lower_case names)
230245

@@ -252,4 +267,4 @@ def __init__(self):
252267

253268
if __name__ == '__main__':
254269

255-
App()#.run()
270+
App() #.run()

0 commit comments

Comments
 (0)