Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Pygame

From Wikipedia, the free encyclopedia
Python module for writing video games

Original author(s)Lenard Lindstrom, René Dudfield, Pete Shinners, Nicholas Dudfield, Thomas Kluyver, and others[1]
Developer(s)Pygame Community
Initial release28 October 2000; 24 years ago (2000-10-28)[2][3]
Stable release
2.6.1 / 30 September 2024; 6 months ago (2024-09-30)[4]
Repository
Written inPython,C,Cython, andAssembly[5][6]
Operating systemCross-platform
TypeAPI
LicenseGNU Lesser General Public License
Websitewww.pygame.org Edit this on Wikidata

Pygame is across-platform set ofPython modules designed for writingvideo games. It includescomputer graphics and soundlibraries designed to be used with the Pythonprogramming language.[7]

History

[edit]

Pygame was originally written byPete Shinners to replacePySDL after its development stalled.[2][8] It has been acommunity project since 2000[9] and is released under thefree softwareGNU Lesser General Public License[5] (which "provides for Pygame to be distributed withopen source and commercial software"[10]).

Development of version 2

[edit]

Pygame version 2 was planned as "Pygame Reloaded" in 2009, but development and maintenance of Pygame completely stopped until the end of 2016 with version 1.9.1. After the release of version 1.9.5 in March 2019, development of a new version 2 was active on the roadmap.[11]

Pygame 2.0 released on 28 October 2020, Pygame's 20th anniversary.[12]

Features

[edit]

Pygame uses theSimple DirectMedia Layer (SDL) library,[a] with the intention of allowingreal-timecomputer game development without thelow-level mechanics of theC programming language and its derivatives. This is based on the assumption that the mostexpensive functions inside games can be abstracted from the game logic, making it possible to use ahigh-level programming language, such as Python, to structure the game.[5]

Other features that SDL does have include vector math,collision detection, 2D spritescene graph management,MIDI support, camera, pixel-array manipulation, transformations, filtering, advanced freetype font support, and drawing.[13]

Applications using Pygame can run on Android phones and tablets with the use of Pygame Subset for Android (pgs4a).[14] Sound, vibration, keyboard, and accelerometer are supported on Android.[15]

Community

[edit]

Following disagreements between former core developers and the repository owner, a fork known as pygame-ce (Community Edition) was created.[16]

There is a regular competition, called PyWeek, to write games using Python (and usually but not necessarily, Pygame).[17][18][19] The community has created many tutorials for Pygame.[20][21][22][23][24]

Sample code

[edit]

The following code makes an image of a raccoon("raccoon.png") bounce when hitting an edge.

importpygame,syspygame.init()screen=pygame.display.set_mode((1280,720))clock=pygame.time.Clock()clock.tick(30)black=0,0,0raccoon=pygame.image.load("raccoon.png")raccoon=pygame.transform.scale(raccoon,(200,140))raccoonrect=raccoon.get_rect()velocity=[1,1]whileTrue:raccoonrect=raccoonrect.move(velocity)ifraccoonrect.left<0orraccoonrect.right>1280:velocity[0]=-velocity[0]raccoon=pygame.transform.flip(raccoon,True,False)ifraccoonrect.top<0orraccoonrect.bottom>720:velocity[1]=-velocity[1]foreventinpygame.event.get():ifevent.type==pygame.QUIT:sys.exit()#screen updatescreen.fill(black)screen.blit(raccoon,raccoonrect)pygame.display.flip()

Notable games using Pygame

[edit]

See also

[edit]

Notes

[edit]
  1. ^Pygame 2 and later versions are based on SDL2, while earlier releases were based on SDL1.[27]

References

[edit]
  1. ^"Contributors to Pygame".GitHub.
  2. ^abShinners, Pete."Python Pygame Introduction - History".Pygame.org. Archived fromthe original on 17 September 2019. Retrieved28 April 2017.
  3. ^"Downloads - Pygame - Python game development".Pypi.python.org.
  4. ^"PyGame 2.6.1 - Python 3.13 bugfix release". Retrieved16 March 2025.
  5. ^abc"About Pygame". GitHub. Archived fromthe original on 18 September 2019. Retrieved31 August 2019.
  6. ^"GettingStarted".Pygame.org.
  7. ^Alam, Imran (2 July 2023)."How to Implement a Dialogue System in Pygame".MUO. Retrieved29 November 2024.
  8. ^"pySDL sourceforge page".Sourceforge.net.
  9. ^"commit by other authors". GitHub.
  10. ^"Pygame Front Page — pygame v2.0.1.dev1 documentation".www.pygame.org. Retrieved26 February 2021.
  11. ^"pygame 1.9.5 released into the wilds".www.pygame.org.
  12. ^"pygame 2.0 - the happy dance birthday release". GitHub.
  13. ^"Pygame docs".Pygame.org.
  14. ^"Example of using RAPT to package pygame(_sdl2) games.: renpytom/rapt-pygame-example". GitHub. 1 April 2019. Retrieved1 April 2019.
  15. ^"API — Pygame Subset for Android". Archived fromthe original on 19 October 2014. Retrieved14 October 2014.
  16. ^"pygame - Community Edition".pypi.com.
  17. ^"PyWeek - Python Game Programming Challenge".Pyweek.org.
  18. ^Gee, Sue (29 March 2013)."Why PyWeek: An Interview with Richard Jones".i-programmer.info. Retrieved31 March 2020.
  19. ^"PyWeek - Python Wiki".Wiki.python.org. Retrieved1 April 2019.
  20. ^"pygame documentation: Tutorials".Pygame.org.
  21. ^Siddiqi (27 June 2020)."Python Game projects with source code".CodersLegacy. Retrieved25 December 2020.
  22. ^Shinners, Pete."Line by line tutorial - Tutorial for beginners". Archived fromthe original on 5 February 2005.
  23. ^"Creating Games with Python - A tutorial explaining how to use pygame for game development and improved execution".Linuxjournal.com.
  24. ^"Arinoid tutorials video tutorials at ShowMeDo". Archived fromthe original on 29 April 2007.
  25. ^"fretsonfire/src at master · skyostil/fretsonfire".GitHub. Retrieved2 June 2023.
  26. ^"Dangerous High School Girls in Trouble!".Pygame.org. Retrieved8 July 2011.
  27. ^"pygame 1.9.5 released into the wilds".Pygame.org.

External links

[edit]


Proprietary
1980s
1990s
2000s
2010s
2020s
Free and
open-source
1970s
1990s
2000s
2010s
2020s
Retrieved from "https://en.wikipedia.org/w/index.php?title=Pygame&oldid=1280751430"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp