PyGame
PyGame é uma biblioteca 2D para Python que encapsula as funcionalidades da SDL
Características
- Manipular dispositivos de entrada como o mouse, teclado e o joypad
- Funções que controlam o básico de um jogo como áudio e vídeo
- Facilidade de uso
Exemplo simples usando PyGame
import sys, pygame pygame.init() size = width, height = 320, 240 speed = [2, 2] black = 0, 0, 0 screen = pygame.display.set_mode(size) ball = pygame.image.load( "ball.bmp" ) ballrect = ball.get_rect() while 1: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() ballrect = ballrect.move( speed ) if ballrect.left < 0 or ballrect.right > width: speed[0] = -speed[0] if ballrect.top < 0 or ballrect.bottom > height: speed[1] = -speed[1] screen.fill( black ) screen.blit( ball, ballrect ) pygame.display.flip()
Links
http://www.pygame.org/news.html; Site oficial da biblioteca PyGame
http://inventwithpython.com/IYOCGwP_book1.pdf: Livro online (em inglês) que ensina programação e usa PyGame.
http://pyvideo.org/video/2620/introduction-to-game-programming: Vídeo (em inglês) introduzindo programação de jogos com PyGame
revisão da página: 3, última edição: 07 Jun 2014 16:36





