koffi 2.1.1 → 2.1.2
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.
- package/ChangeLog.md +6 -0
- package/build/qemu/2.1.2/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_win32_x64.tar.gz +0 -0
- package/doc/templates/badges.html +3 -0
- package/package.json +2 -2
- package/src/abi_arm64.cc +35 -1
- package/src/abi_x64_win.cc +2 -8
- package/src/abi_x86.cc +1 -7
- package/src/ffi.hh +1 -1
- package/src/util.hh +6 -0
- package/test/raylib.js +37 -5
- package/vendor/libcc/libcc.cc +430 -196
- package/vendor/libcc/libcc.hh +1417 -1283
- package/vendor/raylib/BINDINGS.md +87 -70
- package/vendor/raylib/CHANGELOG +263 -50
- package/vendor/raylib/CMakeLists.txt +12 -0
- package/vendor/raylib/CMakeOptions.txt +8 -1
- package/vendor/raylib/CONVENTIONS.md +2 -3
- package/vendor/raylib/FAQ.md +137 -0
- package/vendor/raylib/HISTORY.md +62 -29
- package/vendor/raylib/LICENSE +1 -1
- package/vendor/raylib/README.md +22 -17
- package/vendor/raylib/ROADMAP.md +8 -7
- package/vendor/raylib/cmake/CompileDefinitions.cmake +19 -15
- package/vendor/raylib/cmake/GlfwImport.cmake +2 -0
- package/vendor/raylib/cmake/LibraryConfigurations.cmake +22 -16
- package/vendor/raylib/cmake/raylib-config.cmake +52 -49
- package/vendor/raylib/examples/CMakeLists.txt +14 -9
- package/vendor/raylib/examples/Makefile +112 -125
- package/vendor/raylib/examples/Makefile.Android +1 -1
- package/vendor/raylib/examples/Makefile.Web +145 -158
- package/vendor/raylib/examples/README.md +141 -141
- package/vendor/raylib/examples/audio/audio_module_playing.c +9 -4
- package/vendor/raylib/examples/audio/audio_multichannel_sound.c +8 -3
- package/vendor/raylib/examples/audio/audio_music_stream.c +16 -11
- package/vendor/raylib/examples/audio/audio_raw_stream.c +57 -9
- package/vendor/raylib/examples/audio/audio_sound_loading.c +8 -3
- package/vendor/raylib/examples/audio/audio_stream_effects.c +179 -0
- package/vendor/raylib/examples/audio/audio_stream_effects.png +0 -0
- package/vendor/raylib/examples/build.zig +17 -6
- package/vendor/raylib/examples/core/core_2d_camera.c +8 -4
- package/vendor/raylib/examples/core/core_2d_camera_mouse_zoom.c +105 -0
- package/vendor/raylib/examples/core/core_2d_camera_mouse_zoom.png +0 -0
- package/vendor/raylib/examples/core/core_2d_camera_platformer.c +11 -6
- package/vendor/raylib/examples/core/core_3d_camera_first_person.c +9 -4
- package/vendor/raylib/examples/core/core_3d_camera_free.c +9 -4
- package/vendor/raylib/examples/core/core_3d_camera_mode.c +8 -3
- package/vendor/raylib/examples/core/core_3d_picking.c +9 -4
- package/vendor/raylib/examples/core/core_basic_screen_manager.c +9 -7
- package/vendor/raylib/examples/core/core_basic_window.c +8 -3
- package/vendor/raylib/examples/core/core_basic_window_web.c +13 -11
- package/vendor/raylib/examples/core/core_custom_frame_control.c +9 -4
- package/vendor/raylib/examples/core/core_custom_logging.c +12 -8
- package/vendor/raylib/examples/core/core_drop_files.c +20 -12
- package/vendor/raylib/examples/core/core_input_gamepad.c +20 -15
- package/vendor/raylib/examples/core/core_input_gestures.c +19 -15
- package/vendor/raylib/examples/core/core_input_keys.c +8 -3
- package/vendor/raylib/examples/core/core_input_mouse.c +8 -3
- package/vendor/raylib/examples/core/core_input_mouse_wheel.c +8 -3
- package/vendor/raylib/examples/core/core_input_multitouch.c +8 -3
- package/vendor/raylib/examples/core/core_loading_thread.c +10 -6
- package/vendor/raylib/examples/core/core_random_values.c +8 -3
- package/vendor/raylib/examples/core/core_scissor_test.c +8 -3
- package/vendor/raylib/examples/core/core_smooth_pixelperfect.c +9 -4
- package/vendor/raylib/examples/core/core_split_screen.c +8 -3
- package/vendor/raylib/examples/core/core_storage_values.c +109 -3
- package/vendor/raylib/examples/core/core_vr_simulator.c +15 -7
- package/vendor/raylib/examples/core/core_window_flags.c +8 -3
- package/vendor/raylib/examples/core/core_window_letterbox.c +13 -18
- package/vendor/raylib/examples/core/core_window_should_close.c +77 -0
- package/vendor/raylib/examples/core/core_window_should_close.png +0 -0
- package/vendor/raylib/examples/core/core_world_screen.c +9 -4
- package/vendor/raylib/examples/examples_template.c +8 -3
- package/vendor/raylib/examples/models/models_animation.c +11 -7
- package/vendor/raylib/examples/models/models_billboard.c +9 -4
- package/vendor/raylib/examples/models/models_box_collisions.c +8 -3
- package/vendor/raylib/examples/models/models_cubicmap.c +9 -4
- package/vendor/raylib/examples/models/models_first_person_maze.c +9 -4
- package/vendor/raylib/examples/models/models_geometric_shapes.c +8 -3
- package/vendor/raylib/examples/models/models_heightmap.c +9 -4
- package/vendor/raylib/examples/models/models_loading.c +21 -17
- package/vendor/raylib/examples/models/models_loading_gltf.c +15 -41
- package/vendor/raylib/examples/models/models_loading_vox.c +9 -4
- package/vendor/raylib/examples/models/models_mesh_generation.c +71 -58
- package/vendor/raylib/examples/models/models_mesh_picking.c +25 -7
- package/vendor/raylib/examples/models/models_orthographic_projection.c +8 -5
- package/vendor/raylib/examples/models/models_rlgl_solar_system.c +6 -4
- package/vendor/raylib/examples/models/models_skybox.c +16 -12
- package/vendor/raylib/examples/models/models_waving_cubes.c +9 -4
- package/vendor/raylib/examples/models/models_yaw_pitch_roll.c +12 -7
- package/vendor/raylib/examples/models/resources/LICENSE.md +9 -10
- package/vendor/raylib/examples/models/resources/models/gltf/LICENSE +2 -23
- package/vendor/raylib/examples/models/resources/models/gltf/{raylib_32x32.glb → raylib_logo_3d.glb} +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/robot.blend +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/robot.glb +0 -0
- package/vendor/raylib/examples/others/easings_testbed.c +10 -8
- package/vendor/raylib/examples/others/easings_testbed.png +0 -0
- package/vendor/raylib/examples/others/embedded_files_loading.c +10 -5
- package/vendor/raylib/examples/others/embedded_files_loading.png +0 -0
- package/vendor/raylib/examples/others/raylib_opengl_interop.c +10 -6
- package/vendor/raylib/{src/extras/easings.h → examples/others/reasings.h} +38 -38
- package/vendor/raylib/examples/others/rlgl_compute_shader.c +21 -20
- package/vendor/raylib/examples/others/rlgl_compute_shader.png +0 -0
- package/vendor/raylib/examples/others/rlgl_standalone.c +4 -4
- package/vendor/raylib/examples/others/rlgl_standalone.png +0 -0
- package/vendor/raylib/examples/raylib_compile_execute.bat +2 -2
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/lighting.fs +1 -1
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/{base_lighting_instanced.vs → lighting_instancing.vs} +2 -2
- package/vendor/raylib/examples/shaders/rlights.h +14 -27
- package/vendor/raylib/examples/shaders/shaders_basic_lighting.c +24 -26
- package/vendor/raylib/examples/shaders/shaders_custom_uniform.c +10 -5
- package/vendor/raylib/examples/shaders/shaders_eratosthenes.c +13 -8
- package/vendor/raylib/examples/shaders/shaders_fog.c +8 -12
- package/vendor/raylib/examples/shaders/shaders_hot_reloading.c +10 -5
- package/vendor/raylib/examples/shaders/shaders_julia_set.c +9 -4
- package/vendor/raylib/examples/shaders/shaders_mesh_instancing.c +45 -119
- package/vendor/raylib/examples/shaders/shaders_model_shader.c +10 -5
- package/vendor/raylib/examples/shaders/shaders_multi_sample2d.c +8 -3
- package/vendor/raylib/examples/shaders/shaders_palette_switch.c +8 -3
- package/vendor/raylib/examples/shaders/shaders_postprocessing.c +9 -4
- package/vendor/raylib/examples/shaders/shaders_raymarching.c +14 -11
- package/vendor/raylib/examples/shaders/shaders_shapes_textures.c +8 -3
- package/vendor/raylib/examples/shaders/shaders_simple_mask.c +10 -5
- package/vendor/raylib/examples/shaders/shaders_spotlight.c +10 -6
- package/vendor/raylib/examples/shaders/shaders_texture_drawing.c +9 -4
- package/vendor/raylib/examples/shaders/shaders_texture_outline.c +8 -3
- package/vendor/raylib/examples/shaders/shaders_texture_waves.c +8 -3
- package/vendor/raylib/{src/extras → examples/shapes}/raygui.h +1290 -1141
- package/vendor/raylib/examples/{others/easings.h → shapes/reasings.h} +40 -40
- package/vendor/raylib/examples/shapes/shapes_basic_shapes.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_bouncing_ball.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_collision_area.c +10 -4
- package/vendor/raylib/examples/shapes/shapes_colors_palette.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_draw_circle_sector.c +9 -4
- package/vendor/raylib/examples/shapes/shapes_draw_rectangle_rounded.c +9 -4
- package/vendor/raylib/examples/shapes/shapes_draw_ring.c +10 -6
- package/vendor/raylib/examples/shapes/shapes_easings_ball_anim.c +9 -4
- package/vendor/raylib/examples/shapes/shapes_easings_box_anim.c +9 -4
- package/vendor/raylib/examples/shapes/shapes_easings_rectangle_array.c +9 -4
- package/vendor/raylib/examples/shapes/shapes_following_eyes.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_lines_bezier.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_logo_raylib.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_logo_raylib_anim.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_rectangle_scaling.c +14 -5
- package/vendor/raylib/examples/shapes/shapes_top_down_lights.c +355 -0
- package/vendor/raylib/examples/shapes/shapes_top_down_lights.png +0 -0
- package/vendor/raylib/examples/text/resources/DotGothic16-Regular.ttf +0 -0
- package/vendor/raylib/examples/text/resources/DotGothic16-Regular_OFL.txt +93 -0
- package/vendor/raylib/examples/text/resources/LICENSE.md +1 -1
- package/vendor/raylib/examples/text/text_codepoints_loading.c +138 -0
- package/vendor/raylib/examples/text/text_codepoints_loading.png +0 -0
- package/vendor/raylib/examples/text/text_draw_3d.c +42 -33
- package/vendor/raylib/examples/text/text_font_filters.c +14 -11
- package/vendor/raylib/examples/text/text_font_loading.c +9 -4
- package/vendor/raylib/examples/text/text_font_sdf.c +9 -4
- package/vendor/raylib/examples/text/text_font_spritefont.c +12 -6
- package/vendor/raylib/examples/text/text_format_text.c +8 -3
- package/vendor/raylib/examples/text/text_input_box.c +8 -3
- package/vendor/raylib/examples/text/text_raylib_fonts.c +9 -4
- package/vendor/raylib/examples/text/text_rectangle_bounds.c +9 -5
- package/vendor/raylib/examples/text/text_unicode.c +9 -7
- package/vendor/raylib/examples/text/text_writing_anim.c +8 -3
- package/vendor/raylib/examples/textures/resources/scarfy_run.gif +0 -0
- package/vendor/raylib/examples/textures/textures_background_scrolling.c +8 -3
- package/vendor/raylib/examples/textures/textures_blend_modes.c +8 -3
- package/vendor/raylib/examples/textures/textures_bunnymark.c +8 -3
- package/vendor/raylib/examples/textures/textures_draw_tiled.c +14 -10
- package/vendor/raylib/examples/textures/textures_fog_of_war.c +154 -0
- package/vendor/raylib/examples/textures/textures_fog_of_war.png +0 -0
- package/vendor/raylib/examples/textures/textures_gif_player.c +121 -0
- package/vendor/raylib/examples/textures/textures_gif_player.png +0 -0
- package/vendor/raylib/examples/textures/textures_image_drawing.c +8 -3
- package/vendor/raylib/examples/textures/textures_image_generation.c +8 -3
- package/vendor/raylib/examples/textures/textures_image_loading.c +8 -3
- package/vendor/raylib/examples/textures/textures_image_processing.c +8 -3
- package/vendor/raylib/examples/textures/textures_image_text.c +8 -3
- package/vendor/raylib/examples/textures/textures_logo_raylib.c +8 -3
- package/vendor/raylib/examples/textures/textures_mouse_painting.c +9 -4
- package/vendor/raylib/examples/textures/textures_npatch_drawing.c +8 -3
- package/vendor/raylib/examples/textures/textures_particles_blending.c +8 -3
- package/vendor/raylib/examples/textures/textures_polygon.c +9 -5
- package/vendor/raylib/examples/textures/textures_raw_data.c +8 -3
- package/vendor/raylib/examples/textures/{textures_rectangle.c → textures_sprite_anim.c} +11 -5
- package/vendor/raylib/examples/textures/{textures_rectangle.png → textures_sprite_anim.png} +0 -0
- package/vendor/raylib/examples/textures/textures_sprite_button.c +8 -3
- package/vendor/raylib/examples/textures/textures_sprite_explosion.c +8 -3
- package/vendor/raylib/examples/textures/textures_srcrec_dstrec.c +8 -3
- package/vendor/raylib/examples/textures/textures_to_image.c +8 -3
- package/vendor/raylib/parser/LICENSE +1 -1
- package/vendor/raylib/parser/Makefile +28 -0
- package/vendor/raylib/parser/README.md +49 -5
- package/vendor/raylib/parser/output/raylib_api.json +10717 -0
- package/vendor/raylib/parser/output/raylib_api.lua +7435 -0
- package/vendor/raylib/parser/{raylib_api.txt → output/raylib_api.txt} +1371 -824
- package/vendor/raylib/parser/{raylib_api.xml → output/raylib_api.xml} +827 -595
- package/vendor/raylib/parser/raylib_parser.c +1174 -196
- package/vendor/raylib/projects/4coder/Makefile +2 -4
- package/vendor/raylib/projects/4coder/main.c +0 -1
- package/vendor/raylib/projects/CMake/CMakeLists.txt +13 -16
- package/vendor/raylib/projects/CMake/README.md +27 -0
- package/vendor/raylib/projects/CMake/core_basic_window.c +52 -31
- package/vendor/raylib/projects/CodeBlocks/README.md +4 -4
- package/vendor/raylib/projects/Geany/core_basic_window.c +1 -1
- package/vendor/raylib/projects/Notepad++/c_raylib.xml +168 -128
- package/vendor/raylib/projects/Notepad++/npes_saved_tcc.txt +0 -0
- package/vendor/raylib/projects/Notepad++/npes_saved_w64devkit.txt +0 -0
- package/vendor/raylib/projects/Notepad++/npes_saved_zig.txt +0 -0
- package/vendor/raylib/projects/Notepad++/raylib_npp_parser/raylib_npp.xml +168 -84
- package/vendor/raylib/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h +67 -51
- package/vendor/raylib/projects/README.md +1 -1
- package/vendor/raylib/projects/VSCode/.vscode/c_cpp_properties.json +1 -1
- package/vendor/raylib/projects/VSCode/Makefile +8 -11
- package/vendor/raylib/projects/VSCode/main.c +53 -26
- package/vendor/raylib/projects/VSCode/resources/LICENSE +1 -0
- package/vendor/raylib/projects/scripts/build-linux.sh +6 -6
- package/vendor/raylib/projects/scripts/build-osx.sh +6 -6
- package/vendor/raylib/projects/scripts/build-rpi.sh +6 -6
- package/vendor/raylib/projects/scripts/build-windows.bat +2 -2
- package/vendor/raylib/src/CMakeLists.txt +6 -7
- package/vendor/raylib/src/Makefile +209 -103
- package/vendor/raylib/src/build.zig +56 -20
- package/vendor/raylib/src/config.h +32 -27
- package/vendor/raylib/src/external/cgltf.h +342 -104
- package/vendor/raylib/src/external/dr_wav.h +487 -225
- package/vendor/raylib/src/external/glfw/src/posix_time.c +1 -3
- package/vendor/raylib/src/external/glfw/src/wl_init.c +1 -3
- package/vendor/raylib/src/external/jar_xm.h +2 -1
- package/vendor/raylib/src/external/miniaudio.h +62251 -42061
- package/vendor/raylib/src/external/qoi.h +671 -0
- package/vendor/raylib/src/external/stb_vorbis.h +1 -1
- package/vendor/raylib/src/external/vox_loader.h +30 -25
- package/vendor/raylib/src/minshell.html +82 -0
- package/vendor/raylib/src/raudio.c +359 -201
- package/vendor/raylib/src/raylib.dll.rc +5 -5
- package/vendor/raylib/src/raylib.dll.rc.data +0 -0
- package/vendor/raylib/src/raylib.h +95 -63
- package/vendor/raylib/src/raylib.rc +5 -5
- package/vendor/raylib/src/raylib.rc.data +0 -0
- package/vendor/raylib/src/raymath.h +391 -133
- package/vendor/raylib/src/rcamera.h +32 -41
- package/vendor/raylib/src/rcore.c +775 -471
- package/vendor/raylib/src/rgestures.h +5 -5
- package/vendor/raylib/src/rglfw.c +3 -3
- package/vendor/raylib/src/rlgl.h +184 -144
- package/vendor/raylib/src/rmodels.c +207 -144
- package/vendor/raylib/src/rshapes.c +105 -47
- package/vendor/raylib/src/rtext.c +255 -38
- package/vendor/raylib/src/rtextures.c +167 -71
- package/vendor/raylib/src/shell.html +63 -63
- package/vendor/raylib/src/utils.c +49 -3
- package/vendor/raylib/src/utils.h +3 -3
- package/build/qemu/2.1.1/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_win32_x64.tar.gz +0 -0
- package/vendor/raylib/CONTRIBUTORS.md +0 -63
- package/vendor/raylib/SPONSORS.md +0 -68
- package/vendor/raylib/examples/core/core_quat_conversion.c +0 -132
- package/vendor/raylib/examples/core/core_quat_conversion.png +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/AnimatedMorphCube.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/AnimatedTriangle.gltf +0 -118
- package/vendor/raylib/examples/models/resources/models/gltf/BoxAnimated.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/girl.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/rigged_figure.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/vertex_colored_object.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/iqm/vertex_colored_object.iqm +0 -0
- package/vendor/raylib/examples/models/rlights.h +0 -183
- package/vendor/raylib/examples/others/raudio_standalone.c +0 -152
- package/vendor/raylib/examples/others/resources/audio/country.mp3 +0 -0
- package/vendor/raylib/examples/others/resources/audio/target.ogg +0 -0
- package/vendor/raylib/examples/others/resources/audio/weird.wav +0 -0
- package/vendor/raylib/examples/physics/physics_demo.c +0 -128
- package/vendor/raylib/examples/physics/physics_demo.png +0 -0
- package/vendor/raylib/examples/physics/physics_friction.c +0 -142
- package/vendor/raylib/examples/physics/physics_friction.png +0 -0
- package/vendor/raylib/examples/physics/physics_movement.c +0 -128
- package/vendor/raylib/examples/physics/physics_movement.png +0 -0
- package/vendor/raylib/examples/physics/physics_restitution.c +0 -129
- package/vendor/raylib/examples/physics/physics_restitution.png +0 -0
- package/vendor/raylib/examples/physics/physics_shatter.c +0 -111
- package/vendor/raylib/examples/physics/physics_shatter.png +0 -0
- package/vendor/raylib/parser/raylib_api.json +0 -6668
- package/vendor/raylib/projects/VS2019/raylib/raylib.rc +0 -0
- package/vendor/raylib/projects/VS2019/raylib/resource.h +0 -14
- package/vendor/raylib/src/extras/physac.h +0 -1977
- package/vendor/raylib/src/extras/rmem.h +0 -751
- package/vendor/raylib/src/raudio.h +0 -198
|
@@ -2,15 +2,31 @@
|
|
|
2
2
|
*
|
|
3
3
|
* rshapes - Basic functions to draw 2d shapes and check collisions
|
|
4
4
|
*
|
|
5
|
+
* NOTES:
|
|
6
|
+
* Shapes can be draw using 3 types of primitives: LINES, TRIANGLES and QUADS.
|
|
7
|
+
* Some functions implement two drawing options: TRIANGLES and QUADS, by default TRIANGLES
|
|
8
|
+
* are used but QUADS implementation can be selected with SUPPORT_QUADS_DRAW_MODE define
|
|
9
|
+
*
|
|
10
|
+
* Some functions define texture coordinates (rlTexCoord2f()) for the shapes and use a
|
|
11
|
+
* user-provided texture with SetShapesTexture(), the pourpouse of this implementation
|
|
12
|
+
* is allowing to reduce draw calls when combined with a texture-atlas.
|
|
13
|
+
*
|
|
14
|
+
* By default, raylib sets the default texture and rectangle at InitWindow()[rcore] to one
|
|
15
|
+
* white character of default font [rtext], this way, raylib text and shapes can be draw with
|
|
16
|
+
* a single draw call and it also allows users to configure it the same way with their own fonts.
|
|
17
|
+
*
|
|
5
18
|
* CONFIGURATION:
|
|
6
19
|
*
|
|
20
|
+
* #define SUPPORT_MODULE_RSHAPES
|
|
21
|
+
* rshapes module is included in the build
|
|
22
|
+
*
|
|
7
23
|
* #define SUPPORT_QUADS_DRAW_MODE
|
|
8
|
-
* Use QUADS instead of TRIANGLES for drawing when possible.
|
|
9
|
-
*
|
|
24
|
+
* Use QUADS instead of TRIANGLES for drawing when possible. Lines-based shapes still use LINES
|
|
25
|
+
*
|
|
10
26
|
*
|
|
11
27
|
* LICENSE: zlib/libpng
|
|
12
28
|
*
|
|
13
|
-
* Copyright (c) 2013-
|
|
29
|
+
* Copyright (c) 2013-2022 Ramon Santamaria (@raysan5)
|
|
14
30
|
*
|
|
15
31
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
|
16
32
|
* will the authors be held liable for any damages arising from the use of this software.
|
|
@@ -36,6 +52,8 @@
|
|
|
36
52
|
#include "config.h" // Defines module configuration flags
|
|
37
53
|
#endif
|
|
38
54
|
|
|
55
|
+
#if defined(SUPPORT_MODULE_RSHAPES)
|
|
56
|
+
|
|
39
57
|
#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2
|
|
40
58
|
|
|
41
59
|
#include <math.h> // Required for: sinf(), asinf(), cosf(), acosf(), sqrtf(), fabsf()
|
|
@@ -44,12 +62,15 @@
|
|
|
44
62
|
//----------------------------------------------------------------------------------
|
|
45
63
|
// Defines and Macros
|
|
46
64
|
//----------------------------------------------------------------------------------
|
|
47
|
-
|
|
48
65
|
// Error rate to calculate how many segments we need to draw a smooth circle,
|
|
49
66
|
// taken from https://stackoverflow.com/a/2244088
|
|
50
67
|
#ifndef SMOOTH_CIRCLE_ERROR_RATE
|
|
51
|
-
#define SMOOTH_CIRCLE_ERROR_RATE
|
|
68
|
+
#define SMOOTH_CIRCLE_ERROR_RATE 0.5f // Circle error rate
|
|
52
69
|
#endif
|
|
70
|
+
#ifndef BEZIER_LINE_DIVISIONS
|
|
71
|
+
#define BEZIER_LINE_DIVISIONS 24 // Bezier line divisions
|
|
72
|
+
#endif
|
|
73
|
+
|
|
53
74
|
|
|
54
75
|
//----------------------------------------------------------------------------------
|
|
55
76
|
// Types and Structures Definition
|
|
@@ -59,8 +80,8 @@
|
|
|
59
80
|
//----------------------------------------------------------------------------------
|
|
60
81
|
// Global Variables Definition
|
|
61
82
|
//----------------------------------------------------------------------------------
|
|
62
|
-
Texture2D texShapes = { 1, 1, 1, 1, 7 };
|
|
63
|
-
Rectangle texShapesRec = { 0, 0, 1, 1 };
|
|
83
|
+
Texture2D texShapes = { 1, 1, 1, 1, 7 }; // Texture used on shapes drawing (usually a white pixel)
|
|
84
|
+
Rectangle texShapesRec = { 0.0f, 0.0f, 1.0f, 1.0f }; // Texture source rectangle used on shapes drawing
|
|
64
85
|
|
|
65
86
|
//----------------------------------------------------------------------------------
|
|
66
87
|
// Module specific Functions Declaration
|
|
@@ -144,10 +165,6 @@ void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color)
|
|
|
144
165
|
// Draw line using cubic-bezier curves in-out
|
|
145
166
|
void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color)
|
|
146
167
|
{
|
|
147
|
-
#ifndef BEZIER_LINE_DIVISIONS
|
|
148
|
-
#define BEZIER_LINE_DIVISIONS 24 // Bezier line divisions
|
|
149
|
-
#endif
|
|
150
|
-
|
|
151
168
|
Vector2 previous = startPos;
|
|
152
169
|
Vector2 current = { 0 };
|
|
153
170
|
|
|
@@ -333,6 +350,7 @@ void DrawCircleSector(Vector2 center, float radius, float startAngle, float endA
|
|
|
333
350
|
#endif
|
|
334
351
|
}
|
|
335
352
|
|
|
353
|
+
// Draw a piece of a circle outlines
|
|
336
354
|
void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color)
|
|
337
355
|
{
|
|
338
356
|
if (radius <= 0.0f) radius = 0.1f; // Avoid div by zero issue
|
|
@@ -468,6 +486,7 @@ void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Co
|
|
|
468
486
|
rlEnd();
|
|
469
487
|
}
|
|
470
488
|
|
|
489
|
+
// Draw ring
|
|
471
490
|
void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color)
|
|
472
491
|
{
|
|
473
492
|
if (startAngle == endAngle) return;
|
|
@@ -561,6 +580,7 @@ void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startA
|
|
|
561
580
|
#endif
|
|
562
581
|
}
|
|
563
582
|
|
|
583
|
+
// Draw ring outline
|
|
564
584
|
void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color)
|
|
565
585
|
{
|
|
566
586
|
if (startAngle == endAngle) return;
|
|
@@ -662,8 +682,6 @@ void DrawRectangleRec(Rectangle rec, Color color)
|
|
|
662
682
|
// Draw a color-filled rectangle with pro parameters
|
|
663
683
|
void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color)
|
|
664
684
|
{
|
|
665
|
-
rlCheckRenderBatchLimit(4);
|
|
666
|
-
|
|
667
685
|
Vector2 topLeft = { 0 };
|
|
668
686
|
Vector2 topRight = { 0 };
|
|
669
687
|
Vector2 bottomLeft = { 0 };
|
|
@@ -701,7 +719,11 @@ void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color
|
|
|
701
719
|
bottomRight.y = y + (dx + rec.width)*sinRotation + (dy + rec.height)*cosRotation;
|
|
702
720
|
}
|
|
703
721
|
|
|
722
|
+
#if defined(SUPPORT_QUADS_DRAW_MODE)
|
|
723
|
+
rlCheckRenderBatchLimit(4);
|
|
724
|
+
|
|
704
725
|
rlSetTexture(texShapes.id);
|
|
726
|
+
|
|
705
727
|
rlBegin(RL_QUADS);
|
|
706
728
|
|
|
707
729
|
rlNormal3f(0.0f, 0.0f, 1.0f);
|
|
@@ -720,7 +742,25 @@ void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color
|
|
|
720
742
|
rlVertex2f(topRight.x, topRight.y);
|
|
721
743
|
|
|
722
744
|
rlEnd();
|
|
745
|
+
|
|
723
746
|
rlSetTexture(0);
|
|
747
|
+
#else
|
|
748
|
+
rlCheckRenderBatchLimit(6);
|
|
749
|
+
|
|
750
|
+
rlBegin(RL_TRIANGLES);
|
|
751
|
+
|
|
752
|
+
rlColor4ub(color.r, color.g, color.b, color.a);
|
|
753
|
+
|
|
754
|
+
rlVertex2f(topLeft.x, topLeft.y);
|
|
755
|
+
rlVertex2f(bottomLeft.x, bottomLeft.y);
|
|
756
|
+
rlVertex2f(topRight.x, topRight.y);
|
|
757
|
+
|
|
758
|
+
rlVertex2f(topRight.x, topRight.y);
|
|
759
|
+
rlVertex2f(bottomLeft.x, bottomLeft.y);
|
|
760
|
+
rlVertex2f(bottomRight.x, bottomRight.y);
|
|
761
|
+
|
|
762
|
+
rlEnd();
|
|
763
|
+
#endif
|
|
724
764
|
}
|
|
725
765
|
|
|
726
766
|
// Draw a vertical-gradient-filled rectangle
|
|
@@ -741,30 +781,30 @@ void DrawRectangleGradientH(int posX, int posY, int width, int height, Color col
|
|
|
741
781
|
// NOTE: Colors refer to corners, starting at top-lef corner and counter-clockwise
|
|
742
782
|
void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4)
|
|
743
783
|
{
|
|
784
|
+
rlCheckRenderBatchLimit(4);
|
|
785
|
+
|
|
744
786
|
rlSetTexture(texShapes.id);
|
|
745
787
|
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
rlNormal3f(0.0f, 0.0f, 1.0f);
|
|
788
|
+
rlBegin(RL_QUADS);
|
|
789
|
+
rlNormal3f(0.0f, 0.0f, 1.0f);
|
|
749
790
|
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
791
|
+
// NOTE: Default raylib font character 95 is a white square
|
|
792
|
+
rlColor4ub(col1.r, col1.g, col1.b, col1.a);
|
|
793
|
+
rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height);
|
|
794
|
+
rlVertex2f(rec.x, rec.y);
|
|
754
795
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
796
|
+
rlColor4ub(col2.r, col2.g, col2.b, col2.a);
|
|
797
|
+
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height);
|
|
798
|
+
rlVertex2f(rec.x, rec.y + rec.height);
|
|
758
799
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
800
|
+
rlColor4ub(col3.r, col3.g, col3.b, col3.a);
|
|
801
|
+
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height);
|
|
802
|
+
rlVertex2f(rec.x + rec.width, rec.y + rec.height);
|
|
762
803
|
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
rlPopMatrix();
|
|
804
|
+
rlColor4ub(col4.r, col4.g, col4.b, col4.a);
|
|
805
|
+
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height);
|
|
806
|
+
rlVertex2f(rec.x + rec.width, rec.y);
|
|
807
|
+
rlEnd();
|
|
768
808
|
|
|
769
809
|
rlSetTexture(0);
|
|
770
810
|
}
|
|
@@ -1291,9 +1331,9 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, flo
|
|
|
1291
1331
|
// NOTE: Vertex must be provided in counter-clockwise order
|
|
1292
1332
|
void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
|
|
1293
1333
|
{
|
|
1334
|
+
#if defined(SUPPORT_QUADS_DRAW_MODE)
|
|
1294
1335
|
rlCheckRenderBatchLimit(4);
|
|
1295
1336
|
|
|
1296
|
-
#if defined(SUPPORT_QUADS_DRAW_MODE)
|
|
1297
1337
|
rlSetTexture(texShapes.id);
|
|
1298
1338
|
|
|
1299
1339
|
rlBegin(RL_QUADS);
|
|
@@ -1314,6 +1354,8 @@ void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
|
|
|
1314
1354
|
|
|
1315
1355
|
rlSetTexture(0);
|
|
1316
1356
|
#else
|
|
1357
|
+
rlCheckRenderBatchLimit(3);
|
|
1358
|
+
|
|
1317
1359
|
rlBegin(RL_TRIANGLES);
|
|
1318
1360
|
rlColor4ub(color.r, color.g, color.b, color.a);
|
|
1319
1361
|
rlVertex2f(v1.x, v1.y);
|
|
@@ -1564,7 +1606,11 @@ bool CheckCollisionPointRec(Vector2 point, Rectangle rec)
|
|
|
1564
1606
|
// Check if point is inside circle
|
|
1565
1607
|
bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius)
|
|
1566
1608
|
{
|
|
1567
|
-
|
|
1609
|
+
bool collision = false;
|
|
1610
|
+
|
|
1611
|
+
collision = CheckCollisionCircles(point, 0, center, radius);
|
|
1612
|
+
|
|
1613
|
+
return collision;
|
|
1568
1614
|
}
|
|
1569
1615
|
|
|
1570
1616
|
// Check if point is inside a triangle defined by three points (p1, p2, p3)
|
|
@@ -1615,6 +1661,8 @@ bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, floa
|
|
|
1615
1661
|
// NOTE: Reviewed version to take into account corner limit case
|
|
1616
1662
|
bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec)
|
|
1617
1663
|
{
|
|
1664
|
+
bool collision = false;
|
|
1665
|
+
|
|
1618
1666
|
int recCenterX = (int)(rec.x + rec.width/2.0f);
|
|
1619
1667
|
int recCenterY = (int)(rec.y + rec.height/2.0f);
|
|
1620
1668
|
|
|
@@ -1630,37 +1678,45 @@ bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec)
|
|
|
1630
1678
|
float cornerDistanceSq = (dx - rec.width/2.0f)*(dx - rec.width/2.0f) +
|
|
1631
1679
|
(dy - rec.height/2.0f)*(dy - rec.height/2.0f);
|
|
1632
1680
|
|
|
1633
|
-
|
|
1681
|
+
collision = (cornerDistanceSq <= (radius*radius));
|
|
1682
|
+
|
|
1683
|
+
return collision;
|
|
1634
1684
|
}
|
|
1635
1685
|
|
|
1636
1686
|
// Check the collision between two lines defined by two points each, returns collision point by reference
|
|
1637
1687
|
bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint)
|
|
1638
1688
|
{
|
|
1639
|
-
|
|
1689
|
+
bool collision = false;
|
|
1640
1690
|
|
|
1641
|
-
|
|
1691
|
+
float div = (endPos2.y - startPos2.y)*(endPos1.x - startPos1.x) - (endPos2.x - startPos2.x)*(endPos1.y - startPos1.y);
|
|
1642
1692
|
|
|
1643
|
-
|
|
1644
|
-
|
|
1693
|
+
if (fabsf(div) >= FLT_EPSILON)
|
|
1694
|
+
{
|
|
1695
|
+
collision = true;
|
|
1645
1696
|
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
if (fabsf(startPos1.y - endPos1.y) > FLT_EPSILON && (yi < fminf(startPos1.y, endPos1.y) || yi > fmaxf(startPos1.y, endPos1.y))) return false;
|
|
1649
|
-
if (fabsf(startPos2.y - endPos2.y) > FLT_EPSILON && (yi < fminf(startPos2.y, endPos2.y) || yi > fmaxf(startPos2.y, endPos2.y))) return false;
|
|
1697
|
+
float xi = ((startPos2.x - endPos2.x)*(startPos1.x*endPos1.y - startPos1.y*endPos1.x) - (startPos1.x - endPos1.x)*(startPos2.x*endPos2.y - startPos2.y*endPos2.x))/div;
|
|
1698
|
+
float yi = ((startPos2.y - endPos2.y)*(startPos1.x*endPos1.y - startPos1.y*endPos1.x) - (startPos1.y - endPos1.y)*(startPos2.x*endPos2.y - startPos2.y*endPos2.x))/div;
|
|
1650
1699
|
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1700
|
+
if (((fabsf(startPos1.x - endPos1.x) > FLT_EPSILON) && (xi < fminf(startPos1.x, endPos1.x) || (xi > fmaxf(startPos1.x, endPos1.x)))) ||
|
|
1701
|
+
((fabsf(startPos2.x - endPos2.x) > FLT_EPSILON) && (xi < fminf(startPos2.x, endPos2.x) || (xi > fmaxf(startPos2.x, endPos2.x)))) ||
|
|
1702
|
+
((fabsf(startPos1.y - endPos1.y) > FLT_EPSILON) && (yi < fminf(startPos1.y, endPos1.y) || (yi > fmaxf(startPos1.y, endPos1.y)))) ||
|
|
1703
|
+
((fabsf(startPos2.y - endPos2.y) > FLT_EPSILON) && (yi < fminf(startPos2.y, endPos2.y) || (yi > fmaxf(startPos2.y, endPos2.y))))) collision = false;
|
|
1704
|
+
|
|
1705
|
+
if (collision && (collisionPoint != 0))
|
|
1706
|
+
{
|
|
1707
|
+
collisionPoint->x = xi;
|
|
1708
|
+
collisionPoint->y = yi;
|
|
1709
|
+
}
|
|
1655
1710
|
}
|
|
1656
1711
|
|
|
1657
|
-
return
|
|
1712
|
+
return collision;
|
|
1658
1713
|
}
|
|
1659
1714
|
|
|
1660
1715
|
// Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
|
|
1661
1716
|
bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold)
|
|
1662
1717
|
{
|
|
1663
1718
|
bool collision = false;
|
|
1719
|
+
|
|
1664
1720
|
float dxc = point.x - p1.x;
|
|
1665
1721
|
float dyc = point.y - p1.y;
|
|
1666
1722
|
float dxl = p2.x - p1.x;
|
|
@@ -1757,3 +1813,5 @@ static float EaseCubicInOut(float t, float b, float c, float d)
|
|
|
1757
1813
|
|
|
1758
1814
|
return 0.5f*c*(t*t*t + 2.0f) + b;
|
|
1759
1815
|
}
|
|
1816
|
+
|
|
1817
|
+
#endif // SUPPORT_MODULE_RSHAPES
|