def print_paused(g): top_text = ' Paused ' bottom_text = ' Press [SPACE BAR] to Resume ' topFont = pygame.font.SysFont("Verdana", 40, True, False) topText = topFont.render(top_text, True, hue('WHITE')) topRect = topText.get_rect() topRect.centerx = g.scrRect.centerx topRect.centery = (g.scrRect.centery - 30) g.screen.blit(topText, topRect) bottomFont = pygame.font.SysFont("Verdana", 30) bottomText = bottomFont.render(bottom_text, True, hue('WHITE')) bottomRect = bottomText.get_rect() bottomRect.centerx = g.scrRect.centerx bottomRect.y = (topRect.bottom + 5) g.screen.blit(bottomText, bottomRect)
def print_you_lose(g): top_text = ' Your Score: %d! ' % g.score bottom_text = ' Press [F5] to Start Over ' topFont = pygame.font.SysFont("Verdana", 40, True, False) topText = topFont.render(top_text, True, hue('WHITE')) topRect = topText.get_rect() topRect.centerx = g.scrRect.centerx topRect.centery = (g.scrRect.centery - 30) g.screen.blit(topText, topRect) bottomFont = pygame.font.SysFont("Verdana", 30) bottomText = bottomFont.render(bottom_text, True, hue('WHITE')) bottomRect = bottomText.get_rect() bottomRect.centerx = g.scrRect.centerx bottomRect.y = (topRect.bottom + 5) g.screen.blit(bottomText, bottomRect)
def print_mode_draw(g): text = 'Mode: Draw' reportFont = pygame.font.SysFont("Courier", 15, True, False) dispText = reportFont.render(text, True, hue('WHITE')) textRect = dispText.get_rect() textRect.topleft = g.scrRect.topleft g.screen.blit(dispText, textRect)
def print_new_hs1(g): top_text = ' New High Score: %d! ' % g.score topFont = pygame.font.SysFont("Verdana", 40, True, False) topText = topFont.render(top_text, True, hue('WHITE')) topRect = topText.get_rect() topRect.centerx = g.scrRect.centerx topRect.centery = (g.scrRect.centery - 30) g.screen.blit(topText, topRect)
def print_current_hs(g): text = 'High Score: %s %s ' % (g.current_hs[0], g.current_hs[1]) reportFont = pygame.font.SysFont("Courier", 15, True, False) dispText = reportFont.render(text, True, hue('WHITE')) textRect = dispText.get_rect() textRect.topleft = g.scrRect.topleft g.screen.blit(dispText, textRect)
def print_score(g): text = 'Score: %d ' % g.score reportFont = pygame.font.SysFont("Courier", 15, True, False) dispText = reportFont.render(text, True, hue('WHITE')) textRect = dispText.get_rect() textRect.left = g.scrRect.left textRect.top = g.scrRect.top + 15 g.screen.blit(dispText, textRect)
def print_input_box(g, inp_text): top_text = ' New High Score: %d! ' % g.score topFont = pygame.font.SysFont("Verdana", 40, True, False) topText = topFont.render(top_text, True, hue('WHITE')) topRect = topText.get_rect() topRect.centerx = g.scrRect.centerx topRect.centery = (g.scrRect.centery - 30) g.screen.blit(topText, topRect) fontObject = pygame.font.SysFont("Verdana", 30, False, True) if len(inp_text) != 0: group_update(g) group_clear(g) g.screen.blit(g.background, (0, 0)) group_draw(g) print_score(g) print_current_hs(g) g.screen.blit(topText, topRect) g.screen.blit(fontObject.render(inp_text, 1, hue('WHITE')), ((g.scrRect.centerx - 160), (topRect.bottom + 5))) pygame.display.flip()
def print_input_box(g, inp_text): fontObject = pygame.font.SysFont("Verdana", 30, False, True) if len(inp_text) != 0: group_update(g) group_clear(g) g.screen.blit(g.background, (0, 0)) group_draw(g) print_score(g) print_current_hs(g) g.screen.blit(topText, topRect) g.screen.blit(fontObject.render(inp_text, 1, hue('WHITE')), ((g.scrRect.centerx - 160), (topRect.bottom + 5))) pygame.display.flip()