def _draw_state_text(state, screen):
'''
Args:
state (simple_rl.State)
screen (pygame.Surface)
Summary:
Draws the name of the current state to the bottom left of the screen.
'''
scr_width, scr_height = screen.get_width(), screen.get_height()
# Clear.
formatted_state_text = str(state)
if len(formatted_state_text) > 20:
# State text is too long, ignore.
return
state_text_point = (scr_width / 4.0 - len(formatted_state_text)*6, 18*scr_height / 20.0)
pygame.draw.rect(screen, (255,255,255), (state_text_point[0] - 20, state_text_point[1]) + (200,40))
state_text = title_font.render(formatted_state_text, True, (46, 49, 49))
screen.blit(state_text, state_text_point)
评论列表
文章目录