raylib 5.0.0.2__tar.gz → 5.0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of raylib might be problematic. Click here for more details.
- {raylib-5.0.0.2 → raylib-5.0.0.4}/MANIFEST.in +4 -0
- {raylib-5.0.0.2/raylib.egg-info → raylib-5.0.0.4}/PKG-INFO +33 -15
- {raylib-5.0.0.2 → raylib-5.0.0.4}/README.md +30 -15
- raylib-5.0.0.4/pyproject.toml +3 -0
- {raylib-5.0.0.2 → raylib-5.0.0.4}/pyray/__init__.py +50 -33
- {raylib-5.0.0.2 → raylib-5.0.0.4}/pyray/__init__.pyi +30 -43
- {raylib-5.0.0.2 → raylib-5.0.0.4}/raylib/__init__.py +8 -2
- {raylib-5.0.0.2 → raylib-5.0.0.4}/raylib/__init__.pyi +36 -49
- {raylib-5.0.0.2 → raylib-5.0.0.4}/raylib/build.py +8 -3
- raylib-5.0.0.4/raylib/glfw3.h.modified +5502 -0
- raylib-5.0.0.4/raylib/physac.h.modified +165 -0
- raylib-5.0.0.4/raylib/raygui.h.modified +843 -0
- raylib-5.0.0.4/raylib/raylib.h.modified +1409 -0
- raylib-5.0.0.4/raylib/raymath.h.modified +219 -0
- raylib-5.0.0.4/raylib/rlgl.h.modified +505 -0
- raylib-5.0.0.4/raylib/version.py +1 -0
- {raylib-5.0.0.2 → raylib-5.0.0.4/raylib.egg-info}/PKG-INFO +33 -15
- {raylib-5.0.0.2 → raylib-5.0.0.4}/raylib.egg-info/SOURCES.txt +7 -0
- raylib-5.0.0.4/raylib.egg-info/requires.txt +1 -0
- {raylib-5.0.0.2 → raylib-5.0.0.4}/setup.py +4 -1
- raylib-5.0.0.4/version.py +1 -0
- raylib-5.0.0.2/raylib/version.py +0 -1
- raylib-5.0.0.2/raylib.egg-info/requires.txt +0 -1
- raylib-5.0.0.2/version.py +0 -1
- {raylib-5.0.0.2 → raylib-5.0.0.4}/LICENSE +0 -0
- {raylib-5.0.0.2 → raylib-5.0.0.4}/raylib/colors.py +0 -0
- {raylib-5.0.0.2 → raylib-5.0.0.4}/raylib/defines.py +0 -0
- {raylib-5.0.0.2 → raylib-5.0.0.4}/raylib/enums.py +0 -0
- {raylib-5.0.0.2 → raylib-5.0.0.4}/raylib.egg-info/dependency_links.txt +0 -0
- {raylib-5.0.0.2 → raylib-5.0.0.4}/raylib.egg-info/top_level.txt +0 -0
- {raylib-5.0.0.2 → raylib-5.0.0.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: raylib
|
|
3
|
-
Version: 5.0.0.
|
|
3
|
+
Version: 5.0.0.4
|
|
4
4
|
Summary: Python CFFI bindings for Raylib
|
|
5
5
|
Home-page: https://github.com/electronstudio/raylib-python-cffi
|
|
6
6
|
Author: Electron Studio
|
|
@@ -8,6 +8,8 @@ Author-email: github@electronstudio.co.uk
|
|
|
8
8
|
License: EPL-2.0
|
|
9
9
|
Classifier: License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -15,9 +17,12 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
15
17
|
Classifier: Programming Language :: Python :: 3.7
|
|
16
18
|
Description-Content-Type: text/markdown
|
|
17
19
|
License-File: LICENSE
|
|
20
|
+
Requires-Dist: cffi>=1.17.1
|
|
18
21
|
|
|
19
22
|
# Python Bindings for Raylib 5.0
|
|
20
23
|
|
|
24
|
+
Chatroom: [Discord](https://discord.gg/fKDwt85aX6) or [Matrix](https://matrix.to/#/#raylib-python-cffi:matrix.org)
|
|
25
|
+
|
|
21
26
|
New CFFI API static bindings.
|
|
22
27
|
* Automatically generated to be as close as possible to
|
|
23
28
|
original Raylib.
|
|
@@ -53,7 +58,7 @@ Then install
|
|
|
53
58
|
python3 -m pip install setuptools
|
|
54
59
|
python3 -m pip install raylib
|
|
55
60
|
|
|
56
|
-
On most platforms it should install a binary wheel (Windows 10 x64, MacOS
|
|
61
|
+
On most platforms it should install a binary wheel (Windows 10 x64, MacOS 12 x64/arm64, Linux Ubuntu2004 x64/arm64).
|
|
57
62
|
|
|
58
63
|
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.
|
|
59
64
|
using homebrew, apt, etc.
|
|
@@ -108,7 +113,6 @@ Make a folder `my_project` with a file `main.py`:
|
|
|
108
113
|
# /// script
|
|
109
114
|
# dependencies = [
|
|
110
115
|
# "cffi",
|
|
111
|
-
# "inflection",
|
|
112
116
|
# "raylib"
|
|
113
117
|
# ]
|
|
114
118
|
# ///
|
|
@@ -131,15 +135,15 @@ Make a folder `my_project` with a file `main.py`:
|
|
|
131
135
|
|
|
132
136
|
Then to create the web files and launch a web server:
|
|
133
137
|
|
|
134
|
-
python3 -m pip install --user --upgrade
|
|
135
|
-
python3 -m pygbag --
|
|
138
|
+
python3.12 -m pip install --user --upgrade pygbag
|
|
139
|
+
python3.12 -m pygbag --PYBUILD 3.12 --ume_block 0 --template noctx.tmpl my_project
|
|
136
140
|
|
|
137
141
|
Point your browser to http://localhost:8000
|
|
138
142
|
|
|
139
143
|
This is all done by Pygbag rather than by me, so you should probably contact them with any issues.
|
|
140
144
|
Carefully read all their [documentation](https://pygame-web.github.io/).
|
|
141
145
|
|
|
142
|
-
It does work for most of
|
|
146
|
+
It does work for most of [these examples](https://electronstudio.github.io/raylib-python-cffi-pygbag-examples/)
|
|
143
147
|
|
|
144
148
|
# App showcase
|
|
145
149
|
|
|
@@ -167,22 +171,36 @@ statically link and use in non-free / proprietary / commercial projects!
|
|
|
167
171
|
|
|
168
172
|
# Performance
|
|
169
173
|
|
|
170
|
-
|
|
174
|
+
If you need more performance, do in this order:
|
|
175
|
+
|
|
176
|
+
1. Use Pypy rather than standard CPython. It is much, much faster and will make more difference than any other optimisations you might do.
|
|
171
177
|
|
|
172
|
-
Every call to C is costly, so it's slightly faster if you use Python data structures and functions when calculating
|
|
178
|
+
2. Every call to C is costly, so it's slightly faster if you use Python data structures and functions when calculating
|
|
173
179
|
in your update loop
|
|
174
180
|
and then only convert them to C data structures when you have to call the C functions for drawing.
|
|
175
181
|
|
|
182
|
+
3. The raylib.* functions are potentially *slightly* faster than the pyray.* equivalents, so if you need a tiny bit more performance
|
|
183
|
+
you can switch your inner loop functions to these.
|
|
184
|
+
|
|
185
|
+
4. There is a version of Python that is faster than Pypy: GraalPy. However it's not fully compatible with all Python
|
|
186
|
+
packages. It doesn't work with CFFI and so doesn't work with this binding. But it *is* compatible with the
|
|
187
|
+
*Java* binding, Jaylib! There is an example of this here: https://github.com/electronstudio/megabunny/tree/master/raylib-python-jaylib
|
|
188
|
+
|
|
176
189
|
## Bunnymark
|
|
177
190
|
|
|
178
191
|
|
|
179
|
-
| Library
|
|
180
|
-
|
|
181
|
-
| Raylib
|
|
182
|
-
| Raylib Python CFFI
|
|
183
|
-
| Raylib Python CFFI
|
|
184
|
-
| Raylib
|
|
185
|
-
| Raylib Python CFFI 3.7
|
|
192
|
+
| Library | Implementation | Bunnies (60 FPS) | Percentage |
|
|
193
|
+
|--------------------------------|-------------------|------------------|------------|
|
|
194
|
+
| Raylib 5.0 | C | 180000 | 100% |
|
|
195
|
+
| Raylib Python CFFI 5.0.0.2 | Python 3.12 | 10500 | 5.8% |
|
|
196
|
+
| Raylib Python CFFI 5.0.0.2 | Pypy 3.10 | 95000 | 53% |
|
|
197
|
+
| Raylib 3.7 | C | 168100 | 100% |
|
|
198
|
+
| Raylib Python CFFI 3.7 | Pypy 3.7 | 33800 | 20% |
|
|
199
|
+
| Raylib Python CFFI 3.7 | Python 3.9 | 7700 | 4.5% |
|
|
200
|
+
| Raylib Python CFFI 3.7 | Python 3.9 Nuitka | 8600 | 5.1% |
|
|
201
|
+
| Raylib Python CFFI 3.7 Dynamic | Python 3.9 | 6300 | 3.7% |
|
|
202
|
+
|
|
203
|
+
See also https://github.com/electronstudio/megabunny/
|
|
186
204
|
|
|
187
205
|
# Packaging your app
|
|
188
206
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Python Bindings for Raylib 5.0
|
|
2
2
|
|
|
3
|
+
Chatroom: [Discord](https://discord.gg/fKDwt85aX6) or [Matrix](https://matrix.to/#/#raylib-python-cffi:matrix.org)
|
|
4
|
+
|
|
3
5
|
New CFFI API static bindings.
|
|
4
6
|
* Automatically generated to be as close as possible to
|
|
5
7
|
original Raylib.
|
|
@@ -35,7 +37,7 @@ Then install
|
|
|
35
37
|
python3 -m pip install setuptools
|
|
36
38
|
python3 -m pip install raylib
|
|
37
39
|
|
|
38
|
-
On most platforms it should install a binary wheel (Windows 10 x64, MacOS
|
|
40
|
+
On most platforms it should install a binary wheel (Windows 10 x64, MacOS 12 x64/arm64, Linux Ubuntu2004 x64/arm64).
|
|
39
41
|
|
|
40
42
|
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.
|
|
41
43
|
using homebrew, apt, etc.
|
|
@@ -90,7 +92,6 @@ Make a folder `my_project` with a file `main.py`:
|
|
|
90
92
|
# /// script
|
|
91
93
|
# dependencies = [
|
|
92
94
|
# "cffi",
|
|
93
|
-
# "inflection",
|
|
94
95
|
# "raylib"
|
|
95
96
|
# ]
|
|
96
97
|
# ///
|
|
@@ -113,15 +114,15 @@ Make a folder `my_project` with a file `main.py`:
|
|
|
113
114
|
|
|
114
115
|
Then to create the web files and launch a web server:
|
|
115
116
|
|
|
116
|
-
python3 -m pip install --user --upgrade
|
|
117
|
-
python3 -m pygbag --
|
|
117
|
+
python3.12 -m pip install --user --upgrade pygbag
|
|
118
|
+
python3.12 -m pygbag --PYBUILD 3.12 --ume_block 0 --template noctx.tmpl my_project
|
|
118
119
|
|
|
119
120
|
Point your browser to http://localhost:8000
|
|
120
121
|
|
|
121
122
|
This is all done by Pygbag rather than by me, so you should probably contact them with any issues.
|
|
122
123
|
Carefully read all their [documentation](https://pygame-web.github.io/).
|
|
123
124
|
|
|
124
|
-
It does work for most of
|
|
125
|
+
It does work for most of [these examples](https://electronstudio.github.io/raylib-python-cffi-pygbag-examples/)
|
|
125
126
|
|
|
126
127
|
# App showcase
|
|
127
128
|
|
|
@@ -149,22 +150,36 @@ statically link and use in non-free / proprietary / commercial projects!
|
|
|
149
150
|
|
|
150
151
|
# Performance
|
|
151
152
|
|
|
152
|
-
|
|
153
|
+
If you need more performance, do in this order:
|
|
154
|
+
|
|
155
|
+
1. Use Pypy rather than standard CPython. It is much, much faster and will make more difference than any other optimisations you might do.
|
|
153
156
|
|
|
154
|
-
Every call to C is costly, so it's slightly faster if you use Python data structures and functions when calculating
|
|
157
|
+
2. Every call to C is costly, so it's slightly faster if you use Python data structures and functions when calculating
|
|
155
158
|
in your update loop
|
|
156
159
|
and then only convert them to C data structures when you have to call the C functions for drawing.
|
|
157
160
|
|
|
161
|
+
3. The raylib.* functions are potentially *slightly* faster than the pyray.* equivalents, so if you need a tiny bit more performance
|
|
162
|
+
you can switch your inner loop functions to these.
|
|
163
|
+
|
|
164
|
+
4. There is a version of Python that is faster than Pypy: GraalPy. However it's not fully compatible with all Python
|
|
165
|
+
packages. It doesn't work with CFFI and so doesn't work with this binding. But it *is* compatible with the
|
|
166
|
+
*Java* binding, Jaylib! There is an example of this here: https://github.com/electronstudio/megabunny/tree/master/raylib-python-jaylib
|
|
167
|
+
|
|
158
168
|
## Bunnymark
|
|
159
169
|
|
|
160
170
|
|
|
161
|
-
| Library
|
|
162
|
-
|
|
163
|
-
| Raylib
|
|
164
|
-
| Raylib Python CFFI
|
|
165
|
-
| Raylib Python CFFI
|
|
166
|
-
| Raylib
|
|
167
|
-
| Raylib Python CFFI 3.7
|
|
171
|
+
| Library | Implementation | Bunnies (60 FPS) | Percentage |
|
|
172
|
+
|--------------------------------|-------------------|------------------|------------|
|
|
173
|
+
| Raylib 5.0 | C | 180000 | 100% |
|
|
174
|
+
| Raylib Python CFFI 5.0.0.2 | Python 3.12 | 10500 | 5.8% |
|
|
175
|
+
| Raylib Python CFFI 5.0.0.2 | Pypy 3.10 | 95000 | 53% |
|
|
176
|
+
| Raylib 3.7 | C | 168100 | 100% |
|
|
177
|
+
| Raylib Python CFFI 3.7 | Pypy 3.7 | 33800 | 20% |
|
|
178
|
+
| Raylib Python CFFI 3.7 | Python 3.9 | 7700 | 4.5% |
|
|
179
|
+
| Raylib Python CFFI 3.7 | Python 3.9 Nuitka | 8600 | 5.1% |
|
|
180
|
+
| Raylib Python CFFI 3.7 Dynamic | Python 3.9 | 6300 | 3.7% |
|
|
181
|
+
|
|
182
|
+
See also https://github.com/electronstudio/megabunny/
|
|
168
183
|
|
|
169
184
|
# Packaging your app
|
|
170
185
|
|
|
@@ -179,4 +194,4 @@ You can create a standalone binary using the Nuitka compiler. For example, here
|
|
|
179
194
|
[RetroWar: 8-bit Party Battle](https://store.steampowered.com/app/664240/RetroWar_8bit_Party_Battle/?git) is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.
|
|
180
195
|
|
|
181
196
|
[Coding Games With Pygame Zero & Python](https://github.com/electronstudio/pygame-zero-book) is
|
|
182
|
-
a book for Python beginners.
|
|
197
|
+
a book for Python beginners.
|
|
@@ -38,48 +38,61 @@ def _underscore(word: str) -> str:
|
|
|
38
38
|
return word.lower()
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
def pointer(struct):
|
|
42
|
-
return ffi.addressof(struct)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
# I'm concerned that we are doing a lot of string comparisons on every function call to detect types.
|
|
46
|
-
# Quickest way would probably be isinstance(result, ffi._backend._CDataBase) but that class name varies
|
|
47
|
-
# depending on if binding is static/dynamic
|
|
48
|
-
# (and possibly also different on pypy implementations?).
|
|
49
|
-
# which makes me reluctant to rely on it.
|
|
50
|
-
# Another possibility is ffi.typeof() but that will throw an exception if you give it a type that isn't a ctype
|
|
51
|
-
# Another way to improve performance might be to special-case simple types before doing the string comparisons
|
|
52
|
-
|
|
53
41
|
def _wrap_function(original_func):
|
|
54
|
-
|
|
42
|
+
c_args = [str(x) for x in ffi.typeof(original_func).args]
|
|
43
|
+
number_of_args = len(c_args)
|
|
44
|
+
c_arg_is_pointer = [x.kind == 'pointer' for x in ffi.typeof(original_func).args]
|
|
45
|
+
c_arg_is_string = [str(x) == "<ctype 'char *'>" for x in ffi.typeof(original_func).args]
|
|
46
|
+
# c_arg_is_void_pointer = [str(x) == "<ctype 'void *'>" for x in ffi.typeof(original_func).args]
|
|
47
|
+
|
|
55
48
|
def wrapped_func(*args):
|
|
56
|
-
|
|
57
|
-
for
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
#
|
|
49
|
+
args = list(args) # tuple is immutable, converting it to mutable list is faster than constructing new list!
|
|
50
|
+
for i in range(number_of_args):
|
|
51
|
+
try:
|
|
52
|
+
arg = args[i]
|
|
53
|
+
except IndexError:
|
|
54
|
+
raise RuntimeError(f"function requires {number_of_args} arguments but you supplied {len(args)}")
|
|
55
|
+
if c_arg_is_pointer[i]:
|
|
56
|
+
if c_arg_is_string[i]: # we assume c_arg is 'const char *'
|
|
57
|
+
try: # if it's a non-const 'char *' then user should be supplying a ctype pointer, not a Python
|
|
58
|
+
# string
|
|
59
|
+
args[i] = arg.encode('utf-8') # in that case this conversion will fail
|
|
60
|
+
except AttributeError: # but those functions are uncommon, so quicker on average to try the
|
|
61
|
+
# conversion
|
|
62
|
+
pass # and ignore the exception
|
|
63
|
+
# if user supplied a Python string but c_arg is a 'char *' not a 'const char *' then we ought to raise
|
|
64
|
+
# exception because its an out
|
|
65
|
+
# parameter and user should supply a ctype pointer, but we cant because cffi cant detect 'const'
|
|
64
66
|
# so we would have to get the info from raylib.json
|
|
65
|
-
elif
|
|
66
|
-
|
|
67
|
+
elif c_args[i] == "<ctype 'char * *'>" and type(arg) is list:
|
|
68
|
+
args[i] = [ffi.new("char[]", x.encode('utf-8')) for x in arg]
|
|
67
69
|
elif is_cdata(arg) and "*" not in str(arg):
|
|
68
|
-
|
|
70
|
+
args[i] = ffi.addressof(arg)
|
|
69
71
|
elif arg is None:
|
|
70
|
-
|
|
72
|
+
args[i] = ffi.NULL
|
|
71
73
|
elif not is_cdata(arg):
|
|
72
|
-
if
|
|
74
|
+
if c_args[i] == "<ctype '_Bool *'>":
|
|
73
75
|
raise TypeError(
|
|
74
|
-
"Argument must be a ctype bool, please create one with: pyray.ffi.new('bool
|
|
75
|
-
|
|
76
|
+
f"Argument {i} ({arg}) must be a ctype bool, please create one with: pyray.ffi.new('bool "
|
|
77
|
+
f"*', True)")
|
|
78
|
+
elif c_args[i] == "<ctype 'int *'>":
|
|
76
79
|
raise TypeError(
|
|
77
|
-
"Argument must be a ctype int, please create one with: pyray.ffi.new('int
|
|
78
|
-
|
|
80
|
+
f"Argument {i} ({arg}) must be a ctype int, please create one with: pyray.ffi.new('int "
|
|
81
|
+
f"*', 1)")
|
|
82
|
+
elif c_args[i] == "<ctype 'float *'>":
|
|
79
83
|
raise TypeError(
|
|
80
|
-
"Argument must be a ctype float, please create one with: pyray.ffi.new(
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
f"Argument {i} ({arg}) must be a ctype float, please create one with: pyray.ffi.new("
|
|
85
|
+
f"'float *', 1.0)")
|
|
86
|
+
elif c_args[i] == "<ctype 'void *'>":
|
|
87
|
+
# we could assume it's a string and try to convert it but we would have to be sure it's
|
|
88
|
+
# const. that seems reasonable assumption for char* but i'm not confident it is for void*
|
|
89
|
+
raise TypeError(
|
|
90
|
+
f"Argument {i} ({arg}) must be a cdata pointer. Type is void so I don't know what type it "
|
|
91
|
+
f"should be."
|
|
92
|
+
"If it's a const string you can create it with pyray.ffi.new('char []', b\"whatever\") . "
|
|
93
|
+
"If it's a float you can create it with pyray.ffi.new('float *', 1.0)")
|
|
94
|
+
|
|
95
|
+
result = original_func(*args)
|
|
83
96
|
if result is None:
|
|
84
97
|
return
|
|
85
98
|
elif is_cdata(result) and str(result).startswith("<cdata 'char *'"):
|
|
@@ -141,3 +154,7 @@ for struct in ffi.list_types()[0]:
|
|
|
141
154
|
|
|
142
155
|
# overwrite ffi enums with our own
|
|
143
156
|
from raylib.enums import *
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def text_format(*args):
|
|
160
|
+
raise RuntimeError("Use Python f-strings etc rather than calling text_format().")
|
|
@@ -2344,10 +2344,10 @@ def glfw_get_required_instance_extensions(count: Any,) -> list[str]:
|
|
|
2344
2344
|
def glfw_get_time() -> float:
|
|
2345
2345
|
""""""
|
|
2346
2346
|
...
|
|
2347
|
-
def glfw_get_timer_frequency() ->
|
|
2347
|
+
def glfw_get_timer_frequency() -> int:
|
|
2348
2348
|
""""""
|
|
2349
2349
|
...
|
|
2350
|
-
def glfw_get_timer_value() ->
|
|
2350
|
+
def glfw_get_timer_value() -> int:
|
|
2351
2351
|
""""""
|
|
2352
2352
|
...
|
|
2353
2353
|
def glfw_get_version(major: Any,minor: Any,rev: Any,) -> None:
|
|
@@ -3397,6 +3397,34 @@ class rlVertexBuffer:
|
|
|
3397
3397
|
self.indices=indices
|
|
3398
3398
|
self.vaoId=vaoId
|
|
3399
3399
|
self.vboId=vboId
|
|
3400
|
+
|
|
3401
|
+
LIGHTGRAY : Color
|
|
3402
|
+
GRAY : Color
|
|
3403
|
+
DARKGRAY : Color
|
|
3404
|
+
YELLOW : Color
|
|
3405
|
+
GOLD : Color
|
|
3406
|
+
ORANGE : Color
|
|
3407
|
+
PINK : Color
|
|
3408
|
+
RED : Color
|
|
3409
|
+
MAROON : Color
|
|
3410
|
+
GREEN : Color
|
|
3411
|
+
LIME : Color
|
|
3412
|
+
DARKGREEN : Color
|
|
3413
|
+
SKYBLUE : Color
|
|
3414
|
+
BLUE : Color
|
|
3415
|
+
DARKBLUE : Color
|
|
3416
|
+
PURPLE : Color
|
|
3417
|
+
VIOLET : Color
|
|
3418
|
+
DARKPURPLE : Color
|
|
3419
|
+
BEIGE : Color
|
|
3420
|
+
BROWN : Color
|
|
3421
|
+
DARKBROWN : Color
|
|
3422
|
+
WHITE : Color
|
|
3423
|
+
BLACK : Color
|
|
3424
|
+
BLANK : Color
|
|
3425
|
+
MAGENTA : Color
|
|
3426
|
+
RAYWHITE : Color
|
|
3427
|
+
|
|
3400
3428
|
from enum import IntEnum
|
|
3401
3429
|
|
|
3402
3430
|
class ConfigFlags(IntEnum):
|
|
@@ -4111,44 +4139,3 @@ class GuiIconName(IntEnum):
|
|
|
4111
4139
|
ICON_254 = 254
|
|
4112
4140
|
ICON_255 = 255
|
|
4113
4141
|
|
|
4114
|
-
# Copyright (c) 2021 Richard Smith and others
|
|
4115
|
-
#
|
|
4116
|
-
# This program and the accompanying materials are made available under the
|
|
4117
|
-
# terms of the Eclipse Public License 2.0 which is available at
|
|
4118
|
-
# http://www.eclipse.org/legal/epl-2.0.
|
|
4119
|
-
#
|
|
4120
|
-
# This Source Code may also be made available under the following Secondary
|
|
4121
|
-
# licenses when the conditions for such availability set forth in the Eclipse
|
|
4122
|
-
# Public License, v. 2.0 are satisfied: GNU General Public License, version 2
|
|
4123
|
-
# with the GNU Classpath Exception which is
|
|
4124
|
-
# available at https://www.gnu.org/software/classpath/license.html.
|
|
4125
|
-
#
|
|
4126
|
-
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
4127
|
-
|
|
4128
|
-
LIGHTGRAY =( 200, 200, 200, 255 )
|
|
4129
|
-
GRAY =( 130, 130, 130, 255 )
|
|
4130
|
-
DARKGRAY =( 80, 80, 80, 255 )
|
|
4131
|
-
YELLOW =( 253, 249, 0, 255 )
|
|
4132
|
-
GOLD =( 255, 203, 0, 255 )
|
|
4133
|
-
ORANGE =( 255, 161, 0, 255 )
|
|
4134
|
-
PINK =( 255, 109, 194, 255 )
|
|
4135
|
-
RED =( 230, 41, 55, 255 )
|
|
4136
|
-
MAROON =( 190, 33, 55, 255 )
|
|
4137
|
-
GREEN =( 0, 228, 48, 255 )
|
|
4138
|
-
LIME =( 0, 158, 47, 255 )
|
|
4139
|
-
DARKGREEN =( 0, 117, 44, 255 )
|
|
4140
|
-
SKYBLUE =( 102, 191, 255, 255 )
|
|
4141
|
-
BLUE =( 0, 121, 241, 255 )
|
|
4142
|
-
DARKBLUE =( 0, 82, 172, 255 )
|
|
4143
|
-
PURPLE =( 200, 122, 255, 255 )
|
|
4144
|
-
VIOLET =( 135, 60, 190, 255 )
|
|
4145
|
-
DARKPURPLE =( 112, 31, 126, 255 )
|
|
4146
|
-
BEIGE =( 211, 176, 131, 255 )
|
|
4147
|
-
BROWN =( 127, 106, 79, 255 )
|
|
4148
|
-
DARKBROWN =( 76, 63, 47, 255 )
|
|
4149
|
-
WHITE =( 255, 255, 255, 255 )
|
|
4150
|
-
BLACK =( 0, 0, 0, 255 )
|
|
4151
|
-
BLANK =( 0, 0, 0, 0 )
|
|
4152
|
-
MAGENTA =( 255, 0, 255, 255 )
|
|
4153
|
-
RAYWHITE =( 245, 245, 245, 255 )
|
|
4154
|
-
|
|
@@ -12,12 +12,18 @@
|
|
|
12
12
|
#
|
|
13
13
|
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
import sys
|
|
16
|
+
try:
|
|
17
|
+
from ._raylib_cffi import ffi, lib as rl
|
|
18
|
+
except ModuleNotFoundError:
|
|
19
|
+
print("\n*** ERROR LOADING NATIVE CODE ***\n")
|
|
20
|
+
print("See https://github.com/electronstudio/raylib-python-cffi/issues/142\n", file=sys.stderr)
|
|
21
|
+
print("Your Python is: "+str(sys.implementation)+"\n", file=sys.stderr)
|
|
22
|
+
raise
|
|
16
23
|
from raylib._raylib_cffi.lib import *
|
|
17
24
|
from raylib.colors import *
|
|
18
25
|
from raylib.defines import *
|
|
19
26
|
import cffi
|
|
20
|
-
import sys
|
|
21
27
|
from .version import __version__
|
|
22
28
|
|
|
23
29
|
print("RAYLIB STATIC "+__version__+" LOADED", file=sys.stderr)
|
|
@@ -1041,10 +1041,10 @@ def GuiLine(bounds: Rectangle,text: str,) -> int:
|
|
|
1041
1041
|
def GuiListView(bounds: Rectangle,text: str,scrollIndex: Any,active: Any,) -> int:
|
|
1042
1042
|
"""List View control, returns selected list item index"""
|
|
1043
1043
|
...
|
|
1044
|
-
def GuiListViewEx(bounds: Rectangle,text: str,count: int,scrollIndex: Any,active: Any,focus: Any,) -> int:
|
|
1044
|
+
def GuiListViewEx(bounds: Rectangle,text: list[str],count: int,scrollIndex: Any,active: Any,focus: Any,) -> int:
|
|
1045
1045
|
"""List View with extended parameters"""
|
|
1046
1046
|
...
|
|
1047
|
-
def GuiLoadIcons(fileName: str,loadIconsName: bool,) -> str:
|
|
1047
|
+
def GuiLoadIcons(fileName: str,loadIconsName: bool,) -> list[str]:
|
|
1048
1048
|
"""Load raygui icons file (.rgi) into internal icons data"""
|
|
1049
1049
|
...
|
|
1050
1050
|
def GuiLoadStyle(fileName: str,) -> None:
|
|
@@ -1098,7 +1098,7 @@ def GuiSpinner(bounds: Rectangle,text: str,value: Any,minValue: int,maxValue: in
|
|
|
1098
1098
|
def GuiStatusBar(bounds: Rectangle,text: str,) -> int:
|
|
1099
1099
|
"""Status Bar control, shows info text"""
|
|
1100
1100
|
...
|
|
1101
|
-
def GuiTabBar(bounds: Rectangle,text: str,count: int,active: Any,) -> int:
|
|
1101
|
+
def GuiTabBar(bounds: Rectangle,text: list[str],count: int,active: Any,) -> int:
|
|
1102
1102
|
"""Tab Bar control, returns TAB to be closed or -1"""
|
|
1103
1103
|
...
|
|
1104
1104
|
def GuiTextBox(bounds: Rectangle,text: str,textSize: int,editMode: bool,) -> int:
|
|
@@ -2612,7 +2612,7 @@ def TextInsert(text: str,insert: str,position: int,) -> str:
|
|
|
2612
2612
|
def TextIsEqual(text1: str,text2: str,) -> bool:
|
|
2613
2613
|
"""Check if two text string are equal"""
|
|
2614
2614
|
...
|
|
2615
|
-
def TextJoin(textList: str,count: int,delimiter: str,) -> str:
|
|
2615
|
+
def TextJoin(textList: list[str],count: int,delimiter: str,) -> str:
|
|
2616
2616
|
"""Join text strings with delimiter"""
|
|
2617
2617
|
...
|
|
2618
2618
|
def TextLength(text: str,) -> int:
|
|
@@ -2621,7 +2621,7 @@ def TextLength(text: str,) -> int:
|
|
|
2621
2621
|
def TextReplace(text: str,replace: str,by: str,) -> str:
|
|
2622
2622
|
"""Replace text string (WARNING: memory must be freed!)"""
|
|
2623
2623
|
...
|
|
2624
|
-
def TextSplit(text: str,delimiter: str,count: Any,) -> str:
|
|
2624
|
+
def TextSplit(text: str,delimiter: str,count: Any,) -> list[str]:
|
|
2625
2625
|
"""Split text into multiple strings"""
|
|
2626
2626
|
...
|
|
2627
2627
|
def TextSubtext(text: str,position: int,length: int,) -> str:
|
|
@@ -3009,7 +3009,7 @@ def glfwGetCurrentContext() -> Any:
|
|
|
3009
3009
|
def glfwGetCursorPos(window: Any,xpos: Any,ypos: Any,) -> None:
|
|
3010
3010
|
""""""
|
|
3011
3011
|
...
|
|
3012
|
-
def glfwGetError(description: str,) -> int:
|
|
3012
|
+
def glfwGetError(description: list[str],) -> int:
|
|
3013
3013
|
""""""
|
|
3014
3014
|
...
|
|
3015
3015
|
def glfwGetFramebufferSize(window: Any,width: Any,height: Any,) -> None:
|
|
@@ -3087,16 +3087,16 @@ def glfwGetPrimaryMonitor() -> Any:
|
|
|
3087
3087
|
def glfwGetProcAddress(procname: str,) -> Any:
|
|
3088
3088
|
""""""
|
|
3089
3089
|
...
|
|
3090
|
-
def glfwGetRequiredInstanceExtensions(count: Any,) -> str:
|
|
3090
|
+
def glfwGetRequiredInstanceExtensions(count: Any,) -> list[str]:
|
|
3091
3091
|
""""""
|
|
3092
3092
|
...
|
|
3093
3093
|
def glfwGetTime() -> float:
|
|
3094
3094
|
""""""
|
|
3095
3095
|
...
|
|
3096
|
-
def glfwGetTimerFrequency() ->
|
|
3096
|
+
def glfwGetTimerFrequency() -> int:
|
|
3097
3097
|
""""""
|
|
3098
3098
|
...
|
|
3099
|
-
def glfwGetTimerValue() ->
|
|
3099
|
+
def glfwGetTimerValue() -> int:
|
|
3100
3100
|
""""""
|
|
3101
3101
|
...
|
|
3102
3102
|
def glfwGetVersion(major: Any,minor: Any,rev: Any,) -> None:
|
|
@@ -3201,7 +3201,7 @@ def glfwSetCursorPos(window: Any,xpos: float,ypos: float,) -> None:
|
|
|
3201
3201
|
def glfwSetCursorPosCallback(window: Any,callback: Any,) -> Any:
|
|
3202
3202
|
""""""
|
|
3203
3203
|
...
|
|
3204
|
-
def glfwSetDropCallback(window: Any,callback: str,) -> str:
|
|
3204
|
+
def glfwSetDropCallback(window: Any,callback: list[str],) -> list[str]:
|
|
3205
3205
|
""""""
|
|
3206
3206
|
...
|
|
3207
3207
|
def glfwSetErrorCallback(callback: str,) -> str:
|
|
@@ -3886,44 +3886,31 @@ rlShaderUniformDataType: int
|
|
|
3886
3886
|
rlTextureFilter: int
|
|
3887
3887
|
rlTraceLogLevel: int
|
|
3888
3888
|
rlVertexBuffer: struct
|
|
3889
|
-
# Copyright (c) 2021 Richard Smith and others
|
|
3890
|
-
#
|
|
3891
|
-
# This program and the accompanying materials are made available under the
|
|
3892
|
-
# terms of the Eclipse Public License 2.0 which is available at
|
|
3893
|
-
# http://www.eclipse.org/legal/epl-2.0.
|
|
3894
|
-
#
|
|
3895
|
-
# This Source Code may also be made available under the following Secondary
|
|
3896
|
-
# licenses when the conditions for such availability set forth in the Eclipse
|
|
3897
|
-
# Public License, v. 2.0 are satisfied: GNU General Public License, version 2
|
|
3898
|
-
# with the GNU Classpath Exception which is
|
|
3899
|
-
# available at https://www.gnu.org/software/classpath/license.html.
|
|
3900
|
-
#
|
|
3901
|
-
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
3902
3889
|
|
|
3903
|
-
LIGHTGRAY
|
|
3904
|
-
GRAY
|
|
3905
|
-
DARKGRAY
|
|
3906
|
-
YELLOW
|
|
3907
|
-
GOLD
|
|
3908
|
-
ORANGE
|
|
3909
|
-
PINK
|
|
3910
|
-
RED
|
|
3911
|
-
MAROON
|
|
3912
|
-
GREEN
|
|
3913
|
-
LIME
|
|
3914
|
-
DARKGREEN
|
|
3915
|
-
SKYBLUE
|
|
3916
|
-
BLUE
|
|
3917
|
-
DARKBLUE
|
|
3918
|
-
PURPLE
|
|
3919
|
-
VIOLET
|
|
3920
|
-
DARKPURPLE
|
|
3921
|
-
BEIGE
|
|
3922
|
-
BROWN
|
|
3923
|
-
DARKBROWN
|
|
3924
|
-
WHITE
|
|
3925
|
-
BLACK
|
|
3926
|
-
BLANK
|
|
3927
|
-
MAGENTA
|
|
3928
|
-
RAYWHITE
|
|
3890
|
+
LIGHTGRAY : Color
|
|
3891
|
+
GRAY : Color
|
|
3892
|
+
DARKGRAY : Color
|
|
3893
|
+
YELLOW : Color
|
|
3894
|
+
GOLD : Color
|
|
3895
|
+
ORANGE : Color
|
|
3896
|
+
PINK : Color
|
|
3897
|
+
RED : Color
|
|
3898
|
+
MAROON : Color
|
|
3899
|
+
GREEN : Color
|
|
3900
|
+
LIME : Color
|
|
3901
|
+
DARKGREEN : Color
|
|
3902
|
+
SKYBLUE : Color
|
|
3903
|
+
BLUE : Color
|
|
3904
|
+
DARKBLUE : Color
|
|
3905
|
+
PURPLE : Color
|
|
3906
|
+
VIOLET : Color
|
|
3907
|
+
DARKPURPLE : Color
|
|
3908
|
+
BEIGE : Color
|
|
3909
|
+
BROWN : Color
|
|
3910
|
+
DARKBROWN : Color
|
|
3911
|
+
WHITE : Color
|
|
3912
|
+
BLACK : Color
|
|
3913
|
+
BLANK : Color
|
|
3914
|
+
MAGENTA : Color
|
|
3915
|
+
RAYWHITE : Color
|
|
3929
3916
|
|
|
@@ -147,7 +147,6 @@ def build_unix():
|
|
|
147
147
|
"""
|
|
148
148
|
|
|
149
149
|
ffibuilder.cdef(pre_process_header(raylib_h))
|
|
150
|
-
ffibuilder.cdef(pre_process_header(glfw3_h))
|
|
151
150
|
ffibuilder.cdef(pre_process_header(rlgl_h))
|
|
152
151
|
ffibuilder.cdef(pre_process_header(raymath_h, True))
|
|
153
152
|
|
|
@@ -155,6 +154,9 @@ def build_unix():
|
|
|
155
154
|
ffibuilder.cdef(pre_process_header(raygui_h))
|
|
156
155
|
if os.path.isfile(physac_h):
|
|
157
156
|
ffibuilder.cdef(pre_process_header(physac_h))
|
|
157
|
+
if os.path.isfile(glfw3_h):
|
|
158
|
+
ffibuilder.cdef(pre_process_header(glfw3_h))
|
|
159
|
+
|
|
158
160
|
|
|
159
161
|
if platform.system() == "Darwin":
|
|
160
162
|
print("BUILDING FOR MAC")
|
|
@@ -162,16 +164,17 @@ def build_unix():
|
|
|
162
164
|
'-framework', 'IOKit', '-framework', 'CoreFoundation', '-framework',
|
|
163
165
|
'CoreVideo']
|
|
164
166
|
libraries = []
|
|
165
|
-
extra_compile_args = ["-Wno-error=incompatible-function-pointer-types"]
|
|
167
|
+
extra_compile_args = ["-Wno-error=incompatible-function-pointer-types", "-D_CFFI_NO_LIMITED_API"]
|
|
166
168
|
else: #platform.system() == "Linux":
|
|
167
169
|
print("BUILDING FOR LINUX")
|
|
168
170
|
extra_link_args = get_lib_flags() + [ '-lm', '-lpthread', '-lGL',
|
|
169
171
|
'-lrt', '-lm', '-ldl', '-lX11', '-lpthread', '-latomic']
|
|
170
|
-
extra_compile_args = []
|
|
172
|
+
extra_compile_args = ["-Wno-incompatible-pointer-types", "-D_CFFI_NO_LIMITED_API"]
|
|
171
173
|
libraries = ['GL', 'm', 'pthread', 'dl', 'rt', 'X11', 'atomic']
|
|
172
174
|
|
|
173
175
|
ffibuilder.set_source("raylib._raylib_cffi",
|
|
174
176
|
ffi_includes,
|
|
177
|
+
py_limited_api=False,
|
|
175
178
|
include_dirs=[get_the_include_path()],
|
|
176
179
|
extra_link_args=extra_link_args,
|
|
177
180
|
extra_compile_args=extra_compile_args,
|
|
@@ -198,6 +201,8 @@ def build_windows():
|
|
|
198
201
|
#include "physac.h"
|
|
199
202
|
""",
|
|
200
203
|
extra_link_args=['/NODEFAULTLIB:MSVCRTD'],
|
|
204
|
+
extra_compile_args="/D_CFFI_NO_LIMITED_API",
|
|
205
|
+
py_limited_api=False,
|
|
201
206
|
libraries=['raylib', 'gdi32', 'shell32', 'user32', 'OpenGL32', 'winmm'],
|
|
202
207
|
include_dirs=['D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src',
|
|
203
208
|
'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src\\external\\glfw\\include',
|