File: README.rst

package info (click to toggle)
pygame-sdl2 7.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 19,408 kB
  • sloc: ansic: 9,655; python: 1,900; makefile: 10
file content (173 lines) | stat: -rw-r--r-- 4,808 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
===========
Pygame_sdl2
===========

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.

Downloads
---------

Nightly builds are available from:

https://nightly.renpy.org/current/

An official release will be coming to pypi shortly.

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. While not as well documented, it has also
run on Android, iOS, and inside the Chrome browser. 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
* pygame_sdl2.controller

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 <http://brew.sh>`_)::

    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


Windows
^^^^^^^

To build on windows, change into the pygame_sdl2 checkout, clone
renpy/pygame_sdl2_windeps using a command like::

    git clone https://github.com/renpy/pygame_sdl2_windeps

and then build and install using::

    python setup.py install

This assumes you have installed a version of Visual Studio that is
appropriate for the version of Python you are using.

C Headers
^^^^^^^^^

A small number of C headers can be installed using the command::

    python setup.py install_headers

These headers export functions statically, and must be initialized by
including "pygame_sdl2/pygame_sdl2.h" and calling
the (C-language) import_pygame_sdl2() function from each C file in which a
function will be called. The following functions are exposed:

* PySurface_AsSurface - Returns the SDL_Surface underlying a pygame_sdl2.Surface.
* PySurface_New - Wraps an SDL_Surface in a new pygame_sdl2.Surface.


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:

* Patrick Dawson <pat@dw.is>
* Tom Rothamel <tom@rothamel.us>

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