raylib 5.5.0.2__pp311-pypy311_pp73-macosx_10_13_x86_64.whl

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/build.py ADDED
@@ -0,0 +1,256 @@
1
+ # Copyright (c) 2021 Richard Smith and others
2
+ #
3
+ # This program and the accompanying materials are made available under the
4
+ # terms of the Eclipse Public License 2.0 which is available at
5
+ # http://www.eclipse.org/legal/epl-2.0.
6
+ #
7
+ # This Source Code may also be made available under the following Secondary
8
+ # licenses when the conditions for such availability set forth in the Eclipse
9
+ # Public License, v. 2.0 are satisfied: GNU General Public License, version 2
10
+ # with the GNU Classpath Exception which is
11
+ # available at https://www.gnu.org/software/classpath/license.html.
12
+ #
13
+ # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
14
+
15
+ # Assumes raylib, GL, etc are all already installed as system libraries. We dont distribute them.
16
+ # Raylib must be installed and compiled with: cmake -DWITH_PIC=ON -DSHARED=ON -DSTATIC=ON ..
17
+
18
+ # We use /usr/local/lib/libraylib.a to ensure we link to static version
19
+ import re
20
+
21
+ from cffi import FFI
22
+ import os
23
+ import platform
24
+ import sys
25
+ import subprocess
26
+ import time
27
+
28
+ RAYLIB_PLATFORM = os.getenv("RAYLIB_PLATFORM", "Desktop")
29
+
30
+ def check_raylib_installed():
31
+ return subprocess.run(['pkg-config', '--exists', 'raylib'], text=True, stdout=subprocess.PIPE).returncode == 0
32
+
33
+ def check_SDL_installed():
34
+ return subprocess.run(['pkg-config', '--exists', 'sdl2'], text=True, stdout=subprocess.PIPE).returncode == 0
35
+
36
+ def get_the_include_path():
37
+ return subprocess.run(['pkg-config', '--variable=includedir', 'raylib'], text=True,
38
+ stdout=subprocess.PIPE).stdout.strip()
39
+
40
+
41
+ def get_the_lib_path():
42
+ return subprocess.run(['pkg-config', '--variable=libdir', 'raylib'], text=True,
43
+ stdout=subprocess.PIPE).stdout.strip()
44
+
45
+ def get_lib_flags():
46
+ return subprocess.run(['pkg-config', '--libs', 'raylib'], text=True,
47
+ stdout=subprocess.PIPE).stdout.strip().split()
48
+
49
+ def pre_process_header(filename, remove_function_bodies=False):
50
+ print("Pre-processing " + filename)
51
+ file = open(filename, "r")
52
+ filetext = "".join([line for line in file if '#include' not in line])
53
+ command = ['gcc', '-CC', '-P', '-undef', '-nostdinc', '-DRL_MATRIX_TYPE',
54
+ '-DRL_QUATERNION_TYPE','-DRL_VECTOR4_TYPE','-DRL_VECTOR3_TYPE','-DRL_VECTOR2_TYPE',
55
+ '-DRLAPI=', '-DPHYSACDEF=', '-DRAYGUIDEF=','-DRMAPI=',
56
+ '-dDI', '-E', '-']
57
+ filetext = subprocess.run(command, text=True, input=filetext, stdout=subprocess.PIPE).stdout
58
+ filetext = filetext.replace("va_list", "void *")
59
+ if remove_function_bodies:
60
+ filetext = re.sub('\n{\n(.|\n)*?\n}\n', ';', filetext)
61
+ filetext = "\n".join([line for line in filetext.splitlines() if not line.startswith("#")])
62
+ file = open("raylib/"+os.path.basename(filename)+".modified", "w")
63
+ file.write(filetext)
64
+ # print(r)
65
+ return filetext
66
+
67
+
68
+ def check_header_exists(file):
69
+ if not os.path.isfile(file):
70
+ print("\n\n*************** WARNING ***************\n\n")
71
+ print(
72
+ file + " not found. Build will not contain these extra functions.\n\nPlease copy file from src/extras to " + file + " if you want them.\n\n")
73
+ print("**************************************\n\n")
74
+ time.sleep(1)
75
+ return False
76
+ return True
77
+
78
+
79
+ # def mangle(file):
80
+ # result = ""
81
+ # skip = False
82
+ # for line in open(file):
83
+ # line = line.strip().replace("va_list", "void *") + "\n"
84
+ # if skip:
85
+ # if line.startswith("#endif"):
86
+ # skip = False
87
+ # continue
88
+ # if line.startswith("#if defined(__cplusplus)"):
89
+ # skip = True
90
+ # continue
91
+ # if line.startswith("#endif // RAYGUI_H"):
92
+ # break
93
+ # if line.startswith("#"):
94
+ # continue
95
+ # if line.startswith("RLAPI"):
96
+ # line = line.replace('RLAPI ', '')
97
+ # if line.startswith("RAYGUIDEF"):
98
+ # line = line.replace('RAYGUIDEF ', '')
99
+ # if line.startswith("PHYSACDEF"):
100
+ # line = line.replace('PHYSACDEF ', '')
101
+ # result += line
102
+ # # print(line)
103
+ # return result
104
+
105
+
106
+ def build_unix():
107
+ if not check_raylib_installed():
108
+ raise Exception("ERROR: raylib not found by pkg-config. Please install pkg-config and Raylib.")
109
+
110
+ if RAYLIB_PLATFORM=="SDL" and not check_SDL_installed():
111
+ raise Exception("ERROR: SDL2 not found by pkg-config. Please install pkg-config and SDL2.")
112
+
113
+ raylib_h = get_the_include_path() + "/raylib.h"
114
+ rlgl_h = get_the_include_path() + "/rlgl.h"
115
+ raymath_h = get_the_include_path() + "/raymath.h"
116
+
117
+ if not os.path.isfile(raylib_h):
118
+ raise Exception("ERROR: " + raylib_h + " not found. Please install Raylib.")
119
+
120
+ if not os.path.isfile(rlgl_h):
121
+ raise Exception("ERROR: " + rlgl_h + " not found. Please install Raylib.")
122
+
123
+ if not os.path.isfile(raymath_h):
124
+ raise Exception("ERROR: " + raylib_h + " not found. Please install Raylib.")
125
+
126
+ ffi_includes = """
127
+ #include "raylib.h"
128
+ #include "rlgl.h"
129
+ #include "raymath.h"
130
+ """
131
+
132
+ glfw3_h = get_the_include_path() + "/GLFW/glfw3.h"
133
+ if RAYLIB_PLATFORM=="Desktop" and check_header_exists(glfw3_h):
134
+ ffi_includes += """
135
+ #include "GLFW/glfw3.h"
136
+ """
137
+
138
+ raygui_h = get_the_include_path() + "/raygui.h"
139
+ if check_header_exists(raygui_h):
140
+ ffi_includes += """
141
+ #define RAYGUI_IMPLEMENTATION
142
+ #define RAYGUI_SUPPORT_RICONS
143
+ #include "raygui.h"
144
+ """
145
+
146
+ physac_h = get_the_include_path() + "/physac.h"
147
+ if check_header_exists(physac_h):
148
+ ffi_includes += """
149
+ #define PHYSAC_IMPLEMENTATION
150
+ #include "physac.h"
151
+ """
152
+
153
+ ffibuilder.cdef(pre_process_header(raylib_h))
154
+ ffibuilder.cdef(pre_process_header(rlgl_h))
155
+ ffibuilder.cdef(pre_process_header(raymath_h, True))
156
+
157
+ if os.path.isfile(raygui_h):
158
+ ffibuilder.cdef(pre_process_header(raygui_h))
159
+ if os.path.isfile(physac_h):
160
+ ffibuilder.cdef(pre_process_header(physac_h))
161
+ if RAYLIB_PLATFORM=="Desktop" and os.path.isfile(glfw3_h):
162
+ ffibuilder.cdef(pre_process_header(glfw3_h))
163
+
164
+
165
+ if platform.system() == "Darwin":
166
+ print("BUILDING FOR MAC")
167
+ extra_link_args = [get_the_lib_path() + '/libraylib.a', '-framework', 'OpenGL', '-framework', 'Cocoa',
168
+ '-framework', 'IOKit', '-framework', 'CoreFoundation', '-framework',
169
+ 'CoreVideo']
170
+ if RAYLIB_PLATFORM=="SDL":
171
+ extra_link_args += ['/usr/local/lib/libSDL2.a', '-framework', 'CoreHaptics', '-framework', 'ForceFeedback',
172
+ '-framework', 'GameController']
173
+ libraries = []
174
+ extra_compile_args = ["-Wno-error=incompatible-function-pointer-types", "-D_CFFI_NO_LIMITED_API"]
175
+ else: #platform.system() == "Linux":
176
+ print("BUILDING FOR LINUX")
177
+ extra_link_args = get_lib_flags() + [ '-lm', '-lpthread', '-lGL',
178
+ '-lrt', '-lm', '-ldl', '-lpthread', '-latomic']
179
+ if RAYLIB_PLATFORM=="SDL":
180
+ extra_link_args += ['-lX11','-lSDL2']
181
+ elif RAYLIB_PLATFORM=="DRM":
182
+ extra_link_args += ['-lEGL', '-lgbm']
183
+ else:
184
+ extra_link_args += ['-lX11']
185
+ extra_compile_args = ["-Wno-incompatible-pointer-types", "-D_CFFI_NO_LIMITED_API"]
186
+ libraries = [] # Not sure why but we put them in extra_link_args instead so *shouldnt* be needed here
187
+
188
+
189
+ print("extra_link_args: "+str(extra_link_args))
190
+ print("extra_compile_args: "+str(extra_compile_args))
191
+ print("libraries: "+str(libraries))
192
+ ffibuilder.set_source("raylib._raylib_cffi",
193
+ ffi_includes,
194
+ py_limited_api=False,
195
+ include_dirs=[get_the_include_path()],
196
+ extra_link_args=extra_link_args,
197
+ extra_compile_args=extra_compile_args,
198
+ libraries=libraries)
199
+
200
+
201
+ def build_windows():
202
+ print("BUILDING FOR WINDOWS")
203
+ ffibuilder.cdef(open("raylib/raylib.h.modified").read())
204
+ if RAYLIB_PLATFORM=="Desktop":
205
+ ffibuilder.cdef(open("raylib/glfw3.h.modified").read())
206
+ ffibuilder.cdef(open("raylib/rlgl.h.modified").read())
207
+ ffibuilder.cdef(open("raylib/raygui.h.modified").read())
208
+ ffibuilder.cdef(open("raylib/physac.h.modified").read())
209
+ ffibuilder.cdef(open("raylib/raymath.h.modified").read())
210
+
211
+ ffi_includes = """
212
+ #include "raylib.h"
213
+ #include "rlgl.h"
214
+ #include "raymath.h"
215
+ """
216
+
217
+ if RAYLIB_PLATFORM=="Desktop":
218
+ ffi_includes += """
219
+ #include "GLFW/glfw3.h"
220
+ """
221
+
222
+ ffi_includes += """
223
+ #define RAYGUI_IMPLEMENTATION
224
+ #define RAYGUI_SUPPORT_RICONS
225
+ #include "raygui.h"
226
+ #define PHYSAC_IMPLEMENTATION
227
+ #include "physac.h"
228
+ """
229
+ libraries = ['raylib', 'gdi32', 'shell32', 'user32', 'OpenGL32', 'winmm']
230
+ if RAYLIB_PLATFORM=="SDL":
231
+ libraries += ['SDL2']
232
+
233
+ print("libraries: "+str(libraries))
234
+ ffibuilder.set_source("raylib._raylib_cffi", ffi_includes,
235
+ extra_link_args=['/NODEFAULTLIB:MSVCRTD'],
236
+ extra_compile_args=["/D_CFFI_NO_LIMITED_API"],
237
+ py_limited_api=False,
238
+ libraries=libraries,
239
+ include_dirs=['D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src',
240
+ 'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src\\external\\glfw\\include',
241
+ 'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raygui\\src',
242
+ 'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\physac\\src'],
243
+ )
244
+
245
+
246
+ ffibuilder = FFI()
247
+
248
+ if platform.system() == "Windows":
249
+ build_windows()
250
+ else:
251
+ print("not windows, trying Unix build")
252
+ build_unix()
253
+
254
+
255
+ if __name__ == "__main__":
256
+ ffibuilder.compile(verbose=True)
raylib/colors.py ADDED
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 2021 Richard Smith and others
2
+ #
3
+ # This program and the accompanying materials are made available under the
4
+ # terms of the Eclipse Public License 2.0 which is available at
5
+ # http://www.eclipse.org/legal/epl-2.0.
6
+ #
7
+ # This Source Code may also be made available under the following Secondary
8
+ # licenses when the conditions for such availability set forth in the Eclipse
9
+ # Public License, v. 2.0 are satisfied: GNU General Public License, version 2
10
+ # with the GNU Classpath Exception which is
11
+ # available at https://www.gnu.org/software/classpath/license.html.
12
+ #
13
+ # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
14
+
15
+ LIGHTGRAY =( 200, 200, 200, 255 )
16
+ GRAY =( 130, 130, 130, 255 )
17
+ DARKGRAY =( 80, 80, 80, 255 )
18
+ YELLOW =( 253, 249, 0, 255 )
19
+ GOLD =( 255, 203, 0, 255 )
20
+ ORANGE =( 255, 161, 0, 255 )
21
+ PINK =( 255, 109, 194, 255 )
22
+ RED =( 230, 41, 55, 255 )
23
+ MAROON =( 190, 33, 55, 255 )
24
+ GREEN =( 0, 228, 48, 255 )
25
+ LIME =( 0, 158, 47, 255 )
26
+ DARKGREEN =( 0, 117, 44, 255 )
27
+ SKYBLUE =( 102, 191, 255, 255 )
28
+ BLUE =( 0, 121, 241, 255 )
29
+ DARKBLUE =( 0, 82, 172, 255 )
30
+ PURPLE =( 200, 122, 255, 255 )
31
+ VIOLET =( 135, 60, 190, 255 )
32
+ DARKPURPLE =( 112, 31, 126, 255 )
33
+ BEIGE =( 211, 176, 131, 255 )
34
+ BROWN =( 127, 106, 79, 255 )
35
+ DARKBROWN =( 76, 63, 47, 255 )
36
+ WHITE =( 255, 255, 255, 255 )
37
+ BLACK =( 0, 0, 0, 255 )
38
+ BLANK =( 0, 0, 0, 0 )
39
+ MAGENTA =( 255, 0, 255, 255 )
40
+ RAYWHITE =( 245, 245, 245, 255 )
41
+