@@ -7,8 +7,13 @@ related libraries. While in the past it was meant to support multiple
7
7
applications, it only saw adoption as technology underlying Ren'Py, and
8
8
is currently being supported for that purpose.
9
9
10
- The `original pygame <https://www.pygame.org >`_ now runs on SDL2, and should
11
- be used for most applications.
10
+
11
+ We recommend you consider:
12
+
13
+ * `https://pyga.me/ `_
14
+ * `https://www.pygame.org/ `_
15
+
16
+ As alternatives.
12
17
13
18
License
14
19
-------
@@ -23,162 +28,6 @@ to comply with both to distribute software containing pygame_sdl2.
23
28
24
29
25
30
Current Status
26
- --------------
27
-
28
- Pygame_sdl2 builds and runs on Windows, Mac OS X, and Linux, with a useful
29
- subset of the pygame API working. While not as well documented, it has also
30
- run on Android, iOS, and inside the Chrome browser. The following modules
31
- have at least some implementation:
32
-
33
- * pygame_sdl2.color
34
- * pygame_sdl2.display
35
- * pygame_sdl2.draw
36
- * pygame_sdl2.event
37
- * pygame_sdl2.font
38
- * pygame_sdl2.gfxdraw
39
- * pygame_sdl2.image
40
- * pygame_sdl2.joystick
41
- * pygame_sdl2.key
42
- * pygame_sdl2.locals
43
- * pygame_sdl2.mixer (including mixer.music)
44
- * pygame_sdl2.mouse
45
- * pygame_sdl2.scrap
46
- * pygame_sdl2.sprite
47
- * pygame_sdl2.surface
48
- * pygame_sdl2.sysfont
49
- * pygame_sdl2.time
50
- * pygame_sdl2.transform
51
- * pygame_sdl2.version
52
-
53
- Experimental new modules include:
54
-
55
- * pygame_sdl2.render
56
- * pygame_sdl2.controller
57
-
58
- Current omissions include:
59
-
60
- * Modules not listed above.
61
-
62
- * APIs that expose pygame data as buffers or arrays.
63
-
64
- * Support for non-32-bit surface depths. Our thinking is that 8, 16,
65
- and (to some extent) 24-bit surfaces are legacy formats, and not worth
66
- duplicating code four or more times to support. This only applies to
67
- in-memory formats - when an image of lesser color depth is loaded, it
68
- is converted to a 32-bit image.
69
-
70
- * Support for palette functions, which only apply to 8-bit surfaces.
71
-
72
-
73
- Building
74
- --------
75
-
76
- Building pygame_sdl2 requires the ability to build python modules; the
77
- ability to link against the SDL2, SDL2_gfx, SDL2_image, SDL2_mixer,
78
- and SDL2_ttf libraries; and the ability to compile cython code.
79
-
80
- To build pygame_sdl2, install the build dependencies:
81
-
82
- Linux
83
- ^^^^^
84
-
85
- **Ubuntu **::
86
-
87
- sudo apt-get install build-essential python-dev libsdl2-dev \
88
- libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \
89
- libjpeg-dev libpng12-dev virtualenvwrapper
90
-
91
- **Fedora **::
92
-
93
- sudo dnf install SDL2 SDL2-devel SDL2_gfx-devel SDL2_image-devel \
94
- SDL2_sound-devel SDL2_ttf-devel SDL2_mixer-devel SDL2_net-devel \
95
- libjpeg-turbo-devel libjpeg-turbo python-devel
96
-
97
- Darwin
98
- ^^^^^^
99
-
100
- **macOS ** (with `brew <http://brew.sh >`_)::
101
-
102
- brew install sdl2 sdl2_gfx sdl2_image sdl2_mixer sdl2_ttf
103
- sudo pip install virtualenvwrapper
104
-
105
- Open a new shell to ensure virtualenvwrapper is running, then run::
106
-
107
- mkvirtualenv pygame_sdl2
108
- pip install cython
109
-
110
- Change into a clone of this project, and run the following command to modify
111
- the virtualenv so pygame_sdl2 header files can be installed in it::
112
-
113
- python fix_virtualenv.py
114
-
115
- Finally, build and install pygame_sdl2 by running::
116
-
117
- python setup.py install
118
-
119
-
120
- Windows
121
- ^^^^^^^
122
-
123
- **These instructions are likely out of date. **
124
-
125
- To build on windows, change into the pygame_sdl2 checkout, clone
126
- renpy/pygame_sdl2_windeps using a command like::
127
-
128
- git clone https://github.com/renpy/pygame_sdl2_windeps
129
-
130
- and then build and install using::
131
-
132
- python setup.py install
133
-
134
- This assumes you have installed a version of Visual Studio that is
135
- appropriate for the version of Python you are using.
136
-
137
- If you also want to install the python headers in a standard fashion
138
- to make an IDE's autocomplete work then you should try creating a
139
- python wheel. First grab the wheel package::
140
-
141
- pip install wheel
142
-
143
- Then use this command to build your wheel::
144
-
145
- python setup.py sdist bdist_wheel
146
-
147
- Finally, you will need to install your wheel from the dist
148
- sub-directory with pip. What it is called will depend on your version
149
- of python, the current version of the library and your platform.
150
- For example, here is a command to install a python 3.6 wheel,
151
- on 32bit windows::
152
-
153
- pip install dist\pygame_sdl2-2.1.0-cp36-cp36m-win32.whl
154
-
155
- You will also need to delete any currently installed version of
156
- pygame_sdl2 from your Lib/site-packages directory to re-install
157
- this way.
158
-
159
- C Headers
160
- ^^^^^^^^^
161
-
162
- A small number of C headers can be installed using the command::
163
-
164
- python setup.py install_headers
165
-
166
- These headers export functions statically, and must be initialized by
167
- including "pygame_sdl2/pygame_sdl2.h" and calling
168
- the (C-language) import_pygame_sdl2() function from each C file in which a
169
- function will be called. The following functions are exposed:
170
-
171
- * PySurface_AsSurface - Returns the SDL_Surface underlying a pygame_sdl2.Surface.
172
- * PySurface_New - Wraps an SDL_Surface in a new pygame_sdl2.Surface.
173
-
174
- Pygame incompatibility
175
- ----------------------
176
-
177
- Pygame_sdl2 is designed as a complete replacement for pygame.
178
-
179
- If you try to use both the `pygame_sdl2 ` and `pygame ` libraries in the same program
180
- you may encounter errors; such as library import failures in frozen programs.
181
-
182
31
Credits
183
32
-------
184
33
0 commit comments