You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -37,7 +41,7 @@ First make sure you have the latest pip installed:
37
41
Then install
38
42
39
43
python3 -m pip install setuptools
40
-
python3 -m pip install raylib==5.0.0.4
44
+
python3 -m pip install raylib==5.5.0.0
41
45
42
46
On most platforms it should install a binary wheel. If yours isn't available then pip will attempt to build from
43
47
source, in which case you will need to have Raylib development libs installed, e.g.
@@ -59,7 +63,7 @@ Older MacOS requires building from source but this is usually simple:
59
63
60
64
brew install pkg-config
61
65
brew install raylib
62
-
python3 -m pip install raylib==5.0.0.4
66
+
python3 -m pip install raylib==5.5.0.0
63
67
64
68
(I do have binaries for arm64 MacOS 11, 12 and 13 but I have no way of testing they work, so post an issue
65
69
if you want to test them.)
@@ -76,6 +80,8 @@ so may not work on other boards.
76
80
77
81
[Using on Rasperry Pi](RPI.rst)
78
82
83
+
# Backends
84
+
79
85
## Dynamic binding version
80
86
81
87
There is now a separate dynamic version of this binding:
@@ -85,6 +91,8 @@ There is now a separate dynamic version of this binding:
85
91
86
92
It works on some systems where the static version doesn't, [but be sure to read these caveats before using it](https://electronstudio.github.io/raylib-python-cffi/dynamic.html)
87
93
94
+
You can't have multiple raylib packages installed at once.
95
+
88
96
## SDL backend
89
97
90
98
This is not well tested but has better support for controllers:
@@ -116,64 +124,84 @@ If it still doesn't work, [submit an issue](https://github.com/electronstudio/ra
116
124
117
125
# How to use
118
126
119
-
There are two modules in the raylib package, `raylib` and `pyray`. (There is no separate package for
120
-
pyray). You can use either or both:
127
+
There are *two* modules in the raylib package, `raylib` and `pyray`. (There is no separate package for
128
+
pyray. Do *not*`pip install pyray`). You can use either or both:
121
129
122
130
### If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API
123
131
124
132
Use [the raylib module](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
125
133
126
-
### If you prefer a more Pythonistic API
134
+
### If you prefer a more Pythonistic API
127
135
128
136
Use [the pyray module](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
129
137
130
138
# Running in a web browser
131
139
132
-
[Pygbag](https://pypi.org/project/pygbag/) >=0.8.7 supports running in a web browser.
140
+
[Pygbag](https://pypi.org/project/pygbag/) >=0.8.7 supports running in a web browser. Usually the latest git version
141
+
is recommended.
133
142
134
143
Make a folder `my_project` with a file `main.py`:
135
144
136
-
# /// script
137
-
# dependencies = [
138
-
# "cffi",
139
-
# "raylib"
140
-
# ]
141
-
# ///
142
-
import asyncio
143
-
import platform
144
-
from pyray import *
145
-
146
-
async def main(): # You must have an async main function
147
-
init_window(500, 500, "Hello")
148
-
platform.window.window_resize() # You must add this line
149
-
while not window_should_close():
150
-
begin_drawing()
151
-
clear_background(WHITE)
152
-
draw_text("Hello world", 190, 200, 20, VIOLET)
153
-
end_drawing()
154
-
await asyncio.sleep(0) # You must call this in your main loop
155
-
close_window()
156
-
157
-
asyncio.run(main())
145
+
```python
146
+
# /// script
147
+
# dependencies = [
148
+
# "cffi",
149
+
# "raylib"
150
+
# ]
151
+
# ///
152
+
import asyncio
153
+
import platform
154
+
from pyray import*
155
+
156
+
asyncdefmain(): # You MUST have an async main function
157
+
init_window(500, 500, "Hello")
158
+
platform.window.window_resize() # You MAY want to add this line
159
+
whilenot window_should_close():
160
+
begin_drawing()
161
+
clear_background(WHITE)
162
+
draw_text("Hello world", 190, 200, 20, VIOLET)
163
+
end_drawing()
164
+
await asyncio.sleep(0) # You MUST call this in your main loop
165
+
close_window()
166
+
167
+
asyncio.run(main())
168
+
```
158
169
159
170
Then to create the web files and launch a web server:
0 commit comments