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
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/*******************************************************************************************
|
|
2
|
-
*
|
|
3
|
-
* raylib [core] example - quat conversions
|
|
4
|
-
*
|
|
5
|
-
* Generally you should really stick to eulers OR quats...
|
|
6
|
-
* This tests that various conversions are equivalent.
|
|
7
|
-
*
|
|
8
|
-
* This example has been created using raylib 3.5 (www.raylib.com)
|
|
9
|
-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
|
10
|
-
*
|
|
11
|
-
* Example contributed by Chris Camacho (@chriscamacho) and reviewed by Ramon Santamaria (@raysan5)
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) 2020-2021 Chris Camacho (@chriscamacho) and Ramon Santamaria (@raysan5)
|
|
14
|
-
*
|
|
15
|
-
********************************************************************************************/
|
|
16
|
-
|
|
17
|
-
#include "raylib.h"
|
|
18
|
-
|
|
19
|
-
#include "raymath.h"
|
|
20
|
-
|
|
21
|
-
int main(void)
|
|
22
|
-
{
|
|
23
|
-
// Initialization
|
|
24
|
-
//--------------------------------------------------------------------------------------
|
|
25
|
-
const int screenWidth = 800;
|
|
26
|
-
const int screenHeight = 450;
|
|
27
|
-
|
|
28
|
-
InitWindow(screenWidth, screenHeight, "raylib [core] example - quat conversions");
|
|
29
|
-
|
|
30
|
-
Camera3D camera = { 0 };
|
|
31
|
-
camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
|
|
32
|
-
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
|
33
|
-
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
|
34
|
-
camera.fovy = 45.0f; // Camera field-of-view Y
|
|
35
|
-
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
|
36
|
-
|
|
37
|
-
// Load a cylinder model for testing
|
|
38
|
-
Model model = LoadModelFromMesh(GenMeshCylinder(0.2f, 1.0f, 32));
|
|
39
|
-
|
|
40
|
-
// Generic quaternion for operations
|
|
41
|
-
Quaternion q1 = { 0 };
|
|
42
|
-
|
|
43
|
-
// Transform matrices required to draw 4 cylinders
|
|
44
|
-
Matrix m1 = { 0 };
|
|
45
|
-
Matrix m2 = { 0 };
|
|
46
|
-
Matrix m3 = { 0 };
|
|
47
|
-
Matrix m4 = { 0 };
|
|
48
|
-
|
|
49
|
-
// Generic vectors for rotations
|
|
50
|
-
Vector3 v1 = { 0 };
|
|
51
|
-
Vector3 v2 = { 0 };
|
|
52
|
-
|
|
53
|
-
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
|
54
|
-
//--------------------------------------------------------------------------------------
|
|
55
|
-
|
|
56
|
-
// Main game loop
|
|
57
|
-
while (!WindowShouldClose()) // Detect window close button or ESC key
|
|
58
|
-
{
|
|
59
|
-
// Update
|
|
60
|
-
//--------------------------------------------------------------------------------------
|
|
61
|
-
if (v2.x < 0) v2.x += PI*2;
|
|
62
|
-
if (v2.y < 0) v2.y += PI*2;
|
|
63
|
-
if (v2.z < 0) v2.z += PI*2;
|
|
64
|
-
|
|
65
|
-
if (!IsKeyDown(KEY_SPACE))
|
|
66
|
-
{
|
|
67
|
-
v1.x += 0.01f;
|
|
68
|
-
v1.y += 0.03f;
|
|
69
|
-
v1.z += 0.05f;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (v1.x > PI*2) v1.x -= PI*2;
|
|
73
|
-
if (v1.y > PI*2) v1.y -= PI*2;
|
|
74
|
-
if (v1.z > PI*2) v1.z -= PI*2;
|
|
75
|
-
|
|
76
|
-
q1 = QuaternionFromEuler(v1.x, v1.y, v1.z);
|
|
77
|
-
m1 = MatrixRotateZYX(v1);
|
|
78
|
-
m2 = QuaternionToMatrix(q1);
|
|
79
|
-
|
|
80
|
-
q1 = QuaternionFromMatrix(m1);
|
|
81
|
-
m3 = QuaternionToMatrix(q1);
|
|
82
|
-
|
|
83
|
-
v2 = QuaternionToEuler(q1); // Angles returned in radians
|
|
84
|
-
|
|
85
|
-
m4 = MatrixRotateZYX(v2);
|
|
86
|
-
//--------------------------------------------------------------------------------------
|
|
87
|
-
|
|
88
|
-
// Draw
|
|
89
|
-
//----------------------------------------------------------------------------------
|
|
90
|
-
BeginDrawing();
|
|
91
|
-
|
|
92
|
-
ClearBackground(RAYWHITE);
|
|
93
|
-
|
|
94
|
-
BeginMode3D(camera);
|
|
95
|
-
|
|
96
|
-
model.transform = m1;
|
|
97
|
-
DrawModel(model, (Vector3){ -1, 0, 0 }, 1.0f, RED);
|
|
98
|
-
|
|
99
|
-
model.transform = m2;
|
|
100
|
-
DrawModel(model, (Vector3){ 1, 0, 0 }, 1.0f, RED);
|
|
101
|
-
|
|
102
|
-
model.transform = m3;
|
|
103
|
-
DrawModel(model, (Vector3){ 0, 0, 0 }, 1.0f, RED);
|
|
104
|
-
|
|
105
|
-
model.transform = m4;
|
|
106
|
-
DrawModel(model, (Vector3){ 0, 0, -1 }, 1.0f, RED);
|
|
107
|
-
|
|
108
|
-
DrawGrid(10, 1.0f);
|
|
109
|
-
|
|
110
|
-
EndMode3D();
|
|
111
|
-
|
|
112
|
-
DrawText(TextFormat("%2.3f", v1.x), 20, 20, 20, (v1.x == v2.x)? GREEN: BLACK);
|
|
113
|
-
DrawText(TextFormat("%2.3f", v1.y), 20, 40, 20, (v1.y == v2.y)? GREEN: BLACK);
|
|
114
|
-
DrawText(TextFormat("%2.3f", v1.z), 20, 60, 20, (v1.z == v2.z)? GREEN: BLACK);
|
|
115
|
-
|
|
116
|
-
DrawText(TextFormat("%2.3f", v2.x), 200, 20, 20, (v1.x == v2.x)? GREEN: BLACK);
|
|
117
|
-
DrawText(TextFormat("%2.3f", v2.y), 200, 40, 20, (v1.y == v2.y)? GREEN: BLACK);
|
|
118
|
-
DrawText(TextFormat("%2.3f", v2.z), 200, 60, 20, (v1.z == v2.z)? GREEN: BLACK);
|
|
119
|
-
|
|
120
|
-
EndDrawing();
|
|
121
|
-
//----------------------------------------------------------------------------------
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// De-Initialization
|
|
125
|
-
//--------------------------------------------------------------------------------------
|
|
126
|
-
UnloadModel(model); // Unload model data (mesh and materials)
|
|
127
|
-
|
|
128
|
-
CloseWindow(); // Close window and OpenGL context
|
|
129
|
-
//--------------------------------------------------------------------------------------
|
|
130
|
-
|
|
131
|
-
return 0;
|
|
132
|
-
}
|
|
Binary file
|
|
Binary file
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"scene" : 0,
|
|
3
|
-
"scenes" : [
|
|
4
|
-
{
|
|
5
|
-
"nodes" : [ 0 ]
|
|
6
|
-
}
|
|
7
|
-
],
|
|
8
|
-
|
|
9
|
-
"nodes" : [
|
|
10
|
-
{
|
|
11
|
-
"mesh" : 0,
|
|
12
|
-
"rotation" : [ 0.0, 0.0, 0.0, 1.0 ]
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
|
|
16
|
-
"meshes" : [
|
|
17
|
-
{
|
|
18
|
-
"primitives" : [ {
|
|
19
|
-
"attributes" : {
|
|
20
|
-
"POSITION" : 1
|
|
21
|
-
},
|
|
22
|
-
"indices" : 0
|
|
23
|
-
} ]
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
|
|
27
|
-
"animations": [
|
|
28
|
-
{
|
|
29
|
-
"samplers" : [
|
|
30
|
-
{
|
|
31
|
-
"input" : 2,
|
|
32
|
-
"interpolation" : "LINEAR",
|
|
33
|
-
"output" : 3
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
"channels" : [ {
|
|
37
|
-
"sampler" : 0,
|
|
38
|
-
"target" : {
|
|
39
|
-
"node" : 0,
|
|
40
|
-
"path" : "rotation"
|
|
41
|
-
}
|
|
42
|
-
} ]
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
|
|
46
|
-
"buffers" : [
|
|
47
|
-
{
|
|
48
|
-
"uri" : "data:application/octet-stream;base64,AAABAAIAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAA=",
|
|
49
|
-
"byteLength" : 44
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"uri" : "data:application/octet-stream;base64,AAAAAAAAgD4AAAA/AABAPwAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAD0/TQ/9P00PwAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAPT9ND/0/TS/AAAAAAAAAAAAAAAAAACAPw==",
|
|
53
|
-
"byteLength" : 100
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
"bufferViews" : [
|
|
57
|
-
{
|
|
58
|
-
"buffer" : 0,
|
|
59
|
-
"byteOffset" : 0,
|
|
60
|
-
"byteLength" : 6,
|
|
61
|
-
"target" : 34963
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"buffer" : 0,
|
|
65
|
-
"byteOffset" : 8,
|
|
66
|
-
"byteLength" : 36,
|
|
67
|
-
"target" : 34962
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"buffer" : 1,
|
|
71
|
-
"byteOffset" : 0,
|
|
72
|
-
"byteLength" : 100
|
|
73
|
-
}
|
|
74
|
-
],
|
|
75
|
-
"accessors" : [
|
|
76
|
-
{
|
|
77
|
-
"bufferView" : 0,
|
|
78
|
-
"byteOffset" : 0,
|
|
79
|
-
"componentType" : 5123,
|
|
80
|
-
"count" : 3,
|
|
81
|
-
"type" : "SCALAR",
|
|
82
|
-
"max" : [ 2 ],
|
|
83
|
-
"min" : [ 0 ]
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"bufferView" : 1,
|
|
87
|
-
"byteOffset" : 0,
|
|
88
|
-
"componentType" : 5126,
|
|
89
|
-
"count" : 3,
|
|
90
|
-
"type" : "VEC3",
|
|
91
|
-
"max" : [ 1.0, 1.0, 0.0 ],
|
|
92
|
-
"min" : [ 0.0, 0.0, 0.0 ]
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"bufferView" : 2,
|
|
96
|
-
"byteOffset" : 0,
|
|
97
|
-
"componentType" : 5126,
|
|
98
|
-
"count" : 5,
|
|
99
|
-
"type" : "SCALAR",
|
|
100
|
-
"max" : [ 1.0 ],
|
|
101
|
-
"min" : [ 0.0 ]
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"bufferView" : 2,
|
|
105
|
-
"byteOffset" : 20,
|
|
106
|
-
"componentType" : 5126,
|
|
107
|
-
"count" : 5,
|
|
108
|
-
"type" : "VEC4",
|
|
109
|
-
"max" : [ 0.0, 0.0, 1.0, 1.0 ],
|
|
110
|
-
"min" : [ 0.0, 0.0, 0.0, -0.707 ]
|
|
111
|
-
}
|
|
112
|
-
],
|
|
113
|
-
|
|
114
|
-
"asset" : {
|
|
115
|
-
"version" : "2.0"
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/**********************************************************************************************
|
|
2
|
-
*
|
|
3
|
-
* raylib.lights - Some useful functions to deal with lights data
|
|
4
|
-
*
|
|
5
|
-
* CONFIGURATION:
|
|
6
|
-
*
|
|
7
|
-
* #define RLIGHTS_IMPLEMENTATION
|
|
8
|
-
* Generates the implementation of the library into the included file.
|
|
9
|
-
* If not defined, the library is in header only mode and can be included in other headers
|
|
10
|
-
* or source files without problems. But only ONE file should hold the implementation.
|
|
11
|
-
*
|
|
12
|
-
* LICENSE: zlib/libpng
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) 2017-2020 Victor Fisac (@victorfisac) and Ramon Santamaria (@raysan5)
|
|
15
|
-
*
|
|
16
|
-
* This software is provided "as-is", without any express or implied warranty. In no event
|
|
17
|
-
* will the authors be held liable for any damages arising from the use of this software.
|
|
18
|
-
*
|
|
19
|
-
* Permission is granted to anyone to use this software for any purpose, including commercial
|
|
20
|
-
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
|
21
|
-
*
|
|
22
|
-
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
|
23
|
-
* wrote the original software. If you use this software in a product, an acknowledgment
|
|
24
|
-
* in the product documentation would be appreciated but is not required.
|
|
25
|
-
*
|
|
26
|
-
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
|
27
|
-
* as being the original software.
|
|
28
|
-
*
|
|
29
|
-
* 3. This notice may not be removed or altered from any source distribution.
|
|
30
|
-
*
|
|
31
|
-
**********************************************************************************************/
|
|
32
|
-
|
|
33
|
-
#ifndef RLIGHTS_H
|
|
34
|
-
#define RLIGHTS_H
|
|
35
|
-
|
|
36
|
-
//----------------------------------------------------------------------------------
|
|
37
|
-
// Defines and Macros
|
|
38
|
-
//----------------------------------------------------------------------------------
|
|
39
|
-
#define MAX_LIGHTS 4 // Max dynamic lights supported by shader
|
|
40
|
-
|
|
41
|
-
//----------------------------------------------------------------------------------
|
|
42
|
-
// Types and Structures Definition
|
|
43
|
-
//----------------------------------------------------------------------------------
|
|
44
|
-
|
|
45
|
-
// Light data
|
|
46
|
-
typedef struct {
|
|
47
|
-
int type;
|
|
48
|
-
Vector3 position;
|
|
49
|
-
Vector3 target;
|
|
50
|
-
Color color;
|
|
51
|
-
bool enabled;
|
|
52
|
-
|
|
53
|
-
// Shader locations
|
|
54
|
-
int enabledLoc;
|
|
55
|
-
int typeLoc;
|
|
56
|
-
int posLoc;
|
|
57
|
-
int targetLoc;
|
|
58
|
-
int colorLoc;
|
|
59
|
-
} Light;
|
|
60
|
-
|
|
61
|
-
// Light type
|
|
62
|
-
typedef enum {
|
|
63
|
-
LIGHT_DIRECTIONAL,
|
|
64
|
-
LIGHT_POINT
|
|
65
|
-
} LightType;
|
|
66
|
-
|
|
67
|
-
#ifdef __cplusplus
|
|
68
|
-
extern "C" { // Prevents name mangling of functions
|
|
69
|
-
#endif
|
|
70
|
-
|
|
71
|
-
//----------------------------------------------------------------------------------
|
|
72
|
-
// Module Functions Declaration
|
|
73
|
-
//----------------------------------------------------------------------------------
|
|
74
|
-
Light CreateLight(int type, Vector3 position, Vector3 target, Color color, Shader shader); // Create a light and get shader locations
|
|
75
|
-
void UpdateLightValues(Shader shader, Light light); // Send light properties to shader
|
|
76
|
-
|
|
77
|
-
#ifdef __cplusplus
|
|
78
|
-
}
|
|
79
|
-
#endif
|
|
80
|
-
|
|
81
|
-
#endif // RLIGHTS_H
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
/***********************************************************************************
|
|
85
|
-
*
|
|
86
|
-
* RLIGHTS IMPLEMENTATION
|
|
87
|
-
*
|
|
88
|
-
************************************************************************************/
|
|
89
|
-
|
|
90
|
-
#if defined(RLIGHTS_IMPLEMENTATION)
|
|
91
|
-
|
|
92
|
-
#include "raylib.h"
|
|
93
|
-
|
|
94
|
-
//----------------------------------------------------------------------------------
|
|
95
|
-
// Defines and Macros
|
|
96
|
-
//----------------------------------------------------------------------------------
|
|
97
|
-
// ...
|
|
98
|
-
|
|
99
|
-
//----------------------------------------------------------------------------------
|
|
100
|
-
// Types and Structures Definition
|
|
101
|
-
//----------------------------------------------------------------------------------
|
|
102
|
-
// ...
|
|
103
|
-
|
|
104
|
-
//----------------------------------------------------------------------------------
|
|
105
|
-
// Global Variables Definition
|
|
106
|
-
//----------------------------------------------------------------------------------
|
|
107
|
-
static int lightsCount = 0; // Current amount of created lights
|
|
108
|
-
|
|
109
|
-
//----------------------------------------------------------------------------------
|
|
110
|
-
// Module specific Functions Declaration
|
|
111
|
-
//----------------------------------------------------------------------------------
|
|
112
|
-
// ...
|
|
113
|
-
|
|
114
|
-
//----------------------------------------------------------------------------------
|
|
115
|
-
// Module Functions Definition
|
|
116
|
-
//----------------------------------------------------------------------------------
|
|
117
|
-
|
|
118
|
-
// Create a light and get shader locations
|
|
119
|
-
Light CreateLight(int type, Vector3 position, Vector3 target, Color color, Shader shader)
|
|
120
|
-
{
|
|
121
|
-
Light light = { 0 };
|
|
122
|
-
|
|
123
|
-
if (lightsCount < MAX_LIGHTS)
|
|
124
|
-
{
|
|
125
|
-
light.enabled = true;
|
|
126
|
-
light.type = type;
|
|
127
|
-
light.position = position;
|
|
128
|
-
light.target = target;
|
|
129
|
-
light.color = color;
|
|
130
|
-
|
|
131
|
-
// TODO: Below code doesn't look good to me,
|
|
132
|
-
// it assumes a specific shader naming and structure
|
|
133
|
-
// Probably this implementation could be improved
|
|
134
|
-
char enabledName[32] = "lights[x].enabled\0";
|
|
135
|
-
char typeName[32] = "lights[x].type\0";
|
|
136
|
-
char posName[32] = "lights[x].position\0";
|
|
137
|
-
char targetName[32] = "lights[x].target\0";
|
|
138
|
-
char colorName[32] = "lights[x].color\0";
|
|
139
|
-
|
|
140
|
-
// Set location name [x] depending on lights count
|
|
141
|
-
enabledName[7] = '0' + lightsCount;
|
|
142
|
-
typeName[7] = '0' + lightsCount;
|
|
143
|
-
posName[7] = '0' + lightsCount;
|
|
144
|
-
targetName[7] = '0' + lightsCount;
|
|
145
|
-
colorName[7] = '0' + lightsCount;
|
|
146
|
-
|
|
147
|
-
light.enabledLoc = GetShaderLocation(shader, enabledName);
|
|
148
|
-
light.typeLoc = GetShaderLocation(shader, typeName);
|
|
149
|
-
light.posLoc = GetShaderLocation(shader, posName);
|
|
150
|
-
light.targetLoc = GetShaderLocation(shader, targetName);
|
|
151
|
-
light.colorLoc = GetShaderLocation(shader, colorName);
|
|
152
|
-
|
|
153
|
-
UpdateLightValues(shader, light);
|
|
154
|
-
|
|
155
|
-
lightsCount++;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return light;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// Send light properties to shader
|
|
162
|
-
// NOTE: Light shader locations should be available
|
|
163
|
-
void UpdateLightValues(Shader shader, Light light)
|
|
164
|
-
{
|
|
165
|
-
// Send to shader light enabled state and type
|
|
166
|
-
SetShaderValue(shader, light.enabledLoc, &light.enabled, SHADER_UNIFORM_INT);
|
|
167
|
-
SetShaderValue(shader, light.typeLoc, &light.type, SHADER_UNIFORM_INT);
|
|
168
|
-
|
|
169
|
-
// Send to shader light position values
|
|
170
|
-
float position[3] = { light.position.x, light.position.y, light.position.z };
|
|
171
|
-
SetShaderValue(shader, light.posLoc, position, SHADER_UNIFORM_VEC3);
|
|
172
|
-
|
|
173
|
-
// Send to shader light target position values
|
|
174
|
-
float target[3] = { light.target.x, light.target.y, light.target.z };
|
|
175
|
-
SetShaderValue(shader, light.targetLoc, target, SHADER_UNIFORM_VEC3);
|
|
176
|
-
|
|
177
|
-
// Send to shader light color values
|
|
178
|
-
float color[4] = { (float)light.color.r/(float)255, (float)light.color.g/(float)255,
|
|
179
|
-
(float)light.color.b/(float)255, (float)light.color.a/(float)255 };
|
|
180
|
-
SetShaderValue(shader, light.colorLoc, color, SHADER_UNIFORM_VEC4);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
#endif // RLIGHTS_IMPLEMENTATION
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/*******************************************************************************************
|
|
2
|
-
*
|
|
3
|
-
* raylib [audio] example - Using raudio module as standalone module
|
|
4
|
-
*
|
|
5
|
-
* NOTE: This example does not require any graphic device, it can run directly on console.
|
|
6
|
-
*
|
|
7
|
-
* DEPENDENCIES:
|
|
8
|
-
* miniaudio.h - Audio device management lib (https://github.com/dr-soft/miniaudio)
|
|
9
|
-
* stb_vorbis.h - Ogg audio files loading (http://www.nothings.org/stb_vorbis/)
|
|
10
|
-
* dr_wav.h - WAV audio file loading (https://github.com/mackron/dr_libs)
|
|
11
|
-
* dr_mp3.h - MP3 audio file loading (https://github.com/mackron/dr_libs)
|
|
12
|
-
* dr_flac.h - FLAC audio file loading (https://github.com/mackron/dr_libs)
|
|
13
|
-
* jar_xm.h - XM module file loading
|
|
14
|
-
* jar_mod.h - MOD audio file loading
|
|
15
|
-
*
|
|
16
|
-
* COMPILATION:
|
|
17
|
-
* gcc -o raudio_standalone.exe raudio_standalone.c ..\..\src\raudio.c /
|
|
18
|
-
* -I..\..\src -I..\..\src\external -L. -Wall -std=c99 -DRAUDIO_STANDALONE /
|
|
19
|
-
* -DSUPPORT_FILEFORMAT_WAV -DSUPPORT_FILEFORMAT_OGG -DSUPPORT_FILEFORMAT_MP3
|
|
20
|
-
*
|
|
21
|
-
* LICENSE: zlib/libpng
|
|
22
|
-
*
|
|
23
|
-
* This example is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
24
|
-
* BSD-like license that allows static linking with closed source software:
|
|
25
|
-
*
|
|
26
|
-
* Copyright (c) 2014-2020 Ramon Santamaria (@raysan5)
|
|
27
|
-
*
|
|
28
|
-
* This software is provided "as-is", without any express or implied warranty. In no event
|
|
29
|
-
* will the authors be held liable for any damages arising from the use of this software.
|
|
30
|
-
*
|
|
31
|
-
* Permission is granted to anyone to use this software for any purpose, including commercial
|
|
32
|
-
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
|
33
|
-
*
|
|
34
|
-
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
|
35
|
-
* wrote the original software. If you use this software in a product, an acknowledgment
|
|
36
|
-
* in the product documentation would be appreciated but is not required.
|
|
37
|
-
*
|
|
38
|
-
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
|
39
|
-
* as being the original software.
|
|
40
|
-
*
|
|
41
|
-
* 3. This notice may not be removed or altered from any source distribution.
|
|
42
|
-
*
|
|
43
|
-
********************************************************************************************/
|
|
44
|
-
|
|
45
|
-
#include "raudio.h" // raylib audio library
|
|
46
|
-
|
|
47
|
-
#include <stdio.h> // Required for: printf()
|
|
48
|
-
|
|
49
|
-
#if defined(_WIN32)
|
|
50
|
-
#include <conio.h> // Windows only, no stardard library
|
|
51
|
-
#else
|
|
52
|
-
// Required for kbhit() function in non-Windows platforms
|
|
53
|
-
#include <stdio.h>
|
|
54
|
-
#include <termios.h>
|
|
55
|
-
#include <unistd.h>
|
|
56
|
-
#include <fcntl.h>
|
|
57
|
-
#endif
|
|
58
|
-
|
|
59
|
-
#define KEY_ESCAPE 27
|
|
60
|
-
|
|
61
|
-
//----------------------------------------------------------------------------------
|
|
62
|
-
// Module Functions Declaration
|
|
63
|
-
//----------------------------------------------------------------------------------
|
|
64
|
-
#if !defined(_WIN32)
|
|
65
|
-
static int kbhit(void); // Check if a key has been pressed
|
|
66
|
-
static char getch(); // Get pressed character
|
|
67
|
-
#else
|
|
68
|
-
#define kbhit _kbhit
|
|
69
|
-
#define getch _getch
|
|
70
|
-
#endif
|
|
71
|
-
|
|
72
|
-
//------------------------------------------------------------------------------------
|
|
73
|
-
// Program main entry point
|
|
74
|
-
//------------------------------------------------------------------------------------
|
|
75
|
-
int main(int argc, char *argv[])
|
|
76
|
-
{
|
|
77
|
-
// Initialization
|
|
78
|
-
//--------------------------------------------------------------------------------------
|
|
79
|
-
static unsigned char key = 0;
|
|
80
|
-
|
|
81
|
-
InitAudioDevice();
|
|
82
|
-
|
|
83
|
-
Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
|
|
84
|
-
Sound fxOgg = LoadSound("resources/audio/target.ogg"); // Load OGG audio file
|
|
85
|
-
|
|
86
|
-
Music music = LoadMusicStream("resources/audio/country.mp3");
|
|
87
|
-
PlayMusicStream(music);
|
|
88
|
-
|
|
89
|
-
printf("\nPress s or d to play sounds, ESC to stop...\n");
|
|
90
|
-
//--------------------------------------------------------------------------------------
|
|
91
|
-
|
|
92
|
-
// Main loop
|
|
93
|
-
while (key != KEY_ESCAPE)
|
|
94
|
-
{
|
|
95
|
-
if (kbhit()) key = getch();
|
|
96
|
-
|
|
97
|
-
if ((key == 's') || (key == 'S')) PlaySound(fxWav);
|
|
98
|
-
if ((key == 'd') || (key == 'D')) PlaySound(fxOgg);
|
|
99
|
-
|
|
100
|
-
key = 0;
|
|
101
|
-
|
|
102
|
-
UpdateMusicStream(music);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// De-Initialization
|
|
106
|
-
//--------------------------------------------------------------------------------------
|
|
107
|
-
UnloadSound(fxWav); // Unload sound data
|
|
108
|
-
UnloadSound(fxOgg); // Unload sound data
|
|
109
|
-
|
|
110
|
-
UnloadMusicStream(music); // Unload music stream data
|
|
111
|
-
|
|
112
|
-
CloseAudioDevice();
|
|
113
|
-
//--------------------------------------------------------------------------------------
|
|
114
|
-
|
|
115
|
-
return 0;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
//----------------------------------------------------------------------------------
|
|
119
|
-
// Module Functions Definition
|
|
120
|
-
//----------------------------------------------------------------------------------
|
|
121
|
-
#if !defined(_WIN32)
|
|
122
|
-
// Check if a key has been pressed
|
|
123
|
-
static int kbhit(void)
|
|
124
|
-
{
|
|
125
|
-
struct termios oldt, newt;
|
|
126
|
-
int ch;
|
|
127
|
-
int oldf;
|
|
128
|
-
|
|
129
|
-
tcgetattr(STDIN_FILENO, &oldt);
|
|
130
|
-
newt = oldt;
|
|
131
|
-
newt.c_lflag &= ~(ICANON | ECHO);
|
|
132
|
-
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
|
|
133
|
-
oldf = fcntl(STDIN_FILENO, F_GETFL, 0);
|
|
134
|
-
fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK);
|
|
135
|
-
|
|
136
|
-
ch = getchar();
|
|
137
|
-
|
|
138
|
-
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
|
|
139
|
-
fcntl(STDIN_FILENO, F_SETFL, oldf);
|
|
140
|
-
|
|
141
|
-
if (ch != EOF)
|
|
142
|
-
{
|
|
143
|
-
ungetc(ch, stdin);
|
|
144
|
-
return 1;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return 0;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Get pressed character
|
|
151
|
-
static char getch() { return getchar(); }
|
|
152
|
-
#endif
|
|
Binary file
|
|
Binary file
|
|
Binary file
|