Skip to content

Commit c954a4f

Browse files
update docs
1 parent 0a677fe commit c954a4f

17 files changed

+192
-91
lines changed

BUILDING.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ Requirements for build: cmake, pkg-config.
1313

1414
::
1515

16-
cd raylib-4.2.0
16+
cd raylib-5.0
1717
mkdir build
1818
cd build
19-
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
19+
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
2020
make
2121
sudo make install
2222

@@ -26,7 +26,7 @@ Then ask Pip to build from source:
2626

2727
::
2828

29-
pip3 install --no-binary raylib --upgrade --force-reinstall raylib
29+
pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib
3030

3131
Or, Build from source manually
3232
------------------------------
@@ -119,7 +119,7 @@ Build and install Raylib from the raylib-c directory.
119119
cd raylib-python-cffi/raylib-c
120120
mkdir build
121121
cd build
122-
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
122+
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
123123
sudo make install
124124

125125
.. note:: Optional: Build the Raylib shared libs, if you plan to use

RPI.rst

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,72 +3,76 @@ Raspberry Pi
33

44
Please use Raspberry Pi OS Bullseye. Older OSes are not tested.
55

6-
Binary wheel
7-
------------
6+
Option 1: Binary wheel
7+
----------------------
88

9-
We have published a binary wheel using Raylib in X11 mode. This *should* install and work on Bullseye
9+
We have published a binary wheel using Raylib in X11 mode. This *should probably* install and work on Bullseye
1010
with
1111

1212
::
1313

1414
python3.9 -m pip install raylib==4.2.1.2
1515

1616
If it doesn't work, or you're not on Bullseye, or you want a newer version,
17-
or if you want to use Raylib in ``PLATFORM_DRM`` mode, you will need to compile your own raylib.
17+
or if you want to use Raylib in ``PLATFORM_DRM`` mode, you will need to compile your own raylib. See below.
1818
For full instructions on this, see https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi . If you need help with this ask Raylib.
1919

20-
Compile Raylib from source DRM mode
21-
-----------------------------------
20+
Option 2: Compile Raylib from source X11 mode
21+
---------------------------------------------
2222

23-
As far as I can tell, Raylib DRM is broken. It doesn't work on my Pi. However, if you want to compile it and
24-
give it a go, these are the commands:
23+
This should work for everyone.
2524

2625
::
2726

2827
git clone https://github.com/raysan5/raylib.git --branch 5.0 --single-branch
2928
cd raylib
3029
mkdir build
31-
rm rf build/*
30+
rm -rf build/*
3231
cd build
33-
cmake -DPLATFORM="DRM" -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
32+
cmake -DPLATFORM="Desktop" -DOPENGL_VERSION=2.1 -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
3433
make
3534
sudo make install
36-
37-
Then have pip compile and install the wheel with some extra linker flags:
35+
36+
Then have pip compile and install the wheel:
3837

3938
::
4039

4140
sudo apt update
4241
sudo apt install python3-pip
4342
pip3 install setuptools
44-
LDFLAGS="-lgbm -ldrm -lEGL" pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib==5.0.0.0
43+
pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib==5.0.0.1
4544

46-
Compile Raylib from source X11 mode
47-
-----------------------------------
45+
Option 3: Compile Raylib from source DRM mode
46+
---------------------------------------------
47+
48+
As far as I can tell, Raylib DRM is broken. It doesn't work on my Pi. However, if you want to compile it and
49+
give it a go, these are the commands:
4850

4951
::
5052

5153
git clone https://github.com/raysan5/raylib.git --branch 5.0 --single-branch
5254
cd raylib
5355
mkdir build
54-
rm -rf build/*
56+
rm rf build/*
5557
cd build
56-
cmake -DPLATFORM="Desktop" -DOPENGL_VERSION=2.1 -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
58+
cmake -DPLATFORM="DRM" -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
5759
make
5860
sudo make install
59-
60-
Then have pip compile and install the wheel:
61+
62+
Then have pip compile and install the wheel with some extra linker flags:
6163

6264
::
6365

6466
sudo apt update
6567
sudo apt install python3-pip
6668
pip3 install setuptools
67-
pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib==5.0.0.0
69+
LDFLAGS="-lgbm -ldrm -lEGL" pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib==5.0.0.1
70+
71+
6872

6973

7074
.. attention::
7175

72-
The Broadcom proprietary Open GL ES 2.0 drivers (installed by Raspbian into ``/opt/vc`` and compiled in Raylib
73-
with ``PLATFORM_RPI``) do not work with Bullseye and have not been tested with the bindings. They will probably
74-
require additional linker arguments to be added to ``build.py``. Suggest you use ``PLATFORM_DRM`` instead.
76+
If you intend to use the Broadcom proprietary Open GL ES 2.0 drivers (the ones installed by Raspbian into ``/opt/vc`` and compiled in Raylib
77+
with ``PLATFORM_RPI``) be aware they not work with Bullseye and have not been tested with the bindings. They will probably
78+
require additional linker arguments to be added to ``build.py``. Suggest you try ``PLATFORM_DRM`` instead.

docs/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: f23391837b4fdf2db377a22ccd4fd90f
3+
config: 9916125ae8fbc6b931a6987aa12f983d
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/BUILDING.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li>
5252
<li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li>
5353
<li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li>
54+
<li class="toctree-l1"><a class="reference internal" href="README.html#running-in-a-web-browser">Running in a web browser</a></li>
5455
<li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li>
5556
<li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li>
5657
<li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li>
@@ -106,16 +107,16 @@ <h2>Have Pip build from source<a class="headerlink" href="#have-pip-build-from-s
106107
<p>First make sure Raylib is installed. On Linux/Mac it must include the pkg-config files. Best way to ensure this
107108
is to compile and install Raylib using CMake: <a class="reference external" href="https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#build-raylib-using-cmake">https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#build-raylib-using-cmake</a></p>
108109
<p>Requirements for build: cmake, pkg-config.</p>
109-
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="n">raylib</span><span class="o">-</span><span class="mf">4.2.0</span>
110+
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="n">raylib</span><span class="o">-</span><span class="mf">5.0</span>
110111
<span class="n">mkdir</span> <span class="n">build</span>
111112
<span class="n">cd</span> <span class="n">build</span>
112-
<span class="n">cmake</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">on</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
113+
<span class="n">cmake</span> <span class="o">-</span><span class="n">DCUSTOMIZE_BUILD</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_JPG</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_FLAC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
113114
<span class="n">make</span>
114115
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
115116
</pre></div>
116117
</div>
117118
<p>Then ask Pip to build from source:</p>
118-
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">binary</span> <span class="n">raylib</span> <span class="o">--</span><span class="n">upgrade</span> <span class="o">--</span><span class="n">force</span><span class="o">-</span><span class="n">reinstall</span> <span class="n">raylib</span>
119+
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">cache</span><span class="o">-</span><span class="nb">dir</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">binary</span> <span class="n">raylib</span> <span class="o">--</span><span class="n">upgrade</span> <span class="o">--</span><span class="n">force</span><span class="o">-</span><span class="n">reinstall</span> <span class="n">raylib</span>
119120
</pre></div>
120121
</div>
121122
</section>
@@ -189,7 +190,7 @@ <h3>Linux manual build<a class="headerlink" href="#linux-manual-build" title="Li
189190
<span class="n">cd</span> <span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">c</span>
190191
<span class="n">mkdir</span> <span class="n">build</span>
191192
<span class="n">cd</span> <span class="n">build</span>
192-
<span class="n">cmake</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">on</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
193+
<span class="n">cmake</span> <span class="o">-</span><span class="n">DCUSTOMIZE_BUILD</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_JPG</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_FLAC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
193194
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
194195
</pre></div>
195196
</div>

docs/README.html

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
<li class="toctree-l2"><a class="reference internal" href="#if-you-prefer-a-slightly-more-pythonistic-api-and-don-t-mind-it-might-be-slightly-slower">If you prefer a slightly more Pythonistic API and don’t mind it might be slightly slower</a></li>
6262
</ul>
6363
</li>
64+
<li class="toctree-l1"><a class="reference internal" href="#running-in-a-web-browser">Running in a web browser</a></li>
6465
<li class="toctree-l1"><a class="reference internal" href="#app-showcase">App showcase</a></li>
6566
<li class="toctree-l1"><a class="reference internal" href="#rlzero">RLZero</a></li>
6667
<li class="toctree-l1"><a class="reference internal" href="#help-wanted">Help wanted</a></li>
@@ -111,7 +112,7 @@ <h1>Python Bindings for Raylib 5.0<a class="headerlink" href="#python-bindings-f
111112
<li><p>Faster, fewer bugs and easier to maintain than ctypes.</p></li>
112113
<li><p>Commercial-friendly license.</p></li>
113114
<li><p>Docstrings and auto-completion.</p></li>
114-
<li><p><strong>Now includes extra libraries: raymath, raygui, rlgl and physac</strong></p></li>
115+
<li><p><strong>Now includes extra libraries: raymath, raygui, rlgl, physac and GLFW</strong></p></li>
115116
</ul>
116117
<p><a class="reference external" href="http://electronstudio.github.io/raylib-python-cffi">Full documentation</a></p>
117118
</section>
@@ -183,6 +184,45 @@ <h2>If you prefer a slightly more Pythonistic API and don’t mind it might be s
183184
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/pyray.html">the Python API</a>.</p>
184185
</section>
185186
</section>
187+
<section id="running-in-a-web-browser">
188+
<h1>Running in a web browser<a class="headerlink" href="#running-in-a-web-browser" title="Link to this heading"></a></h1>
189+
<p><a class="reference external" href="https://pypi.org/project/pygbag/">Pygbag</a> &gt;=0.8.7 supports running in a web browser.</p>
190+
<p>Make a folder <code class="docutils literal notranslate"><span class="pre">my_project</span></code> with a file <code class="docutils literal notranslate"><span class="pre">main.py</span></code>:</p>
191+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span># /// script
192+
# dependencies = [
193+
# &quot;cffi&quot;,
194+
# &quot;inflection&quot;,
195+
# &quot;raylib&quot;
196+
# ]
197+
# ///
198+
import asyncio
199+
import platform
200+
from pyray import *
201+
202+
async def main(): # You must have an async main function
203+
init_window(500, 500, &quot;Hello&quot;)
204+
platform.window.window_resize() # You must add this line
205+
while not window_should_close():
206+
begin_drawing()
207+
clear_background(WHITE)
208+
draw_text(&quot;Hello world&quot;, 190, 200, 20, VIOLET)
209+
end_drawing()
210+
await asyncio.sleep(0) # You must call this in your main loop
211+
close_window()
212+
213+
asyncio.run(main())
214+
</pre></div>
215+
</div>
216+
<p>Then to create the web files and launch a web server:</p>
217+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install --user --upgrade git+https://github.com/pygame-web/pygbag
218+
python3 -m pygbag --git --PYBUILD 3.12 --ume_block 0 --template noctx.tmpl my_project
219+
</pre></div>
220+
</div>
221+
<p>Point your browser to http://localhost:8000</p>
222+
<p>This is all done by Pygbag rather than by me, so you should probably contact them with any issues.
223+
Carefully read all their <a class="reference external" href="https://pygame-web.github.io/">documentation</a>.</p>
224+
<p>It does work for most of the examples at https://electronstudio.github.io/raylib-python-cffi-pygbag-examples/</p>
225+
</section>
186226
<section id="app-showcase">
187227
<h1>App showcase<a class="headerlink" href="#app-showcase" title="Link to this heading"></a></h1>
188228
<p><a class="reference external" href="https://github.com/pkulev/tanki">Tanki</a></p>

0 commit comments

Comments
 (0)