daily pastebin goal
61%
SHARE
TWEET

PGS4A Font Example

a guest Jul 28th, 2015 193 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pygame
  2. try:
  3.     import android
  4. except ImportError:
  5.     android = None
  6.  
  7. def main():
  8.     pygame.init()
  9.     screen = pygame.display.set_mode((480, 800))
  10.     if android:
  11.         android.init()
  12.         android.map_key(android.KEYCODE_BACK, pygame.K_ESCAPE)
  13.     font = pygame.font.Font('freesansbold.ttf', 24)
  14.     pygame.time.set_timer(pygame.USEREVENT, 100)
  15.     text = font.render('Test', 1, (255, 255, 255))
  16.     while True:
  17.         ev = pygame.event.wait()
  18.         if android:
  19.             if android.check_pause():
  20.                 android.wait_for_resume()
  21.         if ev.type == pygame.USEREVENT:
  22.             screen.fill((0, 0, 0))
  23.             screen.blit(text, (50, 50))
  24.             pygame.display.flip()
  25.         elif ev.type == pygame.KEYDOWN and ev.key == pygame.K_ESCAPE:
  26.             break
  27.         elif ev.type == pygame.QUIT:
  28.             break
  29.     pygame.quit()
  30.  
  31. if __name__ == '__main__':
  32.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top