Advertisement
cookertron

PyDroid Pygame - Font Render

Feb 13th, 2020
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. import pygame_sdl2
  2. pygame_sdl2.import_as_pygame()
  3. import pygame
  4. import time
  5.  
  6. # define some colors
  7. BLACK = (0, 0, 0)
  8. WHITE = (255, 255, 255)
  9.  
  10. pygame.init()
  11. pygame.font.init()
  12. DS = pygame.display.set_mode((640, 480))
  13. CLOCK = pygame.time.Clock()
  14.  
  15. FPS = 30
  16.  
  17. W = DS.get_width()
  18. H = DS.get_height()
  19. HW, HH = int(W / 2), int(H / 2)
  20.  
  21. FONT = pygame.font.SysFont("'", 75)
  22.  
  23. start = time.time()
  24.  
  25. while True:
  26.     DS.fill(BLACK)
  27.    
  28.     t = str(int(time.time() - start))
  29.     text = FONT.render(t, True, WHITE)
  30.     DS.blit(text, (0, 0))
  31.    
  32.     pygame.display.update()
  33.     CLOCK.tick()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement