diff --git a/.gitmodules b/.gitmodules index fd4dc26..f6c3e1d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ [submodule "raylib-c"] path = raylib-c - url = https://github.com/raysan5/raylib.git + url = https://git.terah.dev/UnrealXR/raylib.git [submodule "raygui"] path = raygui url = https://github.com/raysan5/raygui.git [submodule "physac"] path = physac - url = https://github.com/victorfisac/Physac + url = https://github.com/victorfisac/Physac.git diff --git a/BUILDING.rst b/BUILDING.rst index b9ccd84..a32dd6f 100644 --- a/BUILDING.rst +++ b/BUILDING.rst @@ -83,11 +83,6 @@ To build a binary wheel distribution: pip3 install wheel python setup.py bdist_wheel -.. TODO:: - There's a hardcoded path (to the raylib header files) in `raylib/build.py` you will probably need to edit. - Would be useful if some Windows user could figure out how to auto detect this. - - Then install it: :: diff --git a/create_enums.py b/create_enums.py index 36905a1..d7fbeec 100644 --- a/create_enums.py +++ b/create_enums.py @@ -35,3 +35,4 @@ print("""from enum import IntEnum process("raylib.json") process("raygui.json") process("glfw3.json") +process("physac.json") diff --git a/create_stub_pyray.py b/create_stub_pyray.py index e800125..fb334e7 100644 --- a/create_stub_pyray.py +++ b/create_stub_pyray.py @@ -83,6 +83,7 @@ from warnings import deprecated import _cffi_backend # type: ignore ffi: _cffi_backend.FFI +PhysicsShapeType = int """) # These words can be used for c arg names, but not in python diff --git a/create_stub_static.py b/create_stub_static.py index 5968924..0c43c6d 100644 --- a/create_stub_static.py +++ b/create_stub_static.py @@ -74,6 +74,7 @@ import _cffi_backend # type: ignore ffi: _cffi_backend.FFI rl: _cffi_backend.Lib +PhysicsShapeType = int class struct: ... diff --git a/dynamic/raylib/__init__.py b/dynamic/raylib/__init__.py index a030bf0..75ab2d6 100644 --- a/dynamic/raylib/__init__.py +++ b/dynamic/raylib/__init__.py @@ -22,9 +22,10 @@ import itertools import os import pathlib import platform +import logging from .version import __version__ - +logger = logging.getLogger(__name__) MODULE = pathlib.Path(__file__).parent def raylib_library_path(): @@ -54,9 +55,9 @@ ffi.cdef(open(MODULE / "raylib_modified.h").read().replace('RLAPI ', '')) try: raylib_fname = raylib_library_path() rl = ffi.dlopen(raylib_fname) - print('LOADED DYNAMICALLY SHARED LIB {} {}'.format(__version__, raylib_fname)) + logger.warning('LOADED DYNAMICALLY SHARED LIB {} {}'.format(__version__, raylib_fname)) except Exception as e: - print(e) + logger.exception(e) LIGHTGRAY =( 200, 200, 200, 255 ) GRAY =( 130, 130, 130, 255 ) diff --git a/dynamic/raylib/__init__.pyi b/dynamic/raylib/__init__.pyi index cdc6ce8..c1b492f 100644 --- a/dynamic/raylib/__init__.pyi +++ b/dynamic/raylib/__init__.pyi @@ -4,6 +4,7 @@ import _cffi_backend # type: ignore ffi: _cffi_backend.FFI rl: _cffi_backend.Lib +PhysicsShapeType = int class struct: ... diff --git a/examples/audio/audio_music_stream.py b/examples/audio/audio_music_stream.py new file mode 100644 index 0000000..46f88ad --- /dev/null +++ b/examples/audio/audio_music_stream.py @@ -0,0 +1,101 @@ +"""checked with raylib-python-cffi 5.5.0.2 +raylib [audio] example - Music playing (streaming) +Example complexity rating: [★☆☆☆] 1/4 +Example originally created with raylib 1.3, last time updated with raylib 4.0 +Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, +BSD-like license that allows static linking with closed source software +Copyright (c) 2015-2025 Ramon Santamaria (@raysan5) + +This source has been converted from C raylib examples to Python. +""" + +import pyray as rl +from pathlib import Path + +THIS_DIR = Path(__file__).resolve().parent + + +# ------------------------------------------------------------------------------------ +# Program main entry point +# ------------------------------------------------------------------------------------ +def main(): + # Initialization + # -------------------------------------------------------------------------------------- + screen_width = 800 + screen_height = 450 + + rl.init_window( + screen_width, + screen_height, + "raylib [audio] example - music playing (streaming)", + ) + + rl.init_audio_device() # Initialize audio device + + music = rl.load_music_stream(str(THIS_DIR / "resources/country.mp3")) + + rl.play_music_stream(music) + + time_played = 0.0 # Time played normalized [0.0f..1.0f] + pause = False # Music playing paused + + rl.set_target_fps(30) # Set our game to run at 30 frames-per-second + # -------------------------------------------------------------------------------------- + + # Main game loop + while not rl.window_should_close(): # Detect window close button or ESC key + # Update + # ---------------------------------------------------------------------------------- + rl.update_music_stream(music) # Update music buffer with new stream data + + # Restart music playing (stop and play) + if rl.is_key_pressed(rl.KEY_SPACE): + rl.stop_music_stream(music) + rl.play_music_stream(music) + + # Pause/Resume music playing + if rl.is_key_pressed(rl.KEY_P): + pause = not pause + + if pause: + rl.pause_music_stream(music) + else: + rl.resume_music_stream(music) + + # Get normalized time played for current music stream + time_played = rl.get_music_time_played(music) / rl.get_music_time_length(music) + + if time_played > 1.0: + time_played = 1.0 # Make sure time played is no longer than music + # ---------------------------------------------------------------------------------- + + # Draw + # ---------------------------------------------------------------------------------- + rl.begin_drawing() + + rl.clear_background(rl.RAYWHITE) + + rl.draw_text("MUSIC SHOULD BE PLAYING!", 255, 150, 20, rl.LIGHTGRAY) + + rl.draw_rectangle(200, 200, 400, 12, rl.LIGHTGRAY) + rl.draw_rectangle(200, 200, int(time_played * 400.0), 12, rl.MAROON) + rl.draw_rectangle_lines(200, 200, 400, 12, rl.GRAY) + + rl.draw_text("PRESS SPACE TO RESTART MUSIC", 215, 250, 20, rl.LIGHTGRAY) + rl.draw_text("PRESS P TO PAUSE/RESUME MUSIC", 208, 280, 20, rl.LIGHTGRAY) + + rl.end_drawing() + # ---------------------------------------------------------------------------------- + + # De-Initialization + # -------------------------------------------------------------------------------------- + rl.unload_music_stream(music) # Unload music stream buffers from RAM + + rl.close_audio_device() # Close audio device (music streaming is automatically stopped) + + rl.close_window() # Close window and OpenGL context + # -------------------------------------------------------------------------------------- + + +if __name__ == "__main__": + main() diff --git a/examples/audio/audio_sound_loading.py b/examples/audio/audio_sound_loading.py new file mode 100644 index 0000000..3854293 --- /dev/null +++ b/examples/audio/audio_sound_loading.py @@ -0,0 +1,67 @@ +"""checked with raylib-python-cffi 5.5.0.2 +raylib [audio] example - Sound loading and playing +Example complexity rating: [★☆☆☆] 1/4 +Example originally created with raylib 1.1, last time updated with raylib 3.5 +Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, +BSD-like license that allows static linking with closed source software +Copyright (c) 2014-2025 Ramon Santamaria (@raysan5) + +This source has been converted from C raylib examples to Python. +""" + +import pyray as rl +from pathlib import Path + +# Get the directory where this script is located +THIS_DIR = Path(__file__).resolve().parent + +# Initialization +# -------------------------------------------------------------------------------------- +screen_width = 800 +screen_height = 450 + +rl.init_window( + screen_width, screen_height, "raylib [audio] example - sound loading and playing" +) + +rl.init_audio_device() # Initialize audio device + +# Load WAV audio file using proper path resolution +fx_wav = rl.load_sound(str(THIS_DIR / "resources/sound.wav")) +# Load OGG audio file using proper path resolution +fx_ogg = rl.load_sound(str(THIS_DIR / "resources/target.ogg")) + +rl.set_target_fps(60) # Set our game to run at 60 frames-per-second +# -------------------------------------------------------------------------------------- + +# Main game loop +while not rl.window_should_close(): # Detect window close button or ESC key + # Update + # ---------------------------------------------------------------------------------- + if rl.is_key_pressed(rl.KeyboardKey.KEY_SPACE): + rl.play_sound(fx_wav) # Play WAV sound + if rl.is_key_pressed(rl.KeyboardKey.KEY_ENTER): + rl.play_sound(fx_ogg) # Play OGG sound + # ---------------------------------------------------------------------------------- + + # Draw + # ---------------------------------------------------------------------------------- + rl.begin_drawing() + + rl.clear_background(rl.RAYWHITE) + + rl.draw_text("Press SPACE to PLAY the WAV sound!", 200, 180, 20, rl.LIGHTGRAY) + rl.draw_text("Press ENTER to PLAY the OGG sound!", 200, 220, 20, rl.LIGHTGRAY) + + rl.end_drawing() + # ---------------------------------------------------------------------------------- + +# De-Initialization +# -------------------------------------------------------------------------------------- +rl.unload_sound(fx_wav) # Unload sound data +rl.unload_sound(fx_ogg) # Unload sound data + +rl.close_audio_device() # Close audio device + +rl.close_window() # Close window and OpenGL context +# -------------------------------------------------------------------------------------- diff --git a/examples/audio/audio_sound_multi.py b/examples/audio/audio_sound_multi.py new file mode 100644 index 0000000..0cc6c82 --- /dev/null +++ b/examples/audio/audio_sound_multi.py @@ -0,0 +1,86 @@ +"""checked with raylib-python-cffi 5.5.0.2 +raylib [audio] example - Playing sound multiple times +Example complexity rating: [★★☆☆] 2/4 +Example originally created with raylib 4.6, last time updated with raylib 4.6 +Example contributed by Jeffery Myers (@JeffM2501) and reviewed by Ramon Santamaria (@raysan5) +Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, +BSD-like license that allows static linking with closed source software +Copyright (c) 2023-2025 Jeffery Myers (@JeffM2501) + +This source has been converted from C raylib examples to Python. +""" + +from typing import List + +import pyray as rl +from pathlib import Path + +# Get the directory where this script is located +THIS_DIR = Path(__file__).resolve().parent + +MAX_SOUNDS = 10 +sound_array: List[rl.Sound] = [] +current_sound = 0 + +# Initialization +# -------------------------------------------------------------------------------------- +screen_width = 800 +screen_height = 450 + +rl.init_window( + screen_width, screen_height, "raylib [audio] example - playing sound multiple times" +) + +rl.init_audio_device() # Initialize audio device + +# Load the sound list +sound_array.append( + rl.load_sound(str(THIS_DIR / "resources/sound.wav")) +) # Load WAV audio file into the first slot as the 'source' sound +# this sound owns the sample data +for i in range(1, MAX_SOUNDS): + sound_array.append( + rl.load_sound_alias(sound_array[0]) + ) # Load an alias of the sound into slots 1-9 + # These do not own the sound data, but can be played +current_sound = 0 # Set the sound list to the start + +rl.set_target_fps(60) # Set our game to run at 60 frames-per-second +# -------------------------------------------------------------------------------------- + +# Main game loop +while not rl.window_should_close(): # Detect window close button or ESC key + # Update + # ---------------------------------------------------------------------------------- + if rl.is_key_pressed(rl.KeyboardKey.KEY_SPACE): + rl.play_sound(sound_array[current_sound]) # Play the next open sound slot + current_sound += 1 # Increment the sound slot + if ( + current_sound >= MAX_SOUNDS + ): # If the sound slot is out of bounds, go back to 0 + current_sound = 0 + + # Note: a better way would be to look at the list for the first sound that is not playing and use that slot + # ---------------------------------------------------------------------------------- + + # Draw + # ---------------------------------------------------------------------------------- + rl.begin_drawing() + + rl.clear_background(rl.RAYWHITE) + + rl.draw_text("Press SPACE to PLAY a WAV sound!", 200, 180, 20, rl.LIGHTGRAY) + + rl.end_drawing() + # ---------------------------------------------------------------------------------- + +# De-Initialization +# -------------------------------------------------------------------------------------- +for i in range(1, MAX_SOUNDS): + rl.unload_sound_alias(sound_array[i]) # Unload sound aliases +rl.unload_sound(sound_array[0]) # Unload source sound data + +rl.close_audio_device() # Close audio device + +rl.close_window() # Close window and OpenGL context +# -------------------------------------------------------------------------------------- diff --git a/examples/audio/audio_sound_positioning.py b/examples/audio/audio_sound_positioning.py new file mode 100644 index 0000000..f3e77cf --- /dev/null +++ b/examples/audio/audio_sound_positioning.py @@ -0,0 +1,112 @@ +"""checked with raylib-python-cffi 5.5.0.2 +raylib [audio] example - Playing spatialized 3D sound +Example complexity rating: [★★☆☆] 2/4 +Example originally created with raylib 5.5, last time updated with raylib 5.5 +Example contributed by Le Juez Victor (@Bigfoot71) and reviewed by Ramon Santamaria (@raysan5) +Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, +BSD-like license that allows static linking with closed source software +Copyright (c) 2025 Le Juez Victor (@Bigfoot71) + +This source has been converted from C raylib examples to Python. +""" + +import pyray as rl +import math +from pathlib import Path + +# Get the directory where this script is located +THIS_DIR = Path(__file__).resolve().parent + + +# Sound positioning function +def set_sound_position(listener, sound, position, max_dist): + # Calculate direction vector and distance between listener and sound source + direction = rl.vector3_subtract(position, listener.position) + distance = rl.vector3_length(direction) + + # Apply logarithmic distance attenuation and clamp between 0-1 + attenuation = 1.0 / (1.0 + (distance / max_dist)) + attenuation = rl.clamp(attenuation, 0.0, 1.0) + + # Calculate normalized vectors for spatial positioning + normalized_direction = rl.vector3_normalize(direction) + forward = rl.vector3_normalize( + rl.vector3_subtract(listener.target, listener.position) + ) + right = rl.vector3_normalize(rl.vector3_cross_product(listener.up, forward)) + + # Reduce volume for sounds behind the listener + dot_product = rl.vector3_dot_product(forward, normalized_direction) + if dot_product < 0.0: + attenuation *= 1.0 + dot_product * 0.5 + + # Set stereo panning based on sound position relative to listener + pan = 0.5 + 0.5 * rl.vector3_dot_product(normalized_direction, right) + + # Apply final sound properties + rl.set_sound_volume(sound, attenuation) + rl.set_sound_pan(sound, pan) + + +# Initialization +# -------------------------------------------------------------------------------------- +screen_width = 800 +screen_height = 450 + +rl.init_window( + screen_width, screen_height, "raylib [audio] example - Playing spatialized 3D sound" +) + +rl.init_audio_device() + +sound = rl.load_sound(str(THIS_DIR / "resources/coin.wav")) + +camera = rl.Camera3D( + (0, 5, 5), + (0, 0, 0), + (0, 1, 0), + 60.0, + rl.CameraProjection.CAMERA_PERSPECTIVE, +) + +rl.disable_cursor() + +rl.set_target_fps(60) +# -------------------------------------------------------------------------------------- + +# Main game loop +while not rl.window_should_close(): + # Update + # ---------------------------------------------------------------------------------- + rl.update_camera(camera, rl.CameraMode.CAMERA_FREE) + + th = rl.get_time() + + sphere_pos = rl.Vector3(5.0 * math.cos(th), 0.0, 5.0 * math.sin(th)) + + set_sound_position(camera, sound, sphere_pos, 20.0) + if not rl.is_sound_playing(sound): + rl.play_sound(sound) + # ---------------------------------------------------------------------------------- + + # Draw + # ---------------------------------------------------------------------------------- + rl.begin_drawing() + + rl.clear_background(rl.RAYWHITE) + + rl.begin_mode_3d(camera) + rl.draw_grid(10, 2) + rl.draw_sphere(sphere_pos, 0.5, rl.RED) + rl.end_mode_3d() + + rl.end_drawing() + # ---------------------------------------------------------------------------------- + +# De-Initialization +# -------------------------------------------------------------------------------------- +rl.unload_sound(sound) +rl.close_audio_device() # Close audio device + +rl.close_window() # Close window and OpenGL context +# -------------------------------------------------------------------------------------- diff --git a/examples/audio/resources/coin.wav b/examples/audio/resources/coin.wav new file mode 100644 index 0000000..ad95bfb Binary files /dev/null and b/examples/audio/resources/coin.wav differ diff --git a/examples/audio/resources/sound.wav b/examples/audio/resources/sound.wav new file mode 100644 index 0000000..b5d01c9 Binary files /dev/null and b/examples/audio/resources/sound.wav differ diff --git a/examples/audio/resources/target.ogg b/examples/audio/resources/target.ogg new file mode 100644 index 0000000..2b73e1c Binary files /dev/null and b/examples/audio/resources/target.ogg differ diff --git a/pyray/__init__.py b/pyray/__init__.py index c85959f..4a28587 100644 --- a/pyray/__init__.py +++ b/pyray/__init__.py @@ -126,7 +126,7 @@ def _make_struct_constructor_function(struct): or isinstance(arg, (array, bytes, bytearray, memoryview)))): arg = ffi.from_buffer(field[1].type, arg) modified_args.append(arg) - s = ffi.new(f"struct {struct} *", modified_args)[0] + s = ffi.new(f"{struct} *", modified_args)[0] global_weakkeydict[s] = modified_args return s diff --git a/pyray/__init__.pyi b/pyray/__init__.pyi index 790a032..e8e8acb 100644 --- a/pyray/__init__.pyi +++ b/pyray/__init__.pyi @@ -908,6 +908,7 @@ from warnings import deprecated import _cffi_backend # type: ignore ffi: _cffi_backend.FFI +PhysicsShapeType = int def attach_audio_mixed_processor(processor: Any,) -> None: """Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'.""" diff --git a/raylib-c b/raylib-c index 26548c1..15afe89 160000 --- a/raylib-c +++ b/raylib-c @@ -1 +1 @@ -Subproject commit 26548c10620c4ae6937cf8b506c777a006b33c16 +Subproject commit 15afe89aff2fc7da96ab5de80bde7f6186971cde diff --git a/raylib/__init__.py b/raylib/__init__.py index bee47cb..786ad69 100644 --- a/raylib/__init__.py +++ b/raylib/__init__.py @@ -13,18 +13,22 @@ # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 import sys +import logging + +logger = logging.getLogger(__name__) + try: from ._raylib_cffi import ffi, lib as rl except ModuleNotFoundError: - print("\n*** ERROR LOADING NATIVE CODE ***\n") - print("See https://github.com/electronstudio/raylib-python-cffi/issues/142\n", file=sys.stderr) - print("Your Python is: "+str(sys.implementation)+"\n", file=sys.stderr) + logger.error("*** ERROR LOADING NATIVE CODE ***") + logger.error("See https://github.com/electronstudio/raylib-python-cffi/issues/142") + logger.error("Your Python is: %s", str(sys.implementation)) raise + from raylib._raylib_cffi.lib import * from raylib.colors import * from raylib.defines import * import cffi from .version import __version__ -print("RAYLIB STATIC "+__version__+" LOADED", file=sys.stderr) - +logger.warning("RAYLIB STATIC %s LOADED", __version__) diff --git a/raylib/__init__.pyi b/raylib/__init__.pyi index cdc6ce8..c1b492f 100644 --- a/raylib/__init__.pyi +++ b/raylib/__init__.pyi @@ -4,6 +4,7 @@ import _cffi_backend # type: ignore ffi: _cffi_backend.FFI rl: _cffi_backend.Lib +PhysicsShapeType = int class struct: ... diff --git a/raylib/build.py b/raylib/build.py index 523b292..ca477c8 100644 --- a/raylib/build.py +++ b/raylib/build.py @@ -24,8 +24,14 @@ import platform import sys import subprocess import time +from pathlib import Path + +THIS_DIR = Path(__file__).resolve().parent +REPO_ROOT = THIS_DIR.parent + RAYLIB_PLATFORM = os.getenv("RAYLIB_PLATFORM", "Desktop") +ENABLE_WAYLAND_DRM_LEASING = os.getenv("ENABLE_WAYLAND_DRM_LEASING") def check_raylib_installed(): return subprocess.run(['pkg-config', '--exists', 'raylib'], text=True, stdout=subprocess.PIPE).returncode == 0 @@ -42,6 +48,17 @@ def get_the_lib_path(): return subprocess.run(['pkg-config', '--variable=libdir', 'raylib'], text=True, stdout=subprocess.PIPE).stdout.strip() +def get_specified_libs(lib_target): + libs = subprocess.run(['pkg-config', '--libs', lib_target], text=True, + stdout=subprocess.PIPE).stdout.strip().split() + + if libs == "": + raise ValueError(f"Failed to get specified libs ({lib_target})") + + print(f"{lib_target}: {libs}") + + return libs + def get_lib_flags(): return subprocess.run(['pkg-config', '--libs', 'raylib'], text=True, stdout=subprocess.PIPE).stdout.strip().split() @@ -179,7 +196,11 @@ def build_unix(): if RAYLIB_PLATFORM=="SDL": extra_link_args += ['-lX11','-lSDL2'] elif RAYLIB_PLATFORM=="DRM": - extra_link_args += ['-lEGL', '-lgbm'] + extra_link_args += get_specified_libs("egl") + extra_link_args += get_specified_libs("gbm") + + if ENABLE_WAYLAND_DRM_LEASING != "": + extra_link_args += get_specified_libs("wayland-client") else: extra_link_args += ['-lX11'] extra_compile_args = ["-Wno-incompatible-pointer-types", "-D_CFFI_NO_LIMITED_API"] @@ -200,13 +221,13 @@ def build_unix(): def build_windows(): print("BUILDING FOR WINDOWS") - ffibuilder.cdef(open("raylib/raylib.h.modified").read()) + ffibuilder.cdef((THIS_DIR / "raylib.h.modified").read_text()) if RAYLIB_PLATFORM=="Desktop": - ffibuilder.cdef(open("raylib/glfw3.h.modified").read()) - ffibuilder.cdef(open("raylib/rlgl.h.modified").read()) - ffibuilder.cdef(open("raylib/raygui.h.modified").read()) - ffibuilder.cdef(open("raylib/physac.h.modified").read()) - ffibuilder.cdef(open("raylib/raymath.h.modified").read()) + ffibuilder.cdef((THIS_DIR / "glfw3.h.modified").read_text()) + ffibuilder.cdef((THIS_DIR / "rlgl.h.modified").read_text()) + ffibuilder.cdef((THIS_DIR / "raygui.h.modified").read_text()) + ffibuilder.cdef((THIS_DIR / "physac.h.modified").read_text()) + ffibuilder.cdef((THIS_DIR / "raymath.h.modified").read_text()) ffi_includes = """ #include "raylib.h" @@ -237,10 +258,10 @@ def build_windows(): extra_compile_args=["/D_CFFI_NO_LIMITED_API"], py_limited_api=False, libraries=libraries, - include_dirs=['D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src', - 'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src\\external\\glfw\\include', - 'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raygui\\src', - 'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\physac\\src'], + include_dirs=[str(REPO_ROOT / 'raylib-c/src'), + str(REPO_ROOT / 'raylib-c/src/external/glfw/include'), + str(REPO_ROOT / 'raygui/src'), + str(REPO_ROOT / 'physac/src')], ) diff --git a/raylib/rlgl.h.modified b/raylib/rlgl.h.modified index 1695c66..1184262 100644 --- a/raylib/rlgl.h.modified +++ b/raylib/rlgl.h.modified @@ -3,7 +3,7 @@ * rlgl v5.0 - A multi-OpenGL abstraction layer with an immediate-mode style API * * DESCRIPTION: -* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0, ES 3.0) +* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0) * that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...) * * ADDITIONAL NOTES: diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..8facf8b --- /dev/null +++ b/shell.nix @@ -0,0 +1,30 @@ +{ + pkgs ? import { }, +}: pkgs.mkShell { + buildInputs = with pkgs; [ + python3 + cmake + clang-tools + pkg-config + wayland-scanner + wayland + libGL + libgbm + libdrm + xorg.libXi + xorg.libXcursor + xorg.libXrandr + xorg.libXinerama + xorg.libX11 + ]; + + shellHook = '' + export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [ pkgs.xorg.libX11 pkgs.libGL ]}:$LD_LIBRARY_PATH" + + if [ ! -d ".venv" ]; then + python3 -m venv .venv + fi + + source .venv/bin/activate + ''; +} diff --git a/tests/test_pyray.py b/tests/test_pyray.py index 478fcce..e9f54bc 100644 --- a/tests/test_pyray.py +++ b/tests/test_pyray.py @@ -7,6 +7,8 @@ import pyray as pr pr.init_window(800, 450, "Raylib texture test") pr.set_target_fps(60) +test_typedef_init = pr.Texture2D() # Texture2D is typedef for Texture + image = pr.gen_image_color(800, 400, (0,0,0,255) ) texture = pr.load_texture_from_image(image) pr.update_texture(texture, image.data)