praylib 0.8.1__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.
Files changed (52) hide show
  1. praylib-0.8.1/.gitignore +94 -0
  2. praylib-0.8.1/CMakeLists.txt +101 -0
  3. praylib-0.8.1/LICENSE +21 -0
  4. praylib-0.8.1/PKG-INFO +48 -0
  5. praylib-0.8.1/README.md +28 -0
  6. praylib-0.8.1/api/raygui_api.json +3359 -0
  7. praylib-0.8.1/api/raylib_api.json +13013 -0
  8. praylib-0.8.1/api/raymath_api.json +2494 -0
  9. praylib-0.8.1/api/rcamera_api.json +438 -0
  10. praylib-0.8.1/api/rlgl_api.json +3610 -0
  11. praylib-0.8.1/licenses/LICENSE_glfw.txt +23 -0
  12. praylib-0.8.1/licenses/LICENSE_nanobind.txt +26 -0
  13. praylib-0.8.1/licenses/LICENSE_raygui.txt +18 -0
  14. praylib-0.8.1/licenses/LICENSE_raylib.txt +16 -0
  15. praylib-0.8.1/licenses/THIRD_PARTY_NOTICES.md +100 -0
  16. praylib-0.8.1/pixi.toml +208 -0
  17. praylib-0.8.1/pyproject.toml +83 -0
  18. praylib-0.8.1/scripts/build_emscripten_forge_pkg.sh +55 -0
  19. praylib-0.8.1/scripts/generate_bindings.py +500 -0
  20. praylib-0.8.1/scripts/glsl_to_300es.py +38 -0
  21. praylib-0.8.1/scripts/test_page.py +106 -0
  22. praylib-0.8.1/scripts/update_api.sh +19 -0
  23. praylib-0.8.1/src/generated/raygui.cpp +482 -0
  24. praylib-0.8.1/src/generated/raylib.cpp +1224 -0
  25. praylib-0.8.1/src/generated/raymath.cpp +284 -0
  26. praylib-0.8.1/src/generated/rcamera.cpp +39 -0
  27. praylib-0.8.1/src/generated/rlgl.cpp +387 -0
  28. praylib-0.8.1/src/helpers.hpp +262 -0
  29. praylib-0.8.1/src/main.cpp +40 -0
  30. praylib-0.8.1/src/manual/raygui.cpp +64 -0
  31. praylib-0.8.1/src/manual/raylib.cpp +533 -0
  32. praylib-0.8.1/src/manual/rlgl.cpp +94 -0
  33. praylib-0.8.1/src/module/praylib/__init__.py +5 -0
  34. praylib-0.8.1/src/module/praylib/_api.py +1033 -0
  35. praylib-0.8.1/src/module/praylib/_colors.py +29 -0
  36. praylib-0.8.1/src/module/praylib/ctx_managers.py +45 -0
  37. praylib-0.8.1/src/module/praylib/deploy.py +274 -0
  38. praylib-0.8.1/src/module/praylib/gui.py +7 -0
  39. praylib-0.8.1/src/module/praylib/main_loop.py +46 -0
  40. praylib-0.8.1/src/module/praylib/raylib.py +20 -0
  41. praylib-0.8.1/src/module/praylib/raymath.py +3 -0
  42. praylib-0.8.1/src/module/praylib/rlgl.py +4 -0
  43. praylib-0.8.1/src/module/praylib/web/editor.js +272 -0
  44. praylib-0.8.1/src/module/praylib/web/index.html +104 -0
  45. praylib-0.8.1/src/module/praylib/web/main.js +256 -0
  46. praylib-0.8.1/src/raygui_impl.c +4 -0
  47. praylib-0.8.1/src/web_audio_glue.c +23 -0
  48. praylib-0.8.1/src/web_gl_guard.c +26 -0
  49. praylib-0.8.1/tests/conftest.py +8 -0
  50. praylib-0.8.1/tests/test_api_coverage.py +22 -0
  51. praylib-0.8.1/tests/test_basic.py +164 -0
  52. praylib-0.8.1/tests/test_examples.py +12 -0
@@ -0,0 +1,94 @@
1
+ # Prerequisites
2
+ *.d
3
+
4
+ # Compiled Object files
5
+ *.slo
6
+ *.lo
7
+ *.o
8
+ *.obj
9
+ # (but the examples' 3d models)
10
+ !examples/resources/**/*.obj
11
+
12
+ # Precompiled Headers
13
+ *.gch
14
+ *.pch
15
+
16
+ # Compiled Dynamic libraries
17
+ *.so
18
+ *.dylib
19
+ *.dll
20
+
21
+ # Fortran module files
22
+ *.mod
23
+ *.smod
24
+
25
+ # Compiled Static libraries
26
+ *.lai
27
+ *.la
28
+ *.a
29
+ *.lib
30
+
31
+ # Executables
32
+ *.exe
33
+ *.out
34
+ *.app
35
+
36
+
37
+ #
38
+ .DS_Store
39
+
40
+
41
+ _pyb2d.cpython*
42
+ __pycache__/
43
+
44
+ # bld directory
45
+ bld/
46
+
47
+ # some testfonts
48
+ Minecraft.ttf
49
+
50
+ .pixi/
51
+ pixi.lock
52
+ build/
53
+ dist/
54
+
55
+ dependencies/
56
+
57
+
58
+ # jupyter notebook checkpoints
59
+ .ipynb_checkpoints/
60
+
61
+
62
+ # .vscode directory
63
+ .vscode/
64
+
65
+
66
+ # ignore benchmark directory
67
+ # (contains benchmark results and scripts)
68
+ benchmark/
69
+
70
+ # ignore custom scripts
71
+ run.sh
72
+ init.sh
73
+
74
+ .benchmarks/
75
+ .ruff_cache/
76
+ .pytest_cache/
77
+
78
+ # egg-info directories ALL OF THEM
79
+ **/*.egg-info/
80
+
81
+ # the notebooks atm
82
+ examples/notebooks/
83
+
84
+
85
+ # ignore the "output" directory for emscripten-forge builds
86
+ emscripten_forge/output/
87
+
88
+ # ignore the rendered recipe (ie where the template is replaced)
89
+ emscripten_forge/recipe/recipe.yaml
90
+
91
+ # ignore the variant file (we donwload it on the fly)
92
+ emscripten_forge/variant*.yaml
93
+
94
+ emscripten_forge/recipe_src
@@ -0,0 +1,101 @@
1
+ cmake_minimum_required(VERSION 3.22)
2
+ project(praylib)
3
+ include(FetchContent)
4
+
5
+ # native: conda-forge has no raylib, fetch and build it.
6
+ # emscripten: raylib-static of emscripten-forge ($PREFIX/lib/libraylib.a)
7
+ option(FETCH_RAYLIB "Download and build raylib" OFF)
8
+
9
+ if(EMSCRIPTEN)
10
+ find_package(Python COMPONENTS Interpreter Development REQUIRED)
11
+ else()
12
+ find_package(Python 3.9
13
+ REQUIRED COMPONENTS Interpreter Development.Module
14
+ OPTIONAL_COMPONENTS Development.SABIModule)
15
+ endif()
16
+
17
+ if(FETCH_RAYLIB)
18
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
19
+ set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
20
+ FetchContent_Declare(
21
+ raylib
22
+ GIT_REPOSITORY "https://github.com/raysan5/raylib.git"
23
+ GIT_TAG "6.2"
24
+ GIT_SHALLOW TRUE
25
+ GIT_PROGRESS TRUE
26
+ )
27
+ # raygui: a single header (SOURCE_SUBDIR: nothing to add_subdirectory)
28
+ FetchContent_Declare(
29
+ raygui
30
+ GIT_REPOSITORY "https://github.com/raysan5/raygui.git"
31
+ GIT_TAG "5.0"
32
+ GIT_SHALLOW TRUE
33
+ SOURCE_SUBDIR none
34
+ )
35
+ FetchContent_MakeAvailable(raylib raygui)
36
+ # HDR images (.hdr, float data): off in raylib's config.h, on as in the
37
+ # emscripten-forge raylib-static
38
+ target_compile_definitions(raylib PRIVATE SUPPORT_FILEFORMAT_HDR=1)
39
+ elseif(NOT EMSCRIPTEN)
40
+ find_package(raylib REQUIRED)
41
+ endif()
42
+
43
+ if(NOT nanobind_DIR)
44
+ execute_process(
45
+ COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
46
+ OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE nanobind_DIR)
47
+ endif()
48
+ find_package(nanobind CONFIG REQUIRED)
49
+
50
+ set(PY_SOURCES
51
+ src/main.cpp
52
+ # scripts/generate_bindings.py
53
+ src/generated/raylib.cpp
54
+ src/generated/raymath.cpp
55
+ src/generated/rlgl.cpp
56
+ src/generated/raygui.cpp
57
+ src/generated/rcamera.cpp
58
+ src/manual/raylib.cpp
59
+ src/manual/raygui.cpp
60
+ src/manual/rlgl.cpp
61
+ src/raygui_impl.c
62
+ )
63
+
64
+ if(EMSCRIPTEN)
65
+ # a side module of the pyjs runtime (which has GL + GLFW, pyjs >= 6.2).
66
+ # NOSTRIP: stripping removes the dylink section
67
+ nanobind_add_module(_praylib NOSTRIP ${PY_SOURCES} src/web_gl_guard.c src/web_audio_glue.c)
68
+ target_compile_definitions(_praylib PRIVATE PLATFORM_WEB)
69
+ # -Bsymbolic: our nanobind binds to itself, not to the (other) nanobind
70
+ # the pyjs runtime exports
71
+ target_link_options(_praylib PRIVATE "SHELL: -sSIDE_MODULE=1" "-Wl,-Bsymbolic")
72
+ # the emscripten env with raylib-static / raygui (cached: re-configures by ninja
73
+ # run without the PREFIX of the first configure)
74
+ set(WASM_PREFIX "$ENV{PREFIX}" CACHE PATH "the emscripten environment with raylib-static")
75
+ target_link_libraries(_praylib PRIVATE ${WASM_PREFIX}/lib/libraylib.a)
76
+ target_include_directories(_praylib PRIVATE ${WASM_PREFIX}/include)
77
+ else()
78
+ nanobind_add_module(_praylib STABLE_ABI ${PY_SOURCES})
79
+ target_link_libraries(_praylib PRIVATE raylib)
80
+ if(FETCH_RAYLIB)
81
+ target_include_directories(_praylib PRIVATE ${raygui_SOURCE_DIR}/src)
82
+ endif()
83
+ endif()
84
+ target_include_directories(_praylib PRIVATE ${CMAKE_SOURCE_DIR}/src/)
85
+
86
+ if(DEFINED SKBUILD)
87
+ # component python: the wheel gets only these (pyproject.toml install.components),
88
+ # not the install rules of the fetched raylib (headers, libraylib.a)
89
+ install(TARGETS _praylib LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME} COMPONENT python)
90
+ install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/module/praylib/ DESTINATION ${SKBUILD_PROJECT_NAME}
91
+ COMPONENT python
92
+ PATTERN "_praylib*.so" EXCLUDE
93
+ PATTERN "__pycache__" EXCLUDE)
94
+ elseif(NOT EMSCRIPTEN)
95
+ # in-place build: the extension next to the python sources (the wasm build
96
+ # stays in its build dir: deploy.py --praylib <build dir>)
97
+ add_custom_command(TARGET _praylib POST_BUILD
98
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:_praylib> ${CMAKE_SOURCE_DIR}/src/module/praylib
99
+ COMMENT "Copying _praylib to python package directory"
100
+ )
101
+ endif()
praylib-0.8.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Thorsten Beier
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
praylib-0.8.1/PKG-INFO ADDED
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.4
2
+ Name: praylib
3
+ Version: 0.8.1
4
+ Summary: python bindings for raylib
5
+ License-Expression: MIT AND Zlib AND BSD-3-Clause
6
+ License-File: LICENSE
7
+ License-File: licenses/LICENSE_glfw.txt
8
+ License-File: licenses/LICENSE_nanobind.txt
9
+ License-File: licenses/LICENSE_raygui.txt
10
+ License-File: licenses/LICENSE_raylib.txt
11
+ License-File: licenses/THIRD_PARTY_NOTICES.md
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: numpy
19
+ Description-Content-Type: text/markdown
20
+
21
+ # praylib
22
+
23
+ [![CI](https://github.com/DerThorsten/praylib/actions/workflows/pages.yml/badge.svg)](https://github.com/DerThorsten/praylib/actions/workflows/pages.yml)
24
+ [![docs](https://img.shields.io/badge/docs-online-a6e22e)](https://derthorsten.github.io/praylib/docs/)
25
+
26
+ Python bindings for [raylib](https://www.raylib.com) 6.2 (with raygui, raymath,
27
+ rlgl), natively and in the browser.
28
+
29
+ - **Playground**: <https://derthorsten.github.io/praylib/>: all of raylib's
30
+ examples in Python, running in your browser, editable
31
+ - **Docs**: <https://derthorsten.github.io/praylib/docs/>: getting started, the
32
+ API, and how to put your own game on the web
33
+
34
+ ```python
35
+ import praylib as pr
36
+
37
+ pr.init_window(800, 450, "hello praylib")
38
+
39
+
40
+ def frame(dt):
41
+ pr.begin_drawing()
42
+ pr.clear_background(pr.RAYWHITE)
43
+ pr.draw_text("Hello praylib!", 190, 200, 20, pr.LIGHTGRAY)
44
+ pr.end_drawing()
45
+
46
+
47
+ pr.set_main_loop_callback(frame)
48
+ ```
@@ -0,0 +1,28 @@
1
+ # praylib
2
+
3
+ [![CI](https://github.com/DerThorsten/praylib/actions/workflows/pages.yml/badge.svg)](https://github.com/DerThorsten/praylib/actions/workflows/pages.yml)
4
+ [![docs](https://img.shields.io/badge/docs-online-a6e22e)](https://derthorsten.github.io/praylib/docs/)
5
+
6
+ Python bindings for [raylib](https://www.raylib.com) 6.2 (with raygui, raymath,
7
+ rlgl), natively and in the browser.
8
+
9
+ - **Playground**: <https://derthorsten.github.io/praylib/>: all of raylib's
10
+ examples in Python, running in your browser, editable
11
+ - **Docs**: <https://derthorsten.github.io/praylib/docs/>: getting started, the
12
+ API, and how to put your own game on the web
13
+
14
+ ```python
15
+ import praylib as pr
16
+
17
+ pr.init_window(800, 450, "hello praylib")
18
+
19
+
20
+ def frame(dt):
21
+ pr.begin_drawing()
22
+ pr.clear_background(pr.RAYWHITE)
23
+ pr.draw_text("Hello praylib!", 190, 200, 20, pr.LIGHTGRAY)
24
+ pr.end_drawing()
25
+
26
+
27
+ pr.set_main_loop_callback(frame)
28
+ ```