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.
Files changed (311) hide show
  1. package/ChangeLog.md +6 -0
  2. package/build/qemu/2.1.2/koffi_darwin_arm64.tar.gz +0 -0
  3. package/build/qemu/2.1.2/koffi_darwin_x64.tar.gz +0 -0
  4. package/build/qemu/2.1.2/koffi_freebsd_arm64.tar.gz +0 -0
  5. package/build/qemu/2.1.2/koffi_freebsd_ia32.tar.gz +0 -0
  6. package/build/qemu/2.1.2/koffi_freebsd_x64.tar.gz +0 -0
  7. package/build/qemu/2.1.2/koffi_linux_arm32hf.tar.gz +0 -0
  8. package/build/qemu/2.1.2/koffi_linux_arm64.tar.gz +0 -0
  9. package/build/qemu/2.1.2/koffi_linux_ia32.tar.gz +0 -0
  10. package/build/qemu/2.1.2/koffi_linux_riscv64hf64.tar.gz +0 -0
  11. package/build/qemu/2.1.2/koffi_linux_x64.tar.gz +0 -0
  12. package/build/qemu/2.1.2/koffi_openbsd_ia32.tar.gz +0 -0
  13. package/build/qemu/2.1.2/koffi_openbsd_x64.tar.gz +0 -0
  14. package/build/qemu/2.1.2/koffi_win32_arm64.tar.gz +0 -0
  15. package/build/qemu/2.1.2/koffi_win32_ia32.tar.gz +0 -0
  16. package/build/qemu/2.1.2/koffi_win32_x64.tar.gz +0 -0
  17. package/doc/templates/badges.html +3 -0
  18. package/package.json +2 -2
  19. package/src/abi_arm64.cc +35 -1
  20. package/src/abi_x64_win.cc +2 -8
  21. package/src/abi_x86.cc +1 -7
  22. package/src/ffi.hh +1 -1
  23. package/src/util.hh +6 -0
  24. package/test/raylib.js +37 -5
  25. package/vendor/libcc/libcc.cc +430 -196
  26. package/vendor/libcc/libcc.hh +1417 -1283
  27. package/vendor/raylib/BINDINGS.md +87 -70
  28. package/vendor/raylib/CHANGELOG +263 -50
  29. package/vendor/raylib/CMakeLists.txt +12 -0
  30. package/vendor/raylib/CMakeOptions.txt +8 -1
  31. package/vendor/raylib/CONVENTIONS.md +2 -3
  32. package/vendor/raylib/FAQ.md +137 -0
  33. package/vendor/raylib/HISTORY.md +62 -29
  34. package/vendor/raylib/LICENSE +1 -1
  35. package/vendor/raylib/README.md +22 -17
  36. package/vendor/raylib/ROADMAP.md +8 -7
  37. package/vendor/raylib/cmake/CompileDefinitions.cmake +19 -15
  38. package/vendor/raylib/cmake/GlfwImport.cmake +2 -0
  39. package/vendor/raylib/cmake/LibraryConfigurations.cmake +22 -16
  40. package/vendor/raylib/cmake/raylib-config.cmake +52 -49
  41. package/vendor/raylib/examples/CMakeLists.txt +14 -9
  42. package/vendor/raylib/examples/Makefile +112 -125
  43. package/vendor/raylib/examples/Makefile.Android +1 -1
  44. package/vendor/raylib/examples/Makefile.Web +145 -158
  45. package/vendor/raylib/examples/README.md +141 -141
  46. package/vendor/raylib/examples/audio/audio_module_playing.c +9 -4
  47. package/vendor/raylib/examples/audio/audio_multichannel_sound.c +8 -3
  48. package/vendor/raylib/examples/audio/audio_music_stream.c +16 -11
  49. package/vendor/raylib/examples/audio/audio_raw_stream.c +57 -9
  50. package/vendor/raylib/examples/audio/audio_sound_loading.c +8 -3
  51. package/vendor/raylib/examples/audio/audio_stream_effects.c +179 -0
  52. package/vendor/raylib/examples/audio/audio_stream_effects.png +0 -0
  53. package/vendor/raylib/examples/build.zig +17 -6
  54. package/vendor/raylib/examples/core/core_2d_camera.c +8 -4
  55. package/vendor/raylib/examples/core/core_2d_camera_mouse_zoom.c +105 -0
  56. package/vendor/raylib/examples/core/core_2d_camera_mouse_zoom.png +0 -0
  57. package/vendor/raylib/examples/core/core_2d_camera_platformer.c +11 -6
  58. package/vendor/raylib/examples/core/core_3d_camera_first_person.c +9 -4
  59. package/vendor/raylib/examples/core/core_3d_camera_free.c +9 -4
  60. package/vendor/raylib/examples/core/core_3d_camera_mode.c +8 -3
  61. package/vendor/raylib/examples/core/core_3d_picking.c +9 -4
  62. package/vendor/raylib/examples/core/core_basic_screen_manager.c +9 -7
  63. package/vendor/raylib/examples/core/core_basic_window.c +8 -3
  64. package/vendor/raylib/examples/core/core_basic_window_web.c +13 -11
  65. package/vendor/raylib/examples/core/core_custom_frame_control.c +9 -4
  66. package/vendor/raylib/examples/core/core_custom_logging.c +12 -8
  67. package/vendor/raylib/examples/core/core_drop_files.c +20 -12
  68. package/vendor/raylib/examples/core/core_input_gamepad.c +20 -15
  69. package/vendor/raylib/examples/core/core_input_gestures.c +19 -15
  70. package/vendor/raylib/examples/core/core_input_keys.c +8 -3
  71. package/vendor/raylib/examples/core/core_input_mouse.c +8 -3
  72. package/vendor/raylib/examples/core/core_input_mouse_wheel.c +8 -3
  73. package/vendor/raylib/examples/core/core_input_multitouch.c +8 -3
  74. package/vendor/raylib/examples/core/core_loading_thread.c +10 -6
  75. package/vendor/raylib/examples/core/core_random_values.c +8 -3
  76. package/vendor/raylib/examples/core/core_scissor_test.c +8 -3
  77. package/vendor/raylib/examples/core/core_smooth_pixelperfect.c +9 -4
  78. package/vendor/raylib/examples/core/core_split_screen.c +8 -3
  79. package/vendor/raylib/examples/core/core_storage_values.c +109 -3
  80. package/vendor/raylib/examples/core/core_vr_simulator.c +15 -7
  81. package/vendor/raylib/examples/core/core_window_flags.c +8 -3
  82. package/vendor/raylib/examples/core/core_window_letterbox.c +13 -18
  83. package/vendor/raylib/examples/core/core_window_should_close.c +77 -0
  84. package/vendor/raylib/examples/core/core_window_should_close.png +0 -0
  85. package/vendor/raylib/examples/core/core_world_screen.c +9 -4
  86. package/vendor/raylib/examples/examples_template.c +8 -3
  87. package/vendor/raylib/examples/models/models_animation.c +11 -7
  88. package/vendor/raylib/examples/models/models_billboard.c +9 -4
  89. package/vendor/raylib/examples/models/models_box_collisions.c +8 -3
  90. package/vendor/raylib/examples/models/models_cubicmap.c +9 -4
  91. package/vendor/raylib/examples/models/models_first_person_maze.c +9 -4
  92. package/vendor/raylib/examples/models/models_geometric_shapes.c +8 -3
  93. package/vendor/raylib/examples/models/models_heightmap.c +9 -4
  94. package/vendor/raylib/examples/models/models_loading.c +21 -17
  95. package/vendor/raylib/examples/models/models_loading_gltf.c +15 -41
  96. package/vendor/raylib/examples/models/models_loading_vox.c +9 -4
  97. package/vendor/raylib/examples/models/models_mesh_generation.c +71 -58
  98. package/vendor/raylib/examples/models/models_mesh_picking.c +25 -7
  99. package/vendor/raylib/examples/models/models_orthographic_projection.c +8 -5
  100. package/vendor/raylib/examples/models/models_rlgl_solar_system.c +6 -4
  101. package/vendor/raylib/examples/models/models_skybox.c +16 -12
  102. package/vendor/raylib/examples/models/models_waving_cubes.c +9 -4
  103. package/vendor/raylib/examples/models/models_yaw_pitch_roll.c +12 -7
  104. package/vendor/raylib/examples/models/resources/LICENSE.md +9 -10
  105. package/vendor/raylib/examples/models/resources/models/gltf/LICENSE +2 -23
  106. package/vendor/raylib/examples/models/resources/models/gltf/{raylib_32x32.glb → raylib_logo_3d.glb} +0 -0
  107. package/vendor/raylib/examples/models/resources/models/gltf/robot.blend +0 -0
  108. package/vendor/raylib/examples/models/resources/models/gltf/robot.glb +0 -0
  109. package/vendor/raylib/examples/others/easings_testbed.c +10 -8
  110. package/vendor/raylib/examples/others/easings_testbed.png +0 -0
  111. package/vendor/raylib/examples/others/embedded_files_loading.c +10 -5
  112. package/vendor/raylib/examples/others/embedded_files_loading.png +0 -0
  113. package/vendor/raylib/examples/others/raylib_opengl_interop.c +10 -6
  114. package/vendor/raylib/{src/extras/easings.h → examples/others/reasings.h} +38 -38
  115. package/vendor/raylib/examples/others/rlgl_compute_shader.c +21 -20
  116. package/vendor/raylib/examples/others/rlgl_compute_shader.png +0 -0
  117. package/vendor/raylib/examples/others/rlgl_standalone.c +4 -4
  118. package/vendor/raylib/examples/others/rlgl_standalone.png +0 -0
  119. package/vendor/raylib/examples/raylib_compile_execute.bat +2 -2
  120. package/vendor/raylib/examples/shaders/resources/shaders/glsl330/lighting.fs +1 -1
  121. package/vendor/raylib/examples/shaders/resources/shaders/glsl330/{base_lighting_instanced.vs → lighting_instancing.vs} +2 -2
  122. package/vendor/raylib/examples/shaders/rlights.h +14 -27
  123. package/vendor/raylib/examples/shaders/shaders_basic_lighting.c +24 -26
  124. package/vendor/raylib/examples/shaders/shaders_custom_uniform.c +10 -5
  125. package/vendor/raylib/examples/shaders/shaders_eratosthenes.c +13 -8
  126. package/vendor/raylib/examples/shaders/shaders_fog.c +8 -12
  127. package/vendor/raylib/examples/shaders/shaders_hot_reloading.c +10 -5
  128. package/vendor/raylib/examples/shaders/shaders_julia_set.c +9 -4
  129. package/vendor/raylib/examples/shaders/shaders_mesh_instancing.c +45 -119
  130. package/vendor/raylib/examples/shaders/shaders_model_shader.c +10 -5
  131. package/vendor/raylib/examples/shaders/shaders_multi_sample2d.c +8 -3
  132. package/vendor/raylib/examples/shaders/shaders_palette_switch.c +8 -3
  133. package/vendor/raylib/examples/shaders/shaders_postprocessing.c +9 -4
  134. package/vendor/raylib/examples/shaders/shaders_raymarching.c +14 -11
  135. package/vendor/raylib/examples/shaders/shaders_shapes_textures.c +8 -3
  136. package/vendor/raylib/examples/shaders/shaders_simple_mask.c +10 -5
  137. package/vendor/raylib/examples/shaders/shaders_spotlight.c +10 -6
  138. package/vendor/raylib/examples/shaders/shaders_texture_drawing.c +9 -4
  139. package/vendor/raylib/examples/shaders/shaders_texture_outline.c +8 -3
  140. package/vendor/raylib/examples/shaders/shaders_texture_waves.c +8 -3
  141. package/vendor/raylib/{src/extras → examples/shapes}/raygui.h +1290 -1141
  142. package/vendor/raylib/examples/{others/easings.h → shapes/reasings.h} +40 -40
  143. package/vendor/raylib/examples/shapes/shapes_basic_shapes.c +8 -3
  144. package/vendor/raylib/examples/shapes/shapes_bouncing_ball.c +8 -3
  145. package/vendor/raylib/examples/shapes/shapes_collision_area.c +10 -4
  146. package/vendor/raylib/examples/shapes/shapes_colors_palette.c +8 -3
  147. package/vendor/raylib/examples/shapes/shapes_draw_circle_sector.c +9 -4
  148. package/vendor/raylib/examples/shapes/shapes_draw_rectangle_rounded.c +9 -4
  149. package/vendor/raylib/examples/shapes/shapes_draw_ring.c +10 -6
  150. package/vendor/raylib/examples/shapes/shapes_easings_ball_anim.c +9 -4
  151. package/vendor/raylib/examples/shapes/shapes_easings_box_anim.c +9 -4
  152. package/vendor/raylib/examples/shapes/shapes_easings_rectangle_array.c +9 -4
  153. package/vendor/raylib/examples/shapes/shapes_following_eyes.c +8 -3
  154. package/vendor/raylib/examples/shapes/shapes_lines_bezier.c +8 -3
  155. package/vendor/raylib/examples/shapes/shapes_logo_raylib.c +8 -3
  156. package/vendor/raylib/examples/shapes/shapes_logo_raylib_anim.c +8 -3
  157. package/vendor/raylib/examples/shapes/shapes_rectangle_scaling.c +14 -5
  158. package/vendor/raylib/examples/shapes/shapes_top_down_lights.c +355 -0
  159. package/vendor/raylib/examples/shapes/shapes_top_down_lights.png +0 -0
  160. package/vendor/raylib/examples/text/resources/DotGothic16-Regular.ttf +0 -0
  161. package/vendor/raylib/examples/text/resources/DotGothic16-Regular_OFL.txt +93 -0
  162. package/vendor/raylib/examples/text/resources/LICENSE.md +1 -1
  163. package/vendor/raylib/examples/text/text_codepoints_loading.c +138 -0
  164. package/vendor/raylib/examples/text/text_codepoints_loading.png +0 -0
  165. package/vendor/raylib/examples/text/text_draw_3d.c +42 -33
  166. package/vendor/raylib/examples/text/text_font_filters.c +14 -11
  167. package/vendor/raylib/examples/text/text_font_loading.c +9 -4
  168. package/vendor/raylib/examples/text/text_font_sdf.c +9 -4
  169. package/vendor/raylib/examples/text/text_font_spritefont.c +12 -6
  170. package/vendor/raylib/examples/text/text_format_text.c +8 -3
  171. package/vendor/raylib/examples/text/text_input_box.c +8 -3
  172. package/vendor/raylib/examples/text/text_raylib_fonts.c +9 -4
  173. package/vendor/raylib/examples/text/text_rectangle_bounds.c +9 -5
  174. package/vendor/raylib/examples/text/text_unicode.c +9 -7
  175. package/vendor/raylib/examples/text/text_writing_anim.c +8 -3
  176. package/vendor/raylib/examples/textures/resources/scarfy_run.gif +0 -0
  177. package/vendor/raylib/examples/textures/textures_background_scrolling.c +8 -3
  178. package/vendor/raylib/examples/textures/textures_blend_modes.c +8 -3
  179. package/vendor/raylib/examples/textures/textures_bunnymark.c +8 -3
  180. package/vendor/raylib/examples/textures/textures_draw_tiled.c +14 -10
  181. package/vendor/raylib/examples/textures/textures_fog_of_war.c +154 -0
  182. package/vendor/raylib/examples/textures/textures_fog_of_war.png +0 -0
  183. package/vendor/raylib/examples/textures/textures_gif_player.c +121 -0
  184. package/vendor/raylib/examples/textures/textures_gif_player.png +0 -0
  185. package/vendor/raylib/examples/textures/textures_image_drawing.c +8 -3
  186. package/vendor/raylib/examples/textures/textures_image_generation.c +8 -3
  187. package/vendor/raylib/examples/textures/textures_image_loading.c +8 -3
  188. package/vendor/raylib/examples/textures/textures_image_processing.c +8 -3
  189. package/vendor/raylib/examples/textures/textures_image_text.c +8 -3
  190. package/vendor/raylib/examples/textures/textures_logo_raylib.c +8 -3
  191. package/vendor/raylib/examples/textures/textures_mouse_painting.c +9 -4
  192. package/vendor/raylib/examples/textures/textures_npatch_drawing.c +8 -3
  193. package/vendor/raylib/examples/textures/textures_particles_blending.c +8 -3
  194. package/vendor/raylib/examples/textures/textures_polygon.c +9 -5
  195. package/vendor/raylib/examples/textures/textures_raw_data.c +8 -3
  196. package/vendor/raylib/examples/textures/{textures_rectangle.c → textures_sprite_anim.c} +11 -5
  197. package/vendor/raylib/examples/textures/{textures_rectangle.png → textures_sprite_anim.png} +0 -0
  198. package/vendor/raylib/examples/textures/textures_sprite_button.c +8 -3
  199. package/vendor/raylib/examples/textures/textures_sprite_explosion.c +8 -3
  200. package/vendor/raylib/examples/textures/textures_srcrec_dstrec.c +8 -3
  201. package/vendor/raylib/examples/textures/textures_to_image.c +8 -3
  202. package/vendor/raylib/parser/LICENSE +1 -1
  203. package/vendor/raylib/parser/Makefile +28 -0
  204. package/vendor/raylib/parser/README.md +49 -5
  205. package/vendor/raylib/parser/output/raylib_api.json +10717 -0
  206. package/vendor/raylib/parser/output/raylib_api.lua +7435 -0
  207. package/vendor/raylib/parser/{raylib_api.txt → output/raylib_api.txt} +1371 -824
  208. package/vendor/raylib/parser/{raylib_api.xml → output/raylib_api.xml} +827 -595
  209. package/vendor/raylib/parser/raylib_parser.c +1174 -196
  210. package/vendor/raylib/projects/4coder/Makefile +2 -4
  211. package/vendor/raylib/projects/4coder/main.c +0 -1
  212. package/vendor/raylib/projects/CMake/CMakeLists.txt +13 -16
  213. package/vendor/raylib/projects/CMake/README.md +27 -0
  214. package/vendor/raylib/projects/CMake/core_basic_window.c +52 -31
  215. package/vendor/raylib/projects/CodeBlocks/README.md +4 -4
  216. package/vendor/raylib/projects/Geany/core_basic_window.c +1 -1
  217. package/vendor/raylib/projects/Notepad++/c_raylib.xml +168 -128
  218. package/vendor/raylib/projects/Notepad++/npes_saved_tcc.txt +0 -0
  219. package/vendor/raylib/projects/Notepad++/npes_saved_w64devkit.txt +0 -0
  220. package/vendor/raylib/projects/Notepad++/npes_saved_zig.txt +0 -0
  221. package/vendor/raylib/projects/Notepad++/raylib_npp_parser/raylib_npp.xml +168 -84
  222. package/vendor/raylib/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h +67 -51
  223. package/vendor/raylib/projects/README.md +1 -1
  224. package/vendor/raylib/projects/VSCode/.vscode/c_cpp_properties.json +1 -1
  225. package/vendor/raylib/projects/VSCode/Makefile +8 -11
  226. package/vendor/raylib/projects/VSCode/main.c +53 -26
  227. package/vendor/raylib/projects/VSCode/resources/LICENSE +1 -0
  228. package/vendor/raylib/projects/scripts/build-linux.sh +6 -6
  229. package/vendor/raylib/projects/scripts/build-osx.sh +6 -6
  230. package/vendor/raylib/projects/scripts/build-rpi.sh +6 -6
  231. package/vendor/raylib/projects/scripts/build-windows.bat +2 -2
  232. package/vendor/raylib/src/CMakeLists.txt +6 -7
  233. package/vendor/raylib/src/Makefile +209 -103
  234. package/vendor/raylib/src/build.zig +56 -20
  235. package/vendor/raylib/src/config.h +32 -27
  236. package/vendor/raylib/src/external/cgltf.h +342 -104
  237. package/vendor/raylib/src/external/dr_wav.h +487 -225
  238. package/vendor/raylib/src/external/glfw/src/posix_time.c +1 -3
  239. package/vendor/raylib/src/external/glfw/src/wl_init.c +1 -3
  240. package/vendor/raylib/src/external/jar_xm.h +2 -1
  241. package/vendor/raylib/src/external/miniaudio.h +62251 -42061
  242. package/vendor/raylib/src/external/qoi.h +671 -0
  243. package/vendor/raylib/src/external/stb_vorbis.h +1 -1
  244. package/vendor/raylib/src/external/vox_loader.h +30 -25
  245. package/vendor/raylib/src/minshell.html +82 -0
  246. package/vendor/raylib/src/raudio.c +359 -201
  247. package/vendor/raylib/src/raylib.dll.rc +5 -5
  248. package/vendor/raylib/src/raylib.dll.rc.data +0 -0
  249. package/vendor/raylib/src/raylib.h +95 -63
  250. package/vendor/raylib/src/raylib.rc +5 -5
  251. package/vendor/raylib/src/raylib.rc.data +0 -0
  252. package/vendor/raylib/src/raymath.h +391 -133
  253. package/vendor/raylib/src/rcamera.h +32 -41
  254. package/vendor/raylib/src/rcore.c +775 -471
  255. package/vendor/raylib/src/rgestures.h +5 -5
  256. package/vendor/raylib/src/rglfw.c +3 -3
  257. package/vendor/raylib/src/rlgl.h +184 -144
  258. package/vendor/raylib/src/rmodels.c +207 -144
  259. package/vendor/raylib/src/rshapes.c +105 -47
  260. package/vendor/raylib/src/rtext.c +255 -38
  261. package/vendor/raylib/src/rtextures.c +167 -71
  262. package/vendor/raylib/src/shell.html +63 -63
  263. package/vendor/raylib/src/utils.c +49 -3
  264. package/vendor/raylib/src/utils.h +3 -3
  265. package/build/qemu/2.1.1/koffi_darwin_arm64.tar.gz +0 -0
  266. package/build/qemu/2.1.1/koffi_darwin_x64.tar.gz +0 -0
  267. package/build/qemu/2.1.1/koffi_freebsd_arm64.tar.gz +0 -0
  268. package/build/qemu/2.1.1/koffi_freebsd_ia32.tar.gz +0 -0
  269. package/build/qemu/2.1.1/koffi_freebsd_x64.tar.gz +0 -0
  270. package/build/qemu/2.1.1/koffi_linux_arm32hf.tar.gz +0 -0
  271. package/build/qemu/2.1.1/koffi_linux_arm64.tar.gz +0 -0
  272. package/build/qemu/2.1.1/koffi_linux_ia32.tar.gz +0 -0
  273. package/build/qemu/2.1.1/koffi_linux_riscv64hf64.tar.gz +0 -0
  274. package/build/qemu/2.1.1/koffi_linux_x64.tar.gz +0 -0
  275. package/build/qemu/2.1.1/koffi_openbsd_ia32.tar.gz +0 -0
  276. package/build/qemu/2.1.1/koffi_openbsd_x64.tar.gz +0 -0
  277. package/build/qemu/2.1.1/koffi_win32_arm64.tar.gz +0 -0
  278. package/build/qemu/2.1.1/koffi_win32_ia32.tar.gz +0 -0
  279. package/build/qemu/2.1.1/koffi_win32_x64.tar.gz +0 -0
  280. package/vendor/raylib/CONTRIBUTORS.md +0 -63
  281. package/vendor/raylib/SPONSORS.md +0 -68
  282. package/vendor/raylib/examples/core/core_quat_conversion.c +0 -132
  283. package/vendor/raylib/examples/core/core_quat_conversion.png +0 -0
  284. package/vendor/raylib/examples/models/resources/models/gltf/AnimatedMorphCube.glb +0 -0
  285. package/vendor/raylib/examples/models/resources/models/gltf/AnimatedTriangle.gltf +0 -118
  286. package/vendor/raylib/examples/models/resources/models/gltf/BoxAnimated.glb +0 -0
  287. package/vendor/raylib/examples/models/resources/models/gltf/girl.glb +0 -0
  288. package/vendor/raylib/examples/models/resources/models/gltf/rigged_figure.glb +0 -0
  289. package/vendor/raylib/examples/models/resources/models/gltf/vertex_colored_object.glb +0 -0
  290. package/vendor/raylib/examples/models/resources/models/iqm/vertex_colored_object.iqm +0 -0
  291. package/vendor/raylib/examples/models/rlights.h +0 -183
  292. package/vendor/raylib/examples/others/raudio_standalone.c +0 -152
  293. package/vendor/raylib/examples/others/resources/audio/country.mp3 +0 -0
  294. package/vendor/raylib/examples/others/resources/audio/target.ogg +0 -0
  295. package/vendor/raylib/examples/others/resources/audio/weird.wav +0 -0
  296. package/vendor/raylib/examples/physics/physics_demo.c +0 -128
  297. package/vendor/raylib/examples/physics/physics_demo.png +0 -0
  298. package/vendor/raylib/examples/physics/physics_friction.c +0 -142
  299. package/vendor/raylib/examples/physics/physics_friction.png +0 -0
  300. package/vendor/raylib/examples/physics/physics_movement.c +0 -128
  301. package/vendor/raylib/examples/physics/physics_movement.png +0 -0
  302. package/vendor/raylib/examples/physics/physics_restitution.c +0 -129
  303. package/vendor/raylib/examples/physics/physics_restitution.png +0 -0
  304. package/vendor/raylib/examples/physics/physics_shatter.c +0 -111
  305. package/vendor/raylib/examples/physics/physics_shatter.png +0 -0
  306. package/vendor/raylib/parser/raylib_api.json +0 -6668
  307. package/vendor/raylib/projects/VS2019/raylib/raylib.rc +0 -0
  308. package/vendor/raylib/projects/VS2019/raylib/resource.h +0 -14
  309. package/vendor/raylib/src/extras/physac.h +0 -1977
  310. package/vendor/raylib/src/extras/rmem.h +0 -751
  311. package/vendor/raylib/src/raudio.h +0 -198
@@ -4,11 +4,15 @@
4
4
  *
5
5
  * CONFIGURATION:
6
6
  *
7
+ * #define SUPPORT_MODULE_RTEXTURES
8
+ * rtextures module is included in the build
9
+ *
7
10
  * #define SUPPORT_FILEFORMAT_BMP
8
11
  * #define SUPPORT_FILEFORMAT_PNG
9
12
  * #define SUPPORT_FILEFORMAT_TGA
10
13
  * #define SUPPORT_FILEFORMAT_JPG
11
14
  * #define SUPPORT_FILEFORMAT_GIF
15
+ * #define SUPPORT_FILEFORMAT_QOI
12
16
  * #define SUPPORT_FILEFORMAT_PSD
13
17
  * #define SUPPORT_FILEFORMAT_PIC
14
18
  * #define SUPPORT_FILEFORMAT_HDR
@@ -33,12 +37,12 @@
33
37
  * DEPENDENCIES:
34
38
  * stb_image - Multiple image formats loading (JPEG, PNG, BMP, TGA, PSD, GIF, PIC)
35
39
  * NOTE: stb_image has been slightly modified to support Android platform.
36
- * stb_image_resize - Multiple image resize algorythms
40
+ * stb_image_resize - Multiple image resize algorithms
37
41
  *
38
42
  *
39
43
  * LICENSE: zlib/libpng
40
44
  *
41
- * Copyright (c) 2013-2021 Ramon Santamaria (@raysan5)
45
+ * Copyright (c) 2013-2022 Ramon Santamaria (@raysan5)
42
46
  *
43
47
  * This software is provided "as-is", without any express or implied warranty. In no event
44
48
  * will the authors be held liable for any damages arising from the use of this software.
@@ -64,11 +68,13 @@
64
68
  #include "config.h" // Defines module configuration flags
65
69
  #endif
66
70
 
71
+ #if defined(SUPPORT_MODULE_RTEXTURES)
72
+
67
73
  #include "utils.h" // Required for: TRACELOG() and fopen() Android mapping
68
74
  #include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 3.3 or ES2
69
75
 
70
76
  #include <stdlib.h> // Required for: malloc(), free()
71
- #include <string.h> // Required for: strlen() [Used in ImageTextEx()]
77
+ #include <string.h> // Required for: strlen() [Used in ImageTextEx()], strcmp() [Used in LoadImageFromMemory()]
72
78
  #include <math.h> // Required for: fabsf()
73
79
  #include <stdio.h> // Required for: sprintf() [Used in ExportImageAsCode()]
74
80
 
@@ -124,6 +130,14 @@
124
130
  // NOTE: Used to read image data (multiple formats support)
125
131
  #endif
126
132
 
133
+ #if defined(SUPPORT_FILEFORMAT_QOI)
134
+ #define QOI_MALLOC RL_MALLOC
135
+ #define QOI_FREE RL_FREE
136
+
137
+ #define QOI_IMPLEMENTATION
138
+ #include "external/qoi.h"
139
+ #endif
140
+
127
141
  #if defined(SUPPORT_IMAGE_EXPORT)
128
142
  #define STBIW_MALLOC RL_MALLOC
129
143
  #define STBIW_FREE RL_FREE
@@ -202,7 +216,8 @@ Image LoadImage(const char *fileName)
202
216
  defined(SUPPORT_FILEFORMAT_PIC) || \
203
217
  defined(SUPPORT_FILEFORMAT_HDR) || \
204
218
  defined(SUPPORT_FILEFORMAT_PSD)
205
- #define STBI_REQUIRED
219
+
220
+ #define STBI_REQUIRED
206
221
  #endif
207
222
 
208
223
  // Loading file to memory
@@ -286,36 +301,32 @@ Image LoadImageAnim(const char *fileName, int *frames)
286
301
  }
287
302
 
288
303
  // Load image from memory buffer, fileType refers to extension: i.e. ".png"
304
+ // WARNING: File extension must be provided in lower-case
289
305
  Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize)
290
306
  {
291
307
  Image image = { 0 };
292
308
 
293
- char fileExtLower[16] = { 0 };
294
- strcpy(fileExtLower, TextToLower(fileType));
295
-
296
- #if defined(SUPPORT_FILEFORMAT_PNG)
297
- if ((TextIsEqual(fileExtLower, ".png"))
298
- #else
299
309
  if ((false)
310
+ #if defined(SUPPORT_FILEFORMAT_PNG)
311
+ || (strcmp(fileType, ".png") == 0)
300
312
  #endif
301
313
  #if defined(SUPPORT_FILEFORMAT_BMP)
302
- || (TextIsEqual(fileExtLower, ".bmp"))
314
+ || (strcmp(fileType, ".bmp") == 0)
303
315
  #endif
304
316
  #if defined(SUPPORT_FILEFORMAT_TGA)
305
- || (TextIsEqual(fileExtLower, ".tga"))
317
+ || (strcmp(fileType, ".tga") == 0)
306
318
  #endif
307
319
  #if defined(SUPPORT_FILEFORMAT_JPG)
308
- || (TextIsEqual(fileExtLower, ".jpg") ||
309
- TextIsEqual(fileExtLower, ".jpeg"))
320
+ || ((strcmp(fileType, ".jpg") == 0) || (strcmp(fileType, ".jpeg") == 0))
310
321
  #endif
311
322
  #if defined(SUPPORT_FILEFORMAT_GIF)
312
- || (TextIsEqual(fileExtLower, ".gif"))
323
+ || (strcmp(fileType, ".gif") == 0)
313
324
  #endif
314
325
  #if defined(SUPPORT_FILEFORMAT_PIC)
315
- || (TextIsEqual(fileExtLower, ".pic"))
326
+ || (strcmp(fileType, ".pic") == 0)
316
327
  #endif
317
328
  #if defined(SUPPORT_FILEFORMAT_PSD)
318
- || (TextIsEqual(fileExtLower, ".psd"))
329
+ || (strcmp(fileType, ".psd") == 0)
319
330
  #endif
320
331
  )
321
332
  {
@@ -340,7 +351,7 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
340
351
  #endif
341
352
  }
342
353
  #if defined(SUPPORT_FILEFORMAT_HDR)
343
- else if (TextIsEqual(fileExtLower, ".hdr"))
354
+ else if (strcmp(fileType, ".hdr") == 0)
344
355
  {
345
356
  #if defined(STBI_REQUIRED)
346
357
  if (fileData != NULL)
@@ -362,20 +373,31 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
362
373
  #endif
363
374
  }
364
375
  #endif
376
+ #if defined(SUPPORT_FILEFORMAT_QOI)
377
+ else if (strcmp(fileType, ".qoi") == 0)
378
+ {
379
+ qoi_desc desc = { 0 };
380
+ image.data = qoi_decode(fileData, dataSize, &desc, 4);
381
+ image.width = desc.width;
382
+ image.height = desc.height;
383
+ image.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
384
+ image.mipmaps = 1;
385
+ }
386
+ #endif
365
387
  #if defined(SUPPORT_FILEFORMAT_DDS)
366
- else if (TextIsEqual(fileExtLower, ".dds")) image = LoadDDS(fileData, dataSize);
388
+ else if (strcmp(fileType, ".dds") == 0) image = LoadDDS(fileData, dataSize);
367
389
  #endif
368
390
  #if defined(SUPPORT_FILEFORMAT_PKM)
369
- else if (TextIsEqual(fileExtLower, ".pkm")) image = LoadPKM(fileData, dataSize);
391
+ else if (strcmp(fileType, ".pkm") == 0) image = LoadPKM(fileData, dataSize);
370
392
  #endif
371
393
  #if defined(SUPPORT_FILEFORMAT_KTX)
372
- else if (TextIsEqual(fileExtLower, ".ktx")) image = LoadKTX(fileData, dataSize);
394
+ else if (strcmp(fileType, ".ktx") == 0) image = LoadKTX(fileData, dataSize);
373
395
  #endif
374
396
  #if defined(SUPPORT_FILEFORMAT_PVR)
375
- else if (TextIsEqual(fileExtLower, ".pvr")) image = LoadPVR(fileData, dataSize);
397
+ else if (strcmp(fileType, ".pvr") == 0) image = LoadPVR(fileData, dataSize);
376
398
  #endif
377
399
  #if defined(SUPPORT_FILEFORMAT_ASTC)
378
- else if (TextIsEqual(fileExtLower, ".astc")) image = LoadASTC(fileData, dataSize);
400
+ else if (strcmp(fileType, ".astc") == 0) image = LoadASTC(fileData, dataSize);
379
401
  #endif
380
402
  else TRACELOG(LOG_WARNING, "IMAGE: Data format not supported");
381
403
 
@@ -477,7 +499,28 @@ bool ExportImage(Image image, const char *fileName)
477
499
  else if (IsFileExtension(fileName, ".tga")) success = stbi_write_tga(fileName, image.width, image.height, channels, imgData);
478
500
  #endif
479
501
  #if defined(SUPPORT_FILEFORMAT_JPG)
480
- else if (IsFileExtension(fileName, ".jpg")) success = stbi_write_jpg(fileName, image.width, image.height, channels, imgData, 90); // JPG quality: between 1 and 100
502
+ else if (IsFileExtension(fileName, ".jpg") ||
503
+ IsFileExtension(fileName, ".jpeg")) success = stbi_write_jpg(fileName, image.width, image.height, channels, imgData, 90); // JPG quality: between 1 and 100
504
+ #endif
505
+ #if defined(SUPPORT_FILEFORMAT_QOI)
506
+ else if (IsFileExtension(fileName, ".qoi"))
507
+ {
508
+ channels = 0;
509
+ if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8) channels = 3;
510
+ else if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8A8) channels = 4;
511
+ else TRACELOG(LOG_WARNING, "IMAGE: Image pixel format must be R8G8B8 or R8G8B8A8");
512
+
513
+ if ((channels == 3) || (channels == 4))
514
+ {
515
+ qoi_desc desc = { 0 };
516
+ desc.width = image.width;
517
+ desc.height = image.height;
518
+ desc.channels = channels;
519
+ desc.colorspace = QOI_SRGB;
520
+
521
+ success = qoi_write(fileName, imgData, &desc);
522
+ }
523
+ }
481
524
  #endif
482
525
  #if defined(SUPPORT_FILEFORMAT_KTX)
483
526
  else if (IsFileExtension(fileName, ".ktx")) success = SaveKTX(image, fileName);
@@ -523,7 +566,7 @@ bool ExportImageAsCode(Image image, const char *fileName)
523
566
  byteCount += sprintf(txtData + byteCount, "// more info and bugs-report: github.com/raysan5/raylib //\n");
524
567
  byteCount += sprintf(txtData + byteCount, "// feedback and support: ray[at]raylib.com //\n");
525
568
  byteCount += sprintf(txtData + byteCount, "// //\n");
526
- byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2018-2021 Ramon Santamaria (@raysan5) //\n");
569
+ byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2018-2022 Ramon Santamaria (@raysan5) //\n");
527
570
  byteCount += sprintf(txtData + byteCount, "// //\n");
528
571
  byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n\n");
529
572
 
@@ -549,8 +592,8 @@ bool ExportImageAsCode(Image image, const char *fileName)
549
592
 
550
593
  #endif // SUPPORT_IMAGE_EXPORT
551
594
 
552
- if (success != 0) TRACELOG(LOG_INFO, "FILEIO: [%s] Image exported successfully", fileName);
553
- else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to export image", fileName);
595
+ if (success != 0) TRACELOG(LOG_INFO, "FILEIO: [%s] Image as code exported successfully", fileName);
596
+ else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to export image as code", fileName);
554
597
 
555
598
  return success;
556
599
  }
@@ -732,7 +775,7 @@ Image GenImageCellular(int width, int height, int tileSize)
732
775
  {
733
776
  int y = (i/seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1);
734
777
  int x = (i%seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1);
735
- seeds[i] = (Vector2){ (float)x, (float)y};
778
+ seeds[i] = (Vector2){ (float)x, (float)y };
736
779
  }
737
780
 
738
781
  for (int y = 0; y < height; y++)
@@ -743,7 +786,7 @@ Image GenImageCellular(int width, int height, int tileSize)
743
786
  {
744
787
  int tileX = x/tileSize;
745
788
 
746
- float minDistance = (float)strtod("Inf", NULL);
789
+ float minDistance = 65536.0f; //(float)strtod("Inf", NULL);
747
790
 
748
791
  // Check all adjacent tiles
749
792
  for (int i = -1; i < 2; i++)
@@ -832,11 +875,11 @@ Image ImageFromImage(Image image, Rectangle rec)
832
875
 
833
876
  result.width = (int)rec.width;
834
877
  result.height = (int)rec.height;
835
- result.data = RL_CALLOC((int)(rec.width*rec.height)*bytesPerPixel, 1);
878
+ result.data = RL_CALLOC((int)rec.width*(int)rec.height*bytesPerPixel, 1);
836
879
  result.format = image.format;
837
880
  result.mipmaps = 1;
838
881
 
839
- for (int y = 0; y < rec.height; y++)
882
+ for (int y = 0; y < (int)rec.height; y++)
840
883
  {
841
884
  memcpy(((unsigned char *)result.data) + y*(int)rec.width*bytesPerPixel, ((unsigned char *)image.data) + ((y + (int)rec.y)*image.width + (int)rec.x)*bytesPerPixel, (int)rec.width*bytesPerPixel);
842
885
  }
@@ -1092,35 +1135,41 @@ void ImageToPOT(Image *image, Color fill)
1092
1135
  // Create an image from text (default font)
1093
1136
  Image ImageText(const char *text, int fontSize, Color color)
1094
1137
  {
1138
+ Image imText = { 0 };
1139
+ #if defined(SUPPORT_MODULE_RTEXT)
1095
1140
  int defaultFontSize = 10; // Default Font chars height in pixel
1096
1141
  if (fontSize < defaultFontSize) fontSize = defaultFontSize;
1097
1142
  int spacing = fontSize/defaultFontSize;
1098
-
1099
- Image imText = ImageTextEx(GetFontDefault(), text, (float)fontSize, (float)spacing, color);
1100
-
1143
+ imText = ImageTextEx(GetFontDefault(), text, (float)fontSize, (float)spacing, color); // WARNING: Module required: rtext
1144
+ #else
1145
+ imText = GenImageColor(200, 60, BLACK); // Generating placeholder black image rectangle
1146
+ TRACELOG(LOG_WARNING, "IMAGE: ImageTextEx() requires module: rtext");
1147
+ #endif
1101
1148
  return imText;
1102
1149
  }
1103
1150
 
1104
1151
  // Create an image from text (custom sprite font)
1105
1152
  Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint)
1106
1153
  {
1154
+ Image imText = { 0 };
1155
+ #if defined(SUPPORT_MODULE_RTEXT)
1107
1156
  int size = (int)strlen(text); // Get size in bytes of text
1108
1157
 
1109
1158
  int textOffsetX = 0; // Image drawing position X
1110
1159
  int textOffsetY = 0; // Offset between lines (on line break '\n')
1111
1160
 
1112
1161
  // NOTE: Text image is generated at font base size, later scaled to desired font size
1113
- Vector2 imSize = MeasureTextEx(font, text, (float)font.baseSize, spacing);
1162
+ Vector2 imSize = MeasureTextEx(font, text, (float)font.baseSize, spacing); // WARNING: Module required: rtext
1114
1163
 
1115
1164
  // Create image to store text
1116
- Image imText = GenImageColor((int)imSize.x, (int)imSize.y, BLANK);
1165
+ imText = GenImageColor((int)imSize.x, (int)imSize.y, BLANK);
1117
1166
 
1118
1167
  for (int i = 0; i < size; i++)
1119
1168
  {
1120
1169
  // Get next codepoint from byte string and glyph index in font
1121
1170
  int codepointByteCount = 0;
1122
- int codepoint = GetCodepoint(&text[i], &codepointByteCount);
1123
- int index = GetGlyphIndex(font, codepoint);
1171
+ int codepoint = GetCodepoint(&text[i], &codepointByteCount); // WARNING: Module required: rtext
1172
+ int index = GetGlyphIndex(font, codepoint); // WARNING: Module required: rtext
1124
1173
 
1125
1174
  // NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
1126
1175
  // but we need to draw all of the bad bytes using the '?' symbol moving one byte
@@ -1155,10 +1204,14 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
1155
1204
  TRACELOG(LOG_INFO, "IMAGE: Text scaled by factor: %f", scaleFactor);
1156
1205
 
1157
1206
  // Using nearest-neighbor scaling algorithm for default font
1207
+ // WARNING: Module required: rtext
1158
1208
  if (font.texture.id == GetFontDefault().texture.id) ImageResizeNN(&imText, (int)(imSize.x*scaleFactor), (int)(imSize.y*scaleFactor));
1159
1209
  else ImageResize(&imText, (int)(imSize.x*scaleFactor), (int)(imSize.y*scaleFactor));
1160
1210
  }
1161
-
1211
+ #else
1212
+ imText = GenImageColor(200, 60, BLACK); // Generating placeholder black image rectangle
1213
+ TRACELOG(LOG_WARNING, "IMAGE: ImageTextEx() requires module: rtext");
1214
+ #endif
1162
1215
  return imText;
1163
1216
  }
1164
1217
 
@@ -1361,10 +1414,12 @@ void ImageResize(Image *image, int newWidth, int newHeight)
1361
1414
  // Security check to avoid program crash
1362
1415
  if ((image->data == NULL) || (image->width == 0) || (image->height == 0)) return;
1363
1416
 
1364
- bool fastPath = true;
1365
- if ((image->format != PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) && (image->format != PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA) && (image->format != PIXELFORMAT_UNCOMPRESSED_R8G8B8) && (image->format != PIXELFORMAT_UNCOMPRESSED_R8G8B8A8)) fastPath = true;
1366
-
1367
- if (fastPath)
1417
+ // Check if we can use a fast path on image scaling
1418
+ // It can be for 8 bit per channel images with 1 to 4 channels per pixel
1419
+ if ((image->format == PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) ||
1420
+ (image->format == PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA) ||
1421
+ (image->format == PIXELFORMAT_UNCOMPRESSED_R8G8B8) ||
1422
+ (image->format == PIXELFORMAT_UNCOMPRESSED_R8G8B8A8))
1368
1423
  {
1369
1424
  int bytesPerPixel = GetPixelDataSize(1, 1, image->format);
1370
1425
  unsigned char *output = (unsigned char *)RL_MALLOC(newWidth*newHeight*bytesPerPixel);
@@ -1836,10 +1891,10 @@ void ImageColorTint(Image *image, Color color)
1836
1891
  unsigned char b = (unsigned char)(((float)pixels[index].b/255*cB)*255.0f);
1837
1892
  unsigned char a = (unsigned char)(((float)pixels[index].a/255*cA)*255.0f);
1838
1893
 
1839
- pixels[y*image->width + x].r = r;
1840
- pixels[y*image->width + x].g = g;
1841
- pixels[y*image->width + x].b = b;
1842
- pixels[y*image->width + x].a = a;
1894
+ pixels[index].r = r;
1895
+ pixels[index].g = g;
1896
+ pixels[index].b = b;
1897
+ pixels[index].a = a;
1843
1898
  }
1844
1899
  }
1845
1900
 
@@ -1905,25 +1960,25 @@ void ImageColorContrast(Image *image, float contrast)
1905
1960
  for (int x = 0; x < image->width; x++)
1906
1961
  {
1907
1962
  float pR = (float)pixels[y*image->width + x].r/255.0f;
1908
- pR -= 0.5;
1963
+ pR -= 0.5f;
1909
1964
  pR *= contrast;
1910
- pR += 0.5;
1965
+ pR += 0.5f;
1911
1966
  pR *= 255;
1912
1967
  if (pR < 0) pR = 0;
1913
1968
  if (pR > 255) pR = 255;
1914
1969
 
1915
1970
  float pG = (float)pixels[y*image->width + x].g/255.0f;
1916
- pG -= 0.5;
1971
+ pG -= 0.5f;
1917
1972
  pG *= contrast;
1918
- pG += 0.5;
1973
+ pG += 0.5f;
1919
1974
  pG *= 255;
1920
1975
  if (pG < 0) pG = 0;
1921
1976
  if (pG > 255) pG = 255;
1922
1977
 
1923
1978
  float pB = (float)pixels[y*image->width + x].b/255.0f;
1924
- pB -= 0.5;
1979
+ pB -= 0.5f;
1925
1980
  pB *= contrast;
1926
- pB += 0.5;
1981
+ pB += 0.5f;
1927
1982
  pB *= 255;
1928
1983
  if (pB < 0) pB = 0;
1929
1984
  if (pB > 255) pB = 255;
@@ -2358,7 +2413,20 @@ Color GetImageColor(Image image, int x, int y)
2358
2413
  // Clear image background with given color
2359
2414
  void ImageClearBackground(Image *dst, Color color)
2360
2415
  {
2361
- for (int i = 0; i < dst->width*dst->height; ++i) ImageDrawPixel(dst, i%dst->width, i/dst->width, color);
2416
+ // Security check to avoid program crash
2417
+ if ((dst->data == NULL) || (dst->width == 0) || (dst->height == 0)) return;
2418
+
2419
+ // Fill in first pixel based on image format
2420
+ ImageDrawPixel(dst, 0, 0, color);
2421
+
2422
+ unsigned char *pSrcPixel = (unsigned char *)dst->data;
2423
+ int bytesPerPixel = GetPixelDataSize(1, 1, dst->format);
2424
+
2425
+ // Repeat the first pixel data throughout the image
2426
+ for (int i = 1; i < dst->width * dst->height; i++)
2427
+ {
2428
+ memcpy(pSrcPixel + i * bytesPerPixel, pSrcPixel, bytesPerPixel);
2429
+ }
2362
2430
  }
2363
2431
 
2364
2432
  // Draw pixel within an image
@@ -2632,13 +2700,21 @@ void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color)
2632
2700
  int ey = sy + (int)rec.height;
2633
2701
 
2634
2702
  int sx = (int)rec.x;
2635
- int ex = sx + (int)rec.width;
2703
+
2704
+ int bytesPerPixel = GetPixelDataSize(1, 1, dst->format);
2636
2705
 
2637
2706
  for (int y = sy; y < ey; y++)
2638
2707
  {
2639
- for (int x = sx; x < ex; x++)
2708
+ // Fill in the first pixel of the row based on image format
2709
+ ImageDrawPixel(dst, sx, y, color);
2710
+
2711
+ int bytesOffset = ((y * dst->width) + sx) * bytesPerPixel;
2712
+ unsigned char *pSrcPixel = (unsigned char *)dst->data + bytesOffset;
2713
+
2714
+ // Repeat the first pixel data throughout the row
2715
+ for (int x = 1; x < (int)rec.width; x++)
2640
2716
  {
2641
- ImageDrawPixel(dst, x, y, color);
2717
+ memcpy(pSrcPixel + x * bytesPerPixel, pSrcPixel, bytesPerPixel);
2642
2718
  }
2643
2719
  }
2644
2720
  }
@@ -2716,6 +2792,9 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color
2716
2792
  // [x] Consider fast path: no alpha blending required cases (src has no alpha)
2717
2793
  // [x] Consider fast path: same src/dst format with no alpha -> direct line copy
2718
2794
  // [-] GetPixelColor(): Get Vector4 instead of Color, easier for ColorAlphaBlend()
2795
+ // [ ] Support f32bit channels drawing
2796
+
2797
+ // TODO: Support PIXELFORMAT_UNCOMPRESSED_R32, PIXELFORMAT_UNCOMPRESSED_R32G32B32, PIXELFORMAT_UNCOMPRESSED_R32G32B32A32
2719
2798
 
2720
2799
  Color colSrc, colDst, blend;
2721
2800
  bool blendRequired = true;
@@ -2768,10 +2847,13 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color
2768
2847
  // Draw text (default font) within an image (destination)
2769
2848
  void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color)
2770
2849
  {
2850
+ #if defined(SUPPORT_MODULE_RTEXT)
2771
2851
  Vector2 position = { (float)posX, (float)posY };
2772
-
2773
- // NOTE: For default font, sapcing is set to desired font size / default font size (10)
2774
- ImageDrawTextEx(dst, GetFontDefault(), text, position, (float)fontSize, (float)fontSize/10, color);
2852
+ // NOTE: For default font, spacing is set to desired font size / default font size (10)
2853
+ ImageDrawTextEx(dst, GetFontDefault(), text, position, (float)fontSize, (float)fontSize/10, color); // WARNING: Module required: rtext
2854
+ #else
2855
+ TRACELOG(LOG_WARNING, "IMAGE: ImageDrawText() requires module: rtext");
2856
+ #endif
2775
2857
  }
2776
2858
 
2777
2859
  // Draw text (custom sprite font) within an image (destination)
@@ -2812,7 +2894,7 @@ Texture2D LoadTextureFromImage(Image image)
2812
2894
  {
2813
2895
  Texture2D texture = { 0 };
2814
2896
 
2815
- if ((image.data != NULL) && (image.width != 0) && (image.height != 0))
2897
+ if ((image.width != 0) && (image.height != 0))
2816
2898
  {
2817
2899
  texture.id = rlLoadTexture(image.data, image.width, image.height, image.format, image.mipmaps);
2818
2900
  }
@@ -2849,6 +2931,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
2849
2931
  cubemap.height = cubemap.width;
2850
2932
  }
2851
2933
 
2934
+ // Layout provided or already auto-detected
2852
2935
  if (layout != CUBEMAP_LAYOUT_AUTO_DETECT)
2853
2936
  {
2854
2937
  int size = cubemap.width;
@@ -2859,8 +2942,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
2859
2942
 
2860
2943
  if (layout == CUBEMAP_LAYOUT_LINE_VERTICAL)
2861
2944
  {
2862
- faces = image;
2863
- for (int i = 0; i < 6; i++) faceRecs[i].y = (float)size*i;
2945
+ faces = ImageCopy(image); // Image data already follows expected convention
2864
2946
  }
2865
2947
  else if (layout == CUBEMAP_LAYOUT_PANORAMA)
2866
2948
  {
@@ -2894,10 +2976,12 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
2894
2976
  ImageFormat(&faces, image.format);
2895
2977
 
2896
2978
  // NOTE: Image formating does not work with compressed textures
2897
- }
2898
2979
 
2899
- for (int i = 0; i < 6; i++) ImageDraw(&faces, image, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, WHITE);
2980
+ for (int i = 0; i < 6; i++) ImageDraw(&faces, image, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, WHITE);
2981
+ }
2900
2982
 
2983
+ // NOTE: Cubemap data is expected to be provided as 6 images in a single data array,
2984
+ // one after the other (that's a vertical image), following convention: +X, -X, +Y, -Y, +Z, -Z
2901
2985
  cubemap.id = rlLoadTextureCubemap(faces.data, size, faces.format);
2902
2986
  if (cubemap.id == 0) TRACELOG(LOG_WARNING, "IMAGE: Failed to load cubemap image");
2903
2987
 
@@ -3071,6 +3155,7 @@ void SetTextureWrap(Texture2D texture, int wrap)
3071
3155
  {
3072
3156
  case TEXTURE_WRAP_REPEAT:
3073
3157
  {
3158
+ // NOTE: It only works if NPOT textures are supported, i.e. OpenGL ES 2.0 could not support it
3074
3159
  rlTextureParameters(texture.id, RL_TEXTURE_WRAP_S, RL_TEXTURE_WRAP_REPEAT);
3075
3160
  rlTextureParameters(texture.id, RL_TEXTURE_WRAP_T, RL_TEXTURE_WRAP_REPEAT);
3076
3161
  } break;
@@ -3132,6 +3217,8 @@ void DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color
3132
3217
  // i.e tiling = { 1.0f, 1.0f } refers to all texture, offset = { 0.5f, 0.5f } moves texture origin to center
3133
3218
  void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangle quad, Color tint)
3134
3219
  {
3220
+ // WARNING: This solution only works if TEXTURE_WRAP_REPEAT is supported,
3221
+ // NPOT textures supported is required and OpenGL ES 2.0 could not support it
3135
3222
  Rectangle source = { offset.x*texture.width, offset.y*texture.height, tiling.x*texture.width, tiling.y*texture.height };
3136
3223
  Vector2 origin = { 0.0f, 0.0f };
3137
3224
 
@@ -3143,6 +3230,7 @@ void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangl
3143
3230
  void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint)
3144
3231
  {
3145
3232
  if ((texture.id <= 0) || (scale <= 0.0f)) return; // Wanna see a infinite loop?!...just delete this line!
3233
+ if ((source.width == 0) || (source.height == 0)) return;
3146
3234
 
3147
3235
  int tileWidth = (int)(source.width*scale), tileHeight = (int)(source.height*scale);
3148
3236
  if ((dest.width < tileWidth) && (dest.height < tileHeight))
@@ -3406,6 +3494,8 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
3406
3494
  coordD.x = (nPatchInfo.source.x + nPatchInfo.source.width)/width;
3407
3495
  coordD.y = (nPatchInfo.source.y + nPatchInfo.source.height)/height;
3408
3496
 
3497
+ rlCheckRenderBatchLimit(9 * 3 * 2); // Maxium number of verts that could happen
3498
+
3409
3499
  rlSetTexture(texture.id);
3410
3500
 
3411
3501
  rlPushMatrix();
@@ -3721,10 +3811,10 @@ Color ColorAlphaBlend(Color dst, Color src, Color tint)
3721
3811
  Color out = WHITE;
3722
3812
 
3723
3813
  // Apply color tint to source color
3724
- src.r = (unsigned char)(((unsigned int)src.r*(unsigned int)tint.r) >> 8);
3725
- src.g = (unsigned char)(((unsigned int)src.g*(unsigned int)tint.g) >> 8);
3726
- src.b = (unsigned char)(((unsigned int)src.b*(unsigned int)tint.b) >> 8);
3727
- src.a = (unsigned char)(((unsigned int)src.a*(unsigned int)tint.a) >> 8);
3814
+ src.r = (unsigned char)(((unsigned int)src.r*((unsigned int)tint.r+1)) >> 8);
3815
+ src.g = (unsigned char)(((unsigned int)src.g*((unsigned int)tint.g+1)) >> 8);
3816
+ src.b = (unsigned char)(((unsigned int)src.b*((unsigned int)tint.b+1)) >> 8);
3817
+ src.a = (unsigned char)(((unsigned int)src.a*((unsigned int)tint.a+1)) >> 8);
3728
3818
 
3729
3819
  //#define COLORALPHABLEND_FLOAT
3730
3820
  #define COLORALPHABLEND_INTEGERS
@@ -4259,6 +4349,7 @@ static Image LoadPKM(const unsigned char *fileData, unsigned int fileSize)
4259
4349
 
4260
4350
  #if defined(SUPPORT_FILEFORMAT_KTX)
4261
4351
  // Load KTX compressed image data (ETC1/ETC2 compression)
4352
+ // TODO: Review KTX loading, many things changed!
4262
4353
  static Image LoadKTX(const unsigned char *fileData, unsigned int fileSize)
4263
4354
  {
4264
4355
  unsigned char *fileDataPtr = (unsigned char *)fileData;
@@ -4333,6 +4424,8 @@ static Image LoadKTX(const unsigned char *fileData, unsigned int fileSize)
4333
4424
  if (ktxHeader->glInternalFormat == 0x8D64) image.format = PIXELFORMAT_COMPRESSED_ETC1_RGB;
4334
4425
  else if (ktxHeader->glInternalFormat == 0x9274) image.format = PIXELFORMAT_COMPRESSED_ETC2_RGB;
4335
4426
  else if (ktxHeader->glInternalFormat == 0x9278) image.format = PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA;
4427
+
4428
+ // TODO: Support uncompressed data formats? Right now it returns format = 0!
4336
4429
  }
4337
4430
  }
4338
4431
 
@@ -4341,11 +4434,12 @@ static Image LoadKTX(const unsigned char *fileData, unsigned int fileSize)
4341
4434
 
4342
4435
  // Save image data as KTX file
4343
4436
  // NOTE: By default KTX 1.1 spec is used, 2.0 is still on draft (01Oct2018)
4437
+ // TODO: Review KTX saving, many things changed!
4344
4438
  static int SaveKTX(Image image, const char *fileName)
4345
4439
  {
4346
4440
  // KTX file Header (64 bytes)
4347
4441
  // v1.1 - https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
4348
- // v2.0 - http://github.khronos.org/KTX-Specification/ - still on draft, not ready for implementation
4442
+ // v2.0 - http://github.khronos.org/KTX-Specification/ - Final specs by 2021-04-18
4349
4443
  typedef struct {
4350
4444
  char id[12]; // Identifier: "«KTX 11»\r\n\x1A\n" // KTX 2.0: "«KTX 22»\r\n\x1A\n"
4351
4445
  unsigned int endianness; // Little endian: 0x01 0x02 0x03 0x04
@@ -4480,7 +4574,7 @@ static Image LoadPVR(const unsigned char *fileData, unsigned int fileSize)
4480
4574
  unsigned int flags;
4481
4575
  unsigned char channels[4]; // pixelFormat high part
4482
4576
  unsigned char channelDepth[4]; // pixelFormat low part
4483
- unsigned int colourSpace;
4577
+ unsigned int colorSpace;
4484
4578
  unsigned int channelType;
4485
4579
  unsigned int height;
4486
4580
  unsigned int width;
@@ -4759,3 +4853,5 @@ static Vector4 *LoadImageDataNormalized(Image image)
4759
4853
 
4760
4854
  return pixels;
4761
4855
  }
4856
+
4857
+ #endif // SUPPORT_MODULE_RTEXTURES