Skip to content

Commit 49d7afe

Browse files
committed
Small corrections.
1 parent d6565da commit 49d7afe

File tree

1 file changed

+115
-42
lines changed

1 file changed

+115
-42
lines changed

README.md

Lines changed: 115 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,106 @@
1-
raylibpy
2-
========
1+
# raylib-py
32

4-
**raylib is a simple and easy-to-use library to learn videogames programming. raylibpy
5-
brings the all the strengths of this great library to Python, via ctypes binding.**
3+
A python binding for the great _C_ library **[raylib](https://github.com/raisan5/raylib)**.
64

7-
More about raylib can be found at its [repository](https://github.com/raisan5/raylib)
8-
and/or [website](https://www.raylib.com).
5+
## Getting Started
6+
<!--
7+
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
8+
-->
9+
### Prerequisites
910

11+
_raylib-py_ uses type [annotations](https://www.python.org/dev/peps/pep-3107/#id30) in its source, so a Python version that supports it is required.
1012

11-
## features
12-
* **NO external dependencies**, all required libraries included with raylib.
13-
* Multiple platforms supported: **Window, MacOS, Android... and many more!**
14-
* Hardware accelerated with OpenGL (**1.1, 2.1, 3.3 or ES 2.0**)
15-
* **Unique OpenGL abstraction layer** (usable as standalone module): rlgl
16-
* Multiple Font formats supported (XNA fonts, AngelCode fonts, TTF)
17-
* Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
18-
* **Full 3d support** for 3d Shapes, Models, Billboards, Heightmaps and more!
19-
* Flexible Materials system, supports classic maps and **PBR maps**
20-
* Shaders support, including Model shaders and Postprocessing shaders
21-
* Audio loading and playing with streamming support (WAV, OGG, MP3, FLAC, XM, MOD)
22-
* **VR stereo rendering** support with configurable HMD device parameters
13+
Some Python versions may not have [enum](https://pypi.org/project/enum/) and/or [typings](https://pypi.org/project/typing/) modules as part of the standard library, wich are required. These are installed automatically by pip.
2314

15+
### Installing
2416

25-
## binaries
17+
The easiest way to install _raylib-py_ is by the pip install command:
2618

27-
raylibpy comes by default with 32bit binaries for Windows (`libraylib_shared.dll`, mingw),
28-
Linux (`libraylib.so.2.0.0`, i386) and MacOS (`libraylib.2.0.0.dylib`), but you can find other
29-
[binary releases](https://github.com/raisan5/raylib/releases) for 64bit Windows, Linux or OSX.
19+
Depending on you system and python version(s) installed, the command might be:
3020

31-
raylibpy will look for the respective binary in 3 locations:
32-
* In the `RAYLIB_BIN_PATH` environment variable;
33-
* in the directory where the `"__main__"` module is located, and
34-
* in the raylibpy package directory.
21+
```
22+
pip install raylib-py
23+
```
24+
25+
or
26+
27+
```
28+
python -m pip install raylip-py
29+
```
30+
31+
or (with Python3.7 launcher with multiple versions installed)
3532

36-
`RAYLIB_LIB_PATH` accepts as value: `"__main__"`, as the entry point module directory;
37-
`"__file__"` as the package directory or another specific directory.
33+
```
34+
py-3.x-32 -m pip install raylib-py
35+
```
36+
37+
> Note that the minimum Python version tested is 3.4. Please, let me know if you're able to run it in Python33.
38+
39+
_raylib-py_ comes with 32bit binaries for Windows, Mac and Linux, but you're not required to use these. If you have a custom _raylib_ _**dll**_, _**dylib**_ or _**so**_ binary, make sure to set a PATH indicating the directory it is located:
40+
41+
```python
42+
import os
3843

39-
if `RAYLIB_BIN_PATH` is not set, it will look in the package directory first,
40-
then in the `__main__` module location. Note though that `"__main__"` refers the module selected to
41-
start the Python interpreter, not the `__main__.py` file, although it might be the case.
44+
# set the path before raylib is imported.
45+
os.environ[RAYLIB_LIB_PATH] = "path/to/the/binary"
4246

43-
The binaries made available by raylib are all OpenGL 3.3. For OpenGL 1.1 or 2.1,
44-
you can download the raylib source and build with the necessary changes in the Makefile.
45-
More information on how to build raylib can be found in the [raylib wiki pages](https://github.com/raisan5/raylib/wiki).
47+
import raylibpy
48+
49+
# let the fun begin.
50+
```
51+
52+
You can set `"__file__"` as value to `RAYLIB_LIB_PATH` and _raylib-py_ will search for the binary in the package dir:
53+
54+
```python
55+
# bynary file is wherever the package is located.
56+
os.environ[RAYLIB_LIB_PATH] = "__file__"
57+
```
58+
59+
`"__main__"` can also be set to look for the binary in the project's directory where the starting script is located:
60+
61+
```python
62+
# binary file is in the same dir as this py file.
63+
os.environ[RAYLIB_LIB_PATH] = "__main__"
64+
65+
# ...
66+
67+
if __name__ == "__main__":
68+
# run the game
69+
# ...
70+
```
4671

72+
> Make sure the bin file name for the respective platform is `libraylib_shared.dll`, `libraylib.2.0.0.dylib` or `libraylib.so.2.0.0`.
4773
48-
## raylib vs raylibpy
74+
## Tests
4975

50-
Below are the differences in usage between raylib and raylibpy. Note, though that these
51-
differences are being worked to make raylibpy as pythonic as possible, so changes may
52-
occur without notification.
76+
_raylib-py_ does not have test code, but you can run the examples in the [examples directory](https://github.com/overdev/raylibpy/tree/master/examples).
77+
78+
<!--
79+
### Break down into end to end tests
80+
81+
Explain what these tests test and why
82+
83+
```
84+
Give an example
85+
```
86+
87+
### And coding style tests
88+
89+
Explain what these tests test and why
90+
91+
```
92+
Give an example
93+
```
94+
95+
## Deployment
96+
97+
Add additional notes about how to deploy this on a live system
98+
99+
-->
100+
101+
## _raylib_ vs _raylib-py_
102+
103+
Below are the differences in usage between raylib and raylibpy. Note, though that these differences are being worked to make raylibpy as pythonic as possible, so changes may occur without notification.
53104

54105
### Constant values
55106

@@ -141,7 +192,7 @@ a.xyzw = (10, b.uv), 1.0
141192
```
142193

143194
This became available by dropping a previous feature wich allowed for a very basic
144-
swizzling emulation. A feature more similas to GLSL vectors is implemented on
195+
swizzling emulation. A feature more similar to GLSL vectors is implemented on
145196
top of Python container emulation magic functions:
146197

147198
```python
@@ -165,8 +216,30 @@ vec['y'] = 20
165216
# vec[2:] = zw # <--- not supported; will raise TypeError
166217
```
167218

168-
## extras
219+
## Building _raylib_ from source
220+
221+
_raylib_ wiki pages contains information on how to build it on [Windows](https://github.com/raysan5/raylib/wiki/Working-on-Windows), [Mac](https://github.com/raysan5/raylib/wiki/Working-on-macOS), [Linux](https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux) and other platforms.
222+
223+
## Contributing
224+
225+
Please, let me know if you find any strange or unexpected behavior while using _raylib-py_. If you want to [request features](https://github.com/raysan5/raylib/pulls) or [report bugs](https://github.com/raysan5/raylib/issues) related to the library (in contrast to this binding), please refer to the [author's project repo](https://github.com/raysan5/raylib).
226+
227+
## Authors
228+
229+
* **Ramon Santamaria** - *raylib's author* - [raysan5](https://github.com/raysan5)
230+
* **Jorge A. Gomes** - *python binding code* - [overdev](https://github.com/overdev)
231+
232+
See also the list of [contributors](https://github.com/raysan5/raylib/graphs/contributors) who participated in this project.
233+
234+
## License
235+
236+
_raylib-py_ (and _raylib_) is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software.
237+
238+
<!--
239+
## Acknowledgments
169240
170-
raylibpy has the extra module [`easings`](https://github.com/overdev/raylibpy/blob/master/raylibpy/easings.py) for animations.
241+
* Hat tip to anyone whose code was used
242+
* Inspiration
243+
* etc
244+
-->
171245

172-
The current plan it to translate [rayGui](https://github.com/raysan5/raygui) and add it too.

0 commit comments

Comments
 (0)