Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

Pygame_sdl2 is a reimplementation of the Pygame API using SDL2 and related libraries. The initial goal of this project are to allow games written using the pygame API to run on SDL2 on desktop and mobile platforms. We will then evolve the API to expose SDL2-provided functionality in a pythonic manner.

License

New code written for pygame_sdl2 is licensed under the Zlib license. Some code - including compiled code - is taken wholesale from Pygame, and is licensed under the LGPL2. Please check each module to determine its licensing status.

See the COPYING.ZLIB and COPYING.LGPL21 files for details - you’ll need to comply with both to distribute software containing pygame_sdl2.

Current Status

Pygame_sdl2 builds and runs on Windows, Mac OS X, and Linux, with a useful subset of the pygame API working. The following modules have at least some implementation:

  • pygame_sdl2.color
  • pygame_sdl2.display
  • pygame_sdl2.draw
  • pygame_sdl2.event
  • pygame_sdl2.font
  • pygame_sdl2.gfxdraw
  • pygame_sdl2.image
  • pygame_sdl2.joystick
  • pygame_sdl2.key
  • pygame_sdl2.locals
  • pygame_sdl2.mixer (including mixer.music)
  • pygame_sdl2.mouse
  • pygame_sdl2.scrap
  • pygame_sdl2.sprite
  • pygame_sdl2.surface
  • pygame_sdl2.sysfont
  • pygame_sdl2.time
  • pygame_sdl2.transform
  • pygame_sdl2.version

Experimental new modules include:

  • pygame_sdl2.render

Current omissions include:

  • Modules not listed above.
  • APIs that expose pygame data as buffers or arrays.
  • Support for non-32-bit surface depths. Our thinking is that 8, 16, and (to some extent) 24-bit surfaces are legacy formats, and not worth duplicating code four or more times to support. This only applies to in-memory formats - when an image of lesser color depth is loaded, it is converted to a 32-bit image.
  • Support for palette functions, which only apply to 8-bit surfaces.

Documentation

The latest documentation can be found at:

http://pygame-sdl2.readthedocs.org/

An Android packaging example can be found at:

https://github.com/renpytom/rapt-pygame-example

Building

Building pygame_sdl2 requires the ability to build python modules; the ability to link against the SDL2, SDL2_gfx, SDL2_image, SDL2_mixer, and SDL2_ttf libraries; and the ability to compile cython code.

To build pygame_sdl2, install the build dependencies:

Ubuntu:

sudo apt-get install build-essential python-dev libsdl2-dev \
    libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \
    libjpeg-dev libpng12-dev virtualenvwrapper

Mac OS X (with brew):

brew install sdl2 sdl2_gfx sdl2_image sdl2_mixer sdl2_ttf
sudo pip install virtualenvwrapper

Open a new shell to ensure virtualenvwrapper is running, then run:

mkvirtualenv pygame_sdl2
pip install cython

Change into a clone of this project, and run the following command to modify the virtualenv so pygame_sdl2 header files can be installed in it:

python fix_virtualenv.py

Finally, build and install pygame_sdl2 by running:

python setup.py install

Contributing

We’re looking for people to contribute to pygame_sdl2 development. For simple changes, just give us a pull request. Before making a change that is a lot of work, it might make sense to send us an email to ensure we’re not already working on it.

Credits

Pygame_sdl2 is written by:

It includes some code from Pygame, and is inspired by the hundreds of contributors to the Pygame, Python, and SDL2 projects.

Release History

Release History

This version
History Node

2.1.0

History Node

2.0.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pygame_sdl2-2.1.0-cp27-none-win32.whl (2.8 MB) Copy SHA256 Checksum SHA256 cp27 Wheel Jan 24, 2016
pygame_sdl2-2.1.0-cp27-none-win_amd64.whl (3.1 MB) Copy SHA256 Checksum SHA256 cp27 Wheel Jan 24, 2016
pygame_sdl2-2.1.0-cp35-none-win32.whl (2.8 MB) Copy SHA256 Checksum SHA256 cp35 Wheel Jan 24, 2016
pygame_sdl2-2.1.0-cp35-none-win_amd64.whl (3.1 MB) Copy SHA256 Checksum SHA256 cp35 Wheel Jan 24, 2016
pygame_sdl2-2.1.0.tar.gz (1.9 MB) Copy SHA256 Checksum SHA256 Source Jan 24, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting