update docs

This commit is contained in:
richard 2021-08-27 03:38:11 +01:00
parent 13ca8d2ae8
commit b3b7688963
118 changed files with 40165 additions and 211 deletions

View file

@ -0,0 +1,143 @@
## Have Pip build from source
Useful if the binaries don't work on your system.
Make sure Raylib is installed and then:
pip3 install --no-binary raylib --upgrade --force-reinstall raylib
## Build from source manually
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 *use the dynamic binding with your own dll*.
If you do build on a new platform please
submit your binaries as a PR.
### Windows manual build
Clone this repo including submodules so you get correct version of Raylib.
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
Open Visual C++ command shell.
Fix the symlink that doesnt work on Windows
cd raylib-python-cffi
copy raylib-c\src\raylib.h raylib\raylib.h
Build and install Raylib from the raylib-c directory.
cd raylib-python-cffi/raylib-c
mkdir build
cd build
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
msbuild raylib.sln /target:raylib /property:Configuration=Release
copy raylib\Release\raylib.lib ..\..
cd ..\..
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.
To build a binary wheel distribution:
rmdir /Q /S build
pip3 install cffi
pip3 install wheel
python setup.py bdist_wheel
and install it:
pip3 install dist\raylib-3.7.0-cp37-cp37m-win_amd64.whl
(Note: your wheel's filename will probably be different than the one here.)
### Linux etc manual build
These instructions have been tested on Ubuntu 20.10 and 16.04. Mac should be very similar.
Clone this repo including submodules so you get correct version of Raylib.
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
Build and install Raylib from the raylib-c directory.
sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev
cd raylib-python-cffi/raylib-c
mkdir build
cd build
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
sudo make install
Optional: Build the Raylib shared libs, if you plan to use `raylib.dynamic` binding.
rm -rf *
cmake -DWITH_PIC=on -DBUILD_SHARED_LIBS=on -DCMAKE_BUILD_TYPE=Release ..
sudo make install
Optional: Make a patched version of raylib header. (**Not necessary** if you've already got
raylib_modifed.h from repo and haven't changed anything.)
cd ../../raylib
cp raylib.h raylib_modified.h
patch -p0 <raylib_modified.h.patch
Build
pip3 install cffi
cd ..
rm -rf build raylib/static/_raylib_cffi.*
python3 raylib/static/build.py
To update the Linux dynamic libs (names will be different on other platfroms):
rm raylib/dynamic/*.so*
cp -P /usr/local/lib/libraylib.so* raylib/dynamic/
To build a binary wheel distribution:
pip3 install wheel
python3 setup.py bdist_wheel
and install it:
pip3 install dist/raylib*.whl
To build a complete set of libs for Python 3.6, 3.7, 3.8 and 3.9:
./raylib/static/build_multi.sh
(NOTE pypi wont accept Linux packages unless they are built `--plat-name manylinux2014_x86_64` so on linux
please run `./raylib/static/build_multi_linux.sh` )
(TODO move the dynamic libs into a separate package rather than include them with every one.)
### Raspberry Pi
The integrated GPU hardware in a Raspberry Pi ("VideoCore") is rather
idiosyncratic, resulting in a complex set of software options. Probably the
most interesting two options for Raylib applications are:
1. Use the Broadcom proprietary Open GL ES 2.0 drivers, installed by Raspbian
into `/opt/vc`. These are 32-bit only, and currently X11 doesn't use these
for its acceleration, so this is most suitable for driving the entire HDMI
output from one application with minimal overhead (no X11).
2. Use the more recent open-source `vc4-fkms-v3d` kernel driver. This can run
in either 32-bit or 64-bit, and X11 can use these, so using X11 is probably
the more common choice here.
With option 2, the regular linux install instructions above should probably
work as-is.
For option 1, then also follow the above instructions, but with these
modifications:
- With `cmake`, use `cmake -DWITH_PIC=on -DSTATIC=on -DSHARED=on -DPLATFORM='Raspberry Pi' ..`
(See [here](https://github.com/electronstudio/raylib-python-cffi/issues/31#issuecomment-862078330) for a Raspberry Pi wheel)

View file

@ -0,0 +1,78 @@
# Python Bindings for Raylib 3.7
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.
[Full documentation](http://electronstudio.github.io/raylib-python-cffi)
# Install
We distribute a statically linked binary Raylib wheel:
pip3 install raylib
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 it doesn't work, build from source](BUILDING.md)
# How to use
There are three 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, choose raylib.static.
If you prefer a slightly more Pythonistic API and don't mind it might be slightly slower, choose
raylib.pyray.
If you insist on dynamic bindings and don't care that they are slower and less safe, choose
raylib.dynamic.
# RLZero
Work in progress:
[A simplified API for Raylib for use in education and to enable beginners to create 3d games](https://github.com/electronstudio/rlzero)
# Help wanted
* converting more examples from C to python
* testing and building on more platforms
# Performance
For fastest permformance use Pypy rather than standard python.
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.
## Bunnymark
| Library | Implementation | Bunnies (60 FPS) | Percentage |
| ------------- | ------------- | ------------- | ------------- |
| Raylib 3.7 | C | 168100 | 100% |
| Raylib Python CFFI 3.7 | Pypy 3.7 | 33800 | 20% |
| Raylib Python CFFI 3.7 | Python 3.9 | 7700 | 4.5% |
| Raylib Python CFFI 3.7 | Python 3.9 Nuitka | 8600 | 5.1% |
| Raylib Python CFFI 3.7 Dynamic | Python 3.9 | 6300 | 3.7% |
# Packaging your app
You can create a standalone binary using the Nuitka compiler. For example, here is how to package Bunnymark:
pip3 install nuitka
cd examples/textures
python3 -m nuitka --onefile --linux-onefile-icon resources/wabbit_alpha.png textures_bunnymark.py
# Advert
[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.

View file

@ -0,0 +1,21 @@
raylib.dynamic
==============
CFFI ABI dynamic bindings exist in order to avoid the need to compile a C extension module.
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.
See https://github.com/electronstudio/raylib-python-cffi/blob/master/test_static.py for how to use.
.. 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.
API is the same as raylib.static.

View file

@ -0,0 +1,836 @@
raylib.pyray.PyRay
==================
.. currentmodule:: raylib.pyray
.. autoclass:: PyRay
.. automethod:: __init__
.. rubric:: Methods
.. autosummary::
~PyRay.AudioStream
~PyRay.BlendMode
~PyRay.BoneInfo
~PyRay.BoundingBox
~PyRay.Camera
~PyRay.Camera2D
~PyRay.Camera3D
~PyRay.CameraMode
~PyRay.CameraProjection
~PyRay.CharInfo
~PyRay.Color
~PyRay.ConfigFlags
~PyRay.CubemapLayout
~PyRay.Font
~PyRay.FontType
~PyRay.GamepadAxis
~PyRay.GamepadButton
~PyRay.Gestures
~PyRay.Image
~PyRay.KeyboardKey
~PyRay.Material
~PyRay.MaterialMap
~PyRay.MaterialMapIndex
~PyRay.Matrix
~PyRay.Mesh
~PyRay.Model
~PyRay.ModelAnimation
~PyRay.MouseButton
~PyRay.MouseCursor
~PyRay.Music
~PyRay.NPatchInfo
~PyRay.NPatchLayout
~PyRay.PixelFormat
~PyRay.Quaternion
~PyRay.Ray
~PyRay.RayHitInfo
~PyRay.Rectangle
~PyRay.RenderTexture
~PyRay.RenderTexture2D
~PyRay.Shader
~PyRay.ShaderLocationIndex
~PyRay.ShaderUniformDataType
~PyRay.Sound
~PyRay.Texture
~PyRay.Texture2D
~PyRay.TextureCubemap
~PyRay.TextureFilter
~PyRay.TextureWrap
~PyRay.TraceLogLevel
~PyRay.Transform
~PyRay.Vector2
~PyRay.Vector3
~PyRay.Vector4
~PyRay.VrDeviceInfo
~PyRay.VrStereoConfig
~PyRay.Wave
~PyRay.__init__
~PyRay.begin_blend_mode
~PyRay.begin_drawing
~PyRay.begin_mode_2d
~PyRay.begin_mode_3d
~PyRay.begin_scissor_mode
~PyRay.begin_shader_mode
~PyRay.begin_texture_mode
~PyRay.begin_vr_stereo_mode
~PyRay.change_directory
~PyRay.check_collision_box_sphere
~PyRay.check_collision_boxes
~PyRay.check_collision_circle_rec
~PyRay.check_collision_circles
~PyRay.check_collision_lines
~PyRay.check_collision_point_circle
~PyRay.check_collision_point_rec
~PyRay.check_collision_point_triangle
~PyRay.check_collision_ray_box
~PyRay.check_collision_ray_sphere
~PyRay.check_collision_ray_sphere_ex
~PyRay.check_collision_recs
~PyRay.check_collision_spheres
~PyRay.clear_background
~PyRay.clear_directory_files
~PyRay.clear_dropped_files
~PyRay.clear_window_state
~PyRay.close_audio_device
~PyRay.close_audio_stream
~PyRay.close_window
~PyRay.codepoint_to_utf8
~PyRay.color_alpha
~PyRay.color_alpha_blend
~PyRay.color_from_hsv
~PyRay.color_from_normalized
~PyRay.color_normalize
~PyRay.color_to_hsv
~PyRay.color_to_int
~PyRay.compress_data
~PyRay.decompress_data
~PyRay.directory_exists
~PyRay.disable_cursor
~PyRay.draw_billboard
~PyRay.draw_billboard_rec
~PyRay.draw_bounding_box
~PyRay.draw_circle
~PyRay.draw_circle_3d
~PyRay.draw_circle_gradient
~PyRay.draw_circle_lines
~PyRay.draw_circle_sector
~PyRay.draw_circle_sector_lines
~PyRay.draw_circle_v
~PyRay.draw_cube
~PyRay.draw_cube_texture
~PyRay.draw_cube_v
~PyRay.draw_cube_wires
~PyRay.draw_cube_wires_v
~PyRay.draw_cylinder
~PyRay.draw_cylinder_wires
~PyRay.draw_ellipse
~PyRay.draw_ellipse_lines
~PyRay.draw_fps
~PyRay.draw_grid
~PyRay.draw_line
~PyRay.draw_line_3d
~PyRay.draw_line_bezier
~PyRay.draw_line_bezier_quad
~PyRay.draw_line_ex
~PyRay.draw_line_strip
~PyRay.draw_line_v
~PyRay.draw_mesh
~PyRay.draw_mesh_instanced
~PyRay.draw_model
~PyRay.draw_model_ex
~PyRay.draw_model_wires
~PyRay.draw_model_wires_ex
~PyRay.draw_pixel
~PyRay.draw_pixel_v
~PyRay.draw_plane
~PyRay.draw_point_3d
~PyRay.draw_poly
~PyRay.draw_poly_lines
~PyRay.draw_ray
~PyRay.draw_rectangle
~PyRay.draw_rectangle_gradient_ex
~PyRay.draw_rectangle_gradient_h
~PyRay.draw_rectangle_gradient_v
~PyRay.draw_rectangle_lines
~PyRay.draw_rectangle_lines_ex
~PyRay.draw_rectangle_pro
~PyRay.draw_rectangle_rec
~PyRay.draw_rectangle_rounded
~PyRay.draw_rectangle_rounded_lines
~PyRay.draw_rectangle_v
~PyRay.draw_ring
~PyRay.draw_ring_lines
~PyRay.draw_sphere
~PyRay.draw_sphere_ex
~PyRay.draw_sphere_wires
~PyRay.draw_text
~PyRay.draw_text_codepoint
~PyRay.draw_text_ex
~PyRay.draw_text_rec
~PyRay.draw_text_rec_ex
~PyRay.draw_texture
~PyRay.draw_texture_ex
~PyRay.draw_texture_n_patch
~PyRay.draw_texture_poly
~PyRay.draw_texture_pro
~PyRay.draw_texture_quad
~PyRay.draw_texture_rec
~PyRay.draw_texture_tiled
~PyRay.draw_texture_v
~PyRay.draw_triangle
~PyRay.draw_triangle_3d
~PyRay.draw_triangle_fan
~PyRay.draw_triangle_lines
~PyRay.draw_triangle_strip
~PyRay.draw_triangle_strip_3d
~PyRay.enable_cursor
~PyRay.end_blend_mode
~PyRay.end_drawing
~PyRay.end_mode_2d
~PyRay.end_mode_3d
~PyRay.end_scissor_mode
~PyRay.end_shader_mode
~PyRay.end_texture_mode
~PyRay.end_vr_stereo_mode
~PyRay.export_image
~PyRay.export_image_as_code
~PyRay.export_mesh
~PyRay.export_wave
~PyRay.export_wave_as_code
~PyRay.fade
~PyRay.file_exists
~PyRay.gen_image_cellular
~PyRay.gen_image_checked
~PyRay.gen_image_color
~PyRay.gen_image_font_atlas
~PyRay.gen_image_gradient_h
~PyRay.gen_image_gradient_radial
~PyRay.gen_image_gradient_v
~PyRay.gen_image_perlin_noise
~PyRay.gen_image_white_noise
~PyRay.gen_mesh_cube
~PyRay.gen_mesh_cubicmap
~PyRay.gen_mesh_cylinder
~PyRay.gen_mesh_heightmap
~PyRay.gen_mesh_hemi_sphere
~PyRay.gen_mesh_knot
~PyRay.gen_mesh_plane
~PyRay.gen_mesh_poly
~PyRay.gen_mesh_sphere
~PyRay.gen_mesh_torus
~PyRay.gen_texture_mipmaps
~PyRay.get_camera_matrix
~PyRay.get_camera_matrix_2d
~PyRay.get_char_pressed
~PyRay.get_clipboard_text
~PyRay.get_codepoints
~PyRay.get_codepoints_count
~PyRay.get_collision_ray_ground
~PyRay.get_collision_ray_mesh
~PyRay.get_collision_ray_model
~PyRay.get_collision_ray_triangle
~PyRay.get_collision_rec
~PyRay.get_color
~PyRay.get_current_monitor
~PyRay.get_directory_files
~PyRay.get_directory_path
~PyRay.get_dropped_files
~PyRay.get_file_extension
~PyRay.get_file_mod_time
~PyRay.get_file_name
~PyRay.get_file_name_without_ext
~PyRay.get_font_default
~PyRay.get_fps
~PyRay.get_frame_time
~PyRay.get_gamepad_axis_count
~PyRay.get_gamepad_axis_movement
~PyRay.get_gamepad_button_pressed
~PyRay.get_gamepad_name
~PyRay.get_gesture_detected
~PyRay.get_gesture_drag_angle
~PyRay.get_gesture_drag_vector
~PyRay.get_gesture_hold_duration
~PyRay.get_gesture_pinch_angle
~PyRay.get_gesture_pinch_vector
~PyRay.get_glyph_index
~PyRay.get_image_alpha_border
~PyRay.get_key_pressed
~PyRay.get_monitor_count
~PyRay.get_monitor_height
~PyRay.get_monitor_name
~PyRay.get_monitor_physical_height
~PyRay.get_monitor_physical_width
~PyRay.get_monitor_position
~PyRay.get_monitor_refresh_rate
~PyRay.get_monitor_width
~PyRay.get_mouse_position
~PyRay.get_mouse_ray
~PyRay.get_mouse_wheel_move
~PyRay.get_mouse_x
~PyRay.get_mouse_y
~PyRay.get_music_time_length
~PyRay.get_music_time_played
~PyRay.get_next_codepoint
~PyRay.get_pixel_color
~PyRay.get_pixel_data_size
~PyRay.get_prev_directory_path
~PyRay.get_random_value
~PyRay.get_screen_data
~PyRay.get_screen_height
~PyRay.get_screen_to_world_2d
~PyRay.get_screen_width
~PyRay.get_shader_location
~PyRay.get_shader_location_attrib
~PyRay.get_sounds_playing
~PyRay.get_texture_data
~PyRay.get_time
~PyRay.get_touch_points_count
~PyRay.get_touch_position
~PyRay.get_touch_x
~PyRay.get_touch_y
~PyRay.get_window_handle
~PyRay.get_window_position
~PyRay.get_window_scale_dpi
~PyRay.get_working_directory
~PyRay.get_world_to_screen
~PyRay.get_world_to_screen_2d
~PyRay.get_world_to_screen_ex
~PyRay.hide_cursor
~PyRay.image_alpha_clear
~PyRay.image_alpha_crop
~PyRay.image_alpha_mask
~PyRay.image_alpha_premultiply
~PyRay.image_clear_background
~PyRay.image_color_brightness
~PyRay.image_color_contrast
~PyRay.image_color_grayscale
~PyRay.image_color_invert
~PyRay.image_color_replace
~PyRay.image_color_tint
~PyRay.image_copy
~PyRay.image_crop
~PyRay.image_dither
~PyRay.image_draw
~PyRay.image_draw_circle
~PyRay.image_draw_circle_v
~PyRay.image_draw_line
~PyRay.image_draw_line_v
~PyRay.image_draw_pixel
~PyRay.image_draw_pixel_v
~PyRay.image_draw_rectangle
~PyRay.image_draw_rectangle_lines
~PyRay.image_draw_rectangle_rec
~PyRay.image_draw_rectangle_v
~PyRay.image_draw_text
~PyRay.image_draw_text_ex
~PyRay.image_flip_horizontal
~PyRay.image_flip_vertical
~PyRay.image_format
~PyRay.image_from_image
~PyRay.image_mipmaps
~PyRay.image_resize
~PyRay.image_resize_canvas
~PyRay.image_resize_nn
~PyRay.image_rotate_ccw
~PyRay.image_rotate_cw
~PyRay.image_text
~PyRay.image_text_ex
~PyRay.image_to_pot
~PyRay.init_audio_device
~PyRay.init_audio_stream
~PyRay.init_window
~PyRay.is_audio_device_ready
~PyRay.is_audio_stream_playing
~PyRay.is_audio_stream_processed
~PyRay.is_cursor_hidden
~PyRay.is_cursor_on_screen
~PyRay.is_file_dropped
~PyRay.is_file_extension
~PyRay.is_gamepad_available
~PyRay.is_gamepad_button_down
~PyRay.is_gamepad_button_pressed
~PyRay.is_gamepad_button_released
~PyRay.is_gamepad_button_up
~PyRay.is_gamepad_name
~PyRay.is_gesture_detected
~PyRay.is_key_down
~PyRay.is_key_pressed
~PyRay.is_key_released
~PyRay.is_key_up
~PyRay.is_model_animation_valid
~PyRay.is_mouse_button_down
~PyRay.is_mouse_button_pressed
~PyRay.is_mouse_button_released
~PyRay.is_mouse_button_up
~PyRay.is_music_playing
~PyRay.is_sound_playing
~PyRay.is_window_focused
~PyRay.is_window_fullscreen
~PyRay.is_window_hidden
~PyRay.is_window_maximized
~PyRay.is_window_minimized
~PyRay.is_window_ready
~PyRay.is_window_resized
~PyRay.is_window_state
~PyRay.load_file_data
~PyRay.load_file_text
~PyRay.load_font
~PyRay.load_font_data
~PyRay.load_font_ex
~PyRay.load_font_from_image
~PyRay.load_font_from_memory
~PyRay.load_image
~PyRay.load_image_anim
~PyRay.load_image_colors
~PyRay.load_image_from_memory
~PyRay.load_image_palette
~PyRay.load_image_raw
~PyRay.load_material_default
~PyRay.load_materials
~PyRay.load_model
~PyRay.load_model_animations
~PyRay.load_model_from_mesh
~PyRay.load_music_stream
~PyRay.load_music_stream_from_memory
~PyRay.load_render_texture
~PyRay.load_shader
~PyRay.load_shader_from_memory
~PyRay.load_sound
~PyRay.load_sound_from_wave
~PyRay.load_storage_value
~PyRay.load_texture
~PyRay.load_texture_cubemap
~PyRay.load_texture_from_image
~PyRay.load_vr_stereo_config
~PyRay.load_wave
~PyRay.load_wave_from_memory
~PyRay.load_wave_samples
~PyRay.maximize_window
~PyRay.measure_text
~PyRay.measure_text_ex
~PyRay.mem_alloc
~PyRay.mem_free
~PyRay.mem_realloc
~PyRay.mesh_binormals
~PyRay.mesh_bounding_box
~PyRay.mesh_tangents
~PyRay.minimize_window
~PyRay.open_url
~PyRay.pause_audio_stream
~PyRay.pause_music_stream
~PyRay.pause_sound
~PyRay.play_audio_stream
~PyRay.play_music_stream
~PyRay.play_sound
~PyRay.play_sound_multi
~PyRay.pointer
~PyRay.rAudioBuffer
~PyRay.restore_window
~PyRay.resume_audio_stream
~PyRay.resume_music_stream
~PyRay.resume_sound
~PyRay.save_file_data
~PyRay.save_file_text
~PyRay.save_storage_value
~PyRay.set_audio_stream_buffer_size_default
~PyRay.set_audio_stream_pitch
~PyRay.set_audio_stream_volume
~PyRay.set_camera_alt_control
~PyRay.set_camera_mode
~PyRay.set_camera_move_controls
~PyRay.set_camera_pan_control
~PyRay.set_camera_smooth_zoom_control
~PyRay.set_clipboard_text
~PyRay.set_config_flags
~PyRay.set_exit_key
~PyRay.set_gamepad_mappings
~PyRay.set_gestures_enabled
~PyRay.set_master_volume
~PyRay.set_material_texture
~PyRay.set_model_mesh_material
~PyRay.set_mouse_cursor
~PyRay.set_mouse_offset
~PyRay.set_mouse_position
~PyRay.set_mouse_scale
~PyRay.set_music_pitch
~PyRay.set_music_volume
~PyRay.set_pixel_color
~PyRay.set_shader_value
~PyRay.set_shader_value_matrix
~PyRay.set_shader_value_texture
~PyRay.set_shader_value_v
~PyRay.set_shapes_texture
~PyRay.set_sound_pitch
~PyRay.set_sound_volume
~PyRay.set_target_fps
~PyRay.set_texture_filter
~PyRay.set_texture_wrap
~PyRay.set_trace_log_level
~PyRay.set_window_icon
~PyRay.set_window_min_size
~PyRay.set_window_monitor
~PyRay.set_window_position
~PyRay.set_window_size
~PyRay.set_window_state
~PyRay.set_window_title
~PyRay.show_cursor
~PyRay.stop_audio_stream
~PyRay.stop_music_stream
~PyRay.stop_sound
~PyRay.stop_sound_multi
~PyRay.take_screenshot
~PyRay.text_append
~PyRay.text_copy
~PyRay.text_find_index
~PyRay.text_insert
~PyRay.text_is_equal
~PyRay.text_join
~PyRay.text_length
~PyRay.text_replace
~PyRay.text_split
~PyRay.text_subtext
~PyRay.text_to_integer
~PyRay.text_to_lower
~PyRay.text_to_pascal
~PyRay.text_to_upper
~PyRay.text_to_utf8
~PyRay.toggle_fullscreen
~PyRay.unload_file_data
~PyRay.unload_file_text
~PyRay.unload_font
~PyRay.unload_font_data
~PyRay.unload_image
~PyRay.unload_image_colors
~PyRay.unload_image_palette
~PyRay.unload_material
~PyRay.unload_mesh
~PyRay.unload_model
~PyRay.unload_model_animation
~PyRay.unload_model_animations
~PyRay.unload_model_keep_meshes
~PyRay.unload_music_stream
~PyRay.unload_render_texture
~PyRay.unload_shader
~PyRay.unload_sound
~PyRay.unload_texture
~PyRay.unload_vr_stereo_config
~PyRay.unload_wave
~PyRay.unload_wave_samples
~PyRay.update_audio_stream
~PyRay.update_camera
~PyRay.update_mesh_buffer
~PyRay.update_model_animation
~PyRay.update_music_stream
~PyRay.update_sound
~PyRay.update_texture
~PyRay.update_texture_rec
~PyRay.upload_mesh
~PyRay.wave_copy
~PyRay.wave_crop
~PyRay.wave_format
~PyRay.window_should_close
.. rubric:: Attributes
.. autosummary::
~PyRay.BLEND_ADDITIVE
~PyRay.BLEND_ADD_COLORS
~PyRay.BLEND_ALPHA
~PyRay.BLEND_CUSTOM
~PyRay.BLEND_MULTIPLIED
~PyRay.BLEND_SUBTRACT_COLORS
~PyRay.CAMERA_CUSTOM
~PyRay.CAMERA_FIRST_PERSON
~PyRay.CAMERA_FREE
~PyRay.CAMERA_ORBITAL
~PyRay.CAMERA_ORTHOGRAPHIC
~PyRay.CAMERA_PERSPECTIVE
~PyRay.CAMERA_THIRD_PERSON
~PyRay.CUBEMAP_LAYOUT_AUTO_DETECT
~PyRay.CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE
~PyRay.CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR
~PyRay.CUBEMAP_LAYOUT_LINE_HORIZONTAL
~PyRay.CUBEMAP_LAYOUT_LINE_VERTICAL
~PyRay.CUBEMAP_LAYOUT_PANORAMA
~PyRay.FLAG_FULLSCREEN_MODE
~PyRay.FLAG_INTERLACED_HINT
~PyRay.FLAG_MSAA_4X_HINT
~PyRay.FLAG_VSYNC_HINT
~PyRay.FLAG_WINDOW_ALWAYS_RUN
~PyRay.FLAG_WINDOW_HIDDEN
~PyRay.FLAG_WINDOW_HIGHDPI
~PyRay.FLAG_WINDOW_MAXIMIZED
~PyRay.FLAG_WINDOW_MINIMIZED
~PyRay.FLAG_WINDOW_RESIZABLE
~PyRay.FLAG_WINDOW_TOPMOST
~PyRay.FLAG_WINDOW_TRANSPARENT
~PyRay.FLAG_WINDOW_UNDECORATED
~PyRay.FLAG_WINDOW_UNFOCUSED
~PyRay.FONT_BITMAP
~PyRay.FONT_DEFAULT
~PyRay.FONT_SDF
~PyRay.GAMEPAD_AXIS_LEFT_TRIGGER
~PyRay.GAMEPAD_AXIS_LEFT_X
~PyRay.GAMEPAD_AXIS_LEFT_Y
~PyRay.GAMEPAD_AXIS_RIGHT_TRIGGER
~PyRay.GAMEPAD_AXIS_RIGHT_X
~PyRay.GAMEPAD_AXIS_RIGHT_Y
~PyRay.GAMEPAD_BUTTON_LEFT_FACE_DOWN
~PyRay.GAMEPAD_BUTTON_LEFT_FACE_LEFT
~PyRay.GAMEPAD_BUTTON_LEFT_FACE_RIGHT
~PyRay.GAMEPAD_BUTTON_LEFT_FACE_UP
~PyRay.GAMEPAD_BUTTON_LEFT_THUMB
~PyRay.GAMEPAD_BUTTON_LEFT_TRIGGER_1
~PyRay.GAMEPAD_BUTTON_LEFT_TRIGGER_2
~PyRay.GAMEPAD_BUTTON_MIDDLE
~PyRay.GAMEPAD_BUTTON_MIDDLE_LEFT
~PyRay.GAMEPAD_BUTTON_MIDDLE_RIGHT
~PyRay.GAMEPAD_BUTTON_RIGHT_FACE_DOWN
~PyRay.GAMEPAD_BUTTON_RIGHT_FACE_LEFT
~PyRay.GAMEPAD_BUTTON_RIGHT_FACE_RIGHT
~PyRay.GAMEPAD_BUTTON_RIGHT_FACE_UP
~PyRay.GAMEPAD_BUTTON_RIGHT_THUMB
~PyRay.GAMEPAD_BUTTON_RIGHT_TRIGGER_1
~PyRay.GAMEPAD_BUTTON_RIGHT_TRIGGER_2
~PyRay.GAMEPAD_BUTTON_UNKNOWN
~PyRay.GESTURE_DOUBLETAP
~PyRay.GESTURE_DRAG
~PyRay.GESTURE_HOLD
~PyRay.GESTURE_NONE
~PyRay.GESTURE_PINCH_IN
~PyRay.GESTURE_PINCH_OUT
~PyRay.GESTURE_SWIPE_DOWN
~PyRay.GESTURE_SWIPE_LEFT
~PyRay.GESTURE_SWIPE_RIGHT
~PyRay.GESTURE_SWIPE_UP
~PyRay.GESTURE_TAP
~PyRay.KEY_A
~PyRay.KEY_APOSTROPHE
~PyRay.KEY_B
~PyRay.KEY_BACK
~PyRay.KEY_BACKSLASH
~PyRay.KEY_BACKSPACE
~PyRay.KEY_C
~PyRay.KEY_CAPS_LOCK
~PyRay.KEY_COMMA
~PyRay.KEY_D
~PyRay.KEY_DELETE
~PyRay.KEY_DOWN
~PyRay.KEY_E
~PyRay.KEY_EIGHT
~PyRay.KEY_END
~PyRay.KEY_ENTER
~PyRay.KEY_EQUAL
~PyRay.KEY_ESCAPE
~PyRay.KEY_F
~PyRay.KEY_F1
~PyRay.KEY_F10
~PyRay.KEY_F11
~PyRay.KEY_F12
~PyRay.KEY_F2
~PyRay.KEY_F3
~PyRay.KEY_F4
~PyRay.KEY_F5
~PyRay.KEY_F6
~PyRay.KEY_F7
~PyRay.KEY_F8
~PyRay.KEY_F9
~PyRay.KEY_FIVE
~PyRay.KEY_FOUR
~PyRay.KEY_G
~PyRay.KEY_GRAVE
~PyRay.KEY_H
~PyRay.KEY_HOME
~PyRay.KEY_I
~PyRay.KEY_INSERT
~PyRay.KEY_J
~PyRay.KEY_K
~PyRay.KEY_KB_MENU
~PyRay.KEY_KP_0
~PyRay.KEY_KP_1
~PyRay.KEY_KP_2
~PyRay.KEY_KP_3
~PyRay.KEY_KP_4
~PyRay.KEY_KP_5
~PyRay.KEY_KP_6
~PyRay.KEY_KP_7
~PyRay.KEY_KP_8
~PyRay.KEY_KP_9
~PyRay.KEY_KP_ADD
~PyRay.KEY_KP_DECIMAL
~PyRay.KEY_KP_DIVIDE
~PyRay.KEY_KP_ENTER
~PyRay.KEY_KP_EQUAL
~PyRay.KEY_KP_MULTIPLY
~PyRay.KEY_KP_SUBTRACT
~PyRay.KEY_L
~PyRay.KEY_LEFT
~PyRay.KEY_LEFT_ALT
~PyRay.KEY_LEFT_BRACKET
~PyRay.KEY_LEFT_CONTROL
~PyRay.KEY_LEFT_SHIFT
~PyRay.KEY_LEFT_SUPER
~PyRay.KEY_M
~PyRay.KEY_MENU
~PyRay.KEY_MINUS
~PyRay.KEY_N
~PyRay.KEY_NINE
~PyRay.KEY_NULL
~PyRay.KEY_NUM_LOCK
~PyRay.KEY_O
~PyRay.KEY_ONE
~PyRay.KEY_P
~PyRay.KEY_PAGE_DOWN
~PyRay.KEY_PAGE_UP
~PyRay.KEY_PAUSE
~PyRay.KEY_PERIOD
~PyRay.KEY_PRINT_SCREEN
~PyRay.KEY_Q
~PyRay.KEY_R
~PyRay.KEY_RIGHT
~PyRay.KEY_RIGHT_ALT
~PyRay.KEY_RIGHT_BRACKET
~PyRay.KEY_RIGHT_CONTROL
~PyRay.KEY_RIGHT_SHIFT
~PyRay.KEY_RIGHT_SUPER
~PyRay.KEY_S
~PyRay.KEY_SCROLL_LOCK
~PyRay.KEY_SEMICOLON
~PyRay.KEY_SEVEN
~PyRay.KEY_SIX
~PyRay.KEY_SLASH
~PyRay.KEY_SPACE
~PyRay.KEY_T
~PyRay.KEY_TAB
~PyRay.KEY_THREE
~PyRay.KEY_TWO
~PyRay.KEY_U
~PyRay.KEY_UP
~PyRay.KEY_V
~PyRay.KEY_VOLUME_DOWN
~PyRay.KEY_VOLUME_UP
~PyRay.KEY_W
~PyRay.KEY_X
~PyRay.KEY_Y
~PyRay.KEY_Z
~PyRay.KEY_ZERO
~PyRay.LOG_ALL
~PyRay.LOG_DEBUG
~PyRay.LOG_ERROR
~PyRay.LOG_FATAL
~PyRay.LOG_INFO
~PyRay.LOG_NONE
~PyRay.LOG_TRACE
~PyRay.LOG_WARNING
~PyRay.MATERIAL_MAP_ALBEDO
~PyRay.MATERIAL_MAP_BRDG
~PyRay.MATERIAL_MAP_CUBEMAP
~PyRay.MATERIAL_MAP_DIFFUSE
~PyRay.MATERIAL_MAP_EMISSION
~PyRay.MATERIAL_MAP_HEIGHT
~PyRay.MATERIAL_MAP_IRRADIANCE
~PyRay.MATERIAL_MAP_METALNESS
~PyRay.MATERIAL_MAP_NORMAL
~PyRay.MATERIAL_MAP_OCCLUSION
~PyRay.MATERIAL_MAP_PREFILTER
~PyRay.MATERIAL_MAP_ROUGHNESS
~PyRay.MATERIAL_MAP_SPECULAR
~PyRay.MOUSE_CURSOR_ARROW
~PyRay.MOUSE_CURSOR_CROSSHAIR
~PyRay.MOUSE_CURSOR_DEFAULT
~PyRay.MOUSE_CURSOR_IBEAM
~PyRay.MOUSE_CURSOR_NOT_ALLOWED
~PyRay.MOUSE_CURSOR_POINTING_HAND
~PyRay.MOUSE_CURSOR_RESIZE_ALL
~PyRay.MOUSE_CURSOR_RESIZE_EW
~PyRay.MOUSE_CURSOR_RESIZE_NESW
~PyRay.MOUSE_CURSOR_RESIZE_NS
~PyRay.MOUSE_CURSOR_RESIZE_NWSE
~PyRay.MOUSE_LEFT_BUTTON
~PyRay.MOUSE_MIDDLE_BUTTON
~PyRay.MOUSE_RIGHT_BUTTON
~PyRay.NPATCH_NINE_PATCH
~PyRay.NPATCH_THREE_PATCH_HORIZONTAL
~PyRay.NPATCH_THREE_PATCH_VERTICAL
~PyRay.PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA
~PyRay.PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA
~PyRay.PIXELFORMAT_COMPRESSED_DXT1_RGB
~PyRay.PIXELFORMAT_COMPRESSED_DXT1_RGBA
~PyRay.PIXELFORMAT_COMPRESSED_DXT3_RGBA
~PyRay.PIXELFORMAT_COMPRESSED_DXT5_RGBA
~PyRay.PIXELFORMAT_COMPRESSED_ETC1_RGB
~PyRay.PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA
~PyRay.PIXELFORMAT_COMPRESSED_ETC2_RGB
~PyRay.PIXELFORMAT_COMPRESSED_PVRT_RGB
~PyRay.PIXELFORMAT_COMPRESSED_PVRT_RGBA
~PyRay.PIXELFORMAT_UNCOMPRESSED_GRAYSCALE
~PyRay.PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA
~PyRay.PIXELFORMAT_UNCOMPRESSED_R32
~PyRay.PIXELFORMAT_UNCOMPRESSED_R32G32B32
~PyRay.PIXELFORMAT_UNCOMPRESSED_R32G32B32A32
~PyRay.PIXELFORMAT_UNCOMPRESSED_R4G4B4A4
~PyRay.PIXELFORMAT_UNCOMPRESSED_R5G5B5A1
~PyRay.PIXELFORMAT_UNCOMPRESSED_R5G6B5
~PyRay.PIXELFORMAT_UNCOMPRESSED_R8G8B8
~PyRay.PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
~PyRay.SHADER_LOC_COLOR_AMBIENT
~PyRay.SHADER_LOC_COLOR_DIFFUSE
~PyRay.SHADER_LOC_COLOR_SPECULAR
~PyRay.SHADER_LOC_MAP_ALBEDO
~PyRay.SHADER_LOC_MAP_BRDF
~PyRay.SHADER_LOC_MAP_CUBEMAP
~PyRay.SHADER_LOC_MAP_DIFFUSE
~PyRay.SHADER_LOC_MAP_EMISSION
~PyRay.SHADER_LOC_MAP_HEIGHT
~PyRay.SHADER_LOC_MAP_IRRADIANCE
~PyRay.SHADER_LOC_MAP_METALNESS
~PyRay.SHADER_LOC_MAP_NORMAL
~PyRay.SHADER_LOC_MAP_OCCLUSION
~PyRay.SHADER_LOC_MAP_PREFILTER
~PyRay.SHADER_LOC_MAP_ROUGHNESS
~PyRay.SHADER_LOC_MAP_SPECULAR
~PyRay.SHADER_LOC_MATRIX_MODEL
~PyRay.SHADER_LOC_MATRIX_MVP
~PyRay.SHADER_LOC_MATRIX_NORMAL
~PyRay.SHADER_LOC_MATRIX_PROJECTION
~PyRay.SHADER_LOC_MATRIX_VIEW
~PyRay.SHADER_LOC_VECTOR_VIEW
~PyRay.SHADER_LOC_VERTEX_COLOR
~PyRay.SHADER_LOC_VERTEX_NORMAL
~PyRay.SHADER_LOC_VERTEX_POSITION
~PyRay.SHADER_LOC_VERTEX_TANGENT
~PyRay.SHADER_LOC_VERTEX_TEXCOORD01
~PyRay.SHADER_LOC_VERTEX_TEXCOORD02
~PyRay.SHADER_UNIFORM_FLOAT
~PyRay.SHADER_UNIFORM_INT
~PyRay.SHADER_UNIFORM_IVEC2
~PyRay.SHADER_UNIFORM_IVEC3
~PyRay.SHADER_UNIFORM_IVEC4
~PyRay.SHADER_UNIFORM_SAMPLER2D
~PyRay.SHADER_UNIFORM_VEC2
~PyRay.SHADER_UNIFORM_VEC3
~PyRay.SHADER_UNIFORM_VEC4
~PyRay.TEXTURE_FILTER_ANISOTROPIC_16X
~PyRay.TEXTURE_FILTER_ANISOTROPIC_4X
~PyRay.TEXTURE_FILTER_ANISOTROPIC_8X
~PyRay.TEXTURE_FILTER_BILINEAR
~PyRay.TEXTURE_FILTER_POINT
~PyRay.TEXTURE_FILTER_TRILINEAR
~PyRay.TEXTURE_WRAP_CLAMP
~PyRay.TEXTURE_WRAP_MIRROR_CLAMP
~PyRay.TEXTURE_WRAP_MIRROR_REPEAT
~PyRay.TEXTURE_WRAP_REPEAT
~PyRay.TextFormat
~PyRay.TraceLog

View file

@ -0,0 +1,22 @@
.. RL Zero documentation master file, created by
sphinx-quickstart on Mon Jul 12 14:03:57 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Raylib Python
===================================
.. toctree::
:maxdepth: 1
:caption: Contents:
README
pyray
raylib
* :ref:`search`

View file

@ -0,0 +1,57 @@
raylib.pyray
============
.. comment::
Link to API reference:
toctree::
:maxdepth: 1
autoapi/raylib/pyray/index
This is a wrapper around the static bindings.
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:
* the function names are in **snake_case**.
* Some string and pointer conversions are handled automatically.
* There are some helper functions to create structures.
Example program:
.. code-block::
from raylib.pyray import PyRay
from raylib.colors import *
pyray = PyRay()
pyray.init_window(800, 450, "Hello Pyray")
pyray.set_target_fps(60)
camera = pyray.Camera3D([18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0)
pyray.set_camera_mode(camera, pyray.CAMERA_ORBITAL)
while not pyray.window_should_close():
pyray.update_camera(camera)
pyray.begin_drawing()
pyray.clear_background(RAYWHITE)
pyray.begin_mode_3d(camera)
pyray.draw_grid(20, 1.0)
pyray.end_mode_3d()
pyray.draw_text("Hello world", 190, 200, 20, VIOLET)
pyray.end_drawing()
pyray.close_window()
See also https://github.com/electronstudio/raylib-python-cffi/blob/master/test_pyray.py
API reference
-------------
.. autoapimodule:: raylib.pyray
:members:
:undoc-members:

View file

@ -0,0 +1,46 @@
raylib.static
=============
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>`_
are very, very similar to the C originals.
Example program:
.. code-block::
from raylib.static import *
InitWindow(800, 450, b"Hello Raylib")
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])
SetCameraMode(camera[0], CAMERA_ORBITAL)
while not WindowShouldClose():
UpdateCamera(camera)
BeginDrawing()
ClearBackground(RAYWHITE)
BeginMode3D(camera[0])
DrawGrid(20, 1.0)
EndMode3D()
DrawText(b"Hellow World", 190, 200, 20, VIOLET)
EndDrawing()
CloseWindow()
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
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
-----------------------
.. automodule:: raylib.static.rl
:members:
:undoc-members: