Skip to content

Instantly share code, notes, and snippets.

@cbscribe
Last active January 24, 2017 04:37
Show Gist options
  • Save cbscribe/0a46117ec3d05122bdf5387cb6ce1c86 to your computer and use it in GitHub Desktop.
Save cbscribe/0a46117ec3d05122bdf5387cb6ce1c86 to your computer and use it in GitHub Desktop.
pygame_draw_text_basic
font_name = pg.font.match_font('hack')
def draw_text(text, size, color, x, y, align="topleft"):
font = pg.font.Font(font_name, size)
text_surface = font.render(text, True, color)
text_rect = text_surface.get_rect(**{align: (x, y)})
screen.blit(text_surface, text_rect)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment