improve docs, make clear different APIs and static/dynamic
This commit is contained in:
parent
47c4d0d1b4
commit
9e17046408
49 changed files with 5467 additions and 17850 deletions
19
BUILDING.rst
19
BUILDING.rst
|
@ -59,8 +59,7 @@ Build and install Raylib from the raylib-c directory.
|
|||
|
||||
To update the dynamic libs, download the official release,
|
||||
e.g. https://github.com/raysan5/raylib/releases/download/3.7.0/raylib-3.7.0_win64_msvc16.zip
|
||||
and extract ``raylib.dll`` into ``raylib/dynamic``. Delete the files for
|
||||
other platforms, unless you want them in your distribution.
|
||||
and extract ``raylib.dll`` into ``dynamic/raylib``.
|
||||
|
||||
To build a binary wheel distribution:
|
||||
|
||||
|
@ -111,7 +110,7 @@ Build and install Raylib from the raylib-c directory.
|
|||
sudo make install
|
||||
|
||||
.. note:: Optional: Build the Raylib shared libs, if you plan to use
|
||||
``raylib.dynamic`` binding.
|
||||
``raylib_dynamic`` binding.
|
||||
|
||||
::
|
||||
|
||||
|
@ -148,8 +147,8 @@ Build
|
|||
|
||||
::
|
||||
|
||||
rm raylib/dynamic/*.so*
|
||||
cp -P /usr/local/lib/libraylib.so* raylib/dynamic/
|
||||
rm dynamic/raylib/*.so*
|
||||
cp -P /usr/local/lib/libraylib.so* dynamic/raylib/
|
||||
|
||||
To build a binary wheel distribution:
|
||||
|
||||
|
@ -158,12 +157,6 @@ To build a binary wheel distribution:
|
|||
pip3 install wheel
|
||||
python3 setup.py bdist_wheel
|
||||
|
||||
Alternatively, if you don’t want the static binaries and just want to
|
||||
use DLLs with raylib.dynamic:
|
||||
|
||||
::
|
||||
|
||||
python3 setup_dynamic.py bdist_wheel
|
||||
|
||||
Then install it:
|
||||
|
||||
|
@ -183,8 +176,8 @@ To build a complete set of libs for Python 3.6, 3.7, 3.8 and 3.9:
|
|||
``./raylib/static/build_multi_linux.sh`` )
|
||||
|
||||
.. TODO::
|
||||
move the dynamic libs into a separate package rather than include
|
||||
them with every one.
|
||||
Separate the instructions for preparing the dynamic module
|
||||
from the instructions for building the static module!
|
||||
|
||||
|
||||
|
||||
|
|
14
README.md
14
README.md
|
@ -27,24 +27,26 @@ using homebrew, apt, etc.
|
|||
|
||||
[If it doesn't work, build from source](BUILDING.md)
|
||||
|
||||
There is now a separate dynamic version of this binding:
|
||||
|
||||
python3 -m pip install raylib_dynamic
|
||||
|
||||
[Read this before using raylib_dynamic](https://electronstudio.github.io/raylib-python-cffi/dynamic.html)
|
||||
|
||||
|
||||
# How to use
|
||||
|
||||
There are three different ways of using this binding. You only need to pick one method, but you
|
||||
There are two different ways of using this binding. You only need to pick one method, but you
|
||||
can combine two methods in one program if you want to.
|
||||
|
||||
### If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API
|
||||
|
||||
Use [raylib.static](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
|
||||
Use [the C API](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
|
||||
|
||||
### If you prefer a slightly more Pythonistic API and don't mind it might be slightly slower
|
||||
|
||||
Use [raylib.pyray](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
|
||||
Use [the Python API](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
|
||||
|
||||
### If you insist on dynamic bindings and don't care that they are slower and less safe
|
||||
|
||||
Use [raylib.dynamic](https://electronstudio.github.io/raylib-python-cffi/dynamic.html).
|
||||
|
||||
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,4 +1,4 @@
|
|||
# Sphinx build info version 1
|
||||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
|
||||
config: c6c8605a01fab3fc8b4c8636342889f3
|
||||
config: ea2d09333a22dd4475734aaaf7403057
|
||||
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
raylib.pyray
|
||||
============
|
||||
Python API
|
||||
==============
|
||||
|
||||
.. comment::
|
||||
|
||||
|
@ -10,7 +10,7 @@ raylib.pyray
|
|||
autoapi/raylib/pyray/index
|
||||
|
||||
|
||||
This is a wrapper around the static bindings.
|
||||
This is a wrapper around the C API with some syntactic sugar.
|
||||
|
||||
The API is *still the same as Raylib*, so you should still reply on `the official Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_, except:
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
raylib.static
|
||||
C API
|
||||
=============
|
||||
|
||||
The goal of raylib.static is make usage as similar to the original C as CFFI will allow. The `example programs <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
|
||||
The goal of the C API is make usage as similar to the original C as CFFI will allow. The `example programs <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
|
||||
are very, very similar to the C originals.
|
||||
|
||||
Example program:
|
||||
|
||||
.. code-block::
|
||||
|
||||
from raylib.static import *
|
||||
from raylib import *
|
||||
|
||||
InitWindow(800, 450, b"Hello Raylib")
|
||||
SetTargetFPS(60)
|
||||
|
@ -27,18 +27,30 @@ Example program:
|
|||
EndDrawing()
|
||||
CloseWindow()
|
||||
|
||||
If you want to be more portable you can prefix the functions like this:
|
||||
|
||||
.. code-block::
|
||||
|
||||
from raylib import ffi, rl, colors
|
||||
|
||||
rl.InitWindow(800, 450, b"Hello Raylib")
|
||||
rl.SetTargetFPS(60)
|
||||
|
||||
...
|
||||
|
||||
|
||||
See also https://github.com/electronstudio/raylib-python-cffi/blob/master/test_static.py
|
||||
|
||||
Also useful to read whenever you need to convert stuff between C and Python: https://cffi.readthedocs.io
|
||||
.. note:: Whenever you need to convert stuff between C and Python see https://cffi.readthedocs.io
|
||||
|
||||
Your **primary reference** should always be `the official Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
|
||||
.. important:: Your **primary reference** should always be `the official Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
|
||||
|
||||
However, here is a list of available functions:
|
||||
|
||||
Functions API reference
|
||||
-----------------------
|
||||
|
||||
.. autoapimodule:: raylib.static
|
||||
.. autoapimodule:: raylib
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Sphinx build info version 1
|
||||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
|
||||
config: c6c8605a01fab3fc8b4c8636342889f3
|
||||
config: ea2d09333a22dd4475734aaaf7403057
|
||||
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Building from source — Raylib Python documentation</title><link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<title>Building from source — Raylib Python documentation</title>
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="_static/js/html5shiv.min.js"></script>
|
||||
<![endif]-->
|
||||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||||
|
||||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||
<script src="_static/jquery.js"></script>
|
||||
<script src="_static/underscore.js"></script>
|
||||
<script src="_static/doctools.js"></script>
|
||||
<script src="_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
<link rel="search" title="Search" href="search.html" />
|
||||
<link rel="prev" title="raylib.dynamic" href="dynamic.html" />
|
||||
<link rel="prev" title="Dynamic Bindings" href="dynamic.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
@ -34,7 +37,7 @@
|
|||
</form>
|
||||
</div>
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption"><span class="caption-text">Contents:</span></p>
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 3.7</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#license-updated">License (updated)</a></li>
|
||||
|
@ -45,9 +48,9 @@
|
|||
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">raylib.pyray</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">raylib.static</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">raylib.dynamic</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">Dynamic Bindings</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Building from source</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#have-pip-build-from-source">Have Pip build from source</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#build-from-source-manually">Build from source manually</a><ul>
|
||||
|
@ -85,17 +88,17 @@
|
|||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<div class="section" id="building-from-source">
|
||||
<section id="building-from-source">
|
||||
<h1>Building from source<a class="headerlink" href="#building-from-source" title="Permalink to this headline"></a></h1>
|
||||
<div class="section" id="have-pip-build-from-source">
|
||||
<section id="have-pip-build-from-source">
|
||||
<h2>Have Pip build from source<a class="headerlink" href="#have-pip-build-from-source" title="Permalink to this headline"></a></h2>
|
||||
<p>Useful if the binaries don’t work on your system.</p>
|
||||
<p>Make sure Raylib is installed and then:</p>
|
||||
<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>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="build-from-source-manually">
|
||||
</section>
|
||||
<section id="build-from-source-manually">
|
||||
<h2>Build from source manually<a class="headerlink" href="#build-from-source-manually" title="Permalink to this headline"></a></h2>
|
||||
<p>Useful if the Pip build doesn’t work, or you want to contribute to the
|
||||
project, or you want to skip building the static lib and just <em>use the
|
||||
|
@ -107,7 +110,7 @@ fixed it, a PR.)</p>
|
|||
</div>
|
||||
<p>Manual instructions follow, but see also how we actually build the wheels
|
||||
at <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml">https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml</a></p>
|
||||
<div class="section" id="windows-manual-build">
|
||||
<section id="windows-manual-build">
|
||||
<h3>Windows manual build<a class="headerlink" href="#windows-manual-build" title="Permalink to this headline"></a></h3>
|
||||
<p>Clone this repo including submodules so you get correct version of
|
||||
Raylib.</p>
|
||||
|
@ -132,8 +135,7 @@ Raylib.</p>
|
|||
</div>
|
||||
<p>To update the dynamic libs, download the official release,
|
||||
e.g. <a class="reference external" href="https://github.com/raysan5/raylib/releases/download/3.7.0/raylib-3.7.0_win64_msvc16.zip">https://github.com/raysan5/raylib/releases/download/3.7.0/raylib-3.7.0_win64_msvc16.zip</a>
|
||||
and extract <code class="docutils literal notranslate"><span class="pre">raylib.dll</span></code> into <code class="docutils literal notranslate"><span class="pre">raylib/dynamic</span></code>. Delete the files for
|
||||
other platforms, unless you want them in your distribution.</p>
|
||||
and extract <code class="docutils literal notranslate"><span class="pre">raylib.dll</span></code> into <code class="docutils literal notranslate"><span class="pre">dynamic/raylib</span></code>.</p>
|
||||
<p>To build a binary wheel distribution:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rmdir</span> <span class="o">/</span><span class="n">Q</span> <span class="o">/</span><span class="n">S</span> <span class="n">build</span>
|
||||
<span class="n">pip3</span> <span class="n">install</span> <span class="n">cffi</span>
|
||||
|
@ -147,13 +149,13 @@ use DLLs with raylib.dynamic:</p>
|
|||
</pre></div>
|
||||
</div>
|
||||
<p>Then install it:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="n">dist</span>\<span class="n">raylib</span><span class="o">-</span><span class="mf">3.7</span><span class="o">.</span><span class="mi">0</span><span class="o">-</span><span class="n">cp37</span><span class="o">-</span><span class="n">cp37m</span><span class="o">-</span><span class="n">win_amd64</span><span class="o">.</span><span class="n">whl</span>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="n">dist</span>\<span class="n">raylib</span><span class="o">-</span><span class="mf">3.7.0</span><span class="o">-</span><span class="n">cp37</span><span class="o">-</span><span class="n">cp37m</span><span class="o">-</span><span class="n">win_amd64</span><span class="o">.</span><span class="n">whl</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>(Note: your wheel’s filename will probably be different than the one
|
||||
here.)</p>
|
||||
</div>
|
||||
<div class="section" id="linux-manual-build">
|
||||
</section>
|
||||
<section id="linux-manual-build">
|
||||
<h3>Linux manual build<a class="headerlink" href="#linux-manual-build" title="Permalink to this headline"></a></h3>
|
||||
<p>These instructions have been tested on Ubuntu 20.10 and 16.04.</p>
|
||||
<p>Clone this repo including submodules so you get correct version of
|
||||
|
@ -173,7 +175,7 @@ Raylib.</p>
|
|||
<div class="admonition note">
|
||||
<p class="admonition-title">Note</p>
|
||||
<p>Optional: Build the Raylib shared libs, if you plan to use
|
||||
<code class="docutils literal notranslate"><span class="pre">raylib.dynamic</span></code> binding.</p>
|
||||
<code class="docutils literal notranslate"><span class="pre">raylib_dynamic</span></code> binding.</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rm</span> <span class="o">-</span><span class="n">rf</span> <span class="o">*</span>
|
||||
<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">DBUILD_SHARED_LIBS</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>
|
||||
<span class="n">make</span>
|
||||
|
@ -205,8 +207,8 @@ anything.)</p>
|
|||
<div class="admonition note">
|
||||
<p class="admonition-title">Note</p>
|
||||
<p>(Optional) To update the Linux dynamic libs (names will be different on other platfroms):</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rm</span> <span class="n">raylib</span><span class="o">/</span><span class="n">dynamic</span><span class="o">/*.</span><span class="n">so</span><span class="o">*</span>
|
||||
<span class="n">cp</span> <span class="o">-</span><span class="n">P</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">libraylib</span><span class="o">.</span><span class="n">so</span><span class="o">*</span> <span class="n">raylib</span><span class="o">/</span><span class="n">dynamic</span><span class="o">/</span>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rm</span> <span class="n">dynamic</span><span class="o">/</span><span class="n">raylib</span><span class="o">/*.</span><span class="n">so</span><span class="o">*</span>
|
||||
<span class="n">cp</span> <span class="o">-</span><span class="n">P</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">libraylib</span><span class="o">.</span><span class="n">so</span><span class="o">*</span> <span class="n">dynamic</span><span class="o">/</span><span class="n">raylib</span><span class="o">/</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -215,11 +217,6 @@ anything.)</p>
|
|||
<span class="n">python3</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">bdist_wheel</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Alternatively, if you don’t want the static binaries and just want to
|
||||
use DLLs with raylib.dynamic:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="n">setup_dynamic</span><span class="o">.</span><span class="n">py</span> <span class="n">bdist_wheel</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Then install it:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="n">dist</span><span class="o">/</span><span class="n">raylib</span><span class="o">*.</span><span class="n">whl</span>
|
||||
</pre></div>
|
||||
|
@ -236,11 +233,11 @@ use DLLs with raylib.dynamic:</p>
|
|||
</div>
|
||||
<div class="admonition-todo admonition" id="id1">
|
||||
<p class="admonition-title">Todo</p>
|
||||
<p>move the dynamic libs into a separate package rather than include
|
||||
them with every one.</p>
|
||||
<p>Separate the instructions for preparing the dynamic module
|
||||
from the instructions for building the static module!</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="macos-manual-build">
|
||||
</section>
|
||||
<section id="macos-manual-build">
|
||||
<h3>Macos manual build<a class="headerlink" href="#macos-manual-build" title="Permalink to this headline"></a></h3>
|
||||
<p>These instructions have been tested on Macos 10.14.</p>
|
||||
<p>Clone this repo including submodules so you get correct version of
|
||||
|
@ -248,9 +245,10 @@ Raylib.</p>
|
|||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="o">--</span><span class="n">recurse</span><span class="o">-</span><span class="n">submodules</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">electronstudio</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Build Raylib from the raylib-c directory.</p>
|
||||
<p>Build and install Raylib from the raylib-c directory.</p>
|
||||
<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="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><span class="o">/</span><span class="n">src</span>
|
||||
<span class="n">make</span>
|
||||
<span class="n">sudo</span> <span class="n">cp</span> <span class="n">libraylib</span><span class="o">.</span><span class="n">a</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">libraylib</span><span class="o">.</span><span class="n">a</span>
|
||||
<span class="n">cd</span> <span class="o">../..</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
|
@ -262,8 +260,8 @@ Raylib.</p>
|
|||
<span class="n">python3</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">install</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="raspberry-pi">
|
||||
</section>
|
||||
<section id="raspberry-pi">
|
||||
<h3>Raspberry Pi<a class="headerlink" href="#raspberry-pi" title="Permalink to this headline"></a></h3>
|
||||
<p>The integrated GPU hardware in a Raspberry Pi (“VideoCore”) is rather
|
||||
idiosyncratic, resulting in a complex set of software options. Probably
|
||||
|
@ -289,15 +287,15 @@ modifications:</p>
|
|||
<p>(See
|
||||
<a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues/31#issuecomment-862078330">here</a>
|
||||
for a Raspberry Pi wheel)</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||
<a href="dynamic.html" class="btn btn-neutral float-left" title="raylib.dynamic" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||
<a href="dynamic.html" class="btn btn-neutral float-left" title="Dynamic Bindings" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Python Bindings for Raylib 3.7 — Raylib Python documentation</title><link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<title>Python Bindings for Raylib 3.7 — Raylib Python documentation</title>
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="_static/js/html5shiv.min.js"></script>
|
||||
<![endif]-->
|
||||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||||
|
||||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||
<script src="_static/jquery.js"></script>
|
||||
<script src="_static/underscore.js"></script>
|
||||
<script src="_static/doctools.js"></script>
|
||||
<script src="_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
<link rel="search" title="Search" href="search.html" />
|
||||
<link rel="next" title="raylib.pyray" href="pyray.html" />
|
||||
<link rel="next" title="Python API" href="pyray.html" />
|
||||
<link rel="prev" title="Raylib Python" href="index.html" />
|
||||
</head>
|
||||
|
||||
|
@ -35,7 +38,7 @@
|
|||
</form>
|
||||
</div>
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption"><span class="caption-text">Contents:</span></p>
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Python Bindings for Raylib 3.7</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="#license-updated">License (updated)</a></li>
|
||||
|
@ -43,7 +46,6 @@
|
|||
<li class="toctree-l1"><a class="reference internal" href="#how-to-use">How to use</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api">If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API</a></li>
|
||||
<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>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#if-you-insist-on-dynamic-bindings-and-don-t-care-that-they-are-slower-and-less-safe">If you insist on dynamic bindings and don’t care that they are slower and less safe</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="#rlzero">RLZero</a></li>
|
||||
|
@ -54,9 +56,9 @@
|
|||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="#packaging-your-app">Packaging your app</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="#advert">Advert</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">raylib.pyray</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">raylib.static</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">raylib.dynamic</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">Dynamic Bindings</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="BUILDING.html">Building from source</a></li>
|
||||
</ul>
|
||||
|
||||
|
@ -84,63 +86,69 @@
|
|||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<div class="tex2jax_ignore mathjax_ignore section" id="python-bindings-for-raylib-3-7">
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="python-bindings-for-raylib-3-7">
|
||||
<h1>Python Bindings for Raylib 3.7<a class="headerlink" href="#python-bindings-for-raylib-3-7" title="Permalink to this headline"></a></h1>
|
||||
<p>New CFFI API static bindings. Automatically generated to be as close as possible to
|
||||
original Raylib. Faster, fewer bugs and easier to maintain than ctypes.</p>
|
||||
<p><a class="reference external" href="http://electronstudio.github.io/raylib-python-cffi">Full documentation</a></p>
|
||||
</div>
|
||||
<div class="tex2jax_ignore mathjax_ignore section" id="license-updated">
|
||||
</section>
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="license-updated">
|
||||
<h1>License (updated)<a class="headerlink" href="#license-updated" title="Permalink to this headline"></a></h1>
|
||||
<p>The bindings are now under the Eclipse Public License, so you are free to
|
||||
statically link and use in non-free / proprietary / commercial projects!</p>
|
||||
</div>
|
||||
<div class="tex2jax_ignore mathjax_ignore section" id="installation">
|
||||
</section>
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="installation">
|
||||
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this headline"></a></h1>
|
||||
<p>We distribute a statically linked binary Raylib wheel:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>pip3 install raylib
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install raylib
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Problems may be caused by out of date pip:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install --upgrade pip
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Some platforms that <em>should</em> be available: Windows 10 x64, MacOS 10.15 x64, Linux Ubuntu1804 x64.</p>
|
||||
<p>If yours isn’t available then pip will attempt to build from source, so you will need to have Raylib development libs installed.</p>
|
||||
<p>If yours isn’t available then pip will attempt to build from source, in which case you will need to have Raylib development libs installed, e.g.
|
||||
using homebrew, apt, etc.</p>
|
||||
<p><a class="reference internal" href="BUILDING.html"><span class="doc std std-doc">If it doesn’t work, build from source</span></a></p>
|
||||
<p>There is now a separate dynamic version of this binding:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install raylib_dynamic
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="tex2jax_ignore mathjax_ignore section" id="how-to-use">
|
||||
<p><a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/dynamic.html">Read this before using raylib_dynamic</a></p>
|
||||
</section>
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="how-to-use">
|
||||
<h1>How to use<a class="headerlink" href="#how-to-use" title="Permalink to this headline"></a></h1>
|
||||
<p>There are three different ways of using this binding. You only need to pick one method, but you
|
||||
<p>There are two different ways of using this binding. You only need to pick one method, but you
|
||||
can combine two methods in one program if you want to.</p>
|
||||
<div class="section" id="if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api">
|
||||
<section id="if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api">
|
||||
<h2>If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API<a class="headerlink" href="#if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api" title="Permalink to this headline"></a></h2>
|
||||
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/raylib.html">raylib.static</a>.</p>
|
||||
</div>
|
||||
<div class="section" id="if-you-prefer-a-slightly-more-pythonistic-api-and-don-t-mind-it-might-be-slightly-slower">
|
||||
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/raylib.html">the C API</a>.</p>
|
||||
</section>
|
||||
<section id="if-you-prefer-a-slightly-more-pythonistic-api-and-don-t-mind-it-might-be-slightly-slower">
|
||||
<h2>If you prefer a slightly more Pythonistic API and don’t mind it might be slightly slower<a class="headerlink" href="#if-you-prefer-a-slightly-more-pythonistic-api-and-don-t-mind-it-might-be-slightly-slower" title="Permalink to this headline"></a></h2>
|
||||
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/pyray.html">raylib.pyray</a>.</p>
|
||||
</div>
|
||||
<div class="section" id="if-you-insist-on-dynamic-bindings-and-don-t-care-that-they-are-slower-and-less-safe">
|
||||
<h2>If you insist on dynamic bindings and don’t care that they are slower and less safe<a class="headerlink" href="#if-you-insist-on-dynamic-bindings-and-don-t-care-that-they-are-slower-and-less-safe" title="Permalink to this headline"></a></h2>
|
||||
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/dynamic.html">raylib.dynamic</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tex2jax_ignore mathjax_ignore section" id="rlzero">
|
||||
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/pyray.html">the Python API</a>.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="rlzero">
|
||||
<h1>RLZero<a class="headerlink" href="#rlzero" title="Permalink to this headline"></a></h1>
|
||||
<p>Work in progress:</p>
|
||||
<p><a class="reference external" href="https://github.com/electronstudio/rlzero">A simplified API for Raylib for use in education and to enable beginners to create 3d games</a></p>
|
||||
</div>
|
||||
<div class="tex2jax_ignore mathjax_ignore section" id="help-wanted">
|
||||
</section>
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="help-wanted">
|
||||
<h1>Help wanted<a class="headerlink" href="#help-wanted" title="Permalink to this headline"></a></h1>
|
||||
<ul class="simple">
|
||||
<li><p>converting more examples from C to python</p></li>
|
||||
<li><p>testing and building on more platforms</p></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tex2jax_ignore mathjax_ignore section" id="performance">
|
||||
</section>
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="performance">
|
||||
<h1>Performance<a class="headerlink" href="#performance" title="Permalink to this headline"></a></h1>
|
||||
<p>For fastest permformance use Pypy rather than standard python.</p>
|
||||
<p>Every call to C is costly, so it’s slightly faster if you use Python data structures and functions when calculating
|
||||
in your update loop
|
||||
and then only convert them to C data structures when you have to call the C functions for drawing.</p>
|
||||
<div class="section" id="bunnymark">
|
||||
<section id="bunnymark">
|
||||
<h2>Bunnymark<a class="headerlink" href="#bunnymark" title="Permalink to this headline"></a></h2>
|
||||
<table class="colwidths-auto docutils align-default">
|
||||
<thead>
|
||||
|
@ -178,9 +186,9 @@ and then only convert them to C data structures when you have to call the C func
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tex2jax_ignore mathjax_ignore section" id="packaging-your-app">
|
||||
</section>
|
||||
</section>
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="packaging-your-app">
|
||||
<h1>Packaging your app<a class="headerlink" href="#packaging-your-app" title="Permalink to this headline"></a></h1>
|
||||
<p>You can create a standalone binary using the Nuitka compiler. For example, here is how to package Bunnymark:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>pip3 install nuitka
|
||||
|
@ -188,20 +196,20 @@ cd examples/textures
|
|||
python3 -m nuitka --onefile --linux-onefile-icon resources/wabbit_alpha.png textures_bunnymark.py
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tex2jax_ignore mathjax_ignore section" id="advert">
|
||||
</section>
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="advert">
|
||||
<h1>Advert<a class="headerlink" href="#advert" title="Permalink to this headline"></a></h1>
|
||||
<p><a class="reference external" href="https://store.steampowered.com/app/664240/RetroWar_8bit_Party_Battle/?git">RetroWar: 8-bit Party Battle</a> is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.</p>
|
||||
<p><a class="reference external" href="https://github.com/electronstudio/pygame-zero-book">Coding Games With Pygame Zero & Python</a> is
|
||||
a book for Python beginners.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||
<a href="index.html" class="btn btn-neutral float-left" title="Raylib Python" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||
<a href="pyray.html" class="btn btn-neutral float-right" title="raylib.pyray" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||
<a href="pyray.html" class="btn btn-neutral float-right" title="Python API" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
|
|
@ -59,8 +59,7 @@ Build and install Raylib from the raylib-c directory.
|
|||
|
||||
To update the dynamic libs, download the official release,
|
||||
e.g. https://github.com/raysan5/raylib/releases/download/3.7.0/raylib-3.7.0_win64_msvc16.zip
|
||||
and extract ``raylib.dll`` into ``raylib/dynamic``. Delete the files for
|
||||
other platforms, unless you want them in your distribution.
|
||||
and extract ``raylib.dll`` into ``dynamic/raylib``.
|
||||
|
||||
To build a binary wheel distribution:
|
||||
|
||||
|
@ -111,7 +110,7 @@ Build and install Raylib from the raylib-c directory.
|
|||
sudo make install
|
||||
|
||||
.. note:: Optional: Build the Raylib shared libs, if you plan to use
|
||||
``raylib.dynamic`` binding.
|
||||
``raylib_dynamic`` binding.
|
||||
|
||||
::
|
||||
|
||||
|
@ -148,8 +147,8 @@ Build
|
|||
|
||||
::
|
||||
|
||||
rm raylib/dynamic/*.so*
|
||||
cp -P /usr/local/lib/libraylib.so* raylib/dynamic/
|
||||
rm dynamic/raylib/*.so*
|
||||
cp -P /usr/local/lib/libraylib.so* dynamic/raylib/
|
||||
|
||||
To build a binary wheel distribution:
|
||||
|
||||
|
@ -158,12 +157,6 @@ To build a binary wheel distribution:
|
|||
pip3 install wheel
|
||||
python3 setup.py bdist_wheel
|
||||
|
||||
Alternatively, if you don’t want the static binaries and just want to
|
||||
use DLLs with raylib.dynamic:
|
||||
|
||||
::
|
||||
|
||||
python3 setup_dynamic.py bdist_wheel
|
||||
|
||||
Then install it:
|
||||
|
||||
|
@ -183,8 +176,8 @@ To build a complete set of libs for Python 3.6, 3.7, 3.8 and 3.9:
|
|||
``./raylib/static/build_multi_linux.sh`` )
|
||||
|
||||
.. TODO::
|
||||
move the dynamic libs into a separate package rather than include
|
||||
them with every one.
|
||||
Separate the instructions for preparing the dynamic module
|
||||
from the instructions for building the static module!
|
||||
|
||||
|
||||
|
||||
|
@ -200,12 +193,13 @@ Raylib.
|
|||
|
||||
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
|
||||
|
||||
Build Raylib from the raylib-c directory.
|
||||
Build and install Raylib from the raylib-c directory.
|
||||
|
||||
::
|
||||
|
||||
cd raylib-python-cffi/raylib-c/src
|
||||
make
|
||||
sudo cp libraylib.a /usr/local/lib/libraylib.a
|
||||
cd ../..
|
||||
|
||||
|
||||
|
|
|
@ -14,32 +14,39 @@ statically link and use in non-free / proprietary / commercial projects!
|
|||
|
||||
We distribute a statically linked binary Raylib wheel:
|
||||
|
||||
pip3 install raylib
|
||||
python3 -m pip install raylib
|
||||
|
||||
Problems may be caused by out of date pip:
|
||||
|
||||
python3 -m pip install --upgrade pip
|
||||
|
||||
Some platforms that _should_ be available: Windows 10 x64, MacOS 10.15 x64, Linux Ubuntu1804 x64.
|
||||
|
||||
If yours isn't available then pip will attempt to build from source, so you will need to have Raylib development libs installed.
|
||||
If yours isn't available then pip will attempt to build from source, in which case you will need to have Raylib development libs installed, e.g.
|
||||
using homebrew, apt, etc.
|
||||
|
||||
[If it doesn't work, build from source](BUILDING.md)
|
||||
|
||||
There is now a separate dynamic version of this binding:
|
||||
|
||||
python3 -m pip install raylib_dynamic
|
||||
|
||||
[Read this before using raylib_dynamic](https://electronstudio.github.io/raylib-python-cffi/dynamic.html)
|
||||
|
||||
|
||||
# How to use
|
||||
|
||||
There are three different ways of using this binding. You only need to pick one method, but you
|
||||
There are two different ways of using this binding. You only need to pick one method, but you
|
||||
can combine two methods in one program if you want to.
|
||||
|
||||
### If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API
|
||||
|
||||
Use [raylib.static](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
|
||||
Use [the C API](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
|
||||
|
||||
### If you prefer a slightly more Pythonistic API and don't mind it might be slightly slower
|
||||
|
||||
Use [raylib.pyray](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
|
||||
Use [the Python API](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
|
||||
|
||||
### If you insist on dynamic bindings and don't care that they are slower and less safe
|
||||
|
||||
Use [raylib.dynamic](https://electronstudio.github.io/raylib-python-cffi/dynamic.html).
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,28 +1,38 @@
|
|||
raylib.dynamic
|
||||
==============
|
||||
|
||||
CFFI ABI dynamic bindings exist in order to avoid the need to compile a C extension module.
|
||||
|
||||
See https://github.com/electronstudio/raylib-python-cffi/blob/master/test_static.py for how to use.
|
||||
|
||||
Currently the github version may include bundled DLLs in ``raylib/dynamic`` but the pypi version requires a system installed Raylib.
|
||||
You can put your own DLLs in ``raylib/dynamic`` if you prefer.
|
||||
|
||||
If your system already has the Raylib library installed, you can set the environment variable ``USE_EXTERNAL_RAYLIB`` and it will
|
||||
always be used instead of the bundled DLLs.
|
||||
|
||||
If you want to build your own wheel with just raylib.dynamic and not even attempt to compile the static libraries,
|
||||
the command is::
|
||||
|
||||
python3 setup_dynamic.py bdist_wheel
|
||||
Dynamic Bindings
|
||||
================
|
||||
|
||||
CFFI ABI dynamic bindings avoid the need to compile a C extension module. They now been moved to a separate module::
|
||||
|
||||
python3 -m pip install raylib_dynamic
|
||||
|
||||
.. warning::
|
||||
|
||||
There have been some weird failures with dynamic bindings and ctypes bindings before and often the
|
||||
failures are silent
|
||||
so you dont even know. Also the static bindings should be faster. Therefore I personally recommend the static ones.
|
||||
But the dynamic bindings have the big advantage that you don't need to compile anything to install. You just need a Raylib DLL.
|
||||
so you don't even know something has gone wrong and you don't get proper stacktraces. Also the static bindings are faster.
|
||||
Therefore I personally recommend the static ones.
|
||||
But the dynamic bindings have the advantage that you don't need to compile anything to install. You just need a Raylib DLL.
|
||||
|
||||
API is the same as raylib.static.
|
||||
API is exactly the same as the static one documented here. (Therefore you can't have both modules installed at once.) The only difference is you can't do::
|
||||
|
||||
from raylib import *
|
||||
|
||||
Instead you have to do::
|
||||
|
||||
from raylib import rl
|
||||
|
||||
Then you access the functions with ``rl.`` prefix. See
|
||||
|
||||
See https://github.com/electronstudio/raylib-python-cffi/blob/master/dynamic/test_dynamic.py for an example.
|
||||
|
||||
If you use the ``rl.`` prefix then code will work on both static and dynamic bindings.
|
||||
|
||||
.. warning::
|
||||
|
||||
If you access functions via ``raylib.pyray`` then there is no difference at all, but be warned this hasn't been tested.
|
||||
|
||||
|
||||
.. important::
|
||||
|
||||
If your system already has the Raylib library installed, you can set the environment variable ``USE_EXTERNAL_RAYLIB`` and it will
|
||||
always be used instead of the bundled DLLs.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
raylib.pyray
|
||||
============
|
||||
Python API
|
||||
==============
|
||||
|
||||
.. comment::
|
||||
|
||||
|
@ -10,7 +10,7 @@ raylib.pyray
|
|||
autoapi/raylib/pyray/index
|
||||
|
||||
|
||||
This is a wrapper around the static bindings.
|
||||
This is a wrapper around the C API with some syntactic sugar.
|
||||
|
||||
The API is *still the same as Raylib*, so you should still reply on `the official Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_, except:
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
raylib.static
|
||||
C API
|
||||
=============
|
||||
|
||||
The goal of raylib.static is make usage as similar to the original C as CFFI will allow. The `example programs <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
|
||||
The goal of the C API is make usage as similar to the original C as CFFI will allow. The `example programs <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
|
||||
are very, very similar to the C originals.
|
||||
|
||||
Example program:
|
||||
|
||||
.. code-block::
|
||||
|
||||
from raylib.static import *
|
||||
from raylib import *
|
||||
|
||||
InitWindow(800, 450, b"Hello Raylib")
|
||||
SetTargetFPS(60)
|
||||
|
@ -27,18 +27,30 @@ Example program:
|
|||
EndDrawing()
|
||||
CloseWindow()
|
||||
|
||||
If you want to be more portable you can prefix the functions like this:
|
||||
|
||||
.. code-block::
|
||||
|
||||
from raylib import ffi, rl, colors
|
||||
|
||||
rl.InitWindow(800, 450, b"Hello Raylib")
|
||||
rl.SetTargetFPS(60)
|
||||
|
||||
...
|
||||
|
||||
|
||||
See also https://github.com/electronstudio/raylib-python-cffi/blob/master/test_static.py
|
||||
|
||||
Also useful to read whenever you need to convert stuff between C and Python: https://cffi.readthedocs.io
|
||||
.. note:: Whenever you need to convert stuff between C and Python see https://cffi.readthedocs.io
|
||||
|
||||
Your **primary reference** should always be `the official Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
|
||||
.. important:: Your **primary reference** should always be `the official Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
|
||||
|
||||
However, here is a list of available functions:
|
||||
|
||||
Functions API reference
|
||||
-----------------------
|
||||
|
||||
.. autoapimodule:: raylib.static
|
||||
.. autoapimodule:: raylib
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
|
|
108
docs/_static/basic.css
vendored
108
docs/_static/basic.css
vendored
|
@ -130,7 +130,7 @@ ul.search li a {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
ul.search li div.context {
|
||||
ul.search li p.context {
|
||||
color: #888;
|
||||
margin: 2px 0 0 30px;
|
||||
text-align: left;
|
||||
|
@ -277,25 +277,25 @@ p.rubric {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left {
|
||||
img.align-left, figure.align-left, .figure.align-left, object.align-left {
|
||||
clear: left;
|
||||
float: left;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right {
|
||||
img.align-right, figure.align-right, .figure.align-right, object.align-right {
|
||||
clear: right;
|
||||
float: right;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
img.align-center, figure.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
img.align-default, .figure.align-default {
|
||||
img.align-default, figure.align-default, .figure.align-default {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
@ -319,7 +319,8 @@ img.align-default, .figure.align-default {
|
|||
|
||||
/* -- sidebars -------------------------------------------------------------- */
|
||||
|
||||
div.sidebar {
|
||||
div.sidebar,
|
||||
aside.sidebar {
|
||||
margin: 0 0 0.5em 1em;
|
||||
border: 1px solid #ddb;
|
||||
padding: 7px;
|
||||
|
@ -377,12 +378,14 @@ div.body p.centered {
|
|||
/* -- content of sidebars/topics/admonitions -------------------------------- */
|
||||
|
||||
div.sidebar > :last-child,
|
||||
aside.sidebar > :last-child,
|
||||
div.topic > :last-child,
|
||||
div.admonition > :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
div.sidebar::after,
|
||||
aside.sidebar::after,
|
||||
div.topic::after,
|
||||
div.admonition::after,
|
||||
blockquote::after {
|
||||
|
@ -455,20 +458,22 @@ td > :last-child {
|
|||
|
||||
/* -- figures --------------------------------------------------------------- */
|
||||
|
||||
div.figure {
|
||||
div.figure, figure {
|
||||
margin: 0.5em;
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
div.figure p.caption {
|
||||
div.figure p.caption, figcaption {
|
||||
padding: 0.3em;
|
||||
}
|
||||
|
||||
div.figure p.caption span.caption-number {
|
||||
div.figure p.caption span.caption-number,
|
||||
figcaption span.caption-number {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
div.figure p.caption span.caption-text {
|
||||
div.figure p.caption span.caption-text,
|
||||
figcaption span.caption-text {
|
||||
}
|
||||
|
||||
/* -- field list styles ----------------------------------------------------- */
|
||||
|
@ -503,6 +508,63 @@ table.hlist td {
|
|||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* -- object description styles --------------------------------------------- */
|
||||
|
||||
.sig {
|
||||
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
||||
}
|
||||
|
||||
.sig-name, code.descname {
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.sig-name {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
code.descname {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.sig-prename, code.descclassname {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.optional {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.sig-paren {
|
||||
font-size: larger;
|
||||
}
|
||||
|
||||
.sig-param.n {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* C++ specific styling */
|
||||
|
||||
.sig-inline.c-texpr,
|
||||
.sig-inline.cpp-texpr {
|
||||
font-family: unset;
|
||||
}
|
||||
|
||||
.sig.c .k, .sig.c .kt,
|
||||
.sig.cpp .k, .sig.cpp .kt {
|
||||
color: #0033B3;
|
||||
}
|
||||
|
||||
.sig.c .m,
|
||||
.sig.cpp .m {
|
||||
color: #1750EB;
|
||||
}
|
||||
|
||||
.sig.c .s, .sig.c .sc,
|
||||
.sig.cpp .s, .sig.cpp .sc {
|
||||
color: #067D17;
|
||||
}
|
||||
|
||||
|
||||
/* -- other body styles ----------------------------------------------------- */
|
||||
|
||||
|
@ -629,14 +691,6 @@ dl.glossary dt {
|
|||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.optional {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.sig-paren {
|
||||
font-size: larger;
|
||||
}
|
||||
|
||||
.versionmodified {
|
||||
font-style: italic;
|
||||
}
|
||||
|
@ -765,8 +819,12 @@ div.code-block-caption code {
|
|||
|
||||
table.highlighttable td.linenos,
|
||||
span.linenos,
|
||||
div.doctest > div.highlight span.gp { /* gp: Generic.Prompt */
|
||||
user-select: none;
|
||||
div.highlight span.gp { /* gp: Generic.Prompt */
|
||||
user-select: none;
|
||||
-webkit-user-select: text; /* Safari fallback only */
|
||||
-webkit-user-select: none; /* Chrome/Safari */
|
||||
-moz-user-select: none; /* Firefox */
|
||||
-ms-user-select: none; /* IE10+ */
|
||||
}
|
||||
|
||||
div.code-block-caption span.caption-number {
|
||||
|
@ -781,16 +839,6 @@ div.literal-block-wrapper {
|
|||
margin: 1em 0;
|
||||
}
|
||||
|
||||
code.descname {
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
code.descclassname {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
code.xref, a code {
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
|
|
9
docs/_static/doctools.js
vendored
9
docs/_static/doctools.js
vendored
|
@ -29,9 +29,14 @@ if (!window.console || !console.firebug) {
|
|||
|
||||
/**
|
||||
* small helper function to urldecode strings
|
||||
*
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
|
||||
*/
|
||||
jQuery.urldecode = function(x) {
|
||||
return decodeURIComponent(x).replace(/\+/g, ' ');
|
||||
if (!x) {
|
||||
return x
|
||||
}
|
||||
return decodeURIComponent(x.replace(/\+/g, ' '));
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -296,12 +301,14 @@ var Documentation = {
|
|||
window.location.href = prevHref;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 39: // right
|
||||
var nextHref = $('link[rel="next"]').prop('href');
|
||||
if (nextHref) {
|
||||
window.location.href = nextHref;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
10872
docs/_static/jquery.js
vendored
10872
docs/_static/jquery.js
vendored
File diff suppressed because one or more lines are too long
4
docs/_static/language_data.js
vendored
4
docs/_static/language_data.js
vendored
|
@ -13,7 +13,8 @@
|
|||
var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"];
|
||||
|
||||
|
||||
/* Non-minified version JS is _stemmer.js if file is provided */
|
||||
/* Non-minified version is copied as a separate JS file, is available */
|
||||
|
||||
/**
|
||||
* Porter Stemmer
|
||||
*/
|
||||
|
@ -199,7 +200,6 @@ var Stemmer = function() {
|
|||
|
||||
|
||||
|
||||
|
||||
var splitChars = (function() {
|
||||
var result = {};
|
||||
var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648,
|
||||
|
|
10
docs/_static/pygments.css
vendored
10
docs/_static/pygments.css
vendored
|
@ -1,8 +1,8 @@
|
|||
pre { line-height: 125%; margin: 0; }
|
||||
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
|
||||
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
|
||||
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
|
||||
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
|
||||
pre { line-height: 125%; }
|
||||
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
|
||||
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
|
||||
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
|
||||
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
|
||||
.highlight .hll { background-color: #ffffcc }
|
||||
.highlight { background: #eeffcc; }
|
||||
.highlight .c { color: #408090; font-style: italic } /* Comment */
|
||||
|
|
36
docs/_static/searchtools.js
vendored
36
docs/_static/searchtools.js
vendored
|
@ -248,7 +248,7 @@ var Search = {
|
|||
// results left, load the summary and display it
|
||||
if (results.length) {
|
||||
var item = results.pop();
|
||||
var listItem = $('<li style="display:none"></li>');
|
||||
var listItem = $('<li></li>');
|
||||
var requestUrl = "";
|
||||
var linkUrl = "";
|
||||
if (DOCUMENTATION_OPTIONS.BUILDER === 'dirhtml') {
|
||||
|
@ -273,28 +273,31 @@ var Search = {
|
|||
if (item[3]) {
|
||||
listItem.append($('<span> (' + item[3] + ')</span>'));
|
||||
Search.output.append(listItem);
|
||||
listItem.slideDown(5, function() {
|
||||
setTimeout(function() {
|
||||
displayNextItem();
|
||||
});
|
||||
}, 5);
|
||||
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
|
||||
$.ajax({url: requestUrl,
|
||||
dataType: "text",
|
||||
complete: function(jqxhr, textstatus) {
|
||||
var data = jqxhr.responseText;
|
||||
if (data !== '' && data !== undefined) {
|
||||
listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
|
||||
var summary = Search.makeSearchSummary(data, searchterms, hlterms);
|
||||
if (summary) {
|
||||
listItem.append(summary);
|
||||
}
|
||||
}
|
||||
Search.output.append(listItem);
|
||||
listItem.slideDown(5, function() {
|
||||
setTimeout(function() {
|
||||
displayNextItem();
|
||||
});
|
||||
}, 5);
|
||||
}});
|
||||
} else {
|
||||
// no source available, just display title
|
||||
Search.output.append(listItem);
|
||||
listItem.slideDown(5, function() {
|
||||
setTimeout(function() {
|
||||
displayNextItem();
|
||||
});
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
// search finished, update title and status message
|
||||
|
@ -379,6 +382,13 @@ var Search = {
|
|||
return results;
|
||||
},
|
||||
|
||||
/**
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
|
||||
*/
|
||||
escapeRegExp : function(string) {
|
||||
return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
||||
},
|
||||
|
||||
/**
|
||||
* search for full-text terms in the index
|
||||
*/
|
||||
|
@ -402,13 +412,14 @@ var Search = {
|
|||
];
|
||||
// add support for partial matches
|
||||
if (word.length > 2) {
|
||||
var word_regex = this.escapeRegExp(word);
|
||||
for (var w in terms) {
|
||||
if (w.match(word) && !terms[word]) {
|
||||
if (w.match(word_regex) && !terms[word]) {
|
||||
_o.push({files: terms[w], score: Scorer.partialTerm})
|
||||
}
|
||||
}
|
||||
for (var w in titleterms) {
|
||||
if (w.match(word) && !titleterms[word]) {
|
||||
if (w.match(word_regex) && !titleterms[word]) {
|
||||
_o.push({files: titleterms[w], score: Scorer.partialTitle})
|
||||
}
|
||||
}
|
||||
|
@ -490,6 +501,9 @@ var Search = {
|
|||
*/
|
||||
makeSearchSummary : function(htmlText, keywords, hlwords) {
|
||||
var text = Search.htmlToText(htmlText);
|
||||
if (text == "") {
|
||||
return null;
|
||||
}
|
||||
var textLower = text.toLowerCase();
|
||||
var start = 0;
|
||||
$.each(keywords, function() {
|
||||
|
@ -501,7 +515,7 @@ var Search = {
|
|||
var excerpt = ((start > 0) ? '...' : '') +
|
||||
$.trim(text.substr(start, 240)) +
|
||||
((start + 240 - text.length) ? '...' : '');
|
||||
var rv = $('<div class="context"></div>').text(excerpt);
|
||||
var rv = $('<p class="context"></p>').text(excerpt);
|
||||
$.each(hlwords, function() {
|
||||
rv = rv.highlightText(this, 'highlighted');
|
||||
});
|
||||
|
|
1711
docs/_static/underscore.js
vendored
1711
docs/_static/underscore.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,15 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>raylib.dynamic — Raylib Python documentation</title><link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<title>Dynamic Bindings — Raylib Python documentation</title>
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="_static/js/html5shiv.min.js"></script>
|
||||
<![endif]-->
|
||||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||||
|
||||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||
<script src="_static/jquery.js"></script>
|
||||
<script src="_static/underscore.js"></script>
|
||||
<script src="_static/doctools.js"></script>
|
||||
|
@ -17,7 +20,7 @@
|
|||
<link rel="index" title="Index" href="genindex.html" />
|
||||
<link rel="search" title="Search" href="search.html" />
|
||||
<link rel="next" title="Building from source" href="BUILDING.html" />
|
||||
<link rel="prev" title="raylib.static" href="raylib.html" />
|
||||
<link rel="prev" title="C API" href="raylib.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
@ -35,7 +38,7 @@
|
|||
</form>
|
||||
</div>
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption"><span class="caption-text">Contents:</span></p>
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 3.7</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#license-updated">License (updated)</a></li>
|
||||
|
@ -46,9 +49,9 @@
|
|||
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">raylib.pyray</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">raylib.static</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">raylib.dynamic</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Dynamic Bindings</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="BUILDING.html">Building from source</a></li>
|
||||
</ul>
|
||||
|
||||
|
@ -66,7 +69,7 @@
|
|||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
<li><a href="index.html" class="icon icon-home"></a> »</li>
|
||||
<li>raylib.dynamic</li>
|
||||
<li>Dynamic Bindings</li>
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
<a href="_sources/dynamic.rst.txt" rel="nofollow"> View page source</a>
|
||||
</li>
|
||||
|
@ -76,34 +79,47 @@
|
|||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<div class="section" id="raylib-dynamic">
|
||||
<h1>raylib.dynamic<a class="headerlink" href="#raylib-dynamic" title="Permalink to this headline"></a></h1>
|
||||
<p>CFFI ABI dynamic bindings exist in order to avoid the need to compile a C extension module.</p>
|
||||
<p>See <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/blob/master/test_static.py">https://github.com/electronstudio/raylib-python-cffi/blob/master/test_static.py</a> for how to use.</p>
|
||||
<p>Currently the github version may include bundled DLLs in <code class="docutils literal notranslate"><span class="pre">raylib/dynamic</span></code> but the pypi version requires a system installed Raylib.
|
||||
You can put your own DLLs in <code class="docutils literal notranslate"><span class="pre">raylib/dynamic</span></code> if you prefer.</p>
|
||||
<p>If your system already has the Raylib library installed, you can set the environment variable <code class="docutils literal notranslate"><span class="pre">USE_EXTERNAL_RAYLIB</span></code> and it will
|
||||
always be used instead of the bundled DLLs.</p>
|
||||
<p>If you want to build your own wheel with just raylib.dynamic and not even attempt to compile the static libraries,
|
||||
the command is:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="n">setup_dynamic</span><span class="o">.</span><span class="n">py</span> <span class="n">bdist_wheel</span>
|
||||
<section id="dynamic-bindings">
|
||||
<h1>Dynamic Bindings<a class="headerlink" href="#dynamic-bindings" title="Permalink to this headline"></a></h1>
|
||||
<p>CFFI ABI dynamic bindings avoid the need to compile a C extension module. They now been moved to a separate module:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="n">raylib_dynamic</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Warning</p>
|
||||
<p>There have been some weird failures with dynamic bindings and ctypes bindings before and often the
|
||||
failures are silent
|
||||
so you dont even know. Also the static bindings should be faster. Therefore I personally recommend the static ones.
|
||||
But the dynamic bindings have the big advantage that you don’t need to compile anything to install. You just need a Raylib DLL.</p>
|
||||
so you don’t even know something has gone wrong and you don’t get proper stacktraces. Also the static bindings are faster.
|
||||
Therefore I personally recommend the static ones.
|
||||
But the dynamic bindings have the advantage that you don’t need to compile anything to install. You just need a Raylib DLL.</p>
|
||||
</div>
|
||||
<p>API is the same as raylib.static.</p>
|
||||
<p>API is exactly the same as the static one documented here. (Therefore you can’t have both modules installed at once.) The only difference is you can’t do:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">raylib</span> <span class="kn">import</span> <span class="o">*</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Instead you have to do:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">raylib</span> <span class="kn">import</span> <span class="n">rl</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Then you access the functions with <code class="docutils literal notranslate"><span class="pre">rl.</span></code> prefix. See</p>
|
||||
<p>See <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/blob/master/dynamic/test_dynamic.py">https://github.com/electronstudio/raylib-python-cffi/blob/master/dynamic/test_dynamic.py</a> for an example.</p>
|
||||
<p>If you use the <code class="docutils literal notranslate"><span class="pre">rl.</span></code> prefix then code will work on both static and dynamic bindings.</p>
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Warning</p>
|
||||
<p>If you access functions via <code class="docutils literal notranslate"><span class="pre">raylib.pyray</span></code> then there is no difference at all, but be warned this hasn’t been tested.</p>
|
||||
</div>
|
||||
<div class="admonition important">
|
||||
<p class="admonition-title">Important</p>
|
||||
<p>If your system already has the Raylib library installed, you can set the environment variable <code class="docutils literal notranslate"><span class="pre">USE_EXTERNAL_RAYLIB</span></code> and it will
|
||||
always be used instead of the bundled DLLs.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||
<a href="raylib.html" class="btn btn-neutral float-left" title="raylib.static" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||
<a href="raylib.html" class="btn btn-neutral float-left" title="C API" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||
<a href="BUILDING.html" class="btn btn-neutral float-right" title="Building from source" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>raylib.pyray.PyRay — Raylib Python documentation</title><link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||
<title>raylib.pyray.PyRay — Raylib Python documentation</title>
|
||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/graphviz.css" type="text/css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="../_static/js/html5shiv.min.js"></script>
|
||||
<![endif]-->
|
||||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||||
|
||||
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||
<script src="../_static/jquery.js"></script>
|
||||
<script src="../_static/underscore.js"></script>
|
||||
<script src="../_static/doctools.js"></script>
|
||||
|
@ -33,7 +36,7 @@
|
|||
</form>
|
||||
</div>
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption"><span class="caption-text">Contents:</span></p>
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../README.html">Python Bindings for Raylib 3.7</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../README.html#license-updated">License (updated)</a></li>
|
||||
|
@ -44,9 +47,9 @@
|
|||
<li class="toctree-l1"><a class="reference internal" href="../README.html#performance">Performance</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../README.html#packaging-your-app">Packaging your app</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../README.html#advert">Advert</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../pyray.html">raylib.pyray</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../raylib.html">raylib.static</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../dynamic.html">raylib.dynamic</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../pyray.html">Python API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../raylib.html">C API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../dynamic.html">Dynamic Bindings</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../BUILDING.html">Building from source</a></li>
|
||||
</ul>
|
||||
|
||||
|
@ -74,16 +77,15 @@
|
|||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<div class="section" id="raylib-pyray-pyray">
|
||||
<section id="raylib-pyray-pyray">
|
||||
<h1>raylib.pyray.PyRay<a class="headerlink" href="#raylib-pyray-pyray" title="Permalink to this headline"></a></h1>
|
||||
<dl class="py class">
|
||||
<dt id="raylib.pyray.PyRay">
|
||||
<em class="property">class </em><code class="sig-prename descclassname">raylib.pyray.</code><code class="sig-name descname">PyRay</code><a class="headerlink" href="#raylib.pyray.PyRay" title="Permalink to this definition"></a></dt>
|
||||
<dt class="sig sig-object py" id="raylib.pyray.PyRay">
|
||||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">raylib.pyray.</span></span><span class="sig-name descname"><span class="pre">PyRay</span></span><a class="headerlink" href="#raylib.pyray.PyRay" title="Permalink to this definition"></a></dt>
|
||||
<dd><dl class="py method">
|
||||
<dt id="raylib.pyray.PyRay.__init__">
|
||||
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#raylib.pyray.PyRay.__init__" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
<dt class="sig sig-object py" id="raylib.pyray.PyRay.__init__">
|
||||
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#raylib.pyray.PyRay.__init__" title="Permalink to this definition"></a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<p class="rubric">Methods</p>
|
||||
<table class="longtable docutils align-default">
|
||||
|
@ -261,7 +263,7 @@
|
|||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#raylib.pyray.PyRay.__init__" title="raylib.pyray.PyRay.__init__"><code class="xref py py-obj docutils literal notranslate"><span class="pre">__init__</span></code></a>()</p></td>
|
||||
<td><p>Initialize self.</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="../pyray.html#raylib.pyray.PyRay.begin_blend_mode" title="raylib.pyray.PyRay.begin_blend_mode"><code class="xref py py-obj docutils literal notranslate"><span class="pre">begin_blend_mode</span></code></a>(*args)</p></td>
|
||||
<td><p></p></td>
|
||||
|
@ -2525,17 +2527,11 @@
|
|||
<tr class="row-odd"><td><p><a class="reference internal" href="../pyray.html#raylib.pyray.PyRay.TEXTURE_WRAP_REPEAT" title="raylib.pyray.PyRay.TEXTURE_WRAP_REPEAT"><code class="xref py py-obj docutils literal notranslate"><span class="pre">TEXTURE_WRAP_REPEAT</span></code></a></p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">TextFormat</span></code></p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">TraceLog</span></code></p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
1652
docs/genindex.html
1652
docs/genindex.html
File diff suppressed because it is too large
Load diff
|
@ -1,15 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Raylib Python — Raylib Python documentation</title><link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<title>Raylib Python — Raylib Python documentation</title>
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="_static/js/html5shiv.min.js"></script>
|
||||
<![endif]-->
|
||||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||||
|
||||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||
<script src="_static/jquery.js"></script>
|
||||
<script src="_static/underscore.js"></script>
|
||||
<script src="_static/doctools.js"></script>
|
||||
|
@ -34,7 +37,7 @@
|
|||
</form>
|
||||
</div>
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption"><span class="caption-text">Contents:</span></p>
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 3.7</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#license-updated">License (updated)</a></li>
|
||||
|
@ -45,9 +48,9 @@
|
|||
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">raylib.pyray</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">raylib.static</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">raylib.dynamic</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">Dynamic Bindings</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="BUILDING.html">Building from source</a></li>
|
||||
</ul>
|
||||
|
||||
|
@ -75,10 +78,10 @@
|
|||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<div class="section" id="raylib-python">
|
||||
<section id="raylib-python">
|
||||
<h1>Raylib Python<a class="headerlink" href="#raylib-python" title="Permalink to this headline"></a></h1>
|
||||
<div class="toctree-wrapper compound">
|
||||
<p class="caption"><span class="caption-text">Contents:</span></p>
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 3.7</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#license-updated">License (updated)</a></li>
|
||||
|
@ -89,16 +92,16 @@
|
|||
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">raylib.pyray</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">raylib.static</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">raylib.dynamic</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">Dynamic Bindings</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="BUILDING.html">Building from source</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></p></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
BIN
docs/objects.inv
BIN
docs/objects.inv
Binary file not shown.
|
@ -3,13 +3,15 @@
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Python Module Index — Raylib Python documentation</title><link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<title>Python Module Index — Raylib Python documentation</title>
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="_static/js/html5shiv.min.js"></script>
|
||||
<![endif]-->
|
||||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||||
|
||||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||
<script src="_static/jquery.js"></script>
|
||||
<script src="_static/underscore.js"></script>
|
||||
<script src="_static/doctools.js"></script>
|
||||
|
@ -36,7 +38,7 @@
|
|||
</form>
|
||||
</div>
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption"><span class="caption-text">Contents:</span></p>
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 3.7</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#license-updated">License (updated)</a></li>
|
||||
|
@ -47,9 +49,9 @@
|
|||
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">raylib.pyray</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">raylib.static</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">raylib.dynamic</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">Dynamic Bindings</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="BUILDING.html">Building from source</a></li>
|
||||
</ul>
|
||||
|
||||
|
@ -91,18 +93,13 @@
|
|||
<td><img src="_static/minus.png" class="toggler"
|
||||
id="toggle-1" style="display: none" alt="-" /></td>
|
||||
<td>
|
||||
<code class="xref">raylib</code></td><td>
|
||||
<a href="raylib.html#module-raylib"><code class="xref">raylib</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr class="cg-1">
|
||||
<td></td>
|
||||
<td>   
|
||||
<a href="pyray.html#module-raylib.pyray"><code class="xref">raylib.pyray</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr class="cg-1">
|
||||
<td></td>
|
||||
<td>   
|
||||
<a href="raylib.html#module-raylib.static"><code class="xref">raylib.static</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
|
3295
docs/pyray.html
3295
docs/pyray.html
File diff suppressed because it is too large
Load diff
4940
docs/raylib.html
4940
docs/raylib.html
File diff suppressed because it is too large
Load diff
|
@ -3,14 +3,16 @@
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Search — Raylib Python documentation</title><link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<title>Search — Raylib Python documentation</title>
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<script src="_static/js/html5shiv.min.js"></script>
|
||||
<![endif]-->
|
||||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||||
|
||||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||
<script src="_static/jquery.js"></script>
|
||||
<script src="_static/underscore.js"></script>
|
||||
<script src="_static/doctools.js"></script>
|
||||
|
@ -36,7 +38,7 @@
|
|||
</form>
|
||||
</div>
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption"><span class="caption-text">Contents:</span></p>
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 3.7</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#license-updated">License (updated)</a></li>
|
||||
|
@ -47,9 +49,9 @@
|
|||
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">raylib.pyray</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">raylib.static</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">raylib.dynamic</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">Dynamic Bindings</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="BUILDING.html">Building from source</a></li>
|
||||
</ul>
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
raylib.dynamic
|
||||
==============
|
||||
Dynamic Bindings
|
||||
================
|
||||
|
||||
CFFI ABI dynamic bindings avoid the need to compile a C extension module. They now been moved to a separate module::
|
||||
|
||||
|
@ -9,7 +9,8 @@ CFFI ABI dynamic bindings avoid the need to compile a C extension module. They
|
|||
|
||||
There have been some weird failures with dynamic bindings and ctypes bindings before and often the
|
||||
failures are silent
|
||||
so you dont even know. Also the static bindings are faster. Therefore I personally recommend the static ones.
|
||||
so you don't even know something has gone wrong and you don't get proper stacktraces. Also the static bindings are faster.
|
||||
Therefore I personally recommend the static ones.
|
||||
But the dynamic bindings have the advantage that you don't need to compile anything to install. You just need a Raylib DLL.
|
||||
|
||||
API is exactly the same as the static one documented here. (Therefore you can't have both modules installed at once.) The only difference is you can't do::
|
||||
|
@ -18,25 +19,20 @@ API is exactly the same as the static one documented here. (Therefore you can't
|
|||
|
||||
Instead you have to do::
|
||||
|
||||
from raylib import raylib as rl
|
||||
from raylib import rl
|
||||
|
||||
Then you access the functions with ``rl.`` prefix. See
|
||||
Then you access the functions with ``rl.`` prefix.
|
||||
|
||||
See https://github.com/electronstudio/raylib-python-cffi/blob/master/dynamic/test_dynamic.py for an example.
|
||||
|
||||
If you use the ``rl.`` prefix then code will work on both static and dynamic bindings.
|
||||
|
||||
.. warning::
|
||||
|
||||
If you access functions via ``raylib.pyray`` then there is no difference at all, but be warned this hasn't been tested.
|
||||
|
||||
|
||||
.. important::
|
||||
|
||||
If your system already has the Raylib library installed, you can set the environment variable ``USE_EXTERNAL_RAYLIB`` and it will
|
||||
always be used instead of the bundled DLLs.
|
||||
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
If you write a program using the ``rl.`` prefix on all the functions and then you decide you want to use
|
||||
that same program with the static binding instead of the dynamic, you don't have to remove the ``rl``,
|
||||
you can just do::
|
||||
|
||||
import raylib as rl
|
||||
|
|
|
@ -51,7 +51,7 @@ ffi.cdef(open(MODULE / "raylib_modified.h").read().replace('RLAPI ', ''))
|
|||
|
||||
try:
|
||||
raylib_fname = raylib_library_path()
|
||||
raylib = ffi.dlopen(raylib_fname)
|
||||
rl = ffi.dlopen(raylib_fname)
|
||||
print('LOADED DYNAMICALLY SHARED LIB "{}"'.format(raylib_fname))
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
|
1
dynamic/raylib/pyray.py
Symbolic link
1
dynamic/raylib/pyray.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../raylib/pyray.py
|
1
dynamic/raylib/pyray.pyi
Symbolic link
1
dynamic/raylib/pyray.pyi
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../raylib/pyray.pyi
|
|
@ -2,14 +2,14 @@
|
|||
This shows how to use the CFFI dynamic (ABI) binding. Note that is slower and more likely to run into silent errors and segfaults.
|
||||
But it doesnt require any C compiler to build.
|
||||
"""
|
||||
from raylib import ffi, raylib as rl
|
||||
from raylib import ffi, rl
|
||||
from raylib.colors import *
|
||||
|
||||
rl.InitWindow(800, 450, b"Raylib dynamic binding test")
|
||||
rl.SetTargetFPS(60)
|
||||
|
||||
camera = ffi.new("struct Camera3D *", [[18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0])
|
||||
image = rl.LoadImage(b"examples/models/resources/heightmap.png")
|
||||
image = rl.LoadImage(b"../examples/models/resources/heightmap.png")
|
||||
texture = rl.LoadTextureFromImage(image)
|
||||
mesh = rl.GenMeshHeightmap(image, [16, 8, 16])
|
||||
model = rl.LoadModelFromMesh(mesh)
|
||||
|
|
48
dynamic/test_pyray.py
Normal file
48
dynamic/test_pyray.py
Normal file
|
@ -0,0 +1,48 @@
|
|||
"""
|
||||
This shows how to use the Pyray wrapper around the static binding.
|
||||
"""
|
||||
|
||||
from raylib.pyray import PyRay
|
||||
from raylib.colors import *
|
||||
|
||||
pyray = PyRay()
|
||||
|
||||
pyray.init_window(800, 450, "Raylib texture test")
|
||||
pyray.set_target_fps(60)
|
||||
|
||||
image = pyray.gen_image_color(800, 400, (0,0,0,255) )
|
||||
texture = pyray.load_texture_from_image(image)
|
||||
pyray.update_texture(texture, image.data)
|
||||
|
||||
camera = pyray.Camera3D([18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0)
|
||||
image = pyray.load_image("../examples/models/resources/heightmap.png")
|
||||
texture = pyray.load_texture_from_image(image)
|
||||
mesh = pyray.gen_mesh_heightmap(image, (16, 8, 16))
|
||||
model = pyray.load_model_from_mesh(mesh)
|
||||
model.materials.maps[pyray.MATERIAL_MAP_DIFFUSE].texture = texture
|
||||
|
||||
pyray.unload_image(image)
|
||||
pyray.set_camera_mode(camera, pyray.CAMERA_ORBITAL)
|
||||
|
||||
pos = pyray.get_mouse_position()
|
||||
ray = pyray.get_mouse_ray(pos, camera)
|
||||
rayhit = pyray.get_collision_ray_ground(ray, 0)
|
||||
print(str(rayhit.position.x))
|
||||
|
||||
while not pyray.window_should_close():
|
||||
pyray.update_camera(camera)
|
||||
pyray.begin_drawing()
|
||||
pyray.clear_background(RAYWHITE)
|
||||
pyray.begin_mode_3d(camera)
|
||||
pyray.draw_model(model, (-8.0, 0.0, -8.0), 1.0, RED)
|
||||
pyray.draw_grid(20, 1.0)
|
||||
pyray.end_mode_3d()
|
||||
pyray.draw_text("This mesh should be textured", 190, 200, 20, VIOLET)
|
||||
pyray.end_drawing()
|
||||
|
||||
pos = pyray.get_mouse_position()
|
||||
ray = pyray.get_mouse_ray(pos, camera)
|
||||
rayhit = pyray.get_collision_ray_ground(ray, 0)
|
||||
#print(str(rayhit.position.x))
|
||||
|
||||
pyray.close_window()
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
pip3 install sphinx-autoapi myst_parser sphinx_rtd_theme
|
||||
python3 create_stub_pyray.py > raylib/pyray.pyi
|
||||
|
|
|
@ -76,17 +76,17 @@ def CheckCollisionPointTriangle(point: Vector2,p1: Vector2,p2: Vector2,p3: Vecto
|
|||
def CheckCollisionRayBox(Ray_0: Ray,BoundingBox_1: BoundingBox,) -> bool:
|
||||
"""_Bool CheckCollisionRayBox(struct Ray, struct BoundingBox);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def CheckCollisionRaySphere(Ray_0: Ray,Vector3_1: Vector3,float_2: float,) -> bool:
|
||||
"""_Bool CheckCollisionRaySphere(struct Ray, struct Vector3, float);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def CheckCollisionRaySphereEx(Ray_0: Ray,Vector3_1: Vector3,float_2: float,Vector3_pointer_3: Any,) -> bool:
|
||||
"""_Bool CheckCollisionRaySphereEx(struct Ray, struct Vector3, float, struct Vector3 *);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def CheckCollisionRecs(rec1: Rectangle,rec2: Rectangle,) -> bool:
|
||||
"""Check collision between two rectangles"""
|
||||
|
@ -112,7 +112,7 @@ def CloseAudioDevice() -> None:
|
|||
def CloseAudioStream(AudioStream_0: AudioStream,) -> None:
|
||||
"""void CloseAudioStream(struct AudioStream);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def CloseWindow() -> None:
|
||||
"""Close window and unload OpenGL context"""
|
||||
|
@ -565,22 +565,22 @@ def GetCodepointsCount(text: str,) -> int:
|
|||
def GetCollisionRayGround(Ray_0: Ray,float_1: float,) -> RayHitInfo:
|
||||
"""struct RayHitInfo GetCollisionRayGround(struct Ray, float);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def GetCollisionRayMesh(Ray_0: Ray,Mesh_1: Mesh,Matrix_2: Matrix,) -> RayHitInfo:
|
||||
"""struct RayHitInfo GetCollisionRayMesh(struct Ray, struct Mesh, struct Matrix);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def GetCollisionRayModel(Ray_0: Ray,Model_1: Model,) -> RayHitInfo:
|
||||
"""struct RayHitInfo GetCollisionRayModel(struct Ray, struct Model);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def GetCollisionRayTriangle(Ray_0: Ray,Vector3_1: Vector3,Vector3_2: Vector3,Vector3_3: Vector3,) -> RayHitInfo:
|
||||
"""struct RayHitInfo GetCollisionRayTriangle(struct Ray, struct Vector3, struct Vector3, struct Vector3);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def GetCollisionRec(rec1: Rectangle,rec2: Rectangle,) -> Rectangle:
|
||||
"""Get collision rectangle for two rectangles collision"""
|
||||
|
@ -909,7 +909,7 @@ def InitAudioDevice() -> None:
|
|||
def InitAudioStream(unsignedint_0: int,unsignedint_1: int,unsignedint_2: int,) -> AudioStream:
|
||||
"""struct AudioStream InitAudioStream(unsigned int, unsigned int, unsigned int);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def InitWindow(width: int,height: int,title: str,) -> None:
|
||||
"""Initialize window and OpenGL context"""
|
||||
|
@ -986,7 +986,7 @@ def IsMouseButtonUp(button: int,) -> bool:
|
|||
def IsMusicPlaying(Music_0: Music,) -> bool:
|
||||
"""_Bool IsMusicPlaying(struct Music);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def IsSoundPlaying(sound: Sound,) -> bool:
|
||||
"""Check if a sound is currently playing"""
|
||||
|
@ -1283,7 +1283,7 @@ def MeshBinormals(mesh: Any,) -> None:
|
|||
def MeshBoundingBox(Mesh_0: Mesh,) -> BoundingBox:
|
||||
"""struct BoundingBox MeshBoundingBox(struct Mesh);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def MeshTangents(mesh: Any,) -> None:
|
||||
"""Compute mesh tangents"""
|
||||
|
|
|
@ -47,7 +47,7 @@ def makeStructHelper(struct):
|
|||
for name, attr in getmembers(rl):
|
||||
#print(name, attr)
|
||||
uname = inflection.underscore(name).replace('3_d','_3d').replace('2_d','_2d')
|
||||
if isbuiltin(attr) or str(type(attr)) == "<class '_cffi_backend.__FFIFunctionWrapper'>":
|
||||
if isbuiltin(attr) or str(type(attr)) == "<class '_cffi_backend.__FFIFunctionWrapper'>" or str(type(attr)) == "<class '_cffi_backend._CDataBase'>":
|
||||
#print(attr.__call__)
|
||||
#print(attr.__doc__)
|
||||
#print(attr.__text_signature__)
|
||||
|
|
|
@ -77,17 +77,17 @@ class PyRay:
|
|||
def check_collision_ray_box(self, Ray_0: Ray, BoundingBox_1: BoundingBox) -> bool:
|
||||
"""_Bool CheckCollisionRayBox(struct Ray, struct BoundingBox);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def check_collision_ray_sphere(self, Ray_0: Ray, Vector3_1: Vector3, float_2: float) -> bool:
|
||||
"""_Bool CheckCollisionRaySphere(struct Ray, struct Vector3, float);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def check_collision_ray_sphere_ex(self, Ray_0: Ray, Vector3_1: Vector3, float_2: float, Vector3_pointer_3: Any) -> bool:
|
||||
"""_Bool CheckCollisionRaySphereEx(struct Ray, struct Vector3, float, struct Vector3 *);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def check_collision_recs(self, rec1: Rectangle, rec2: Rectangle) -> bool:
|
||||
"""Check collision between two rectangles"""
|
||||
|
@ -113,7 +113,7 @@ CFFI C function from raylib.static._raylib_cffi.lib"""
|
|||
def close_audio_stream(self, AudioStream_0: AudioStream) -> None:
|
||||
"""void CloseAudioStream(struct AudioStream);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def close_window(self) -> None:
|
||||
"""Close window and unload OpenGL context"""
|
||||
|
@ -566,22 +566,22 @@ CFFI C function from raylib.static._raylib_cffi.lib"""
|
|||
def get_collision_ray_ground(self, Ray_0: Ray, float_1: float) -> RayHitInfo:
|
||||
"""struct RayHitInfo GetCollisionRayGround(struct Ray, float);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def get_collision_ray_mesh(self, Ray_0: Ray, Mesh_1: Mesh, Matrix_2: Matrix) -> RayHitInfo:
|
||||
"""struct RayHitInfo GetCollisionRayMesh(struct Ray, struct Mesh, struct Matrix);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def get_collision_ray_model(self, Ray_0: Ray, Model_1: Model) -> RayHitInfo:
|
||||
"""struct RayHitInfo GetCollisionRayModel(struct Ray, struct Model);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def get_collision_ray_triangle(self, Ray_0: Ray, Vector3_1: Vector3, Vector3_2: Vector3, Vector3_3: Vector3) -> RayHitInfo:
|
||||
"""struct RayHitInfo GetCollisionRayTriangle(struct Ray, struct Vector3, struct Vector3, struct Vector3);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def get_collision_rec(self, rec1: Rectangle, rec2: Rectangle) -> Rectangle:
|
||||
"""Get collision rectangle for two rectangles collision"""
|
||||
|
@ -910,7 +910,7 @@ CFFI C function from raylib.static._raylib_cffi.lib"""
|
|||
def init_audio_stream(self, unsignedint_0: int, unsignedint_1: int, unsignedint_2: int) -> AudioStream:
|
||||
"""struct AudioStream InitAudioStream(unsigned int, unsigned int, unsigned int);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def init_window(self, width: int, height: int, title: str) -> None:
|
||||
"""Initialize window and OpenGL context"""
|
||||
|
@ -987,7 +987,7 @@ CFFI C function from raylib.static._raylib_cffi.lib"""
|
|||
def is_music_playing(self, Music_0: Music) -> bool:
|
||||
"""_Bool IsMusicPlaying(struct Music);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def is_sound_playing(self, sound: Sound) -> bool:
|
||||
"""Check if a sound is currently playing"""
|
||||
|
@ -1284,7 +1284,7 @@ CFFI C function from raylib.static._raylib_cffi.lib"""
|
|||
def mesh_bounding_box(self, Mesh_0: Mesh) -> BoundingBox:
|
||||
"""struct BoundingBox MeshBoundingBox(struct Mesh);
|
||||
|
||||
CFFI C function from raylib.static._raylib_cffi.lib"""
|
||||
CFFI C function from raylib._raylib_cffi.lib"""
|
||||
...
|
||||
def mesh_tangents(self, mesh: Any) -> None:
|
||||
"""Compute mesh tangents"""
|
||||
|
|
|
@ -3,9 +3,7 @@ This shows how to use the CFFI static (API) binding. It should be fast and code
|
|||
C code.
|
||||
"""
|
||||
|
||||
import raylib as rl
|
||||
from raylib import ffi
|
||||
from raylib.colors import *
|
||||
from raylib import ffi, rl, colors
|
||||
|
||||
rl.InitWindow(800, 450, b"Raylib dynamic binding test")
|
||||
rl.SetTargetFPS(60)
|
||||
|
@ -24,11 +22,11 @@ rl.SetCameraMode(camera[0], rl.CAMERA_ORBITAL)
|
|||
while not rl.WindowShouldClose():
|
||||
rl.UpdateCamera(camera)
|
||||
rl.BeginDrawing()
|
||||
rl.ClearBackground(RAYWHITE)
|
||||
rl.ClearBackground(colors.RAYWHITE)
|
||||
rl.BeginMode3D(camera[0])
|
||||
rl.DrawModel(model, (-8.0, 0.0, -8.0), 1.0, RED)
|
||||
rl.DrawModel(model, (-8.0, 0.0, -8.0), 1.0, colors.RED)
|
||||
rl.DrawGrid(20, 1.0)
|
||||
rl.EndMode3D()
|
||||
rl.DrawText(b"This mesh should be textured", 190, 200, 20, VIOLET)
|
||||
rl.DrawText(b"This mesh should be textured", 190, 200, 20, colors.VIOLET)
|
||||
rl.EndDrawing()
|
||||
rl.CloseWindow()
|
||||
|
|
Reference in a new issue