Last active
January 24, 2017 04:37
-
-
Save cbscribe/0a46117ec3d05122bdf5387cb6ce1c86 to your computer and use it in GitHub Desktop.
pygame_draw_text_basic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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