diff --git a/.gitignore b/.gitignore index 559f9f0d9..6ff0e2346 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ packages/ *.bc *.so *.so.* +*.dll # Ignore wasm data in examples/ examples/**/*.wasm diff --git a/BINDINGS.md b/BINDINGS.md index ab1bf6faa..c66c12808 100644 --- a/BINDINGS.md +++ b/BINDINGS.md @@ -6,7 +6,8 @@ Some people ported raylib to other languages in form of bindings or wrappers to | name | raylib version | language | license | repo | |:------------------:|:---------------:|:---------:|:----------:|-----------------------------------------------------------| -| raylib | **4.5** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib | https://github.com/raysan5/raylib | +| raylib | **5.0** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib | https://github.com/raysan5/raylib | +| raylib-beef | **5.0** | [Beef](https://www.beeflang.org/) | MIT | https://github.com/Starpelly/raylib-beef | | raylib-boo | 3.7 | [Boo](http://boo-language.github.io/)| MIT | https://github.com/Rabios/raylib-boo | | Raylib-cs | **4.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib | https://github.com/ChrisDill/Raylib-cs | | Raylib-CsLo | 4.2 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 | https://github.com/NotNotTech/Raylib-CsLo | @@ -20,20 +21,20 @@ Some people ported raylib to other languages in form of bindings or wrappers to | dart-raylib | 4.0 | [Dart](https://dart.dev/) | MIT | https://gitlab.com/wolfenrain/dart-raylib | | bindbc-raylib3 | **4.5** | [D](https://dlang.org/) | BSL-1.0 | https://github.com/o3o/bindbc-raylib3 | | dray | 4.2 | [D](https://dlang.org/) | Apache-2.0 | https://github.com/redthing1/dray | -| raylib-d | **4.5** | [D](https://dlang.org/) | Zlib | https://github.com/schveiguy/raylib-d | +| raylib-d | **5.0** | [D](https://dlang.org/) | Zlib | https://github.com/schveiguy/raylib-d | | dlang_raylib | 4.0 | [D](https://dlang.org) | MPL-2.0 |https://github.com/rc-05/dlang_raylib | | rayex | 3.7 | [elixir](https://elixir-lang.org/) | Apache-2.0 | https://github.com/shiryel/rayex | | raylib-factor | **4.5** | [Factor](https://factorcode.org/) | BSD | https://github.com/factor/factor/blob/master/extra/raylib/raylib.factor | -| raylib-freebasic | **4.5** | [FreeBASIC](https://www.freebasic.net/) | MIT | https://github.com/WIITD/raylib-freebasic | +| raylib-freebasic | **5.0** | [FreeBASIC](https://www.freebasic.net/) | MIT | https://github.com/WIITD/raylib-freebasic | | fortran-raylib | **4.5** | [Fortran](https://fortran-lang.org/) | ISC | https://github.com/interkosmos/fortran-raylib | | raylib for Pascal | **4.5** | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | Modified Zlib | https://github.com/tinyBigGAMES/raylib | | raylib-go | **5.0** | [Go](https://golang.org/) | Zlib | https://github.com/gen2brain/raylib-go | | raylib-guile | **auto** | [Guile](https://www.gnu.org/software/guile/) | Zlib | https://github.com/petelliott/raylib-guile | -| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | MIT | https://github.com/ArnautDaniel/gforth-raylib | +| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | **???** | https://github.com/ArnautDaniel/gforth-raylib | | h-raylib | **4.6-dev** | [Haskell](https://haskell.org/) | Apache-2.0 | https://github.com/Anut-py/h-raylib | | raylib-hx | 4.2 | [Haxe](https://haxe.org/) | Zlib | https://github.com/foreignsasquatch/raylib-hx | | hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | MIT | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib | -| jaylib | 4.5 | [Janet](https://janet-lang.org/) | MIT | https://github.com/janet-lang/jaylib | +| jaylib | 5.0 | [Janet](https://janet-lang.org/) | MIT | https://github.com/janet-lang/jaylib | | jaylib | **4.5** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE | https://github.com/electronstudio/jaylib/ | | raylib-j | 4.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | Zlib | https://github.com/CreedVI/Raylib-J | | raylib.jl | 4.2 | [Julia](https://julialang.org/) | Zlib | https://github.com/irishgreencitrus/raylib.jl | @@ -43,7 +44,7 @@ Some people ported raylib to other languages in form of bindings or wrappers to | raylua | 4.0 | [Lua](http://www.lua.org/) | MIT | https://github.com/Rabios/raylua | | raylib-matte | 4.6-dev | [Matte](https://github.com/jcorks/matte/) | MIT | https://github.com/jcorks/raylib-matte | | nelua-raylib | 4.0 | [nelua](https://nelua.io/) | MIT | https://github.com/AKDev21/nelua-raylib | -| Raylib.nelua | **4.5** | [nelua](https://nelua.io/) | Zlib | https://github.com/Its-Kenta/Raylib-Nelua | +| Raylib.nelua | **5.0** | [nelua](https://nelua.io/) | Zlib | https://github.com/AuzFox/Raylib.nelua | | NimraylibNow! | 4.2 | [Nim](https://nim-lang.org/) | MIT | https://github.com/greenfork/nimraylib_now | | raylib-bindings | **4.5** | [Ruby](https://www.ruby-lang.org/en/) | Zlib | https://github.com/vaiorabbit/raylib-bindings | | raylib-Forever | auto | [Nim](https://nim-lang.org/) | ? | https://github.com/Guevara-chan/Raylib-Forever | @@ -53,12 +54,12 @@ Some people ported raylib to other languages in form of bindings or wrappers to | raylib_odin_bindings | 4.0-dev | [Odin](https://odin-lang.org/) | MIT | https://github.com/Deathbat2190/raylib_odin_bindings | | raylib-ocaml | **4.5** | [OCaml](https://ocaml.org/) | MIT | https://github.com/tjammer/raylib-ocaml | | TurboRaylib | **4.5** | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT | https://github.com/turborium/TurboRaylib | -| Ray4Laz | **4.5** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/GuvaCode/Ray4Laz | +| Ray4Laz | **5.0** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/GuvaCode/Ray4Laz | | Raylib.4.0.Pascal | 4.0 | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/sysrpl/Raylib.4.0.Pascal | | pyraylib | 3.7 | [Python](https://www.python.org/) | Zlib | https://github.com/Ho011/pyraylib | | raylib-python-cffi | 4.2 | [Python](https://www.python.org/) | EPL-2.0 | https://github.com/electronstudio/raylib-python-cffi | | raylibpyctbg | **4.5** | [Python](https://www.python.org/) | MIT | https://github.com/overdev/raylibpyctbg | -| raylib-py | **4.5** | [Python](https://www.python.org/) | MIT | https://github.com/overdev/raylib-py | +| raylib-py | **5.0b1** | [Python](https://www.python.org/) | MIT | https://github.com/overdev/raylib-py | | raylib-python-ctypes | 4.6-dev | [Python](https://www.python.org/) | MIT | https://github.com/sDos280/raylib-python-ctypes | | raylib-pkpy-bindings | 4.6-dev | [pocketpy](https://pocketpy.dev/) | MIT | https://github.com/blueloveTH/pkpy-bindings | | raylib-php | **4.5** | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib | https://github.com/joseph-montanez/raylib-php | @@ -70,7 +71,7 @@ Some people ported raylib to other languages in form of bindings or wrappers to | racket-raylib | 4.0 | [Racket](https://racket-lang.org/) | MIT/Apache-2.0 | https://github.com/eutro/racket-raylib | | raylib-swift | 4.0 | [Swift](https://swift.org/) | MIT | https://github.com/STREGAsGate/Raylib | | raylib-scopes | auto | [Scopes](http://scopes.rocks) | MIT | https://github.com/salotz/raylib-scopes | -| raylib-smallBasic | 4.1-dev | [SmallBASIC](https://github.com/smallbasic/SmallBASIC) | GPLv3 | https://github.com/smallbasic/smallbasic.plugins/tree/master/raylib | +| raylib-SmallBASIC | 5.0 | [SmallBASIC](https://github.com/smallbasic/SmallBASIC) | GPLv3 | https://github.com/smallbasic/smallbasic.plugins/tree/master/raylib | | raylib-umka | **4.5** | [Umka](https://github.com/vtereshkov/umka-lang) | Zlib | https://github.com/robloach/raylib-umka | | raylib.v | 4.2 | [V](https://vlang.io/) | Zlib | https://github.com/irishgreencitrus/raylib.v | | raylib-vapi | 4.2 | [Vala](https://vala.dev/) | Zlib | https://github.com/lxmcf/raylib-vapi | @@ -83,12 +84,13 @@ Some people ported raylib to other languages in form of bindings or wrappers to | rayjs | 4.6-dev | [QuickJS](https://bellard.org/quickjs/) | MIT | https://github.com/mode777/rayjs | | raylib-raku | **auto** | [Raku](https://www.raku.org/) | Artistic License 2.0 | https://github.com/vushu/raylib-raku | | Raylib.lean | 4.5 | [Lean4](https://lean-lang.org/) | BSD-3-Clause | https://github.com/KislyjKisel/Raylib.lean | +| Raylib-CSharp-Vinculum | 5.0 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 | https://github.com/ZeroElectric/Raylib-CSharp-Vinculum | ### Utility Wrapers These are utility wrappers for specific languages, they are not required to use raylib in the language but may adapt the raylib API to be more inline with the language's pardigm. | name | raylib version | language | license | repo | |:------------------:|:-------------: | :--------:|:-------:|:-------------------------------------------------------------| -| raylib-cpp | **4.5** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib | https://github.com/robloach/raylib-cpp | +| raylib-cpp | **5.0** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib | https://github.com/robloach/raylib-cpp | | claylib | **4.5** | [Common Lisp](https://common-lisp.net/) | Zlib | https://github.com/defun-games/claylib | ### Older or Unmaintained Language Bindings diff --git a/CMakeLists.txt b/CMakeLists.txt index 236aa9a64..ce2de5788 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.5) project(raylib) # Avoid excessive expansion of variables in conditionals. In particular, if -# "PLATFORM" is "DRM" than: +# "PLATFORM" is "DRM" then: # # if (${PLATFORM} MATCHES "DRM") # @@ -13,6 +13,11 @@ project(raylib) # See https://cmake.org/cmake/help/latest/policy/CMP0054.html cmake_policy(SET CMP0054 NEW) +# Makes a hidden visibility preset on a static lib respected +# This is used to hide glfw's symbols from the library exports when building an so/dylib +# See https://cmake.org/cmake/help/latest/policy/CMP0063.html +cmake_policy(SET CMP0063 NEW) + # Directory for easier includes # Anywhere you see include(...) you can check /cmake for that file set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) diff --git a/cmake/GlfwImport.cmake b/cmake/GlfwImport.cmake index d0c23ca52..77c88e6c3 100644 --- a/cmake/GlfwImport.cmake +++ b/cmake/GlfwImport.cmake @@ -17,14 +17,15 @@ if(NOT glfw3_FOUND AND NOT USE_EXTERNAL_GLFW STREQUAL "ON" AND "${PLATFORM}" MAT set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(GLFW_INSTALL OFF CACHE BOOL "" FORCE) set(GLFW_USE_WAYLAND ${USE_WAYLAND} CACHE BOOL "" FORCE) + set(GLFW_LIBRARY_TYPE "OBJECT" CACHE STRING "" FORCE) - set(WAS_SHARED ${BUILD_SHARED_LIBS}) - set(BUILD_SHARED_LIBS OFF CACHE BOOL " " FORCE) add_subdirectory(external/glfw) - set(BUILD_SHARED_LIBS ${WAS_SHARED} CACHE BOOL " " FORCE) - unset(WAS_SHARED) + # Hide glfw's symbols when building a shared lib + if (BUILD_SHARED_LIBS) + set_property(TARGET glfw PROPERTY C_VISIBILITY_PRESET hidden) + endif() list(APPEND raylib_sources $) include_directories(BEFORE SYSTEM external/glfw/include) diff --git a/examples/Makefile b/examples/Makefile index 5cd8e6bba..11669e3a3 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -490,6 +490,7 @@ TEXTURES = \ textures/textures_gif_player \ textures/textures_image_drawing \ textures/textures_image_generation \ + textures/textures_image_kernel \ textures/textures_image_loading \ textures/textures_image_processing \ textures/textures_image_rotate \ diff --git a/examples/Makefile.Web b/examples/Makefile.Web index e8a726613..a3c2bb729 100644 --- a/examples/Makefile.Web +++ b/examples/Makefile.Web @@ -396,6 +396,7 @@ TEXTURES = \ textures/textures_gif_player \ textures/textures_image_drawing \ textures/textures_image_generation \ + textures/textures_image_kernel \ textures/textures_image_loading \ textures/textures_image_processing \ textures/textures_image_rotate \ @@ -702,6 +703,10 @@ textures/textures_image_drawing: textures/textures_image_drawing.c textures/textures_image_generation: textures/textures_image_generation.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 + +textures/textures_image_kernel: textures/textures_image_kernel.c + $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ + --preload-file textures/resources/cat.png@resources/cat.png textures/textures_image_loading: textures/textures_image_loading.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ @@ -968,10 +973,10 @@ shaders/shaders_julia_set: shaders/shaders_julia_set.c shaders/shaders_lightmap: shaders/shaders_lightmap.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s FORCE_FILESYSTEM=1 \ - --preload-file shaders/resources/shaders/glsl330/lightmap.vs \ - --preload-file shaders/resources/shaders/glsl330/lightmap.fs \ - --preload-file shaders/resources/cubicmap_atlas.png \ - --preload-file shaders/resources/spark_flame.png + --preload-file shaders/resources/shaders/glsl100/lightmap.vs@resources/shaders/glsl100/lightmap.vs \ + --preload-file shaders/resources/shaders/glsl100/lightmap.fs@resources/shaders/glsl100/lightmap.fs \ + --preload-file shaders/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png \ + --preload-file shaders/resources/spark_flame.png@resources/spark_flame.png shaders/shaders_mesh_instancing: shaders/shaders_mesh_instancing.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ diff --git a/examples/audio/audio_raw_stream.c b/examples/audio/audio_raw_stream.c index 6befa765a..b3173ab97 100644 --- a/examples/audio/audio_raw_stream.c +++ b/examples/audio/audio_raw_stream.c @@ -38,8 +38,7 @@ float sineIdx = 0.0f; void AudioInputCallback(void *buffer, unsigned int frames) { audioFrequency = frequency + (audioFrequency - frequency)*0.95f; - audioFrequency += 1.0f; - audioFrequency -= 1.0f; + float incr = audioFrequency/44100.0f; short *d = (short *)buffer; diff --git a/examples/audio/audio_stream_effects.c b/examples/audio/audio_stream_effects.c index 219305057..2262d41f9 100644 --- a/examples/audio/audio_stream_effects.c +++ b/examples/audio/audio_stream_effects.c @@ -2,7 +2,7 @@ * * raylib [audio] example - Music stream processing effects * -* Example originally created with raylib 4.2, last time updated with raylib 4.2 +* Example originally created with raylib 4.2, last time updated with raylib 5.0 * * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * BSD-like license that allows static linking with closed source software @@ -13,7 +13,7 @@ #include "raylib.h" -#include // Required for: NULL +#include // Required for: NULL // Required delay effect variables static float *delayBuffer = NULL; @@ -149,13 +149,17 @@ static void AudioProcessEffectLPF(void *buffer, unsigned int frames) static const float cutoff = 70.0f / 44100.0f; // 70 Hz lowpass filter const float k = cutoff / (cutoff + 0.1591549431f); // RC filter formula + // Converts the buffer data before using it + float *bufferData = (float *)buffer; for (unsigned int i = 0; i < frames*2; i += 2) { - float l = ((float *)buffer)[i], r = ((float *)buffer)[i + 1]; + const float l = bufferData[i]; + const float r = bufferData[i + 1]; + low[0] += k * (l - low[0]); low[1] += k * (r - low[1]); - ((float *)buffer)[i] = low[0]; - ((float *)buffer)[i + 1] = low[1]; + bufferData[i] = low[0]; + bufferData[i + 1] = low[1]; } } @@ -176,4 +180,4 @@ static void AudioProcessEffectDelay(void *buffer, unsigned int frames) delayBuffer[delayWriteIndex++] = ((float *)buffer)[i + 1]; if (delayWriteIndex == delayBufferSize) delayWriteIndex = 0; } -} \ No newline at end of file +} diff --git a/examples/core/core_vr_simulator.c b/examples/core/core_vr_simulator.c index fc2dee6b9..9acea1972 100644 --- a/examples/core/core_vr_simulator.c +++ b/examples/core/core_vr_simulator.c @@ -39,7 +39,6 @@ int main(void) .vResolution = 1200, // Vertical resolution in pixels .hScreenSize = 0.133793f, // Horizontal size in meters .vScreenSize = 0.0669f, // Vertical size in meters - .vScreenCenter = 0.04678f, // Screen center in meters .eyeToScreenDistance = 0.041f, // Distance between eye and display in meters .lensSeparationDistance = 0.07f, // Lens separation distance in meters .interpupillaryDistance = 0.07f, // IPD (distance between pupils) in meters diff --git a/examples/shaders/resources/models/old_car_new.glb b/examples/shaders/resources/models/old_car_new.glb new file mode 100644 index 000000000..119995ca7 Binary files /dev/null and b/examples/shaders/resources/models/old_car_new.glb differ diff --git a/examples/shaders/resources/models/plane.glb b/examples/shaders/resources/models/plane.glb new file mode 100644 index 000000000..452e1c5bf Binary files /dev/null and b/examples/shaders/resources/models/plane.glb differ diff --git a/examples/shaders/resources/old_car_d.png b/examples/shaders/resources/old_car_d.png new file mode 100644 index 000000000..d8b3c833d Binary files /dev/null and b/examples/shaders/resources/old_car_d.png differ diff --git a/examples/shaders/resources/old_car_e.png b/examples/shaders/resources/old_car_e.png new file mode 100644 index 000000000..23f01c0fe Binary files /dev/null and b/examples/shaders/resources/old_car_e.png differ diff --git a/examples/shaders/resources/old_car_mra.png b/examples/shaders/resources/old_car_mra.png new file mode 100644 index 000000000..0fb46b336 Binary files /dev/null and b/examples/shaders/resources/old_car_mra.png differ diff --git a/examples/shaders/resources/old_car_n.png b/examples/shaders/resources/old_car_n.png new file mode 100644 index 000000000..11f689fe2 Binary files /dev/null and b/examples/shaders/resources/old_car_n.png differ diff --git a/examples/shaders/resources/road_a.png b/examples/shaders/resources/road_a.png new file mode 100644 index 000000000..103777398 Binary files /dev/null and b/examples/shaders/resources/road_a.png differ diff --git a/examples/shaders/resources/road_mra.png b/examples/shaders/resources/road_mra.png new file mode 100644 index 000000000..988c839cc Binary files /dev/null and b/examples/shaders/resources/road_mra.png differ diff --git a/examples/shaders/resources/road_n.png b/examples/shaders/resources/road_n.png new file mode 100644 index 000000000..a5f3548c1 Binary files /dev/null and b/examples/shaders/resources/road_n.png differ diff --git a/examples/shaders/resources/shaders/glsl100/lightmap.fs b/examples/shaders/resources/shaders/glsl100/lightmap.fs new file mode 100644 index 000000000..9f0bcd27b --- /dev/null +++ b/examples/shaders/resources/shaders/glsl100/lightmap.fs @@ -0,0 +1,22 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec2 fragTexCoord2; +varying vec3 fragPosition; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform sampler2D texture1; + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture2D(texture0, fragTexCoord); + vec4 texelColor2 = texture2D(texture1, fragTexCoord2); + + gl_FragColor = texelColor * texelColor2; +} diff --git a/examples/shaders/resources/shaders/glsl100/lightmap.vs b/examples/shaders/resources/shaders/glsl100/lightmap.vs new file mode 100644 index 000000000..f5d87b3e3 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl100/lightmap.vs @@ -0,0 +1,31 @@ +#version 100 + +// Input vertex attributes +attribute vec3 vertexPosition; +attribute vec2 vertexTexCoord; +attribute vec2 vertexTexCoord2; +attribute vec4 vertexColor; + +// Input uniform values +uniform mat4 mvp; +uniform mat4 matModel; + +// Output vertex attributes (to fragment shader) +varying vec3 fragPosition; +varying vec2 fragTexCoord; +varying vec2 fragTexCoord2; +varying vec4 fragColor; + +// NOTE: Add here your custom variables + +void main() +{ + // Send vertex attributes to fragment shader + fragPosition = vec3(matModel*vec4(vertexPosition, 1.0)); + fragTexCoord = vertexTexCoord; + fragTexCoord2 = vertexTexCoord2; + fragColor = vertexColor; + + // Calculate final vertex position + gl_Position = mvp*vec4(vertexPosition, 1.0); +} diff --git a/examples/shaders/resources/shaders/glsl100/pbr.fs b/examples/shaders/resources/shaders/glsl100/pbr.fs new file mode 100644 index 000000000..1ada83317 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl100/pbr.fs @@ -0,0 +1,156 @@ +#version 100 + +precision mediump float; + +#define MAX_LIGHTS 4 +#define LIGHT_DIRECTIONAL 0 +#define LIGHT_POINT 1 +#define PI 3.14159265358979323846 + +struct Light { + int enabled; + int type; + vec3 position; + vec3 target; + vec4 color; + float intensity; +}; + +// Input vertex attributes (from vertex shader) +varying in vec3 fragPosition; +varying in vec2 fragTexCoord; +varying in vec4 fragColor; +varying in vec3 fragNormal; +varying in vec4 shadowPos; +varying in mat3 TBN; + + +// Input uniform values +uniform int numOfLights; +uniform sampler2D albedoMap; +uniform sampler2D mraMap; +uniform sampler2D normalMap; +uniform sampler2D emissiveMap; // r: Hight g:emissive + +uniform vec2 tiling; +uniform vec2 offset; + +uniform int useTexAlbedo; +uniform int useTexNormal; +uniform int useTexMRA; +uniform int useTexEmissive; + +uniform vec4 albedoColor; +uniform vec4 emissiveColor; +uniform float normalValue; +uniform float metallicValue; +uniform float roughnessValue; +uniform float aoValue; +uniform float emissivePower; + +// Input lighting values +uniform Light lights[MAX_LIGHTS]; +uniform vec3 viewPos; + +uniform vec3 ambientColor; +uniform float ambient; + +// refl in range 0 to 1 +// returns base reflectivity to 1 +// incrase reflectivity when surface view at larger angle +vec3 schlickFresnel(float hDotV,vec3 refl) +{ + return refl + (1.0 - refl) * pow(1.0 - hDotV,5.0); +} + +float ggxDistribution(float nDotH,float roughness) +{ + float a = roughness * roughness * roughness * roughness; + float d = nDotH * nDotH * (a - 1.0) + 1.0; + d = PI * d * d; + return a / max(d,0.0000001); +} + +float geomSmith(float nDotV,float nDotL,float roughness) +{ + float r = roughness + 1.0; + float k = r * r / 8.0; + float ik = 1.0 - k; + float ggx1 = nDotV / (nDotV * ik + k); + float ggx2 = nDotL / (nDotL * ik + k); + return ggx1 * ggx2; +} + +vec3 pbr(){ + vec3 albedo = texture2D(albedoMap,vec2(fragTexCoord.x*tiling.x+offset.x,fragTexCoord.y*tiling.y+offset.y)).rgb; + albedo = vec3(albedoColor.x*albedo.x,albedoColor.y*albedo.y,albedoColor.z*albedo.z); + float metallic = clamp(metallicValue,0.0,1.0); + float roughness = clamp(roughnessValue,0.0,1.0); + float ao = clamp(aoValue,0.0,1.0); + if(useTexMRA == 1) { + vec4 mra = texture2D(mraMap, vec2(fragTexCoord.x * tiling.x + offset.x, fragTexCoord.y * tiling.y + offset.y)); + metallic = clamp(mra.r+metallicValue,0.04,1.0); + roughness = clamp(mra.g+roughnessValue,0.04,1.0); + ao = (mra.b+aoValue)*0.5; + } + + + + vec3 N = normalize(fragNormal); + if(useTexNormal == 1) { + N = texture2D(normalMap, vec2(fragTexCoord.x * tiling.x + offset.y, fragTexCoord.y * tiling.y + offset.y)).rgb; + N = normalize(N * 2.0 - 1.0); + N = normalize(N * TBN); + } + + vec3 V = normalize(viewPos - fragPosition); + + vec3 e = vec3(0); + e = (texture2D(emissiveMap, vec2(fragTexCoord.x*tiling.x+offset.x, fragTexCoord.y*tiling.y+offset.y)).rgb).g * emissiveColor.rgb*emissivePower * float(useTexEmissive); + + //return N;//vec3(metallic,metallic,metallic); + //if dia-electric use base reflectivity of 0.04 otherwise ut is a metal use albedo as base reflectivity + vec3 baseRefl = mix(vec3(0.04),albedo.rgb,metallic); + vec3 Lo = vec3(0.0); // acumulate lighting lum + + for(int i=0;ipbrShader = pbrShader; + + pbrMat->texAlbedo = (Texture2D){0}; + pbrMat->texNormal = (Texture2D){0}; + pbrMat->texMRA = (Texture2D){0}; + pbrMat->texEmissive = (Texture2D){0}; + + //PBRParam + pbrMat->albedo[0] = 1.0; + pbrMat->albedo[1] = 1.0; + pbrMat->albedo[2] = 1.0; + pbrMat->albedo[3] = 1.0; + pbrMat->metallic = 0; + pbrMat->roughness = 0; + pbrMat->ao = 1.0; + pbrMat->normal = 1; + pbrMat->emissive[0] = 0; + pbrMat->emissive[1] = 0; + pbrMat->emissive[2] = 0; + pbrMat->emissive[3] = 0; + + pbrMat->texTiling[0] = 1.0; + pbrMat->texTiling[1] = 1.0; + pbrMat->texOffset[0] = 0.0; + pbrMat->texOffset[1] = 0.0; + pbrMat->emissivePower = 1.0; + // Set up PBR shader material locations + + pbrMat->albedoLoc = GetShaderLocation(pbrMat->pbrShader, "albedoColor"); + pbrMat->normalLoc = GetShaderLocation(pbrMat->pbrShader, "normalValue"); + pbrMat->metallicLoc = GetShaderLocation(pbrMat->pbrShader, "metallicValue"); + pbrMat->roughnessLoc = GetShaderLocation(pbrMat->pbrShader, "roughnessValue"); + pbrMat->aoLoc = GetShaderLocation(pbrMat->pbrShader, "aoValue"); + pbrMat->emissiveColorLoc = GetShaderLocation(pbrMat->pbrShader, "emissiveColor"); + pbrMat->emissivePowerLoc = GetShaderLocation(pbrMat->pbrShader, "emissivePower"); + + pbrMat->texTilingLoc = GetShaderLocation(pbrMat->pbrShader, "tiling"); + pbrMat->texOffsetLoc = GetShaderLocation(pbrMat->pbrShader, "offset"); + + pbrMat->useTexAlbedoLoc = GetShaderLocation(pbrMat->pbrShader, "useTexAlbedo"); + pbrMat->useTexNormalLoc = GetShaderLocation(pbrMat->pbrShader, "useTexNormal"); + pbrMat->useTexMRAELoc = GetShaderLocation(pbrMat->pbrShader, "useTexMRA"); + pbrMat->useTexEmissiveLoc = GetShaderLocation(pbrMat->pbrShader, "useTexEmissive"); + + SetShaderValue(pbrMat->pbrShader,pbrMat->albedoLoc,pbrMat->albedo,SHADER_UNIFORM_VEC4); + SetShaderValue(pbrMat->pbrShader, pbrMat->emissiveColorLoc, pbrMat->emissive, SHADER_UNIFORM_VEC4); + SetShaderValue(pbrMat->pbrShader, pbrMat->emissivePowerLoc, &pbrMat->emissivePower, SHADER_UNIFORM_FLOAT); + SetShaderValue(pbrMat->pbrShader,pbrMat->metallicLoc,&pbrMat->metallic,SHADER_UNIFORM_FLOAT); + SetShaderValue(pbrMat->pbrShader,pbrMat->roughnessLoc,&pbrMat->roughness,SHADER_UNIFORM_FLOAT); + SetShaderValue(pbrMat->pbrShader,pbrMat->aoLoc,&pbrMat->ao,SHADER_UNIFORM_FLOAT); + SetShaderValue(pbrMat->pbrShader,pbrMat->normalLoc,&pbrMat->normal,SHADER_UNIFORM_FLOAT); + SetShaderValue(pbrMat->pbrShader,pbrMat->texTilingLoc,pbrMat->texTiling,SHADER_UNIFORM_VEC2); + SetShaderValue(pbrMat->pbrShader,pbrMat->texOffsetLoc,pbrMat->texOffset,SHADER_UNIFORM_VEC2); +} + +void PBRLoadTextures(PBRMaterial *pbrMat,PBRTexType pbrTexType,const char *fileName){ + if(pbrMat == NULL) return; + switch(pbrTexType){ + case PBR_TEXTURE_ALBEDO: + pbrMat->texAlbedo = LoadTexture(fileName); + pbrMat->useTexAlbedo = 1; + break; + case PBR_TEXTURE_MRA: + pbrMat->texMRA = LoadTexture(fileName); + pbrMat->useTexMRA = 1; + break; + case PBR_TEXTURE_NORMAL: + pbrMat->texNormal = LoadTexture(fileName); + pbrMat->useTexNormal = 1; + break; + case PBR_TEXTURE_EMISSIVE: + pbrMat->texEmissive = LoadTexture(fileName); + pbrMat->useTexEmissive = 1; + break; + } +} + +void UnloadPBRMaterial(PBRMaterial pbrMat){ + if(pbrMat.useTexAlbedo == 1) UnloadTexture(pbrMat.texAlbedo); + if(pbrMat.useTexNormal == 1) UnloadTexture(pbrMat.texNormal); + if(pbrMat.useTexMRA == 1) UnloadTexture(pbrMat.texMRA); + if(pbrMat.useTexEmissive == 1) UnloadTexture(pbrMat.texEmissive); +} + +void PBRSetColor(PBRMaterial *pbrMat,PBRColorType pbrColorType,Color color){ + if(pbrMat == NULL) return; + switch(pbrColorType){ + case PBR_COLOR_ALBEDO: + pbrMat->albedo[0] = (float) color.r / 255; + pbrMat->albedo[1] = (float) color.g / 255; + pbrMat->albedo[2] = (float) color.b / 255; + pbrMat->albedo[3] = (float) color.a / 255; + SetShaderValue(pbrMat->pbrShader,pbrMat->albedoLoc,pbrMat->albedo,SHADER_UNIFORM_VEC4); + break; + case PBR_COLOR_EMISSIVE: + pbrMat->emissive[0] = (float) color.r / 255; + pbrMat->emissive[1] = (float) color.g / 255; + pbrMat->emissive[2] = (float) color.b / 255; + pbrMat->emissive[3] = (float) color.a / 255; + SetShaderValue(pbrMat->pbrShader, pbrMat->emissiveColorLoc, pbrMat->emissive, SHADER_UNIFORM_VEC4); + break; + } +} + +void PBRSetFloat(PBRMaterial *pbrMat, PBRFloatType pbrParamType, float value){ + if(pbrMat == NULL) return; + switch(pbrParamType){ + case PBR_PARAM_METALLIC: + pbrMat->metallic = value; + SetShaderValue(pbrMat->pbrShader,pbrMat->metallicLoc,&pbrMat->metallic,SHADER_UNIFORM_FLOAT); + break; + case PBR_PARAM_ROUGHNESS: + pbrMat->roughness = value; + SetShaderValue(pbrMat->pbrShader,pbrMat->roughnessLoc,&pbrMat->roughness,SHADER_UNIFORM_FLOAT); + break; + case PBR_PARAM_NORMAL: + pbrMat->normal = value; + SetShaderValue(pbrMat->pbrShader,pbrMat->normalLoc,&pbrMat->normal,SHADER_UNIFORM_FLOAT); + break; + case PBR_PARAM_AO: + pbrMat->ao = value; + SetShaderValue(pbrMat->pbrShader,pbrMat->aoLoc,&pbrMat->ao,SHADER_UNIFORM_FLOAT); + break; + case PBR_PARAM_EMISSIVE: + pbrMat->emissivePower = value; + SetShaderValue(pbrMat->pbrShader,pbrMat->emissivePowerLoc,&pbrMat->emissivePower,SHADER_UNIFORM_FLOAT); + break; + } +} + + +void PBRSetVec2(PBRMaterial *pbrMat,PBRVec2Type type,Vector2 value){ + switch(type){ + case PBR_VEC2_TILING: + pbrMat->texTiling[0] = value.x; + pbrMat->texTiling[1] = value.y; + SetShaderValue(pbrMat->pbrShader,pbrMat->texTilingLoc,&pbrMat->texTiling,SHADER_UNIFORM_VEC2); + break; + case PBR_VEC2_OFFSET: + pbrMat->texOffset[0] = value.x; + pbrMat->texOffset[1] = value.y; + SetShaderValue(pbrMat->pbrShader,pbrMat->texOffsetLoc,&pbrMat->texOffset,SHADER_UNIFORM_VEC2); + break; + } +} + +void PBRSetMaterial(PBRModel* model,PBRMaterial* pbrMat,int matIndex){ + + + model->pbrMat = *pbrMat; + model->model.materials[matIndex].shader = model->pbrMat.pbrShader; + pbrMat->pbrShader.locs[SHADER_LOC_MAP_MRA] = GetShaderLocation(pbrMat->pbrShader, "mraMap"); + pbrMat->pbrShader.locs[SHADER_LOC_MAP_EMISSIVE] = GetShaderLocation(pbrMat->pbrShader, "emissiveMap"); + pbrMat->pbrShader.locs[SHADER_LOC_MAP_NORMAL] = GetShaderLocation(pbrMat->pbrShader, "normalMap"); + + if(pbrMat->useTexAlbedo) { + model->model.materials[matIndex].maps[MATERIAL_MAP_ALBEDO].texture = pbrMat->texAlbedo; + } + if(pbrMat->useTexMRA) { + model->model.materials[matIndex].maps[MATERIAL_MAP_MRA].texture = pbrMat->texMRA; + } + if(pbrMat->useTexNormal) { + model->model.materials[matIndex].maps[MATERIAL_MAP_NORMAL].texture = pbrMat->texNormal; + } + if(pbrMat->useTexEmissive) { + model->model.materials[matIndex].maps[MATERIAL_MAP_EMISSIVE].texture = pbrMat->texEmissive; + } + + SetShaderValue(pbrMat->pbrShader,pbrMat->useTexAlbedoLoc,&pbrMat->useTexAlbedo,SHADER_UNIFORM_INT); + SetShaderValue(pbrMat->pbrShader,pbrMat->useTexNormalLoc,&pbrMat->useTexNormal,SHADER_UNIFORM_INT); + SetShaderValue(pbrMat->pbrShader, pbrMat->useTexMRAELoc, &pbrMat->useTexMRA, SHADER_UNIFORM_INT); + SetShaderValue(pbrMat->pbrShader, pbrMat->useTexEmissiveLoc, &pbrMat->useTexEmissive, SHADER_UNIFORM_INT); +} + +void PBRDrawModel(PBRModel pbrModel, Vector3 position, float scale){ + PBRMaterial *pbrMat = &pbrModel.pbrMat; + SetShaderValue(pbrMat->pbrShader,pbrMat->albedoLoc,pbrMat->albedo,SHADER_UNIFORM_VEC4); + SetShaderValue(pbrMat->pbrShader, pbrMat->emissiveColorLoc, pbrMat->emissive, SHADER_UNIFORM_VEC4); + SetShaderValue(pbrMat->pbrShader,pbrMat->metallicLoc,&pbrMat->metallic,SHADER_UNIFORM_FLOAT); + SetShaderValue(pbrMat->pbrShader,pbrMat->roughnessLoc,&pbrMat->roughness,SHADER_UNIFORM_FLOAT); + SetShaderValue(pbrMat->pbrShader,pbrMat->aoLoc,&pbrMat->ao,SHADER_UNIFORM_FLOAT); + SetShaderValue(pbrMat->pbrShader,pbrMat->normalLoc,&pbrMat->normal,SHADER_UNIFORM_FLOAT); + SetShaderValue(pbrMat->pbrShader,pbrMat->texTilingLoc,pbrMat->texTiling,SHADER_UNIFORM_VEC2); + SetShaderValue(pbrMat->pbrShader,pbrMat->texOffsetLoc,pbrMat->texOffset,SHADER_UNIFORM_VEC2); + + SetShaderValue(pbrMat->pbrShader,pbrMat->useTexAlbedoLoc,&pbrMat->useTexAlbedo,SHADER_UNIFORM_INT); + SetShaderValue(pbrMat->pbrShader,pbrMat->useTexNormalLoc,&pbrMat->useTexNormal,SHADER_UNIFORM_INT); + SetShaderValue(pbrMat->pbrShader, pbrMat->useTexMRAELoc, &pbrMat->useTexMRA, SHADER_UNIFORM_INT); + SetShaderValue(pbrMat->pbrShader, pbrMat->useTexEmissiveLoc, &pbrMat->useTexEmissive, SHADER_UNIFORM_INT); + + DrawModel(pbrModel.model,position,scale,WHITE); +} + +PBRModel PBRModelLoad(const char *fileName){ + PBRModel pbrModel = (PBRModel){0}; + pbrModel.model = LoadModel(fileName); + return pbrModel; +} + +PBRModel PBRModelLoadFromMesh(Mesh mesh){ + PBRModel pbrModel = (PBRModel){0}; + pbrModel.model = LoadModelFromMesh(mesh); + return pbrModel; +} +#endif // RPBR_IMPLEMENTATION diff --git a/examples/shaders/shaders_basic_pbr.c b/examples/shaders/shaders_basic_pbr.c new file mode 100644 index 000000000..92a888811 --- /dev/null +++ b/examples/shaders/shaders_basic_pbr.c @@ -0,0 +1,171 @@ +/******************************************************************************************* +* +* raylib [core] example - Model Defuse Normal Shader (adapted for HTML5 platform) +* +* This example is prepared to compile for PLATFORM_WEB and PLATFORM_DESKTOP +* As you will notice, code structure is slightly different to the other examples... +* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning +* +* This example has been created using raylib 5.0 (www.raylib.com) +* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) +* +* Copyright (c) 2023-2024 Afan OLOVCIC (@_DevDad) 2015 Ramon Santamaria (@raysan5) +* Model: "Old Rusty Car" (https://skfb.ly/LxRy) by Renafox is licensed under Creative Commons Attribution-NonCommercial (http://creativecommons.org/licenses/by-nc/4.0/). +********************************************************************************************/ + +#include "raylib.h" + +#if defined(PLATFORM_WEB) +#include +#endif + +#define RPBR_IMPLEMENTATION +#include "rpbr.h" + +#if defined(PLATFORM_DESKTOP) +#define GLSL_VERSION 330 +#else // PLATFORM_ANDROID, PLATFORM_WEB +#define GLSL_VERSION 120 +#endif + + +//---------------------------------------------------------------------------------- +// Main Entry Point +//---------------------------------------------------------------------------------- +int main() +{ + // Initialization + //-------------------------------------------------------------------------------------- + const int screenWidth = 800; + const int screenHeight = 450; + + SetConfigFlags(FLAG_MSAA_4X_HINT); + InitWindow(screenWidth, screenHeight, "raylib [shaders] example - basic pbr"); + + // Define the camera to look into our 3d world + Camera camera = { 0 }; + camera.position = (Vector3){ 2.0f, 2.0f, 6.0f }; // Camera position + camera.target = (Vector3){ 0.0f, 0.5f, 0.0f }; // Camera looking at point + camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target) + camera.fovy = 45.0f; // Camera field-of-view Y + camera.projection = CAMERA_PERSPECTIVE; // Camera projection type + + + Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/pbr.vs",GLSL_VERSION), + TextFormat("resources/shaders/glsl%i/pbr.fs",GLSL_VERSION)); + + + + PBRModel model = PBRModelLoad("resources/models/old_car_new.glb"); + //if we use obj file formator if model doesn't have tangents we have to calculate MeshTangents + //by using raylib function GenMeshTangents(mesh) for example: obj file doesn't support tangents + //GenMeshTangents(&model.model.meshes[0]); + + PBRMaterial model_mat = (PBRMaterial){0}; + PBRMaterialSetup(&model_mat, shader, NULL); //environment = NULL for now + PBRLoadTextures(&model_mat, PBR_TEXTURE_ALBEDO, "resources/old_car_d.png"); + PBRLoadTextures(&model_mat, PBR_TEXTURE_MRA, "resources/old_car_mra.png"); + PBRLoadTextures(&model_mat, PBR_TEXTURE_NORMAL, "resources/old_car_n.png"); + PBRLoadTextures(&model_mat, PBR_TEXTURE_EMISSIVE, "resources/old_car_e.png"); + PBRSetColor(&model_mat,PBR_COLOR_EMISSIVE, (Color){255,162,0,255}); + PBRSetVec2(&model_mat, PBR_VEC2_TILING,(Vector2){0.5,0.5}); + PBRSetMaterial(&model,&model_mat,0); + + PBRModel floor = PBRModelLoad("resources/models/plane.glb"); + + PBRMaterial floor_mat = (PBRMaterial){0}; + PBRMaterialSetup(&floor_mat, shader, NULL); + PBRLoadTextures(&floor_mat, PBR_TEXTURE_ALBEDO, "resources/road_a.png"); + PBRLoadTextures(&floor_mat, PBR_TEXTURE_MRA, "resources/road_mra.png"); + PBRLoadTextures(&floor_mat, PBR_TEXTURE_NORMAL, "resources/road_n.png"); + PBRSetVec2(&floor_mat, PBR_VEC2_TILING,(Vector2){0.5,0.5}); + PBRSetMaterial(&floor,&floor_mat,0); + + shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos"); + int numOfLightsLoc = GetShaderLocation(shader, "numOfLights"); + int numOfLights = 4; + SetShaderValue(shader, numOfLightsLoc, &numOfLights, SHADER_UNIFORM_INT); + + Color ambCol = (Color){26,32,135,255}; + float ambIntens = 0.02; + + int albedoLoc = GetShaderLocation(shader, "albedo"); + PBRSetAmbient(shader,ambCol,ambIntens); + + // Create lights + PBRLight lights[MAX_LIGHTS] = { 0 }; + lights[0] = PBRLightCreate(LIGHT_POINT, (Vector3){ -1, 1, -2 }, (Vector3){0,0,0}, YELLOW,4, shader); + lights[1] = PBRLightCreate(LIGHT_POINT, (Vector3){ 2, 1, 1 }, (Vector3){0,0,0}, GREEN,3.3, shader); + lights[2] = PBRLightCreate(LIGHT_POINT, (Vector3){ -2, 1, 1 }, (Vector3){0,0,0}, RED,8.3, shader); + lights[3] = PBRLightCreate(LIGHT_POINT, (Vector3){ 1, 1, -2 }, (Vector3){0,0,0}, BLUE,2, shader); + SetShaderValueV(shader, GetShaderLocation(shader, "lights"), lights, SHADER_UNIFORM_FLOAT, numOfLights); + + SetTargetFPS(60); // Set our game to run at 60 frames-per-second------------------------------------------------------------- + + int emissiveCnt = 0; + // Main game loop + while (!WindowShouldClose()) // Detect window close button or ESC key + { + // Update + //---------------------------------------------------------------------------------- + UpdateCamera(&camera, CAMERA_ORBITAL); + + // Update the shader with the camera view vector (points towards { 0.0f, 0.0f, 0.0f }) + float cameraPos[3] = {camera.position.x, camera.position.y, camera.position.z}; + SetShaderValue(shader, shader.locs[SHADER_LOC_VECTOR_VIEW], cameraPos, SHADER_UNIFORM_VEC3); + + // Check key inputs to enable/disable lights + if (IsKeyPressed(KEY_Y)) { lights[0].enabled = !lights[0].enabled; } + if (IsKeyPressed(KEY_G)) { lights[1].enabled = !lights[1].enabled; } + if (IsKeyPressed(KEY_R)) { lights[2].enabled = !lights[2].enabled; } + if (IsKeyPressed(KEY_B)) { lights[3].enabled = !lights[3].enabled; } + + // Update light values (actually, only enable/disable them) + for (int i = 0; i < MAX_LIGHTS; i++) PBRLightUpdate(shader, lights[i]); + emissiveCnt--; + if(emissiveCnt<=0){ + emissiveCnt = GetRandomValue(0,20); + PBRSetFloat(&model_mat,PBR_PARAM_EMISSIVE,(float)GetRandomValue(0,100)/100); + } + //---------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + BeginDrawing(); + ClearBackground(BLACK); + BeginMode3D(camera); + + PBRDrawModel(floor, (Vector3){0,0,0}, 5.0f); + PBRDrawModel(model, (Vector3) {0, 0.0, 0}, 0.005); + + // Draw spheres to show where the lights are + for (int i = 0; i < MAX_LIGHTS; i++) { + Color col = (Color) {lights[i].color[0] * 255, lights[i].color[1] * 255, lights[i].color[2] * 255, + lights[i].color[3] * 255}; + if (lights[i].enabled) DrawSphereEx(lights[i].position, 0.2f, 8, 8, col); + else DrawSphereWires(lights[i].position, 0.2f, 8, 8, ColorAlpha(col, 0.3f)); + } + EndMode3D(); + + DrawText("(c) Old Rusty Car model by Renafox (https://skfb.ly/LxRy)", screenWidth - 320, screenHeight - 20, 10, GRAY); + DrawFPS(10, 10); + + EndDrawing(); + //---------------------------------------------------------------------------------- + } + + //-------------------------------------------------------------------------------------- + // De-Initialization + //-------------------------------------------------------------------------------------- + + UnloadModel(floor.model); // Unload model + UnloadModel(model.model); // Unload model + UnloadShader(shader); // Unload Shader + UnloadPBRMaterial(floor_mat); // Unload PBRMaterial + UnloadPBRMaterial(model_mat); // Unload PBRMaterial + + CloseWindow(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- + + return 0; + } diff --git a/examples/shaders/shaders_lightmap.c b/examples/shaders/shaders_lightmap.c index c5ed6094c..445d81d24 100644 --- a/examples/shaders/shaders_lightmap.c +++ b/examples/shaders/shaders_lightmap.c @@ -170,4 +170,3 @@ int main(void) return 0; } - diff --git a/examples/textures/textures_image_kernel.c b/examples/textures/textures_image_kernel.c new file mode 100644 index 000000000..9944ac791 --- /dev/null +++ b/examples/textures/textures_image_kernel.c @@ -0,0 +1,130 @@ +/******************************************************************************************* +* +* raylib [textures] example - Image loading and texture creation +* +* NOTE: Images are loaded in CPU memory (RAM); textures are loaded in GPU memory (VRAM) +* +* Example originally created with raylib 1.3, last time updated with raylib 1.3 +* +* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, +* BSD-like license that allows static linking with closed source software +* +* Copyright (c) 2015-2023 Karim Salem (@kimo-s) +* +********************************************************************************************/ + +#include "raylib.h" + +//------------------------------------------------------------------------------------ +// Program main entry point +//------------------------------------------------------------------------------------ +void NormalizeKernel(float *kernel, int size) +{ + float sum = 0.0f; + for (int i = 0; i < size; i++) sum += kernel[i]; + + if (sum != 0.0f) + { + for (int i = 0; i < size; i++) kernel[i] /= sum; + } +} + +int main(void) +{ + // Initialization + //-------------------------------------------------------------------------------------- + const int screenWidth = 800; + const int screenHeight = 450; + + InitWindow(screenWidth, screenHeight, "raylib [textures] example - image convolution"); + + Image image = LoadImage("resources/cat.png"); // Loaded in CPU memory (RAM) + + float gaussiankernel[] = { + 1.0f, 2.0f, 1.0f, + 2.0f, 4.0f, 2.0f, + 1.0f, 2.0f, 1.0f }; + + float sobelkernel[] = { + 1.0f, 0.0f, -1.0f, + 2.0f, 0.0f, -2.0f, + 1.0f, 0.0f, -1.0f }; + + float sharpenkernel[] = { + 0.0f, -1.0f, 0.0f, + -1.0f, 5.0f, -1.0f, + 0.0f, -1.0f, 0.0f }; + + NormalizeKernel(gaussiankernel, 9); + NormalizeKernel(sharpenkernel, 9); + NormalizeKernel(sobelkernel, 9); + + Image catSharpend = ImageCopy(image); + ImageKernelConvolution(&catSharpend, sharpenkernel, 9); + + Image catSobel = ImageCopy(image); + ImageKernelConvolution(&catSobel, sobelkernel, 9); + + Image catGaussian = ImageCopy(image); + + for (int i = 0; i < 6; i++) + { + ImageKernelConvolution(&catGaussian, gaussiankernel, 9); + } + + ImageCrop(&image, (Rectangle){ 0, 0, (float)200, (float)450 }); + ImageCrop(&catGaussian, (Rectangle){ 0, 0, (float)200, (float)450 }); + ImageCrop(&catSobel, (Rectangle){ 0, 0, (float)200, (float)450 }); + ImageCrop(&catSharpend, (Rectangle){ 0, 0, (float)200, (float)450 }); + + // Images converted to texture, GPU memory (VRAM) + Texture2D texture = LoadTextureFromImage(image); + Texture2D catSharpendTexture = LoadTextureFromImage(catSharpend); + Texture2D catSobelTexture = LoadTextureFromImage(catSobel); + Texture2D catGaussianTexture = LoadTextureFromImage(catGaussian); + + // Once images have been converted to texture and uploaded to VRAM, + // they can be unloaded from RAM + UnloadImage(image); + UnloadImage(catGaussian); + UnloadImage(catSobel); + UnloadImage(catSharpend); + + SetTargetFPS(60); // Set our game to run at 60 frames-per-second + //--------------------------------------------------------------------------------------- + + // Main game loop + while (!WindowShouldClose()) // Detect window close button or ESC key + { + // Update + //---------------------------------------------------------------------------------- + // TODO: Update your variables here + //---------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + BeginDrawing(); + + ClearBackground(RAYWHITE); + + DrawTexture(catSharpendTexture, 0, 0, WHITE); + DrawTexture(catSobelTexture, 200, 0, WHITE); + DrawTexture(catGaussianTexture, 400, 0, WHITE); + DrawTexture(texture, 600, 0, WHITE); + + EndDrawing(); + //---------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + UnloadTexture(texture); + UnloadTexture(catGaussianTexture); + UnloadTexture(catSobelTexture); + UnloadTexture(catSharpendTexture); + + CloseWindow(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- + + return 0; +} diff --git a/examples/textures/textures_image_kernel.png b/examples/textures/textures_image_kernel.png new file mode 100644 index 000000000..0fb36d128 Binary files /dev/null and b/examples/textures/textures_image_kernel.png differ diff --git a/logo/raylib.icns b/logo/raylib.icns new file mode 100644 index 000000000..5adad08cb Binary files /dev/null and b/logo/raylib.icns differ diff --git a/logo/raylib_1024x1024.png b/logo/raylib_1024x1024.png new file mode 100644 index 000000000..b855a6bf6 Binary files /dev/null and b/logo/raylib_1024x1024.png differ diff --git a/parser/output/raylib_api.json b/parser/output/raylib_api.json index ef94c3d86..4b7049d8d 100644 --- a/parser/output/raylib_api.json +++ b/parser/output/raylib_api.json @@ -9,13 +9,13 @@ { "name": "RAYLIB_VERSION_MAJOR", "type": "INT", - "value": 4, + "value": 5, "description": "" }, { "name": "RAYLIB_VERSION_MINOR", "type": "INT", - "value": 6, + "value": 1, "description": "" }, { @@ -27,7 +27,7 @@ { "name": "RAYLIB_VERSION", "type": "STRING", - "value": "4.6-dev", + "value": "5.1-dev", "description": "" }, { @@ -1329,6 +1329,48 @@ "description": "Filepaths entries" } ] + }, + { + "name": "AutomationEvent", + "description": "Automation event", + "fields": [ + { + "type": "unsigned int", + "name": "frame", + "description": "Event frame" + }, + { + "type": "unsigned int", + "name": "type", + "description": "Event type (AutomationEventType)" + }, + { + "type": "int[4]", + "name": "params", + "description": "Event parameters (if required)" + } + ] + }, + { + "name": "AutomationEventList", + "description": "Automation event list", + "fields": [ + { + "type": "unsigned int", + "name": "capacity", + "description": "Events max entries (MAX_AUTOMATION_EVENTS)" + }, + { + "type": "unsigned int", + "name": "count", + "description": "Events entries count" + }, + { + "type": "AutomationEvent *", + "name": "events", + "description": "Events entries" + } + ] } ], "aliases": [ @@ -3092,16 +3134,16 @@ } ] }, - { - "name": "WindowShouldClose", - "description": "Check if KEY_ESCAPE pressed or Close icon pressed", - "returnType": "bool" - }, { "name": "CloseWindow", "description": "Close window and unload OpenGL context", "returnType": "void" }, + { + "name": "WindowShouldClose", + "description": "Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)", + "returnType": "bool" + }, { "name": "IsWindowReady", "description": "Check if window has been initialized successfully", @@ -3467,27 +3509,6 @@ "description": "Disable waiting for events on EndDrawing(), automatic events polling", "returnType": "void" }, - { - "name": "SwapScreenBuffer", - "description": "Swap back buffer with front buffer (screen drawing)", - "returnType": "void" - }, - { - "name": "PollInputEvents", - "description": "Register all input events", - "returnType": "void" - }, - { - "name": "WaitTime", - "description": "Wait for some time (halt program execution)", - "returnType": "void", - "params": [ - { - "type": "double", - "name": "seconds" - } - ] - }, { "name": "ShowCursor", "description": "Shows cursor", @@ -3971,11 +3992,6 @@ } ] }, - { - "name": "GetFPS", - "description": "Get current FPS", - "returnType": "int" - }, { "name": "GetFrameTime", "description": "Get time in seconds for last frame drawn (delta time)", @@ -3986,6 +4002,43 @@ "description": "Get elapsed time in seconds since InitWindow()", "returnType": "double" }, + { + "name": "GetFPS", + "description": "Get current FPS", + "returnType": "int" + }, + { + "name": "SwapScreenBuffer", + "description": "Swap back buffer with front buffer (screen drawing)", + "returnType": "void" + }, + { + "name": "PollInputEvents", + "description": "Register all input events", + "returnType": "void" + }, + { + "name": "WaitTime", + "description": "Wait for some time (halt program execution)", + "returnType": "void", + "params": [ + { + "type": "double", + "name": "seconds" + } + ] + }, + { + "name": "SetRandomSeed", + "description": "Set the seed for the random number generator", + "returnType": "void", + "params": [ + { + "type": "unsigned int", + "name": "seed" + } + ] + }, { "name": "GetRandomValue", "description": "Get a random value between min and max (both included)", @@ -4002,13 +4055,32 @@ ] }, { - "name": "SetRandomSeed", - "description": "Set the seed for the random number generator", - "returnType": "void", + "name": "LoadRandomSequence", + "description": "Load random values sequence, no values repeated", + "returnType": "int *", "params": [ { "type": "unsigned int", - "name": "seed" + "name": "count" + }, + { + "type": "int", + "name": "min" + }, + { + "type": "int", + "name": "max" + } + ] + }, + { + "name": "UnloadRandomSequence", + "description": "Unload random values sequence", + "returnType": "void", + "params": [ + { + "type": "int *", + "name": "sequence" } ] }, @@ -4034,6 +4106,17 @@ } ] }, + { + "name": "OpenURL", + "description": "Open URL with default system browser (if available)", + "returnType": "void", + "params": [ + { + "type": "const char *", + "name": "url" + } + ] + }, { "name": "TraceLog", "description": "Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)", @@ -4101,17 +4184,6 @@ } ] }, - { - "name": "OpenURL", - "description": "Open URL with default system browser (if available)", - "returnType": "void", - "params": [ - { - "type": "const char *", - "name": "url" - } - ] - }, { "name": "SetTraceLogCallback", "description": "Set custom trace log", @@ -4548,6 +4620,86 @@ } ] }, + { + "name": "LoadAutomationEventList", + "description": "Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS", + "returnType": "AutomationEventList", + "params": [ + { + "type": "const char *", + "name": "fileName" + } + ] + }, + { + "name": "UnloadAutomationEventList", + "description": "Unload automation events list from file", + "returnType": "void", + "params": [ + { + "type": "AutomationEventList *", + "name": "list" + } + ] + }, + { + "name": "ExportAutomationEventList", + "description": "Export automation events list as text file", + "returnType": "bool", + "params": [ + { + "type": "AutomationEventList", + "name": "list" + }, + { + "type": "const char *", + "name": "fileName" + } + ] + }, + { + "name": "SetAutomationEventList", + "description": "Set automation event list to record to", + "returnType": "void", + "params": [ + { + "type": "AutomationEventList *", + "name": "list" + } + ] + }, + { + "name": "SetAutomationEventBaseFrame", + "description": "Set automation event internal base frame to start recording", + "returnType": "void", + "params": [ + { + "type": "int", + "name": "frame" + } + ] + }, + { + "name": "StartAutomationEventRecording", + "description": "Start recording automation events (AutomationEventList must be set)", + "returnType": "void" + }, + { + "name": "StopAutomationEventRecording", + "description": "Stop recording automation events", + "returnType": "void" + }, + { + "name": "PlayAutomationEvent", + "description": "Play a recorded automation event", + "returnType": "void", + "params": [ + { + "type": "AutomationEvent", + "name": "event" + } + ] + }, { "name": "IsKeyPressed", "description": "Check if a key has been pressed once", @@ -4603,6 +4755,16 @@ } ] }, + { + "name": "GetKeyPressed", + "description": "Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty", + "returnType": "int" + }, + { + "name": "GetCharPressed", + "description": "Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty", + "returnType": "int" + }, { "name": "SetExitKey", "description": "Set a custom key to exit program (default is ESC)", @@ -4614,16 +4776,6 @@ } ] }, - { - "name": "GetKeyPressed", - "description": "Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty", - "returnType": "int" - }, - { - "name": "GetCharPressed", - "description": "Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty", - "returnType": "int" - }, { "name": "IsGamepadAvailable", "description": "Check if a gamepad is available", @@ -5083,7 +5235,7 @@ }, { "name": "DrawLineV", - "description": "Draw a line (Vector version)", + "description": "Draw a line (using gl lines)", "returnType": "void", "params": [ { @@ -5102,7 +5254,7 @@ }, { "name": "DrawLineEx", - "description": "Draw a line defining thickness", + "description": "Draw a line (using triangles/quads)", "returnType": "void", "params": [ { @@ -5123,136 +5275,9 @@ } ] }, - { - "name": "DrawLineBezier", - "description": "Draw a line using cubic-bezier curves in-out", - "returnType": "void", - "params": [ - { - "type": "Vector2", - "name": "startPos" - }, - { - "type": "Vector2", - "name": "endPos" - }, - { - "type": "float", - "name": "thick" - }, - { - "type": "Color", - "name": "color" - } - ] - }, - { - "name": "DrawLineBezierQuad", - "description": "Draw line using quadratic bezier curves with a control point", - "returnType": "void", - "params": [ - { - "type": "Vector2", - "name": "startPos" - }, - { - "type": "Vector2", - "name": "endPos" - }, - { - "type": "Vector2", - "name": "controlPos" - }, - { - "type": "float", - "name": "thick" - }, - { - "type": "Color", - "name": "color" - } - ] - }, - { - "name": "DrawLineBezierCubic", - "description": "Draw line using cubic bezier curves with 2 control points", - "returnType": "void", - "params": [ - { - "type": "Vector2", - "name": "startPos" - }, - { - "type": "Vector2", - "name": "endPos" - }, - { - "type": "Vector2", - "name": "startControlPos" - }, - { - "type": "Vector2", - "name": "endControlPos" - }, - { - "type": "float", - "name": "thick" - }, - { - "type": "Color", - "name": "color" - } - ] - }, - { - "name": "DrawLineBSpline", - "description": "Draw a B-Spline line, minimum 4 points", - "returnType": "void", - "params": [ - { - "type": "Vector2 *", - "name": "points" - }, - { - "type": "int", - "name": "pointCount" - }, - { - "type": "float", - "name": "thick" - }, - { - "type": "Color", - "name": "color" - } - ] - }, - { - "name": "DrawLineCatmullRom", - "description": "Draw a Catmull Rom spline line, minimum 4 points", - "returnType": "void", - "params": [ - { - "type": "Vector2 *", - "name": "points" - }, - { - "type": "int", - "name": "pointCount" - }, - { - "type": "float", - "name": "thick" - }, - { - "type": "Color", - "name": "color" - } - ] - }, { "name": "DrawLineStrip", - "description": "Draw lines sequence", + "description": "Draw lines sequence (using gl lines)", "returnType": "void", "params": [ { @@ -5269,6 +5294,29 @@ } ] }, + { + "name": "DrawLineBezier", + "description": "Draw line segment cubic-bezier in-out interpolation", + "returnType": "void", + "params": [ + { + "type": "Vector2", + "name": "startPos" + }, + { + "type": "Vector2", + "name": "endPos" + }, + { + "type": "float", + "name": "thick" + }, + { + "type": "Color", + "name": "color" + } + ] + }, { "name": "DrawCircle", "description": "Draw a color-filled circle", @@ -5423,6 +5471,25 @@ } ] }, + { + "name": "DrawCircleLinesV", + "description": "Draw circle outline (Vector version)", + "returnType": "void", + "params": [ + { + "type": "Vector2", + "name": "center" + }, + { + "type": "float", + "name": "radius" + }, + { + "type": "Color", + "name": "color" + } + ] + }, { "name": "DrawEllipse", "description": "Draw ellipse", @@ -5985,6 +6052,387 @@ } ] }, + { + "name": "DrawSplineLinear", + "description": "Draw spline: Linear, minimum 2 points", + "returnType": "void", + "params": [ + { + "type": "Vector2 *", + "name": "points" + }, + { + "type": "int", + "name": "pointCount" + }, + { + "type": "float", + "name": "thick" + }, + { + "type": "Color", + "name": "color" + } + ] + }, + { + "name": "DrawSplineBasis", + "description": "Draw spline: B-Spline, minimum 4 points", + "returnType": "void", + "params": [ + { + "type": "Vector2 *", + "name": "points" + }, + { + "type": "int", + "name": "pointCount" + }, + { + "type": "float", + "name": "thick" + }, + { + "type": "Color", + "name": "color" + } + ] + }, + { + "name": "DrawSplineCatmullRom", + "description": "Draw spline: Catmull-Rom, minimum 4 points", + "returnType": "void", + "params": [ + { + "type": "Vector2 *", + "name": "points" + }, + { + "type": "int", + "name": "pointCount" + }, + { + "type": "float", + "name": "thick" + }, + { + "type": "Color", + "name": "color" + } + ] + }, + { + "name": "DrawSplineBezierQuadratic", + "description": "Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]", + "returnType": "void", + "params": [ + { + "type": "Vector2 *", + "name": "points" + }, + { + "type": "int", + "name": "pointCount" + }, + { + "type": "float", + "name": "thick" + }, + { + "type": "Color", + "name": "color" + } + ] + }, + { + "name": "DrawSplineBezierCubic", + "description": "Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]", + "returnType": "void", + "params": [ + { + "type": "Vector2 *", + "name": "points" + }, + { + "type": "int", + "name": "pointCount" + }, + { + "type": "float", + "name": "thick" + }, + { + "type": "Color", + "name": "color" + } + ] + }, + { + "name": "DrawSplineSegmentLinear", + "description": "Draw spline segment: Linear, 2 points", + "returnType": "void", + "params": [ + { + "type": "Vector2", + "name": "p1" + }, + { + "type": "Vector2", + "name": "p2" + }, + { + "type": "float", + "name": "thick" + }, + { + "type": "Color", + "name": "color" + } + ] + }, + { + "name": "DrawSplineSegmentBasis", + "description": "Draw spline segment: B-Spline, 4 points", + "returnType": "void", + "params": [ + { + "type": "Vector2", + "name": "p1" + }, + { + "type": "Vector2", + "name": "p2" + }, + { + "type": "Vector2", + "name": "p3" + }, + { + "type": "Vector2", + "name": "p4" + }, + { + "type": "float", + "name": "thick" + }, + { + "type": "Color", + "name": "color" + } + ] + }, + { + "name": "DrawSplineSegmentCatmullRom", + "description": "Draw spline segment: Catmull-Rom, 4 points", + "returnType": "void", + "params": [ + { + "type": "Vector2", + "name": "p1" + }, + { + "type": "Vector2", + "name": "p2" + }, + { + "type": "Vector2", + "name": "p3" + }, + { + "type": "Vector2", + "name": "p4" + }, + { + "type": "float", + "name": "thick" + }, + { + "type": "Color", + "name": "color" + } + ] + }, + { + "name": "DrawSplineSegmentBezierQuadratic", + "description": "Draw spline segment: Quadratic Bezier, 2 points, 1 control point", + "returnType": "void", + "params": [ + { + "type": "Vector2", + "name": "p1" + }, + { + "type": "Vector2", + "name": "c2" + }, + { + "type": "Vector2", + "name": "p3" + }, + { + "type": "float", + "name": "thick" + }, + { + "type": "Color", + "name": "color" + } + ] + }, + { + "name": "DrawSplineSegmentBezierCubic", + "description": "Draw spline segment: Cubic Bezier, 2 points, 2 control points", + "returnType": "void", + "params": [ + { + "type": "Vector2", + "name": "p1" + }, + { + "type": "Vector2", + "name": "c2" + }, + { + "type": "Vector2", + "name": "c3" + }, + { + "type": "Vector2", + "name": "p4" + }, + { + "type": "float", + "name": "thick" + }, + { + "type": "Color", + "name": "color" + } + ] + }, + { + "name": "GetSplinePointLinear", + "description": "Get (evaluate) spline point: Linear", + "returnType": "Vector2", + "params": [ + { + "type": "Vector2", + "name": "startPos" + }, + { + "type": "Vector2", + "name": "endPos" + }, + { + "type": "float", + "name": "t" + } + ] + }, + { + "name": "GetSplinePointBasis", + "description": "Get (evaluate) spline point: B-Spline", + "returnType": "Vector2", + "params": [ + { + "type": "Vector2", + "name": "p1" + }, + { + "type": "Vector2", + "name": "p2" + }, + { + "type": "Vector2", + "name": "p3" + }, + { + "type": "Vector2", + "name": "p4" + }, + { + "type": "float", + "name": "t" + } + ] + }, + { + "name": "GetSplinePointCatmullRom", + "description": "Get (evaluate) spline point: Catmull-Rom", + "returnType": "Vector2", + "params": [ + { + "type": "Vector2", + "name": "p1" + }, + { + "type": "Vector2", + "name": "p2" + }, + { + "type": "Vector2", + "name": "p3" + }, + { + "type": "Vector2", + "name": "p4" + }, + { + "type": "float", + "name": "t" + } + ] + }, + { + "name": "GetSplinePointBezierQuad", + "description": "Get (evaluate) spline point: Quadratic Bezier", + "returnType": "Vector2", + "params": [ + { + "type": "Vector2", + "name": "p1" + }, + { + "type": "Vector2", + "name": "c2" + }, + { + "type": "Vector2", + "name": "p3" + }, + { + "type": "float", + "name": "t" + } + ] + }, + { + "name": "GetSplinePointBezierCubic", + "description": "Get (evaluate) spline point: Cubic Bezier", + "returnType": "Vector2", + "params": [ + { + "type": "Vector2", + "name": "p1" + }, + { + "type": "Vector2", + "name": "c2" + }, + { + "type": "Vector2", + "name": "c3" + }, + { + "type": "Vector2", + "name": "p4" + }, + { + "type": "float", + "name": "t" + } + ] + }, { "name": "CheckCollisionRecs", "description": "Check collision between two rectangles", @@ -6768,6 +7216,25 @@ } ] }, + { + "name": "ImageKernelConvolution", + "description": "Apply Custom Square image convolution kernel", + "returnType": "void", + "params": [ + { + "type": "Image *", + "name": "image" + }, + { + "type": "float*", + "name": "kernel" + }, + { + "type": "int", + "name": "kernelSize" + } + ] + }, { "name": "ImageResize", "description": "Resize image (Bicubic scaling algorithm)", @@ -10339,6 +10806,11 @@ } ] }, + { + "name": "GetMasterVolume", + "description": "Get master volume (listener)", + "returnType": "float" + }, { "name": "LoadWave", "description": "Load wave data from file", diff --git a/parser/output/raylib_api.lua b/parser/output/raylib_api.lua index 26b2564a5..18375e179 100644 --- a/parser/output/raylib_api.lua +++ b/parser/output/raylib_api.lua @@ -9,13 +9,13 @@ return { { name = "RAYLIB_VERSION_MAJOR", type = "INT", - value = 4, + value = 5, description = "" }, { name = "RAYLIB_VERSION_MINOR", type = "INT", - value = 6, + value = 1, description = "" }, { @@ -27,7 +27,7 @@ return { { name = "RAYLIB_VERSION", type = "STRING", - value = "4.6-dev", + value = "5.1-dev", description = "" }, { @@ -1329,6 +1329,48 @@ return { description = "Filepaths entries" } } + }, + { + name = "AutomationEvent", + description = "Automation event", + fields = { + { + type = "unsigned int", + name = "frame", + description = "Event frame" + }, + { + type = "unsigned int", + name = "type", + description = "Event type (AutomationEventType)" + }, + { + type = "int[4]", + name = "params", + description = "Event parameters (if required)" + } + } + }, + { + name = "AutomationEventList", + description = "Automation event list", + fields = { + { + type = "unsigned int", + name = "capacity", + description = "Events max entries (MAX_AUTOMATION_EVENTS)" + }, + { + type = "unsigned int", + name = "count", + description = "Events entries count" + }, + { + type = "AutomationEvent *", + name = "events", + description = "Events entries" + } + } } }, aliases = { @@ -3044,16 +3086,16 @@ return { {type = "const char *", name = "title"} } }, - { - name = "WindowShouldClose", - description = "Check if KEY_ESCAPE pressed or Close icon pressed", - returnType = "bool" - }, { name = "CloseWindow", description = "Close window and unload OpenGL context", returnType = "void" }, + { + name = "WindowShouldClose", + description = "Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)", + returnType = "bool" + }, { name = "IsWindowReady", description = "Check if window has been initialized successfully", @@ -3344,24 +3386,6 @@ return { description = "Disable waiting for events on EndDrawing(), automatic events polling", returnType = "void" }, - { - name = "SwapScreenBuffer", - description = "Swap back buffer with front buffer (screen drawing)", - returnType = "void" - }, - { - name = "PollInputEvents", - description = "Register all input events", - returnType = "void" - }, - { - name = "WaitTime", - description = "Wait for some time (halt program execution)", - returnType = "void", - params = { - {type = "double", name = "seconds"} - } - }, { name = "ShowCursor", description = "Shows cursor", @@ -3686,11 +3710,6 @@ return { {type = "int", name = "fps"} } }, - { - name = "GetFPS", - description = "Get current FPS", - returnType = "int" - }, { name = "GetFrameTime", description = "Get time in seconds for last frame drawn (delta time)", @@ -3701,6 +3720,37 @@ return { description = "Get elapsed time in seconds since InitWindow()", returnType = "double" }, + { + name = "GetFPS", + description = "Get current FPS", + returnType = "int" + }, + { + name = "SwapScreenBuffer", + description = "Swap back buffer with front buffer (screen drawing)", + returnType = "void" + }, + { + name = "PollInputEvents", + description = "Register all input events", + returnType = "void" + }, + { + name = "WaitTime", + description = "Wait for some time (halt program execution)", + returnType = "void", + params = { + {type = "double", name = "seconds"} + } + }, + { + name = "SetRandomSeed", + description = "Set the seed for the random number generator", + returnType = "void", + params = { + {type = "unsigned int", name = "seed"} + } + }, { name = "GetRandomValue", description = "Get a random value between min and max (both included)", @@ -3711,11 +3761,21 @@ return { } }, { - name = "SetRandomSeed", - description = "Set the seed for the random number generator", + name = "LoadRandomSequence", + description = "Load random values sequence, no values repeated", + returnType = "int *", + params = { + {type = "unsigned int", name = "count"}, + {type = "int", name = "min"}, + {type = "int", name = "max"} + } + }, + { + name = "UnloadRandomSequence", + description = "Unload random values sequence", returnType = "void", params = { - {type = "unsigned int", name = "seed"} + {type = "int *", name = "sequence"} } }, { @@ -3734,6 +3794,14 @@ return { {type = "unsigned int", name = "flags"} } }, + { + name = "OpenURL", + description = "Open URL with default system browser (if available)", + returnType = "void", + params = { + {type = "const char *", name = "url"} + } + }, { name = "TraceLog", description = "Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)", @@ -3777,14 +3845,6 @@ return { {type = "void *", name = "ptr"} } }, - { - name = "OpenURL", - description = "Open URL with default system browser (if available)", - returnType = "void", - params = { - {type = "const char *", name = "url"} - } - }, { name = "SetTraceLogCallback", description = "Set custom trace log", @@ -4077,6 +4137,65 @@ return { {type = "int *", name = "outputSize"} } }, + { + name = "LoadAutomationEventList", + description = "Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS", + returnType = "AutomationEventList", + params = { + {type = "const char *", name = "fileName"} + } + }, + { + name = "UnloadAutomationEventList", + description = "Unload automation events list from file", + returnType = "void", + params = { + {type = "AutomationEventList *", name = "list"} + } + }, + { + name = "ExportAutomationEventList", + description = "Export automation events list as text file", + returnType = "bool", + params = { + {type = "AutomationEventList", name = "list"}, + {type = "const char *", name = "fileName"} + } + }, + { + name = "SetAutomationEventList", + description = "Set automation event list to record to", + returnType = "void", + params = { + {type = "AutomationEventList *", name = "list"} + } + }, + { + name = "SetAutomationEventBaseFrame", + description = "Set automation event internal base frame to start recording", + returnType = "void", + params = { + {type = "int", name = "frame"} + } + }, + { + name = "StartAutomationEventRecording", + description = "Start recording automation events (AutomationEventList must be set)", + returnType = "void" + }, + { + name = "StopAutomationEventRecording", + description = "Stop recording automation events", + returnType = "void" + }, + { + name = "PlayAutomationEvent", + description = "Play a recorded automation event", + returnType = "void", + params = { + {type = "AutomationEvent", name = "event"} + } + }, { name = "IsKeyPressed", description = "Check if a key has been pressed once", @@ -4117,14 +4236,6 @@ return { {type = "int", name = "key"} } }, - { - name = "SetExitKey", - description = "Set a custom key to exit program (default is ESC)", - returnType = "void", - params = { - {type = "int", name = "key"} - } - }, { name = "GetKeyPressed", description = "Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty", @@ -4135,6 +4246,14 @@ return { description = "Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty", returnType = "int" }, + { + name = "SetExitKey", + description = "Set a custom key to exit program (default is ESC)", + returnType = "void", + params = { + {type = "int", name = "key"} + } + }, { name = "IsGamepadAvailable", description = "Check if a gamepad is available", @@ -4453,7 +4572,7 @@ return { }, { name = "DrawLineV", - description = "Draw a line (Vector version)", + description = "Draw a line (using gl lines)", returnType = "void", params = { {type = "Vector2", name = "startPos"}, @@ -4463,7 +4582,7 @@ return { }, { name = "DrawLineEx", - description = "Draw a line defining thickness", + description = "Draw a line (using triangles/quads)", returnType = "void", params = { {type = "Vector2", name = "startPos"}, @@ -4472,67 +4591,9 @@ return { {type = "Color", name = "color"} } }, - { - name = "DrawLineBezier", - description = "Draw a line using cubic-bezier curves in-out", - returnType = "void", - params = { - {type = "Vector2", name = "startPos"}, - {type = "Vector2", name = "endPos"}, - {type = "float", name = "thick"}, - {type = "Color", name = "color"} - } - }, - { - name = "DrawLineBezierQuad", - description = "Draw line using quadratic bezier curves with a control point", - returnType = "void", - params = { - {type = "Vector2", name = "startPos"}, - {type = "Vector2", name = "endPos"}, - {type = "Vector2", name = "controlPos"}, - {type = "float", name = "thick"}, - {type = "Color", name = "color"} - } - }, - { - name = "DrawLineBezierCubic", - description = "Draw line using cubic bezier curves with 2 control points", - returnType = "void", - params = { - {type = "Vector2", name = "startPos"}, - {type = "Vector2", name = "endPos"}, - {type = "Vector2", name = "startControlPos"}, - {type = "Vector2", name = "endControlPos"}, - {type = "float", name = "thick"}, - {type = "Color", name = "color"} - } - }, - { - name = "DrawLineBSpline", - description = "Draw a B-Spline line, minimum 4 points", - returnType = "void", - params = { - {type = "Vector2 *", name = "points"}, - {type = "int", name = "pointCount"}, - {type = "float", name = "thick"}, - {type = "Color", name = "color"} - } - }, - { - name = "DrawLineCatmullRom", - description = "Draw a Catmull Rom spline line, minimum 4 points", - returnType = "void", - params = { - {type = "Vector2 *", name = "points"}, - {type = "int", name = "pointCount"}, - {type = "float", name = "thick"}, - {type = "Color", name = "color"} - } - }, { name = "DrawLineStrip", - description = "Draw lines sequence", + description = "Draw lines sequence (using gl lines)", returnType = "void", params = { {type = "Vector2 *", name = "points"}, @@ -4540,6 +4601,17 @@ return { {type = "Color", name = "color"} } }, + { + name = "DrawLineBezier", + description = "Draw line segment cubic-bezier in-out interpolation", + returnType = "void", + params = { + {type = "Vector2", name = "startPos"}, + {type = "Vector2", name = "endPos"}, + {type = "float", name = "thick"}, + {type = "Color", name = "color"} + } + }, { name = "DrawCircle", description = "Draw a color-filled circle", @@ -4610,6 +4682,16 @@ return { {type = "Color", name = "color"} } }, + { + name = "DrawCircleLinesV", + description = "Draw circle outline (Vector version)", + returnType = "void", + params = { + {type = "Vector2", name = "center"}, + {type = "float", name = "radius"}, + {type = "Color", name = "color"} + } + }, { name = "DrawEllipse", description = "Draw ellipse", @@ -4866,6 +4948,180 @@ return { {type = "Color", name = "color"} } }, + { + name = "DrawSplineLinear", + description = "Draw spline: Linear, minimum 2 points", + returnType = "void", + params = { + {type = "Vector2 *", name = "points"}, + {type = "int", name = "pointCount"}, + {type = "float", name = "thick"}, + {type = "Color", name = "color"} + } + }, + { + name = "DrawSplineBasis", + description = "Draw spline: B-Spline, minimum 4 points", + returnType = "void", + params = { + {type = "Vector2 *", name = "points"}, + {type = "int", name = "pointCount"}, + {type = "float", name = "thick"}, + {type = "Color", name = "color"} + } + }, + { + name = "DrawSplineCatmullRom", + description = "Draw spline: Catmull-Rom, minimum 4 points", + returnType = "void", + params = { + {type = "Vector2 *", name = "points"}, + {type = "int", name = "pointCount"}, + {type = "float", name = "thick"}, + {type = "Color", name = "color"} + } + }, + { + name = "DrawSplineBezierQuadratic", + description = "Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]", + returnType = "void", + params = { + {type = "Vector2 *", name = "points"}, + {type = "int", name = "pointCount"}, + {type = "float", name = "thick"}, + {type = "Color", name = "color"} + } + }, + { + name = "DrawSplineBezierCubic", + description = "Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]", + returnType = "void", + params = { + {type = "Vector2 *", name = "points"}, + {type = "int", name = "pointCount"}, + {type = "float", name = "thick"}, + {type = "Color", name = "color"} + } + }, + { + name = "DrawSplineSegmentLinear", + description = "Draw spline segment: Linear, 2 points", + returnType = "void", + params = { + {type = "Vector2", name = "p1"}, + {type = "Vector2", name = "p2"}, + {type = "float", name = "thick"}, + {type = "Color", name = "color"} + } + }, + { + name = "DrawSplineSegmentBasis", + description = "Draw spline segment: B-Spline, 4 points", + returnType = "void", + params = { + {type = "Vector2", name = "p1"}, + {type = "Vector2", name = "p2"}, + {type = "Vector2", name = "p3"}, + {type = "Vector2", name = "p4"}, + {type = "float", name = "thick"}, + {type = "Color", name = "color"} + } + }, + { + name = "DrawSplineSegmentCatmullRom", + description = "Draw spline segment: Catmull-Rom, 4 points", + returnType = "void", + params = { + {type = "Vector2", name = "p1"}, + {type = "Vector2", name = "p2"}, + {type = "Vector2", name = "p3"}, + {type = "Vector2", name = "p4"}, + {type = "float", name = "thick"}, + {type = "Color", name = "color"} + } + }, + { + name = "DrawSplineSegmentBezierQuadratic", + description = "Draw spline segment: Quadratic Bezier, 2 points, 1 control point", + returnType = "void", + params = { + {type = "Vector2", name = "p1"}, + {type = "Vector2", name = "c2"}, + {type = "Vector2", name = "p3"}, + {type = "float", name = "thick"}, + {type = "Color", name = "color"} + } + }, + { + name = "DrawSplineSegmentBezierCubic", + description = "Draw spline segment: Cubic Bezier, 2 points, 2 control points", + returnType = "void", + params = { + {type = "Vector2", name = "p1"}, + {type = "Vector2", name = "c2"}, + {type = "Vector2", name = "c3"}, + {type = "Vector2", name = "p4"}, + {type = "float", name = "thick"}, + {type = "Color", name = "color"} + } + }, + { + name = "GetSplinePointLinear", + description = "Get (evaluate) spline point: Linear", + returnType = "Vector2", + params = { + {type = "Vector2", name = "startPos"}, + {type = "Vector2", name = "endPos"}, + {type = "float", name = "t"} + } + }, + { + name = "GetSplinePointBasis", + description = "Get (evaluate) spline point: B-Spline", + returnType = "Vector2", + params = { + {type = "Vector2", name = "p1"}, + {type = "Vector2", name = "p2"}, + {type = "Vector2", name = "p3"}, + {type = "Vector2", name = "p4"}, + {type = "float", name = "t"} + } + }, + { + name = "GetSplinePointCatmullRom", + description = "Get (evaluate) spline point: Catmull-Rom", + returnType = "Vector2", + params = { + {type = "Vector2", name = "p1"}, + {type = "Vector2", name = "p2"}, + {type = "Vector2", name = "p3"}, + {type = "Vector2", name = "p4"}, + {type = "float", name = "t"} + } + }, + { + name = "GetSplinePointBezierQuad", + description = "Get (evaluate) spline point: Quadratic Bezier", + returnType = "Vector2", + params = { + {type = "Vector2", name = "p1"}, + {type = "Vector2", name = "c2"}, + {type = "Vector2", name = "p3"}, + {type = "float", name = "t"} + } + }, + { + name = "GetSplinePointBezierCubic", + description = "Get (evaluate) spline point: Cubic Bezier", + returnType = "Vector2", + params = { + {type = "Vector2", name = "p1"}, + {type = "Vector2", name = "c2"}, + {type = "Vector2", name = "c3"}, + {type = "Vector2", name = "p4"}, + {type = "float", name = "t"} + } + }, { name = "CheckCollisionRecs", description = "Check collision between two rectangles", @@ -5286,6 +5542,16 @@ return { {type = "int", name = "blurSize"} } }, + { + name = "ImageKernelConvolution", + description = "Apply Custom Square image convolution kernel", + returnType = "void", + params = { + {type = "Image *", name = "image"}, + {type = "float*", name = "kernel"}, + {type = "int", name = "kernelSize"} + } + }, { name = "ImageResize", description = "Resize image (Bicubic scaling algorithm)", @@ -7195,6 +7461,11 @@ return { {type = "float", name = "volume"} } }, + { + name = "GetMasterVolume", + description = "Get master volume (listener)", + returnType = "float" + }, { name = "LoadWave", description = "Load wave data from file", diff --git a/parser/output/raylib_api.txt b/parser/output/raylib_api.txt index 725d6ae91..8a57b4e15 100644 --- a/parser/output/raylib_api.txt +++ b/parser/output/raylib_api.txt @@ -9,12 +9,12 @@ Define 001: RAYLIB_H Define 002: RAYLIB_VERSION_MAJOR Name: RAYLIB_VERSION_MAJOR Type: INT - Value: 4 + Value: 5 Description: Define 003: RAYLIB_VERSION_MINOR Name: RAYLIB_VERSION_MINOR Type: INT - Value: 6 + Value: 1 Description: Define 004: RAYLIB_VERSION_PATCH Name: RAYLIB_VERSION_PATCH @@ -24,7 +24,7 @@ Define 004: RAYLIB_VERSION_PATCH Define 005: RAYLIB_VERSION Name: RAYLIB_VERSION Type: STRING - Value: "4.6-dev" + Value: "5.1-dev" Description: Define 006: __declspec(x) Name: __declspec(x) @@ -282,7 +282,7 @@ Define 056: SHADER_LOC_MAP_SPECULAR Value: SHADER_LOC_MAP_METALNESS Description: -Structures found: 32 +Structures found: 34 Struct 01: Vector2 (2 fields) Name: Vector2 @@ -540,6 +540,18 @@ Struct 32: FilePathList (3 fields) Field[1]: unsigned int capacity // Filepaths max entries Field[2]: unsigned int count // Filepaths entries count Field[3]: char ** paths // Filepaths entries +Struct 33: AutomationEvent (3 fields) + Name: AutomationEvent + Description: Automation event + Field[1]: unsigned int frame // Event frame + Field[2]: unsigned int type // Event type (AutomationEventType) + Field[3]: int[4] params // Event parameters (if required) +Struct 34: AutomationEventList (3 fields) + Name: AutomationEventList + Description: Automation event list + Field[1]: unsigned int capacity // Events max entries (MAX_AUTOMATION_EVENTS) + Field[2]: unsigned int count // Events entries count + Field[3]: AutomationEvent * events // Events entries Aliases found: 5 @@ -968,7 +980,7 @@ Callback 006: AudioCallback() (2 input parameters) Param[1]: bufferData (type: void *) Param[2]: frames (type: unsigned int) -Functions found: 529 +Functions found: 553 Function 001: InitWindow() (3 input parameters) Name: InitWindow @@ -977,16 +989,16 @@ Function 001: InitWindow() (3 input parameters) Param[1]: width (type: int) Param[2]: height (type: int) Param[3]: title (type: const char *) -Function 002: WindowShouldClose() (0 input parameters) - Name: WindowShouldClose - Return type: bool - Description: Check if KEY_ESCAPE pressed or Close icon pressed - No input parameters -Function 003: CloseWindow() (0 input parameters) +Function 002: CloseWindow() (0 input parameters) Name: CloseWindow Return type: void Description: Close window and unload OpenGL context No input parameters +Function 003: WindowShouldClose() (0 input parameters) + Name: WindowShouldClose + Return type: bool + Description: Check if application should close (KEY_ESCAPE pressed or windows close icon clicked) + No input parameters Function 004: IsWindowReady() (0 input parameters) Name: IsWindowReady Return type: bool @@ -1217,117 +1229,102 @@ Function 048: DisableEventWaiting() (0 input parameters) Return type: void Description: Disable waiting for events on EndDrawing(), automatic events polling No input parameters -Function 049: SwapScreenBuffer() (0 input parameters) - Name: SwapScreenBuffer - Return type: void - Description: Swap back buffer with front buffer (screen drawing) - No input parameters -Function 050: PollInputEvents() (0 input parameters) - Name: PollInputEvents - Return type: void - Description: Register all input events - No input parameters -Function 051: WaitTime() (1 input parameters) - Name: WaitTime - Return type: void - Description: Wait for some time (halt program execution) - Param[1]: seconds (type: double) -Function 052: ShowCursor() (0 input parameters) +Function 049: ShowCursor() (0 input parameters) Name: ShowCursor Return type: void Description: Shows cursor No input parameters -Function 053: HideCursor() (0 input parameters) +Function 050: HideCursor() (0 input parameters) Name: HideCursor Return type: void Description: Hides cursor No input parameters -Function 054: IsCursorHidden() (0 input parameters) +Function 051: IsCursorHidden() (0 input parameters) Name: IsCursorHidden Return type: bool Description: Check if cursor is not visible No input parameters -Function 055: EnableCursor() (0 input parameters) +Function 052: EnableCursor() (0 input parameters) Name: EnableCursor Return type: void Description: Enables cursor (unlock cursor) No input parameters -Function 056: DisableCursor() (0 input parameters) +Function 053: DisableCursor() (0 input parameters) Name: DisableCursor Return type: void Description: Disables cursor (lock cursor) No input parameters -Function 057: IsCursorOnScreen() (0 input parameters) +Function 054: IsCursorOnScreen() (0 input parameters) Name: IsCursorOnScreen Return type: bool Description: Check if cursor is on the screen No input parameters -Function 058: ClearBackground() (1 input parameters) +Function 055: ClearBackground() (1 input parameters) Name: ClearBackground Return type: void Description: Set background color (framebuffer clear color) Param[1]: color (type: Color) -Function 059: BeginDrawing() (0 input parameters) +Function 056: BeginDrawing() (0 input parameters) Name: BeginDrawing Return type: void Description: Setup canvas (framebuffer) to start drawing No input parameters -Function 060: EndDrawing() (0 input parameters) +Function 057: EndDrawing() (0 input parameters) Name: EndDrawing Return type: void Description: End canvas drawing and swap buffers (double buffering) No input parameters -Function 061: BeginMode2D() (1 input parameters) +Function 058: BeginMode2D() (1 input parameters) Name: BeginMode2D Return type: void Description: Begin 2D mode with custom camera (2D) Param[1]: camera (type: Camera2D) -Function 062: EndMode2D() (0 input parameters) +Function 059: EndMode2D() (0 input parameters) Name: EndMode2D Return type: void Description: Ends 2D mode with custom camera No input parameters -Function 063: BeginMode3D() (1 input parameters) +Function 060: BeginMode3D() (1 input parameters) Name: BeginMode3D Return type: void Description: Begin 3D mode with custom camera (3D) Param[1]: camera (type: Camera3D) -Function 064: EndMode3D() (0 input parameters) +Function 061: EndMode3D() (0 input parameters) Name: EndMode3D Return type: void Description: Ends 3D mode and returns to default 2D orthographic mode No input parameters -Function 065: BeginTextureMode() (1 input parameters) +Function 062: BeginTextureMode() (1 input parameters) Name: BeginTextureMode Return type: void Description: Begin drawing to render texture Param[1]: target (type: RenderTexture2D) -Function 066: EndTextureMode() (0 input parameters) +Function 063: EndTextureMode() (0 input parameters) Name: EndTextureMode Return type: void Description: Ends drawing to render texture No input parameters -Function 067: BeginShaderMode() (1 input parameters) +Function 064: BeginShaderMode() (1 input parameters) Name: BeginShaderMode Return type: void Description: Begin custom shader drawing Param[1]: shader (type: Shader) -Function 068: EndShaderMode() (0 input parameters) +Function 065: EndShaderMode() (0 input parameters) Name: EndShaderMode Return type: void Description: End custom shader drawing (use default shader) No input parameters -Function 069: BeginBlendMode() (1 input parameters) +Function 066: BeginBlendMode() (1 input parameters) Name: BeginBlendMode Return type: void Description: Begin blending mode (alpha, additive, multiplied, subtract, custom) Param[1]: mode (type: int) -Function 070: EndBlendMode() (0 input parameters) +Function 067: EndBlendMode() (0 input parameters) Name: EndBlendMode Return type: void Description: End blending mode (reset to default: alpha blending) No input parameters -Function 071: BeginScissorMode() (4 input parameters) +Function 068: BeginScissorMode() (4 input parameters) Name: BeginScissorMode Return type: void Description: Begin scissor mode (define screen area for following drawing) @@ -1335,61 +1332,61 @@ Function 071: BeginScissorMode() (4 input parameters) Param[2]: y (type: int) Param[3]: width (type: int) Param[4]: height (type: int) -Function 072: EndScissorMode() (0 input parameters) +Function 069: EndScissorMode() (0 input parameters) Name: EndScissorMode Return type: void Description: End scissor mode No input parameters -Function 073: BeginVrStereoMode() (1 input parameters) +Function 070: BeginVrStereoMode() (1 input parameters) Name: BeginVrStereoMode Return type: void Description: Begin stereo rendering (requires VR simulator) Param[1]: config (type: VrStereoConfig) -Function 074: EndVrStereoMode() (0 input parameters) +Function 071: EndVrStereoMode() (0 input parameters) Name: EndVrStereoMode Return type: void Description: End stereo rendering (requires VR simulator) No input parameters -Function 075: LoadVrStereoConfig() (1 input parameters) +Function 072: LoadVrStereoConfig() (1 input parameters) Name: LoadVrStereoConfig Return type: VrStereoConfig Description: Load VR stereo config for VR simulator device parameters Param[1]: device (type: VrDeviceInfo) -Function 076: UnloadVrStereoConfig() (1 input parameters) +Function 073: UnloadVrStereoConfig() (1 input parameters) Name: UnloadVrStereoConfig Return type: void Description: Unload VR stereo config Param[1]: config (type: VrStereoConfig) -Function 077: LoadShader() (2 input parameters) +Function 074: LoadShader() (2 input parameters) Name: LoadShader Return type: Shader Description: Load shader from files and bind default locations Param[1]: vsFileName (type: const char *) Param[2]: fsFileName (type: const char *) -Function 078: LoadShaderFromMemory() (2 input parameters) +Function 075: LoadShaderFromMemory() (2 input parameters) Name: LoadShaderFromMemory Return type: Shader Description: Load shader from code strings and bind default locations Param[1]: vsCode (type: const char *) Param[2]: fsCode (type: const char *) -Function 079: IsShaderReady() (1 input parameters) +Function 076: IsShaderReady() (1 input parameters) Name: IsShaderReady Return type: bool Description: Check if a shader is ready Param[1]: shader (type: Shader) -Function 080: GetShaderLocation() (2 input parameters) +Function 077: GetShaderLocation() (2 input parameters) Name: GetShaderLocation Return type: int Description: Get shader uniform location Param[1]: shader (type: Shader) Param[2]: uniformName (type: const char *) -Function 081: GetShaderLocationAttrib() (2 input parameters) +Function 078: GetShaderLocationAttrib() (2 input parameters) Name: GetShaderLocationAttrib Return type: int Description: Get shader attribute location Param[1]: shader (type: Shader) Param[2]: attribName (type: const char *) -Function 082: SetShaderValue() (4 input parameters) +Function 079: SetShaderValue() (4 input parameters) Name: SetShaderValue Return type: void Description: Set shader uniform value @@ -1397,7 +1394,7 @@ Function 082: SetShaderValue() (4 input parameters) Param[2]: locIndex (type: int) Param[3]: value (type: const void *) Param[4]: uniformType (type: int) -Function 083: SetShaderValueV() (5 input parameters) +Function 080: SetShaderValueV() (5 input parameters) Name: SetShaderValueV Return type: void Description: Set shader uniform value vector @@ -1406,54 +1403,54 @@ Function 083: SetShaderValueV() (5 input parameters) Param[3]: value (type: const void *) Param[4]: uniformType (type: int) Param[5]: count (type: int) -Function 084: SetShaderValueMatrix() (3 input parameters) +Function 081: SetShaderValueMatrix() (3 input parameters) Name: SetShaderValueMatrix Return type: void Description: Set shader uniform value (matrix 4x4) Param[1]: shader (type: Shader) Param[2]: locIndex (type: int) Param[3]: mat (type: Matrix) -Function 085: SetShaderValueTexture() (3 input parameters) +Function 082: SetShaderValueTexture() (3 input parameters) Name: SetShaderValueTexture Return type: void Description: Set shader uniform value for texture (sampler2d) Param[1]: shader (type: Shader) Param[2]: locIndex (type: int) Param[3]: texture (type: Texture2D) -Function 086: UnloadShader() (1 input parameters) +Function 083: UnloadShader() (1 input parameters) Name: UnloadShader Return type: void Description: Unload shader from GPU memory (VRAM) Param[1]: shader (type: Shader) -Function 087: GetMouseRay() (2 input parameters) +Function 084: GetMouseRay() (2 input parameters) Name: GetMouseRay Return type: Ray Description: Get a ray trace from mouse position Param[1]: mousePosition (type: Vector2) Param[2]: camera (type: Camera) -Function 088: GetCameraMatrix() (1 input parameters) +Function 085: GetCameraMatrix() (1 input parameters) Name: GetCameraMatrix Return type: Matrix Description: Get camera transform matrix (view matrix) Param[1]: camera (type: Camera) -Function 089: GetCameraMatrix2D() (1 input parameters) +Function 086: GetCameraMatrix2D() (1 input parameters) Name: GetCameraMatrix2D Return type: Matrix Description: Get camera 2d transform matrix Param[1]: camera (type: Camera2D) -Function 090: GetWorldToScreen() (2 input parameters) +Function 087: GetWorldToScreen() (2 input parameters) Name: GetWorldToScreen Return type: Vector2 Description: Get the screen space position for a 3d world space position Param[1]: position (type: Vector3) Param[2]: camera (type: Camera) -Function 091: GetScreenToWorld2D() (2 input parameters) +Function 088: GetScreenToWorld2D() (2 input parameters) Name: GetScreenToWorld2D Return type: Vector2 Description: Get the world space position for a 2d camera screen space position Param[1]: position (type: Vector2) Param[2]: camera (type: Camera2D) -Function 092: GetWorldToScreenEx() (4 input parameters) +Function 089: GetWorldToScreenEx() (4 input parameters) Name: GetWorldToScreenEx Return type: Vector2 Description: Get size position for a 3d world space position @@ -1461,522 +1458,590 @@ Function 092: GetWorldToScreenEx() (4 input parameters) Param[2]: camera (type: Camera) Param[3]: width (type: int) Param[4]: height (type: int) -Function 093: GetWorldToScreen2D() (2 input parameters) +Function 090: GetWorldToScreen2D() (2 input parameters) Name: GetWorldToScreen2D Return type: Vector2 Description: Get the screen space position for a 2d camera world space position Param[1]: position (type: Vector2) Param[2]: camera (type: Camera2D) -Function 094: SetTargetFPS() (1 input parameters) +Function 091: SetTargetFPS() (1 input parameters) Name: SetTargetFPS Return type: void Description: Set target FPS (maximum) Param[1]: fps (type: int) -Function 095: GetFPS() (0 input parameters) - Name: GetFPS - Return type: int - Description: Get current FPS - No input parameters -Function 096: GetFrameTime() (0 input parameters) +Function 092: GetFrameTime() (0 input parameters) Name: GetFrameTime Return type: float Description: Get time in seconds for last frame drawn (delta time) No input parameters -Function 097: GetTime() (0 input parameters) +Function 093: GetTime() (0 input parameters) Name: GetTime Return type: double Description: Get elapsed time in seconds since InitWindow() No input parameters -Function 098: GetRandomValue() (2 input parameters) +Function 094: GetFPS() (0 input parameters) + Name: GetFPS + Return type: int + Description: Get current FPS + No input parameters +Function 095: SwapScreenBuffer() (0 input parameters) + Name: SwapScreenBuffer + Return type: void + Description: Swap back buffer with front buffer (screen drawing) + No input parameters +Function 096: PollInputEvents() (0 input parameters) + Name: PollInputEvents + Return type: void + Description: Register all input events + No input parameters +Function 097: WaitTime() (1 input parameters) + Name: WaitTime + Return type: void + Description: Wait for some time (halt program execution) + Param[1]: seconds (type: double) +Function 098: SetRandomSeed() (1 input parameters) + Name: SetRandomSeed + Return type: void + Description: Set the seed for the random number generator + Param[1]: seed (type: unsigned int) +Function 099: GetRandomValue() (2 input parameters) Name: GetRandomValue Return type: int Description: Get a random value between min and max (both included) Param[1]: min (type: int) Param[2]: max (type: int) -Function 099: SetRandomSeed() (1 input parameters) - Name: SetRandomSeed +Function 100: LoadRandomSequence() (3 input parameters) + Name: LoadRandomSequence + Return type: int * + Description: Load random values sequence, no values repeated + Param[1]: count (type: unsigned int) + Param[2]: min (type: int) + Param[3]: max (type: int) +Function 101: UnloadRandomSequence() (1 input parameters) + Name: UnloadRandomSequence Return type: void - Description: Set the seed for the random number generator - Param[1]: seed (type: unsigned int) -Function 100: TakeScreenshot() (1 input parameters) + Description: Unload random values sequence + Param[1]: sequence (type: int *) +Function 102: TakeScreenshot() (1 input parameters) Name: TakeScreenshot Return type: void Description: Takes a screenshot of current screen (filename extension defines format) Param[1]: fileName (type: const char *) -Function 101: SetConfigFlags() (1 input parameters) +Function 103: SetConfigFlags() (1 input parameters) Name: SetConfigFlags Return type: void Description: Setup init configuration flags (view FLAGS) Param[1]: flags (type: unsigned int) -Function 102: TraceLog() (3 input parameters) +Function 104: OpenURL() (1 input parameters) + Name: OpenURL + Return type: void + Description: Open URL with default system browser (if available) + Param[1]: url (type: const char *) +Function 105: TraceLog() (3 input parameters) Name: TraceLog Return type: void Description: Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) Param[1]: logLevel (type: int) Param[2]: text (type: const char *) Param[3]: args (type: ...) -Function 103: SetTraceLogLevel() (1 input parameters) +Function 106: SetTraceLogLevel() (1 input parameters) Name: SetTraceLogLevel Return type: void Description: Set the current threshold (minimum) log level Param[1]: logLevel (type: int) -Function 104: MemAlloc() (1 input parameters) +Function 107: MemAlloc() (1 input parameters) Name: MemAlloc Return type: void * Description: Internal memory allocator Param[1]: size (type: unsigned int) -Function 105: MemRealloc() (2 input parameters) +Function 108: MemRealloc() (2 input parameters) Name: MemRealloc Return type: void * Description: Internal memory reallocator Param[1]: ptr (type: void *) Param[2]: size (type: unsigned int) -Function 106: MemFree() (1 input parameters) +Function 109: MemFree() (1 input parameters) Name: MemFree Return type: void Description: Internal memory free Param[1]: ptr (type: void *) -Function 107: OpenURL() (1 input parameters) - Name: OpenURL - Return type: void - Description: Open URL with default system browser (if available) - Param[1]: url (type: const char *) -Function 108: SetTraceLogCallback() (1 input parameters) +Function 110: SetTraceLogCallback() (1 input parameters) Name: SetTraceLogCallback Return type: void Description: Set custom trace log Param[1]: callback (type: TraceLogCallback) -Function 109: SetLoadFileDataCallback() (1 input parameters) +Function 111: SetLoadFileDataCallback() (1 input parameters) Name: SetLoadFileDataCallback Return type: void Description: Set custom file binary data loader Param[1]: callback (type: LoadFileDataCallback) -Function 110: SetSaveFileDataCallback() (1 input parameters) +Function 112: SetSaveFileDataCallback() (1 input parameters) Name: SetSaveFileDataCallback Return type: void Description: Set custom file binary data saver Param[1]: callback (type: SaveFileDataCallback) -Function 111: SetLoadFileTextCallback() (1 input parameters) +Function 113: SetLoadFileTextCallback() (1 input parameters) Name: SetLoadFileTextCallback Return type: void Description: Set custom file text data loader Param[1]: callback (type: LoadFileTextCallback) -Function 112: SetSaveFileTextCallback() (1 input parameters) +Function 114: SetSaveFileTextCallback() (1 input parameters) Name: SetSaveFileTextCallback Return type: void Description: Set custom file text data saver Param[1]: callback (type: SaveFileTextCallback) -Function 113: LoadFileData() (2 input parameters) +Function 115: LoadFileData() (2 input parameters) Name: LoadFileData Return type: unsigned char * Description: Load file data as byte array (read) Param[1]: fileName (type: const char *) Param[2]: dataSize (type: int *) -Function 114: UnloadFileData() (1 input parameters) +Function 116: UnloadFileData() (1 input parameters) Name: UnloadFileData Return type: void Description: Unload file data allocated by LoadFileData() Param[1]: data (type: unsigned char *) -Function 115: SaveFileData() (3 input parameters) +Function 117: SaveFileData() (3 input parameters) Name: SaveFileData Return type: bool Description: Save data to file from byte array (write), returns true on success Param[1]: fileName (type: const char *) Param[2]: data (type: void *) Param[3]: dataSize (type: int) -Function 116: ExportDataAsCode() (3 input parameters) +Function 118: ExportDataAsCode() (3 input parameters) Name: ExportDataAsCode Return type: bool Description: Export data to code (.h), returns true on success Param[1]: data (type: const unsigned char *) Param[2]: dataSize (type: int) Param[3]: fileName (type: const char *) -Function 117: LoadFileText() (1 input parameters) +Function 119: LoadFileText() (1 input parameters) Name: LoadFileText Return type: char * Description: Load text data from file (read), returns a '\0' terminated string Param[1]: fileName (type: const char *) -Function 118: UnloadFileText() (1 input parameters) +Function 120: UnloadFileText() (1 input parameters) Name: UnloadFileText Return type: void Description: Unload file text data allocated by LoadFileText() Param[1]: text (type: char *) -Function 119: SaveFileText() (2 input parameters) +Function 121: SaveFileText() (2 input parameters) Name: SaveFileText Return type: bool Description: Save text data to file (write), string must be '\0' terminated, returns true on success Param[1]: fileName (type: const char *) Param[2]: text (type: char *) -Function 120: FileExists() (1 input parameters) +Function 122: FileExists() (1 input parameters) Name: FileExists Return type: bool Description: Check if file exists Param[1]: fileName (type: const char *) -Function 121: DirectoryExists() (1 input parameters) +Function 123: DirectoryExists() (1 input parameters) Name: DirectoryExists Return type: bool Description: Check if a directory path exists Param[1]: dirPath (type: const char *) -Function 122: IsFileExtension() (2 input parameters) +Function 124: IsFileExtension() (2 input parameters) Name: IsFileExtension Return type: bool Description: Check file extension (including point: .png, .wav) Param[1]: fileName (type: const char *) Param[2]: ext (type: const char *) -Function 123: GetFileLength() (1 input parameters) +Function 125: GetFileLength() (1 input parameters) Name: GetFileLength Return type: int Description: Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) Param[1]: fileName (type: const char *) -Function 124: GetFileExtension() (1 input parameters) +Function 126: GetFileExtension() (1 input parameters) Name: GetFileExtension Return type: const char * Description: Get pointer to extension for a filename string (includes dot: '.png') Param[1]: fileName (type: const char *) -Function 125: GetFileName() (1 input parameters) +Function 127: GetFileName() (1 input parameters) Name: GetFileName Return type: const char * Description: Get pointer to filename for a path string Param[1]: filePath (type: const char *) -Function 126: GetFileNameWithoutExt() (1 input parameters) +Function 128: GetFileNameWithoutExt() (1 input parameters) Name: GetFileNameWithoutExt Return type: const char * Description: Get filename string without extension (uses static string) Param[1]: filePath (type: const char *) -Function 127: GetDirectoryPath() (1 input parameters) +Function 129: GetDirectoryPath() (1 input parameters) Name: GetDirectoryPath Return type: const char * Description: Get full path for a given fileName with path (uses static string) Param[1]: filePath (type: const char *) -Function 128: GetPrevDirectoryPath() (1 input parameters) +Function 130: GetPrevDirectoryPath() (1 input parameters) Name: GetPrevDirectoryPath Return type: const char * Description: Get previous directory path for a given path (uses static string) Param[1]: dirPath (type: const char *) -Function 129: GetWorkingDirectory() (0 input parameters) +Function 131: GetWorkingDirectory() (0 input parameters) Name: GetWorkingDirectory Return type: const char * Description: Get current working directory (uses static string) No input parameters -Function 130: GetApplicationDirectory() (0 input parameters) +Function 132: GetApplicationDirectory() (0 input parameters) Name: GetApplicationDirectory Return type: const char * Description: Get the directory of the running application (uses static string) No input parameters -Function 131: ChangeDirectory() (1 input parameters) +Function 133: ChangeDirectory() (1 input parameters) Name: ChangeDirectory Return type: bool Description: Change working directory, return true on success Param[1]: dir (type: const char *) -Function 132: IsPathFile() (1 input parameters) +Function 134: IsPathFile() (1 input parameters) Name: IsPathFile Return type: bool Description: Check if a given path is a file or a directory Param[1]: path (type: const char *) -Function 133: LoadDirectoryFiles() (1 input parameters) +Function 135: LoadDirectoryFiles() (1 input parameters) Name: LoadDirectoryFiles Return type: FilePathList Description: Load directory filepaths Param[1]: dirPath (type: const char *) -Function 134: LoadDirectoryFilesEx() (3 input parameters) +Function 136: LoadDirectoryFilesEx() (3 input parameters) Name: LoadDirectoryFilesEx Return type: FilePathList Description: Load directory filepaths with extension filtering and recursive directory scan Param[1]: basePath (type: const char *) Param[2]: filter (type: const char *) Param[3]: scanSubdirs (type: bool) -Function 135: UnloadDirectoryFiles() (1 input parameters) +Function 137: UnloadDirectoryFiles() (1 input parameters) Name: UnloadDirectoryFiles Return type: void Description: Unload filepaths Param[1]: files (type: FilePathList) -Function 136: IsFileDropped() (0 input parameters) +Function 138: IsFileDropped() (0 input parameters) Name: IsFileDropped Return type: bool Description: Check if a file has been dropped into window No input parameters -Function 137: LoadDroppedFiles() (0 input parameters) +Function 139: LoadDroppedFiles() (0 input parameters) Name: LoadDroppedFiles Return type: FilePathList Description: Load dropped filepaths No input parameters -Function 138: UnloadDroppedFiles() (1 input parameters) +Function 140: UnloadDroppedFiles() (1 input parameters) Name: UnloadDroppedFiles Return type: void Description: Unload dropped filepaths Param[1]: files (type: FilePathList) -Function 139: GetFileModTime() (1 input parameters) +Function 141: GetFileModTime() (1 input parameters) Name: GetFileModTime Return type: long Description: Get file modification time (last write time) Param[1]: fileName (type: const char *) -Function 140: CompressData() (3 input parameters) +Function 142: CompressData() (3 input parameters) Name: CompressData Return type: unsigned char * Description: Compress data (DEFLATE algorithm), memory must be MemFree() Param[1]: data (type: const unsigned char *) Param[2]: dataSize (type: int) Param[3]: compDataSize (type: int *) -Function 141: DecompressData() (3 input parameters) +Function 143: DecompressData() (3 input parameters) Name: DecompressData Return type: unsigned char * Description: Decompress data (DEFLATE algorithm), memory must be MemFree() Param[1]: compData (type: const unsigned char *) Param[2]: compDataSize (type: int) Param[3]: dataSize (type: int *) -Function 142: EncodeDataBase64() (3 input parameters) +Function 144: EncodeDataBase64() (3 input parameters) Name: EncodeDataBase64 Return type: char * Description: Encode data to Base64 string, memory must be MemFree() Param[1]: data (type: const unsigned char *) Param[2]: dataSize (type: int) Param[3]: outputSize (type: int *) -Function 143: DecodeDataBase64() (2 input parameters) +Function 145: DecodeDataBase64() (2 input parameters) Name: DecodeDataBase64 Return type: unsigned char * Description: Decode Base64 string data, memory must be MemFree() Param[1]: data (type: const unsigned char *) Param[2]: outputSize (type: int *) -Function 144: IsKeyPressed() (1 input parameters) +Function 146: LoadAutomationEventList() (1 input parameters) + Name: LoadAutomationEventList + Return type: AutomationEventList + Description: Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS + Param[1]: fileName (type: const char *) +Function 147: UnloadAutomationEventList() (1 input parameters) + Name: UnloadAutomationEventList + Return type: void + Description: Unload automation events list from file + Param[1]: list (type: AutomationEventList *) +Function 148: ExportAutomationEventList() (2 input parameters) + Name: ExportAutomationEventList + Return type: bool + Description: Export automation events list as text file + Param[1]: list (type: AutomationEventList) + Param[2]: fileName (type: const char *) +Function 149: SetAutomationEventList() (1 input parameters) + Name: SetAutomationEventList + Return type: void + Description: Set automation event list to record to + Param[1]: list (type: AutomationEventList *) +Function 150: SetAutomationEventBaseFrame() (1 input parameters) + Name: SetAutomationEventBaseFrame + Return type: void + Description: Set automation event internal base frame to start recording + Param[1]: frame (type: int) +Function 151: StartAutomationEventRecording() (0 input parameters) + Name: StartAutomationEventRecording + Return type: void + Description: Start recording automation events (AutomationEventList must be set) + No input parameters +Function 152: StopAutomationEventRecording() (0 input parameters) + Name: StopAutomationEventRecording + Return type: void + Description: Stop recording automation events + No input parameters +Function 153: PlayAutomationEvent() (1 input parameters) + Name: PlayAutomationEvent + Return type: void + Description: Play a recorded automation event + Param[1]: event (type: AutomationEvent) +Function 154: IsKeyPressed() (1 input parameters) Name: IsKeyPressed Return type: bool Description: Check if a key has been pressed once Param[1]: key (type: int) -Function 145: IsKeyPressedRepeat() (1 input parameters) +Function 155: IsKeyPressedRepeat() (1 input parameters) Name: IsKeyPressedRepeat Return type: bool Description: Check if a key has been pressed again (Only PLATFORM_DESKTOP) Param[1]: key (type: int) -Function 146: IsKeyDown() (1 input parameters) +Function 156: IsKeyDown() (1 input parameters) Name: IsKeyDown Return type: bool Description: Check if a key is being pressed Param[1]: key (type: int) -Function 147: IsKeyReleased() (1 input parameters) +Function 157: IsKeyReleased() (1 input parameters) Name: IsKeyReleased Return type: bool Description: Check if a key has been released once Param[1]: key (type: int) -Function 148: IsKeyUp() (1 input parameters) +Function 158: IsKeyUp() (1 input parameters) Name: IsKeyUp Return type: bool Description: Check if a key is NOT being pressed Param[1]: key (type: int) -Function 149: SetExitKey() (1 input parameters) - Name: SetExitKey - Return type: void - Description: Set a custom key to exit program (default is ESC) - Param[1]: key (type: int) -Function 150: GetKeyPressed() (0 input parameters) +Function 159: GetKeyPressed() (0 input parameters) Name: GetKeyPressed Return type: int Description: Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty No input parameters -Function 151: GetCharPressed() (0 input parameters) +Function 160: GetCharPressed() (0 input parameters) Name: GetCharPressed Return type: int Description: Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty No input parameters -Function 152: IsGamepadAvailable() (1 input parameters) +Function 161: SetExitKey() (1 input parameters) + Name: SetExitKey + Return type: void + Description: Set a custom key to exit program (default is ESC) + Param[1]: key (type: int) +Function 162: IsGamepadAvailable() (1 input parameters) Name: IsGamepadAvailable Return type: bool Description: Check if a gamepad is available Param[1]: gamepad (type: int) -Function 153: GetGamepadName() (1 input parameters) +Function 163: GetGamepadName() (1 input parameters) Name: GetGamepadName Return type: const char * Description: Get gamepad internal name id Param[1]: gamepad (type: int) -Function 154: IsGamepadButtonPressed() (2 input parameters) +Function 164: IsGamepadButtonPressed() (2 input parameters) Name: IsGamepadButtonPressed Return type: bool Description: Check if a gamepad button has been pressed once Param[1]: gamepad (type: int) Param[2]: button (type: int) -Function 155: IsGamepadButtonDown() (2 input parameters) +Function 165: IsGamepadButtonDown() (2 input parameters) Name: IsGamepadButtonDown Return type: bool Description: Check if a gamepad button is being pressed Param[1]: gamepad (type: int) Param[2]: button (type: int) -Function 156: IsGamepadButtonReleased() (2 input parameters) +Function 166: IsGamepadButtonReleased() (2 input parameters) Name: IsGamepadButtonReleased Return type: bool Description: Check if a gamepad button has been released once Param[1]: gamepad (type: int) Param[2]: button (type: int) -Function 157: IsGamepadButtonUp() (2 input parameters) +Function 167: IsGamepadButtonUp() (2 input parameters) Name: IsGamepadButtonUp Return type: bool Description: Check if a gamepad button is NOT being pressed Param[1]: gamepad (type: int) Param[2]: button (type: int) -Function 158: GetGamepadButtonPressed() (0 input parameters) +Function 168: GetGamepadButtonPressed() (0 input parameters) Name: GetGamepadButtonPressed Return type: int Description: Get the last gamepad button pressed No input parameters -Function 159: GetGamepadAxisCount() (1 input parameters) +Function 169: GetGamepadAxisCount() (1 input parameters) Name: GetGamepadAxisCount Return type: int Description: Get gamepad axis count for a gamepad Param[1]: gamepad (type: int) -Function 160: GetGamepadAxisMovement() (2 input parameters) +Function 170: GetGamepadAxisMovement() (2 input parameters) Name: GetGamepadAxisMovement Return type: float Description: Get axis movement value for a gamepad axis Param[1]: gamepad (type: int) Param[2]: axis (type: int) -Function 161: SetGamepadMappings() (1 input parameters) +Function 171: SetGamepadMappings() (1 input parameters) Name: SetGamepadMappings Return type: int Description: Set internal gamepad mappings (SDL_GameControllerDB) Param[1]: mappings (type: const char *) -Function 162: IsMouseButtonPressed() (1 input parameters) +Function 172: IsMouseButtonPressed() (1 input parameters) Name: IsMouseButtonPressed Return type: bool Description: Check if a mouse button has been pressed once Param[1]: button (type: int) -Function 163: IsMouseButtonDown() (1 input parameters) +Function 173: IsMouseButtonDown() (1 input parameters) Name: IsMouseButtonDown Return type: bool Description: Check if a mouse button is being pressed Param[1]: button (type: int) -Function 164: IsMouseButtonReleased() (1 input parameters) +Function 174: IsMouseButtonReleased() (1 input parameters) Name: IsMouseButtonReleased Return type: bool Description: Check if a mouse button has been released once Param[1]: button (type: int) -Function 165: IsMouseButtonUp() (1 input parameters) +Function 175: IsMouseButtonUp() (1 input parameters) Name: IsMouseButtonUp Return type: bool Description: Check if a mouse button is NOT being pressed Param[1]: button (type: int) -Function 166: GetMouseX() (0 input parameters) +Function 176: GetMouseX() (0 input parameters) Name: GetMouseX Return type: int Description: Get mouse position X No input parameters -Function 167: GetMouseY() (0 input parameters) +Function 177: GetMouseY() (0 input parameters) Name: GetMouseY Return type: int Description: Get mouse position Y No input parameters -Function 168: GetMousePosition() (0 input parameters) +Function 178: GetMousePosition() (0 input parameters) Name: GetMousePosition Return type: Vector2 Description: Get mouse position XY No input parameters -Function 169: GetMouseDelta() (0 input parameters) +Function 179: GetMouseDelta() (0 input parameters) Name: GetMouseDelta Return type: Vector2 Description: Get mouse delta between frames No input parameters -Function 170: SetMousePosition() (2 input parameters) +Function 180: SetMousePosition() (2 input parameters) Name: SetMousePosition Return type: void Description: Set mouse position XY Param[1]: x (type: int) Param[2]: y (type: int) -Function 171: SetMouseOffset() (2 input parameters) +Function 181: SetMouseOffset() (2 input parameters) Name: SetMouseOffset Return type: void Description: Set mouse offset Param[1]: offsetX (type: int) Param[2]: offsetY (type: int) -Function 172: SetMouseScale() (2 input parameters) +Function 182: SetMouseScale() (2 input parameters) Name: SetMouseScale Return type: void Description: Set mouse scaling Param[1]: scaleX (type: float) Param[2]: scaleY (type: float) -Function 173: GetMouseWheelMove() (0 input parameters) +Function 183: GetMouseWheelMove() (0 input parameters) Name: GetMouseWheelMove Return type: float Description: Get mouse wheel movement for X or Y, whichever is larger No input parameters -Function 174: GetMouseWheelMoveV() (0 input parameters) +Function 184: GetMouseWheelMoveV() (0 input parameters) Name: GetMouseWheelMoveV Return type: Vector2 Description: Get mouse wheel movement for both X and Y No input parameters -Function 175: SetMouseCursor() (1 input parameters) +Function 185: SetMouseCursor() (1 input parameters) Name: SetMouseCursor Return type: void Description: Set mouse cursor Param[1]: cursor (type: int) -Function 176: GetTouchX() (0 input parameters) +Function 186: GetTouchX() (0 input parameters) Name: GetTouchX Return type: int Description: Get touch position X for touch point 0 (relative to screen size) No input parameters -Function 177: GetTouchY() (0 input parameters) +Function 187: GetTouchY() (0 input parameters) Name: GetTouchY Return type: int Description: Get touch position Y for touch point 0 (relative to screen size) No input parameters -Function 178: GetTouchPosition() (1 input parameters) +Function 188: GetTouchPosition() (1 input parameters) Name: GetTouchPosition Return type: Vector2 Description: Get touch position XY for a touch point index (relative to screen size) Param[1]: index (type: int) -Function 179: GetTouchPointId() (1 input parameters) +Function 189: GetTouchPointId() (1 input parameters) Name: GetTouchPointId Return type: int Description: Get touch point identifier for given index Param[1]: index (type: int) -Function 180: GetTouchPointCount() (0 input parameters) +Function 190: GetTouchPointCount() (0 input parameters) Name: GetTouchPointCount Return type: int Description: Get number of touch points No input parameters -Function 181: SetGesturesEnabled() (1 input parameters) +Function 191: SetGesturesEnabled() (1 input parameters) Name: SetGesturesEnabled Return type: void Description: Enable a set of gestures using flags Param[1]: flags (type: unsigned int) -Function 182: IsGestureDetected() (1 input parameters) +Function 192: IsGestureDetected() (1 input parameters) Name: IsGestureDetected Return type: bool Description: Check if a gesture have been detected Param[1]: gesture (type: unsigned int) -Function 183: GetGestureDetected() (0 input parameters) +Function 193: GetGestureDetected() (0 input parameters) Name: GetGestureDetected Return type: int Description: Get latest detected gesture No input parameters -Function 184: GetGestureHoldDuration() (0 input parameters) +Function 194: GetGestureHoldDuration() (0 input parameters) Name: GetGestureHoldDuration Return type: float Description: Get gesture hold time in milliseconds No input parameters -Function 185: GetGestureDragVector() (0 input parameters) +Function 195: GetGestureDragVector() (0 input parameters) Name: GetGestureDragVector Return type: Vector2 Description: Get gesture drag vector No input parameters -Function 186: GetGestureDragAngle() (0 input parameters) +Function 196: GetGestureDragAngle() (0 input parameters) Name: GetGestureDragAngle Return type: float Description: Get gesture drag angle No input parameters -Function 187: GetGesturePinchVector() (0 input parameters) +Function 197: GetGesturePinchVector() (0 input parameters) Name: GetGesturePinchVector Return type: Vector2 Description: Get gesture pinch delta No input parameters -Function 188: GetGesturePinchAngle() (0 input parameters) +Function 198: GetGesturePinchAngle() (0 input parameters) Name: GetGesturePinchAngle Return type: float Description: Get gesture pinch angle No input parameters -Function 189: UpdateCamera() (2 input parameters) +Function 199: UpdateCamera() (2 input parameters) Name: UpdateCamera Return type: void Description: Update camera position for selected mode Param[1]: camera (type: Camera *) Param[2]: mode (type: int) -Function 190: UpdateCameraPro() (4 input parameters) +Function 200: UpdateCameraPro() (4 input parameters) Name: UpdateCameraPro Return type: void Description: Update camera movement/rotation @@ -1984,26 +2049,26 @@ Function 190: UpdateCameraPro() (4 input parameters) Param[2]: movement (type: Vector3) Param[3]: rotation (type: Vector3) Param[4]: zoom (type: float) -Function 191: SetShapesTexture() (2 input parameters) +Function 201: SetShapesTexture() (2 input parameters) Name: SetShapesTexture Return type: void Description: Set texture and rectangle to be used on shapes drawing Param[1]: texture (type: Texture2D) Param[2]: source (type: Rectangle) -Function 192: DrawPixel() (3 input parameters) +Function 202: DrawPixel() (3 input parameters) Name: DrawPixel Return type: void Description: Draw a pixel Param[1]: posX (type: int) Param[2]: posY (type: int) Param[3]: color (type: Color) -Function 193: DrawPixelV() (2 input parameters) +Function 203: DrawPixelV() (2 input parameters) Name: DrawPixelV Return type: void Description: Draw a pixel (Vector version) Param[1]: position (type: Vector2) Param[2]: color (type: Color) -Function 194: DrawLine() (5 input parameters) +Function 204: DrawLine() (5 input parameters) Name: DrawLine Return type: void Description: Draw a line @@ -2012,72 +2077,37 @@ Function 194: DrawLine() (5 input parameters) Param[3]: endPosX (type: int) Param[4]: endPosY (type: int) Param[5]: color (type: Color) -Function 195: DrawLineV() (3 input parameters) +Function 205: DrawLineV() (3 input parameters) Name: DrawLineV Return type: void - Description: Draw a line (Vector version) + Description: Draw a line (using gl lines) Param[1]: startPos (type: Vector2) Param[2]: endPos (type: Vector2) Param[3]: color (type: Color) -Function 196: DrawLineEx() (4 input parameters) +Function 206: DrawLineEx() (4 input parameters) Name: DrawLineEx Return type: void - Description: Draw a line defining thickness + Description: Draw a line (using triangles/quads) Param[1]: startPos (type: Vector2) Param[2]: endPos (type: Vector2) Param[3]: thick (type: float) Param[4]: color (type: Color) -Function 197: DrawLineBezier() (4 input parameters) - Name: DrawLineBezier - Return type: void - Description: Draw a line using cubic-bezier curves in-out - Param[1]: startPos (type: Vector2) - Param[2]: endPos (type: Vector2) - Param[3]: thick (type: float) - Param[4]: color (type: Color) -Function 198: DrawLineBezierQuad() (5 input parameters) - Name: DrawLineBezierQuad - Return type: void - Description: Draw line using quadratic bezier curves with a control point - Param[1]: startPos (type: Vector2) - Param[2]: endPos (type: Vector2) - Param[3]: controlPos (type: Vector2) - Param[4]: thick (type: float) - Param[5]: color (type: Color) -Function 199: DrawLineBezierCubic() (6 input parameters) - Name: DrawLineBezierCubic - Return type: void - Description: Draw line using cubic bezier curves with 2 control points - Param[1]: startPos (type: Vector2) - Param[2]: endPos (type: Vector2) - Param[3]: startControlPos (type: Vector2) - Param[4]: endControlPos (type: Vector2) - Param[5]: thick (type: float) - Param[6]: color (type: Color) -Function 200: DrawLineBSpline() (4 input parameters) - Name: DrawLineBSpline - Return type: void - Description: Draw a B-Spline line, minimum 4 points - Param[1]: points (type: Vector2 *) - Param[2]: pointCount (type: int) - Param[3]: thick (type: float) - Param[4]: color (type: Color) -Function 201: DrawLineCatmullRom() (4 input parameters) - Name: DrawLineCatmullRom - Return type: void - Description: Draw a Catmull Rom spline line, minimum 4 points - Param[1]: points (type: Vector2 *) - Param[2]: pointCount (type: int) - Param[3]: thick (type: float) - Param[4]: color (type: Color) -Function 202: DrawLineStrip() (3 input parameters) +Function 207: DrawLineStrip() (3 input parameters) Name: DrawLineStrip Return type: void - Description: Draw lines sequence + Description: Draw lines sequence (using gl lines) Param[1]: points (type: Vector2 *) Param[2]: pointCount (type: int) Param[3]: color (type: Color) -Function 203: DrawCircle() (4 input parameters) +Function 208: DrawLineBezier() (4 input parameters) + Name: DrawLineBezier + Return type: void + Description: Draw line segment cubic-bezier in-out interpolation + Param[1]: startPos (type: Vector2) + Param[2]: endPos (type: Vector2) + Param[3]: thick (type: float) + Param[4]: color (type: Color) +Function 209: DrawCircle() (4 input parameters) Name: DrawCircle Return type: void Description: Draw a color-filled circle @@ -2085,7 +2115,7 @@ Function 203: DrawCircle() (4 input parameters) Param[2]: centerY (type: int) Param[3]: radius (type: float) Param[4]: color (type: Color) -Function 204: DrawCircleSector() (6 input parameters) +Function 210: DrawCircleSector() (6 input parameters) Name: DrawCircleSector Return type: void Description: Draw a piece of a circle @@ -2095,7 +2125,7 @@ Function 204: DrawCircleSector() (6 input parameters) Param[4]: endAngle (type: float) Param[5]: segments (type: int) Param[6]: color (type: Color) -Function 205: DrawCircleSectorLines() (6 input parameters) +Function 211: DrawCircleSectorLines() (6 input parameters) Name: DrawCircleSectorLines Return type: void Description: Draw circle sector outline @@ -2105,7 +2135,7 @@ Function 205: DrawCircleSectorLines() (6 input parameters) Param[4]: endAngle (type: float) Param[5]: segments (type: int) Param[6]: color (type: Color) -Function 206: DrawCircleGradient() (5 input parameters) +Function 212: DrawCircleGradient() (5 input parameters) Name: DrawCircleGradient Return type: void Description: Draw a gradient-filled circle @@ -2114,14 +2144,14 @@ Function 206: DrawCircleGradient() (5 input parameters) Param[3]: radius (type: float) Param[4]: color1 (type: Color) Param[5]: color2 (type: Color) -Function 207: DrawCircleV() (3 input parameters) +Function 213: DrawCircleV() (3 input parameters) Name: DrawCircleV Return type: void Description: Draw a color-filled circle (Vector version) Param[1]: center (type: Vector2) Param[2]: radius (type: float) Param[3]: color (type: Color) -Function 208: DrawCircleLines() (4 input parameters) +Function 214: DrawCircleLines() (4 input parameters) Name: DrawCircleLines Return type: void Description: Draw circle outline @@ -2129,7 +2159,14 @@ Function 208: DrawCircleLines() (4 input parameters) Param[2]: centerY (type: int) Param[3]: radius (type: float) Param[4]: color (type: Color) -Function 209: DrawEllipse() (5 input parameters) +Function 215: DrawCircleLinesV() (3 input parameters) + Name: DrawCircleLinesV + Return type: void + Description: Draw circle outline (Vector version) + Param[1]: center (type: Vector2) + Param[2]: radius (type: float) + Param[3]: color (type: Color) +Function 216: DrawEllipse() (5 input parameters) Name: DrawEllipse Return type: void Description: Draw ellipse @@ -2138,7 +2175,7 @@ Function 209: DrawEllipse() (5 input parameters) Param[3]: radiusH (type: float) Param[4]: radiusV (type: float) Param[5]: color (type: Color) -Function 210: DrawEllipseLines() (5 input parameters) +Function 217: DrawEllipseLines() (5 input parameters) Name: DrawEllipseLines Return type: void Description: Draw ellipse outline @@ -2147,7 +2184,7 @@ Function 210: DrawEllipseLines() (5 input parameters) Param[3]: radiusH (type: float) Param[4]: radiusV (type: float) Param[5]: color (type: Color) -Function 211: DrawRing() (7 input parameters) +Function 218: DrawRing() (7 input parameters) Name: DrawRing Return type: void Description: Draw ring @@ -2158,7 +2195,7 @@ Function 211: DrawRing() (7 input parameters) Param[5]: endAngle (type: float) Param[6]: segments (type: int) Param[7]: color (type: Color) -Function 212: DrawRingLines() (7 input parameters) +Function 219: DrawRingLines() (7 input parameters) Name: DrawRingLines Return type: void Description: Draw ring outline @@ -2169,7 +2206,7 @@ Function 212: DrawRingLines() (7 input parameters) Param[5]: endAngle (type: float) Param[6]: segments (type: int) Param[7]: color (type: Color) -Function 213: DrawRectangle() (5 input parameters) +Function 220: DrawRectangle() (5 input parameters) Name: DrawRectangle Return type: void Description: Draw a color-filled rectangle @@ -2178,20 +2215,20 @@ Function 213: DrawRectangle() (5 input parameters) Param[3]: width (type: int) Param[4]: height (type: int) Param[5]: color (type: Color) -Function 214: DrawRectangleV() (3 input parameters) +Function 221: DrawRectangleV() (3 input parameters) Name: DrawRectangleV Return type: void Description: Draw a color-filled rectangle (Vector version) Param[1]: position (type: Vector2) Param[2]: size (type: Vector2) Param[3]: color (type: Color) -Function 215: DrawRectangleRec() (2 input parameters) +Function 222: DrawRectangleRec() (2 input parameters) Name: DrawRectangleRec Return type: void Description: Draw a color-filled rectangle Param[1]: rec (type: Rectangle) Param[2]: color (type: Color) -Function 216: DrawRectanglePro() (4 input parameters) +Function 223: DrawRectanglePro() (4 input parameters) Name: DrawRectanglePro Return type: void Description: Draw a color-filled rectangle with pro parameters @@ -2199,7 +2236,7 @@ Function 216: DrawRectanglePro() (4 input parameters) Param[2]: origin (type: Vector2) Param[3]: rotation (type: float) Param[4]: color (type: Color) -Function 217: DrawRectangleGradientV() (6 input parameters) +Function 224: DrawRectangleGradientV() (6 input parameters) Name: DrawRectangleGradientV Return type: void Description: Draw a vertical-gradient-filled rectangle @@ -2209,7 +2246,7 @@ Function 217: DrawRectangleGradientV() (6 input parameters) Param[4]: height (type: int) Param[5]: color1 (type: Color) Param[6]: color2 (type: Color) -Function 218: DrawRectangleGradientH() (6 input parameters) +Function 225: DrawRectangleGradientH() (6 input parameters) Name: DrawRectangleGradientH Return type: void Description: Draw a horizontal-gradient-filled rectangle @@ -2219,7 +2256,7 @@ Function 218: DrawRectangleGradientH() (6 input parameters) Param[4]: height (type: int) Param[5]: color1 (type: Color) Param[6]: color2 (type: Color) -Function 219: DrawRectangleGradientEx() (5 input parameters) +Function 226: DrawRectangleGradientEx() (5 input parameters) Name: DrawRectangleGradientEx Return type: void Description: Draw a gradient-filled rectangle with custom vertex colors @@ -2228,7 +2265,7 @@ Function 219: DrawRectangleGradientEx() (5 input parameters) Param[3]: col2 (type: Color) Param[4]: col3 (type: Color) Param[5]: col4 (type: Color) -Function 220: DrawRectangleLines() (5 input parameters) +Function 227: DrawRectangleLines() (5 input parameters) Name: DrawRectangleLines Return type: void Description: Draw rectangle outline @@ -2237,14 +2274,14 @@ Function 220: DrawRectangleLines() (5 input parameters) Param[3]: width (type: int) Param[4]: height (type: int) Param[5]: color (type: Color) -Function 221: DrawRectangleLinesEx() (3 input parameters) +Function 228: DrawRectangleLinesEx() (3 input parameters) Name: DrawRectangleLinesEx Return type: void Description: Draw rectangle outline with extended parameters Param[1]: rec (type: Rectangle) Param[2]: lineThick (type: float) Param[3]: color (type: Color) -Function 222: DrawRectangleRounded() (4 input parameters) +Function 229: DrawRectangleRounded() (4 input parameters) Name: DrawRectangleRounded Return type: void Description: Draw rectangle with rounded edges @@ -2252,7 +2289,7 @@ Function 222: DrawRectangleRounded() (4 input parameters) Param[2]: roundness (type: float) Param[3]: segments (type: int) Param[4]: color (type: Color) -Function 223: DrawRectangleRoundedLines() (5 input parameters) +Function 230: DrawRectangleRoundedLines() (5 input parameters) Name: DrawRectangleRoundedLines Return type: void Description: Draw rectangle with rounded edges outline @@ -2261,7 +2298,7 @@ Function 223: DrawRectangleRoundedLines() (5 input parameters) Param[3]: segments (type: int) Param[4]: lineThick (type: float) Param[5]: color (type: Color) -Function 224: DrawTriangle() (4 input parameters) +Function 231: DrawTriangle() (4 input parameters) Name: DrawTriangle Return type: void Description: Draw a color-filled triangle (vertex in counter-clockwise order!) @@ -2269,7 +2306,7 @@ Function 224: DrawTriangle() (4 input parameters) Param[2]: v2 (type: Vector2) Param[3]: v3 (type: Vector2) Param[4]: color (type: Color) -Function 225: DrawTriangleLines() (4 input parameters) +Function 232: DrawTriangleLines() (4 input parameters) Name: DrawTriangleLines Return type: void Description: Draw triangle outline (vertex in counter-clockwise order!) @@ -2277,21 +2314,21 @@ Function 225: DrawTriangleLines() (4 input parameters) Param[2]: v2 (type: Vector2) Param[3]: v3 (type: Vector2) Param[4]: color (type: Color) -Function 226: DrawTriangleFan() (3 input parameters) +Function 233: DrawTriangleFan() (3 input parameters) Name: DrawTriangleFan Return type: void Description: Draw a triangle fan defined by points (first vertex is the center) Param[1]: points (type: Vector2 *) Param[2]: pointCount (type: int) Param[3]: color (type: Color) -Function 227: DrawTriangleStrip() (3 input parameters) +Function 234: DrawTriangleStrip() (3 input parameters) Name: DrawTriangleStrip Return type: void Description: Draw a triangle strip defined by points Param[1]: points (type: Vector2 *) Param[2]: pointCount (type: int) Param[3]: color (type: Color) -Function 228: DrawPoly() (5 input parameters) +Function 235: DrawPoly() (5 input parameters) Name: DrawPoly Return type: void Description: Draw a regular polygon (Vector version) @@ -2300,7 +2337,7 @@ Function 228: DrawPoly() (5 input parameters) Param[3]: radius (type: float) Param[4]: rotation (type: float) Param[5]: color (type: Color) -Function 229: DrawPolyLines() (5 input parameters) +Function 236: DrawPolyLines() (5 input parameters) Name: DrawPolyLines Return type: void Description: Draw a polygon outline of n sides @@ -2309,7 +2346,7 @@ Function 229: DrawPolyLines() (5 input parameters) Param[3]: radius (type: float) Param[4]: rotation (type: float) Param[5]: color (type: Color) -Function 230: DrawPolyLinesEx() (6 input parameters) +Function 237: DrawPolyLinesEx() (6 input parameters) Name: DrawPolyLinesEx Return type: void Description: Draw a polygon outline of n sides with extended parameters @@ -2319,13 +2356,142 @@ Function 230: DrawPolyLinesEx() (6 input parameters) Param[4]: rotation (type: float) Param[5]: lineThick (type: float) Param[6]: color (type: Color) -Function 231: CheckCollisionRecs() (2 input parameters) +Function 238: DrawSplineLinear() (4 input parameters) + Name: DrawSplineLinear + Return type: void + Description: Draw spline: Linear, minimum 2 points + Param[1]: points (type: Vector2 *) + Param[2]: pointCount (type: int) + Param[3]: thick (type: float) + Param[4]: color (type: Color) +Function 239: DrawSplineBasis() (4 input parameters) + Name: DrawSplineBasis + Return type: void + Description: Draw spline: B-Spline, minimum 4 points + Param[1]: points (type: Vector2 *) + Param[2]: pointCount (type: int) + Param[3]: thick (type: float) + Param[4]: color (type: Color) +Function 240: DrawSplineCatmullRom() (4 input parameters) + Name: DrawSplineCatmullRom + Return type: void + Description: Draw spline: Catmull-Rom, minimum 4 points + Param[1]: points (type: Vector2 *) + Param[2]: pointCount (type: int) + Param[3]: thick (type: float) + Param[4]: color (type: Color) +Function 241: DrawSplineBezierQuadratic() (4 input parameters) + Name: DrawSplineBezierQuadratic + Return type: void + Description: Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...] + Param[1]: points (type: Vector2 *) + Param[2]: pointCount (type: int) + Param[3]: thick (type: float) + Param[4]: color (type: Color) +Function 242: DrawSplineBezierCubic() (4 input parameters) + Name: DrawSplineBezierCubic + Return type: void + Description: Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...] + Param[1]: points (type: Vector2 *) + Param[2]: pointCount (type: int) + Param[3]: thick (type: float) + Param[4]: color (type: Color) +Function 243: DrawSplineSegmentLinear() (4 input parameters) + Name: DrawSplineSegmentLinear + Return type: void + Description: Draw spline segment: Linear, 2 points + Param[1]: p1 (type: Vector2) + Param[2]: p2 (type: Vector2) + Param[3]: thick (type: float) + Param[4]: color (type: Color) +Function 244: DrawSplineSegmentBasis() (6 input parameters) + Name: DrawSplineSegmentBasis + Return type: void + Description: Draw spline segment: B-Spline, 4 points + Param[1]: p1 (type: Vector2) + Param[2]: p2 (type: Vector2) + Param[3]: p3 (type: Vector2) + Param[4]: p4 (type: Vector2) + Param[5]: thick (type: float) + Param[6]: color (type: Color) +Function 245: DrawSplineSegmentCatmullRom() (6 input parameters) + Name: DrawSplineSegmentCatmullRom + Return type: void + Description: Draw spline segment: Catmull-Rom, 4 points + Param[1]: p1 (type: Vector2) + Param[2]: p2 (type: Vector2) + Param[3]: p3 (type: Vector2) + Param[4]: p4 (type: Vector2) + Param[5]: thick (type: float) + Param[6]: color (type: Color) +Function 246: DrawSplineSegmentBezierQuadratic() (5 input parameters) + Name: DrawSplineSegmentBezierQuadratic + Return type: void + Description: Draw spline segment: Quadratic Bezier, 2 points, 1 control point + Param[1]: p1 (type: Vector2) + Param[2]: c2 (type: Vector2) + Param[3]: p3 (type: Vector2) + Param[4]: thick (type: float) + Param[5]: color (type: Color) +Function 247: DrawSplineSegmentBezierCubic() (6 input parameters) + Name: DrawSplineSegmentBezierCubic + Return type: void + Description: Draw spline segment: Cubic Bezier, 2 points, 2 control points + Param[1]: p1 (type: Vector2) + Param[2]: c2 (type: Vector2) + Param[3]: c3 (type: Vector2) + Param[4]: p4 (type: Vector2) + Param[5]: thick (type: float) + Param[6]: color (type: Color) +Function 248: GetSplinePointLinear() (3 input parameters) + Name: GetSplinePointLinear + Return type: Vector2 + Description: Get (evaluate) spline point: Linear + Param[1]: startPos (type: Vector2) + Param[2]: endPos (type: Vector2) + Param[3]: t (type: float) +Function 249: GetSplinePointBasis() (5 input parameters) + Name: GetSplinePointBasis + Return type: Vector2 + Description: Get (evaluate) spline point: B-Spline + Param[1]: p1 (type: Vector2) + Param[2]: p2 (type: Vector2) + Param[3]: p3 (type: Vector2) + Param[4]: p4 (type: Vector2) + Param[5]: t (type: float) +Function 250: GetSplinePointCatmullRom() (5 input parameters) + Name: GetSplinePointCatmullRom + Return type: Vector2 + Description: Get (evaluate) spline point: Catmull-Rom + Param[1]: p1 (type: Vector2) + Param[2]: p2 (type: Vector2) + Param[3]: p3 (type: Vector2) + Param[4]: p4 (type: Vector2) + Param[5]: t (type: float) +Function 251: GetSplinePointBezierQuad() (4 input parameters) + Name: GetSplinePointBezierQuad + Return type: Vector2 + Description: Get (evaluate) spline point: Quadratic Bezier + Param[1]: p1 (type: Vector2) + Param[2]: c2 (type: Vector2) + Param[3]: p3 (type: Vector2) + Param[4]: t (type: float) +Function 252: GetSplinePointBezierCubic() (5 input parameters) + Name: GetSplinePointBezierCubic + Return type: Vector2 + Description: Get (evaluate) spline point: Cubic Bezier + Param[1]: p1 (type: Vector2) + Param[2]: c2 (type: Vector2) + Param[3]: c3 (type: Vector2) + Param[4]: p4 (type: Vector2) + Param[5]: t (type: float) +Function 253: CheckCollisionRecs() (2 input parameters) Name: CheckCollisionRecs Return type: bool Description: Check collision between two rectangles Param[1]: rec1 (type: Rectangle) Param[2]: rec2 (type: Rectangle) -Function 232: CheckCollisionCircles() (4 input parameters) +Function 254: CheckCollisionCircles() (4 input parameters) Name: CheckCollisionCircles Return type: bool Description: Check collision between two circles @@ -2333,27 +2499,27 @@ Function 232: CheckCollisionCircles() (4 input parameters) Param[2]: radius1 (type: float) Param[3]: center2 (type: Vector2) Param[4]: radius2 (type: float) -Function 233: CheckCollisionCircleRec() (3 input parameters) +Function 255: CheckCollisionCircleRec() (3 input parameters) Name: CheckCollisionCircleRec Return type: bool Description: Check collision between circle and rectangle Param[1]: center (type: Vector2) Param[2]: radius (type: float) Param[3]: rec (type: Rectangle) -Function 234: CheckCollisionPointRec() (2 input parameters) +Function 256: CheckCollisionPointRec() (2 input parameters) Name: CheckCollisionPointRec Return type: bool Description: Check if point is inside rectangle Param[1]: point (type: Vector2) Param[2]: rec (type: Rectangle) -Function 235: CheckCollisionPointCircle() (3 input parameters) +Function 257: CheckCollisionPointCircle() (3 input parameters) Name: CheckCollisionPointCircle Return type: bool Description: Check if point is inside circle Param[1]: point (type: Vector2) Param[2]: center (type: Vector2) Param[3]: radius (type: float) -Function 236: CheckCollisionPointTriangle() (4 input parameters) +Function 258: CheckCollisionPointTriangle() (4 input parameters) Name: CheckCollisionPointTriangle Return type: bool Description: Check if point is inside a triangle @@ -2361,14 +2527,14 @@ Function 236: CheckCollisionPointTriangle() (4 input parameters) Param[2]: p1 (type: Vector2) Param[3]: p2 (type: Vector2) Param[4]: p3 (type: Vector2) -Function 237: CheckCollisionPointPoly() (3 input parameters) +Function 259: CheckCollisionPointPoly() (3 input parameters) Name: CheckCollisionPointPoly Return type: bool Description: Check if point is within a polygon described by array of vertices Param[1]: point (type: Vector2) Param[2]: points (type: Vector2 *) Param[3]: pointCount (type: int) -Function 238: CheckCollisionLines() (5 input parameters) +Function 260: CheckCollisionLines() (5 input parameters) Name: CheckCollisionLines Return type: bool Description: Check the collision between two lines defined by two points each, returns collision point by reference @@ -2377,7 +2543,7 @@ Function 238: CheckCollisionLines() (5 input parameters) Param[3]: startPos2 (type: Vector2) Param[4]: endPos2 (type: Vector2) Param[5]: collisionPoint (type: Vector2 *) -Function 239: CheckCollisionPointLine() (4 input parameters) +Function 261: CheckCollisionPointLine() (4 input parameters) Name: CheckCollisionPointLine Return type: bool Description: Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] @@ -2385,18 +2551,18 @@ Function 239: CheckCollisionPointLine() (4 input parameters) Param[2]: p1 (type: Vector2) Param[3]: p2 (type: Vector2) Param[4]: threshold (type: int) -Function 240: GetCollisionRec() (2 input parameters) +Function 262: GetCollisionRec() (2 input parameters) Name: GetCollisionRec Return type: Rectangle Description: Get collision rectangle for two rectangles collision Param[1]: rec1 (type: Rectangle) Param[2]: rec2 (type: Rectangle) -Function 241: LoadImage() (1 input parameters) +Function 263: LoadImage() (1 input parameters) Name: LoadImage Return type: Image Description: Load image from file into CPU memory (RAM) Param[1]: fileName (type: const char *) -Function 242: LoadImageRaw() (5 input parameters) +Function 264: LoadImageRaw() (5 input parameters) Name: LoadImageRaw Return type: Image Description: Load image from RAW file data @@ -2405,73 +2571,73 @@ Function 242: LoadImageRaw() (5 input parameters) Param[3]: height (type: int) Param[4]: format (type: int) Param[5]: headerSize (type: int) -Function 243: LoadImageSvg() (3 input parameters) +Function 265: LoadImageSvg() (3 input parameters) Name: LoadImageSvg Return type: Image Description: Load image from SVG file data or string with specified size Param[1]: fileNameOrString (type: const char *) Param[2]: width (type: int) Param[3]: height (type: int) -Function 244: LoadImageAnim() (2 input parameters) +Function 266: LoadImageAnim() (2 input parameters) Name: LoadImageAnim Return type: Image Description: Load image sequence from file (frames appended to image.data) Param[1]: fileName (type: const char *) Param[2]: frames (type: int *) -Function 245: LoadImageFromMemory() (3 input parameters) +Function 267: LoadImageFromMemory() (3 input parameters) Name: LoadImageFromMemory Return type: Image Description: Load image from memory buffer, fileType refers to extension: i.e. '.png' Param[1]: fileType (type: const char *) Param[2]: fileData (type: const unsigned char *) Param[3]: dataSize (type: int) -Function 246: LoadImageFromTexture() (1 input parameters) +Function 268: LoadImageFromTexture() (1 input parameters) Name: LoadImageFromTexture Return type: Image Description: Load image from GPU texture data Param[1]: texture (type: Texture2D) -Function 247: LoadImageFromScreen() (0 input parameters) +Function 269: LoadImageFromScreen() (0 input parameters) Name: LoadImageFromScreen Return type: Image Description: Load image from screen buffer and (screenshot) No input parameters -Function 248: IsImageReady() (1 input parameters) +Function 270: IsImageReady() (1 input parameters) Name: IsImageReady Return type: bool Description: Check if an image is ready Param[1]: image (type: Image) -Function 249: UnloadImage() (1 input parameters) +Function 271: UnloadImage() (1 input parameters) Name: UnloadImage Return type: void Description: Unload image from CPU memory (RAM) Param[1]: image (type: Image) -Function 250: ExportImage() (2 input parameters) +Function 272: ExportImage() (2 input parameters) Name: ExportImage Return type: bool Description: Export image data to file, returns true on success Param[1]: image (type: Image) Param[2]: fileName (type: const char *) -Function 251: ExportImageToMemory() (3 input parameters) +Function 273: ExportImageToMemory() (3 input parameters) Name: ExportImageToMemory Return type: unsigned char * Description: Export image to memory buffer Param[1]: image (type: Image) Param[2]: fileType (type: const char *) Param[3]: fileSize (type: int *) -Function 252: ExportImageAsCode() (2 input parameters) +Function 274: ExportImageAsCode() (2 input parameters) Name: ExportImageAsCode Return type: bool Description: Export image as code file defining an array of bytes, returns true on success Param[1]: image (type: Image) Param[2]: fileName (type: const char *) -Function 253: GenImageColor() (3 input parameters) +Function 275: GenImageColor() (3 input parameters) Name: GenImageColor Return type: Image Description: Generate image: plain color Param[1]: width (type: int) Param[2]: height (type: int) Param[3]: color (type: Color) -Function 254: GenImageGradientLinear() (5 input parameters) +Function 276: GenImageGradientLinear() (5 input parameters) Name: GenImageGradientLinear Return type: Image Description: Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient @@ -2480,7 +2646,7 @@ Function 254: GenImageGradientLinear() (5 input parameters) Param[3]: direction (type: int) Param[4]: start (type: Color) Param[5]: end (type: Color) -Function 255: GenImageGradientRadial() (5 input parameters) +Function 277: GenImageGradientRadial() (5 input parameters) Name: GenImageGradientRadial Return type: Image Description: Generate image: radial gradient @@ -2489,7 +2655,7 @@ Function 255: GenImageGradientRadial() (5 input parameters) Param[3]: density (type: float) Param[4]: inner (type: Color) Param[5]: outer (type: Color) -Function 256: GenImageGradientSquare() (5 input parameters) +Function 278: GenImageGradientSquare() (5 input parameters) Name: GenImageGradientSquare Return type: Image Description: Generate image: square gradient @@ -2498,7 +2664,7 @@ Function 256: GenImageGradientSquare() (5 input parameters) Param[3]: density (type: float) Param[4]: inner (type: Color) Param[5]: outer (type: Color) -Function 257: GenImageChecked() (6 input parameters) +Function 279: GenImageChecked() (6 input parameters) Name: GenImageChecked Return type: Image Description: Generate image: checked @@ -2508,14 +2674,14 @@ Function 257: GenImageChecked() (6 input parameters) Param[4]: checksY (type: int) Param[5]: col1 (type: Color) Param[6]: col2 (type: Color) -Function 258: GenImageWhiteNoise() (3 input parameters) +Function 280: GenImageWhiteNoise() (3 input parameters) Name: GenImageWhiteNoise Return type: Image Description: Generate image: white noise Param[1]: width (type: int) Param[2]: height (type: int) Param[3]: factor (type: float) -Function 259: GenImagePerlinNoise() (5 input parameters) +Function 281: GenImagePerlinNoise() (5 input parameters) Name: GenImagePerlinNoise Return type: Image Description: Generate image: perlin noise @@ -2524,39 +2690,39 @@ Function 259: GenImagePerlinNoise() (5 input parameters) Param[3]: offsetX (type: int) Param[4]: offsetY (type: int) Param[5]: scale (type: float) -Function 260: GenImageCellular() (3 input parameters) +Function 282: GenImageCellular() (3 input parameters) Name: GenImageCellular Return type: Image Description: Generate image: cellular algorithm, bigger tileSize means bigger cells Param[1]: width (type: int) Param[2]: height (type: int) Param[3]: tileSize (type: int) -Function 261: GenImageText() (3 input parameters) +Function 283: GenImageText() (3 input parameters) Name: GenImageText Return type: Image Description: Generate image: grayscale image from text data Param[1]: width (type: int) Param[2]: height (type: int) Param[3]: text (type: const char *) -Function 262: ImageCopy() (1 input parameters) +Function 284: ImageCopy() (1 input parameters) Name: ImageCopy Return type: Image Description: Create an image duplicate (useful for transformations) Param[1]: image (type: Image) -Function 263: ImageFromImage() (2 input parameters) +Function 285: ImageFromImage() (2 input parameters) Name: ImageFromImage Return type: Image Description: Create an image from another image piece Param[1]: image (type: Image) Param[2]: rec (type: Rectangle) -Function 264: ImageText() (3 input parameters) +Function 286: ImageText() (3 input parameters) Name: ImageText Return type: Image Description: Create an image from text (default font) Param[1]: text (type: const char *) Param[2]: fontSize (type: int) Param[3]: color (type: Color) -Function 265: ImageTextEx() (5 input parameters) +Function 287: ImageTextEx() (5 input parameters) Name: ImageTextEx Return type: Image Description: Create an image from text (custom sprite font) @@ -2565,69 +2731,76 @@ Function 265: ImageTextEx() (5 input parameters) Param[3]: fontSize (type: float) Param[4]: spacing (type: float) Param[5]: tint (type: Color) -Function 266: ImageFormat() (2 input parameters) +Function 288: ImageFormat() (2 input parameters) Name: ImageFormat Return type: void Description: Convert image data to desired format Param[1]: image (type: Image *) Param[2]: newFormat (type: int) -Function 267: ImageToPOT() (2 input parameters) +Function 289: ImageToPOT() (2 input parameters) Name: ImageToPOT Return type: void Description: Convert image to POT (power-of-two) Param[1]: image (type: Image *) Param[2]: fill (type: Color) -Function 268: ImageCrop() (2 input parameters) +Function 290: ImageCrop() (2 input parameters) Name: ImageCrop Return type: void Description: Crop an image to a defined rectangle Param[1]: image (type: Image *) Param[2]: crop (type: Rectangle) -Function 269: ImageAlphaCrop() (2 input parameters) +Function 291: ImageAlphaCrop() (2 input parameters) Name: ImageAlphaCrop Return type: void Description: Crop image depending on alpha value Param[1]: image (type: Image *) Param[2]: threshold (type: float) -Function 270: ImageAlphaClear() (3 input parameters) +Function 292: ImageAlphaClear() (3 input parameters) Name: ImageAlphaClear Return type: void Description: Clear alpha channel to desired color Param[1]: image (type: Image *) Param[2]: color (type: Color) Param[3]: threshold (type: float) -Function 271: ImageAlphaMask() (2 input parameters) +Function 293: ImageAlphaMask() (2 input parameters) Name: ImageAlphaMask Return type: void Description: Apply alpha mask to image Param[1]: image (type: Image *) Param[2]: alphaMask (type: Image) -Function 272: ImageAlphaPremultiply() (1 input parameters) +Function 294: ImageAlphaPremultiply() (1 input parameters) Name: ImageAlphaPremultiply Return type: void Description: Premultiply alpha channel Param[1]: image (type: Image *) -Function 273: ImageBlurGaussian() (2 input parameters) +Function 295: ImageBlurGaussian() (2 input parameters) Name: ImageBlurGaussian Return type: void Description: Apply Gaussian blur using a box blur approximation Param[1]: image (type: Image *) Param[2]: blurSize (type: int) -Function 274: ImageResize() (3 input parameters) +Function 296: ImageKernelConvolution() (3 input parameters) + Name: ImageKernelConvolution + Return type: void + Description: Apply Custom Square image convolution kernel + Param[1]: image (type: Image *) + Param[2]: kernel (type: float*) + Param[3]: kernelSize (type: int) +Function 297: ImageResize() (3 input parameters) Name: ImageResize Return type: void Description: Resize image (Bicubic scaling algorithm) Param[1]: image (type: Image *) Param[2]: newWidth (type: int) Param[3]: newHeight (type: int) -Function 275: ImageResizeNN() (3 input parameters) +Function 298: ImageResizeNN() (3 input parameters) Name: ImageResizeNN Return type: void Description: Resize image (Nearest-Neighbor scaling algorithm) Param[1]: image (type: Image *) Param[2]: newWidth (type: int) Param[3]: newHeight (type: int) -Function 276: ImageResizeCanvas() (6 input parameters) +Function 299: ImageResizeCanvas() (6 input parameters) Name: ImageResizeCanvas Return type: void Description: Resize canvas and fill with color @@ -2637,12 +2810,12 @@ Function 276: ImageResizeCanvas() (6 input parameters) Param[4]: offsetX (type: int) Param[5]: offsetY (type: int) Param[6]: fill (type: Color) -Function 277: ImageMipmaps() (1 input parameters) +Function 300: ImageMipmaps() (1 input parameters) Name: ImageMipmaps Return type: void Description: Compute all mipmap levels for a provided image Param[1]: image (type: Image *) -Function 278: ImageDither() (5 input parameters) +Function 301: ImageDither() (5 input parameters) Name: ImageDither Return type: void Description: Dither image data to 16bpp or lower (Floyd-Steinberg dithering) @@ -2651,109 +2824,109 @@ Function 278: ImageDither() (5 input parameters) Param[3]: gBpp (type: int) Param[4]: bBpp (type: int) Param[5]: aBpp (type: int) -Function 279: ImageFlipVertical() (1 input parameters) +Function 302: ImageFlipVertical() (1 input parameters) Name: ImageFlipVertical Return type: void Description: Flip image vertically Param[1]: image (type: Image *) -Function 280: ImageFlipHorizontal() (1 input parameters) +Function 303: ImageFlipHorizontal() (1 input parameters) Name: ImageFlipHorizontal Return type: void Description: Flip image horizontally Param[1]: image (type: Image *) -Function 281: ImageRotate() (2 input parameters) +Function 304: ImageRotate() (2 input parameters) Name: ImageRotate Return type: void Description: Rotate image by input angle in degrees (-359 to 359) Param[1]: image (type: Image *) Param[2]: degrees (type: int) -Function 282: ImageRotateCW() (1 input parameters) +Function 305: ImageRotateCW() (1 input parameters) Name: ImageRotateCW Return type: void Description: Rotate image clockwise 90deg Param[1]: image (type: Image *) -Function 283: ImageRotateCCW() (1 input parameters) +Function 306: ImageRotateCCW() (1 input parameters) Name: ImageRotateCCW Return type: void Description: Rotate image counter-clockwise 90deg Param[1]: image (type: Image *) -Function 284: ImageColorTint() (2 input parameters) +Function 307: ImageColorTint() (2 input parameters) Name: ImageColorTint Return type: void Description: Modify image color: tint Param[1]: image (type: Image *) Param[2]: color (type: Color) -Function 285: ImageColorInvert() (1 input parameters) +Function 308: ImageColorInvert() (1 input parameters) Name: ImageColorInvert Return type: void Description: Modify image color: invert Param[1]: image (type: Image *) -Function 286: ImageColorGrayscale() (1 input parameters) +Function 309: ImageColorGrayscale() (1 input parameters) Name: ImageColorGrayscale Return type: void Description: Modify image color: grayscale Param[1]: image (type: Image *) -Function 287: ImageColorContrast() (2 input parameters) +Function 310: ImageColorContrast() (2 input parameters) Name: ImageColorContrast Return type: void Description: Modify image color: contrast (-100 to 100) Param[1]: image (type: Image *) Param[2]: contrast (type: float) -Function 288: ImageColorBrightness() (2 input parameters) +Function 311: ImageColorBrightness() (2 input parameters) Name: ImageColorBrightness Return type: void Description: Modify image color: brightness (-255 to 255) Param[1]: image (type: Image *) Param[2]: brightness (type: int) -Function 289: ImageColorReplace() (3 input parameters) +Function 312: ImageColorReplace() (3 input parameters) Name: ImageColorReplace Return type: void Description: Modify image color: replace color Param[1]: image (type: Image *) Param[2]: color (type: Color) Param[3]: replace (type: Color) -Function 290: LoadImageColors() (1 input parameters) +Function 313: LoadImageColors() (1 input parameters) Name: LoadImageColors Return type: Color * Description: Load color data from image as a Color array (RGBA - 32bit) Param[1]: image (type: Image) -Function 291: LoadImagePalette() (3 input parameters) +Function 314: LoadImagePalette() (3 input parameters) Name: LoadImagePalette Return type: Color * Description: Load colors palette from image as a Color array (RGBA - 32bit) Param[1]: image (type: Image) Param[2]: maxPaletteSize (type: int) Param[3]: colorCount (type: int *) -Function 292: UnloadImageColors() (1 input parameters) +Function 315: UnloadImageColors() (1 input parameters) Name: UnloadImageColors Return type: void Description: Unload color data loaded with LoadImageColors() Param[1]: colors (type: Color *) -Function 293: UnloadImagePalette() (1 input parameters) +Function 316: UnloadImagePalette() (1 input parameters) Name: UnloadImagePalette Return type: void Description: Unload colors palette loaded with LoadImagePalette() Param[1]: colors (type: Color *) -Function 294: GetImageAlphaBorder() (2 input parameters) +Function 317: GetImageAlphaBorder() (2 input parameters) Name: GetImageAlphaBorder Return type: Rectangle Description: Get image alpha border rectangle Param[1]: image (type: Image) Param[2]: threshold (type: float) -Function 295: GetImageColor() (3 input parameters) +Function 318: GetImageColor() (3 input parameters) Name: GetImageColor Return type: Color Description: Get image pixel color at (x, y) position Param[1]: image (type: Image) Param[2]: x (type: int) Param[3]: y (type: int) -Function 296: ImageClearBackground() (2 input parameters) +Function 319: ImageClearBackground() (2 input parameters) Name: ImageClearBackground Return type: void Description: Clear image background with given color Param[1]: dst (type: Image *) Param[2]: color (type: Color) -Function 297: ImageDrawPixel() (4 input parameters) +Function 320: ImageDrawPixel() (4 input parameters) Name: ImageDrawPixel Return type: void Description: Draw pixel within an image @@ -2761,14 +2934,14 @@ Function 297: ImageDrawPixel() (4 input parameters) Param[2]: posX (type: int) Param[3]: posY (type: int) Param[4]: color (type: Color) -Function 298: ImageDrawPixelV() (3 input parameters) +Function 321: ImageDrawPixelV() (3 input parameters) Name: ImageDrawPixelV Return type: void Description: Draw pixel within an image (Vector version) Param[1]: dst (type: Image *) Param[2]: position (type: Vector2) Param[3]: color (type: Color) -Function 299: ImageDrawLine() (6 input parameters) +Function 322: ImageDrawLine() (6 input parameters) Name: ImageDrawLine Return type: void Description: Draw line within an image @@ -2778,7 +2951,7 @@ Function 299: ImageDrawLine() (6 input parameters) Param[4]: endPosX (type: int) Param[5]: endPosY (type: int) Param[6]: color (type: Color) -Function 300: ImageDrawLineV() (4 input parameters) +Function 323: ImageDrawLineV() (4 input parameters) Name: ImageDrawLineV Return type: void Description: Draw line within an image (Vector version) @@ -2786,7 +2959,7 @@ Function 300: ImageDrawLineV() (4 input parameters) Param[2]: start (type: Vector2) Param[3]: end (type: Vector2) Param[4]: color (type: Color) -Function 301: ImageDrawCircle() (5 input parameters) +Function 324: ImageDrawCircle() (5 input parameters) Name: ImageDrawCircle Return type: void Description: Draw a filled circle within an image @@ -2795,7 +2968,7 @@ Function 301: ImageDrawCircle() (5 input parameters) Param[3]: centerY (type: int) Param[4]: radius (type: int) Param[5]: color (type: Color) -Function 302: ImageDrawCircleV() (4 input parameters) +Function 325: ImageDrawCircleV() (4 input parameters) Name: ImageDrawCircleV Return type: void Description: Draw a filled circle within an image (Vector version) @@ -2803,7 +2976,7 @@ Function 302: ImageDrawCircleV() (4 input parameters) Param[2]: center (type: Vector2) Param[3]: radius (type: int) Param[4]: color (type: Color) -Function 303: ImageDrawCircleLines() (5 input parameters) +Function 326: ImageDrawCircleLines() (5 input parameters) Name: ImageDrawCircleLines Return type: void Description: Draw circle outline within an image @@ -2812,7 +2985,7 @@ Function 303: ImageDrawCircleLines() (5 input parameters) Param[3]: centerY (type: int) Param[4]: radius (type: int) Param[5]: color (type: Color) -Function 304: ImageDrawCircleLinesV() (4 input parameters) +Function 327: ImageDrawCircleLinesV() (4 input parameters) Name: ImageDrawCircleLinesV Return type: void Description: Draw circle outline within an image (Vector version) @@ -2820,7 +2993,7 @@ Function 304: ImageDrawCircleLinesV() (4 input parameters) Param[2]: center (type: Vector2) Param[3]: radius (type: int) Param[4]: color (type: Color) -Function 305: ImageDrawRectangle() (6 input parameters) +Function 328: ImageDrawRectangle() (6 input parameters) Name: ImageDrawRectangle Return type: void Description: Draw rectangle within an image @@ -2830,7 +3003,7 @@ Function 305: ImageDrawRectangle() (6 input parameters) Param[4]: width (type: int) Param[5]: height (type: int) Param[6]: color (type: Color) -Function 306: ImageDrawRectangleV() (4 input parameters) +Function 329: ImageDrawRectangleV() (4 input parameters) Name: ImageDrawRectangleV Return type: void Description: Draw rectangle within an image (Vector version) @@ -2838,14 +3011,14 @@ Function 306: ImageDrawRectangleV() (4 input parameters) Param[2]: position (type: Vector2) Param[3]: size (type: Vector2) Param[4]: color (type: Color) -Function 307: ImageDrawRectangleRec() (3 input parameters) +Function 330: ImageDrawRectangleRec() (3 input parameters) Name: ImageDrawRectangleRec Return type: void Description: Draw rectangle within an image Param[1]: dst (type: Image *) Param[2]: rec (type: Rectangle) Param[3]: color (type: Color) -Function 308: ImageDrawRectangleLines() (4 input parameters) +Function 331: ImageDrawRectangleLines() (4 input parameters) Name: ImageDrawRectangleLines Return type: void Description: Draw rectangle lines within an image @@ -2853,7 +3026,7 @@ Function 308: ImageDrawRectangleLines() (4 input parameters) Param[2]: rec (type: Rectangle) Param[3]: thick (type: int) Param[4]: color (type: Color) -Function 309: ImageDraw() (5 input parameters) +Function 332: ImageDraw() (5 input parameters) Name: ImageDraw Return type: void Description: Draw a source image within a destination image (tint applied to source) @@ -2862,7 +3035,7 @@ Function 309: ImageDraw() (5 input parameters) Param[3]: srcRec (type: Rectangle) Param[4]: dstRec (type: Rectangle) Param[5]: tint (type: Color) -Function 310: ImageDrawText() (6 input parameters) +Function 333: ImageDrawText() (6 input parameters) Name: ImageDrawText Return type: void Description: Draw text (using default font) within an image (destination) @@ -2872,7 +3045,7 @@ Function 310: ImageDrawText() (6 input parameters) Param[4]: posY (type: int) Param[5]: fontSize (type: int) Param[6]: color (type: Color) -Function 311: ImageDrawTextEx() (7 input parameters) +Function 334: ImageDrawTextEx() (7 input parameters) Name: ImageDrawTextEx Return type: void Description: Draw text (custom sprite font) within an image (destination) @@ -2883,79 +3056,79 @@ Function 311: ImageDrawTextEx() (7 input parameters) Param[5]: fontSize (type: float) Param[6]: spacing (type: float) Param[7]: tint (type: Color) -Function 312: LoadTexture() (1 input parameters) +Function 335: LoadTexture() (1 input parameters) Name: LoadTexture Return type: Texture2D Description: Load texture from file into GPU memory (VRAM) Param[1]: fileName (type: const char *) -Function 313: LoadTextureFromImage() (1 input parameters) +Function 336: LoadTextureFromImage() (1 input parameters) Name: LoadTextureFromImage Return type: Texture2D Description: Load texture from image data Param[1]: image (type: Image) -Function 314: LoadTextureCubemap() (2 input parameters) +Function 337: LoadTextureCubemap() (2 input parameters) Name: LoadTextureCubemap Return type: TextureCubemap Description: Load cubemap from image, multiple image cubemap layouts supported Param[1]: image (type: Image) Param[2]: layout (type: int) -Function 315: LoadRenderTexture() (2 input parameters) +Function 338: LoadRenderTexture() (2 input parameters) Name: LoadRenderTexture Return type: RenderTexture2D Description: Load texture for rendering (framebuffer) Param[1]: width (type: int) Param[2]: height (type: int) -Function 316: IsTextureReady() (1 input parameters) +Function 339: IsTextureReady() (1 input parameters) Name: IsTextureReady Return type: bool Description: Check if a texture is ready Param[1]: texture (type: Texture2D) -Function 317: UnloadTexture() (1 input parameters) +Function 340: UnloadTexture() (1 input parameters) Name: UnloadTexture Return type: void Description: Unload texture from GPU memory (VRAM) Param[1]: texture (type: Texture2D) -Function 318: IsRenderTextureReady() (1 input parameters) +Function 341: IsRenderTextureReady() (1 input parameters) Name: IsRenderTextureReady Return type: bool Description: Check if a render texture is ready Param[1]: target (type: RenderTexture2D) -Function 319: UnloadRenderTexture() (1 input parameters) +Function 342: UnloadRenderTexture() (1 input parameters) Name: UnloadRenderTexture Return type: void Description: Unload render texture from GPU memory (VRAM) Param[1]: target (type: RenderTexture2D) -Function 320: UpdateTexture() (2 input parameters) +Function 343: UpdateTexture() (2 input parameters) Name: UpdateTexture Return type: void Description: Update GPU texture with new data Param[1]: texture (type: Texture2D) Param[2]: pixels (type: const void *) -Function 321: UpdateTextureRec() (3 input parameters) +Function 344: UpdateTextureRec() (3 input parameters) Name: UpdateTextureRec Return type: void Description: Update GPU texture rectangle with new data Param[1]: texture (type: Texture2D) Param[2]: rec (type: Rectangle) Param[3]: pixels (type: const void *) -Function 322: GenTextureMipmaps() (1 input parameters) +Function 345: GenTextureMipmaps() (1 input parameters) Name: GenTextureMipmaps Return type: void Description: Generate GPU mipmaps for a texture Param[1]: texture (type: Texture2D *) -Function 323: SetTextureFilter() (2 input parameters) +Function 346: SetTextureFilter() (2 input parameters) Name: SetTextureFilter Return type: void Description: Set texture scaling filter mode Param[1]: texture (type: Texture2D) Param[2]: filter (type: int) -Function 324: SetTextureWrap() (2 input parameters) +Function 347: SetTextureWrap() (2 input parameters) Name: SetTextureWrap Return type: void Description: Set texture wrapping mode Param[1]: texture (type: Texture2D) Param[2]: wrap (type: int) -Function 325: DrawTexture() (4 input parameters) +Function 348: DrawTexture() (4 input parameters) Name: DrawTexture Return type: void Description: Draw a Texture2D @@ -2963,14 +3136,14 @@ Function 325: DrawTexture() (4 input parameters) Param[2]: posX (type: int) Param[3]: posY (type: int) Param[4]: tint (type: Color) -Function 326: DrawTextureV() (3 input parameters) +Function 349: DrawTextureV() (3 input parameters) Name: DrawTextureV Return type: void Description: Draw a Texture2D with position defined as Vector2 Param[1]: texture (type: Texture2D) Param[2]: position (type: Vector2) Param[3]: tint (type: Color) -Function 327: DrawTextureEx() (5 input parameters) +Function 350: DrawTextureEx() (5 input parameters) Name: DrawTextureEx Return type: void Description: Draw a Texture2D with extended parameters @@ -2979,7 +3152,7 @@ Function 327: DrawTextureEx() (5 input parameters) Param[3]: rotation (type: float) Param[4]: scale (type: float) Param[5]: tint (type: Color) -Function 328: DrawTextureRec() (4 input parameters) +Function 351: DrawTextureRec() (4 input parameters) Name: DrawTextureRec Return type: void Description: Draw a part of a texture defined by a rectangle @@ -2987,7 +3160,7 @@ Function 328: DrawTextureRec() (4 input parameters) Param[2]: source (type: Rectangle) Param[3]: position (type: Vector2) Param[4]: tint (type: Color) -Function 329: DrawTexturePro() (6 input parameters) +Function 352: DrawTexturePro() (6 input parameters) Name: DrawTexturePro Return type: void Description: Draw a part of a texture defined by a rectangle with 'pro' parameters @@ -2997,7 +3170,7 @@ Function 329: DrawTexturePro() (6 input parameters) Param[4]: origin (type: Vector2) Param[5]: rotation (type: float) Param[6]: tint (type: Color) -Function 330: DrawTextureNPatch() (6 input parameters) +Function 353: DrawTextureNPatch() (6 input parameters) Name: DrawTextureNPatch Return type: void Description: Draws a texture (or part of it) that stretches or shrinks nicely @@ -3007,106 +3180,106 @@ Function 330: DrawTextureNPatch() (6 input parameters) Param[4]: origin (type: Vector2) Param[5]: rotation (type: float) Param[6]: tint (type: Color) -Function 331: Fade() (2 input parameters) +Function 354: Fade() (2 input parameters) Name: Fade Return type: Color Description: Get color with alpha applied, alpha goes from 0.0f to 1.0f Param[1]: color (type: Color) Param[2]: alpha (type: float) -Function 332: ColorToInt() (1 input parameters) +Function 355: ColorToInt() (1 input parameters) Name: ColorToInt Return type: int Description: Get hexadecimal value for a Color Param[1]: color (type: Color) -Function 333: ColorNormalize() (1 input parameters) +Function 356: ColorNormalize() (1 input parameters) Name: ColorNormalize Return type: Vector4 Description: Get Color normalized as float [0..1] Param[1]: color (type: Color) -Function 334: ColorFromNormalized() (1 input parameters) +Function 357: ColorFromNormalized() (1 input parameters) Name: ColorFromNormalized Return type: Color Description: Get Color from normalized values [0..1] Param[1]: normalized (type: Vector4) -Function 335: ColorToHSV() (1 input parameters) +Function 358: ColorToHSV() (1 input parameters) Name: ColorToHSV Return type: Vector3 Description: Get HSV values for a Color, hue [0..360], saturation/value [0..1] Param[1]: color (type: Color) -Function 336: ColorFromHSV() (3 input parameters) +Function 359: ColorFromHSV() (3 input parameters) Name: ColorFromHSV Return type: Color Description: Get a Color from HSV values, hue [0..360], saturation/value [0..1] Param[1]: hue (type: float) Param[2]: saturation (type: float) Param[3]: value (type: float) -Function 337: ColorTint() (2 input parameters) +Function 360: ColorTint() (2 input parameters) Name: ColorTint Return type: Color Description: Get color multiplied with another color Param[1]: color (type: Color) Param[2]: tint (type: Color) -Function 338: ColorBrightness() (2 input parameters) +Function 361: ColorBrightness() (2 input parameters) Name: ColorBrightness Return type: Color Description: Get color with brightness correction, brightness factor goes from -1.0f to 1.0f Param[1]: color (type: Color) Param[2]: factor (type: float) -Function 339: ColorContrast() (2 input parameters) +Function 362: ColorContrast() (2 input parameters) Name: ColorContrast Return type: Color Description: Get color with contrast correction, contrast values between -1.0f and 1.0f Param[1]: color (type: Color) Param[2]: contrast (type: float) -Function 340: ColorAlpha() (2 input parameters) +Function 363: ColorAlpha() (2 input parameters) Name: ColorAlpha Return type: Color Description: Get color with alpha applied, alpha goes from 0.0f to 1.0f Param[1]: color (type: Color) Param[2]: alpha (type: float) -Function 341: ColorAlphaBlend() (3 input parameters) +Function 364: ColorAlphaBlend() (3 input parameters) Name: ColorAlphaBlend Return type: Color Description: Get src alpha-blended into dst color with tint Param[1]: dst (type: Color) Param[2]: src (type: Color) Param[3]: tint (type: Color) -Function 342: GetColor() (1 input parameters) +Function 365: GetColor() (1 input parameters) Name: GetColor Return type: Color Description: Get Color structure from hexadecimal value Param[1]: hexValue (type: unsigned int) -Function 343: GetPixelColor() (2 input parameters) +Function 366: GetPixelColor() (2 input parameters) Name: GetPixelColor Return type: Color Description: Get Color from a source pixel pointer of certain format Param[1]: srcPtr (type: void *) Param[2]: format (type: int) -Function 344: SetPixelColor() (3 input parameters) +Function 367: SetPixelColor() (3 input parameters) Name: SetPixelColor Return type: void Description: Set color formatted into destination pixel pointer Param[1]: dstPtr (type: void *) Param[2]: color (type: Color) Param[3]: format (type: int) -Function 345: GetPixelDataSize() (3 input parameters) +Function 368: GetPixelDataSize() (3 input parameters) Name: GetPixelDataSize Return type: int Description: Get pixel data size in bytes for certain format Param[1]: width (type: int) Param[2]: height (type: int) Param[3]: format (type: int) -Function 346: GetFontDefault() (0 input parameters) +Function 369: GetFontDefault() (0 input parameters) Name: GetFontDefault Return type: Font Description: Get the default Font No input parameters -Function 347: LoadFont() (1 input parameters) +Function 370: LoadFont() (1 input parameters) Name: LoadFont Return type: Font Description: Load font from file into GPU memory (VRAM) Param[1]: fileName (type: const char *) -Function 348: LoadFontEx() (4 input parameters) +Function 371: LoadFontEx() (4 input parameters) Name: LoadFontEx Return type: Font Description: Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont @@ -3114,14 +3287,14 @@ Function 348: LoadFontEx() (4 input parameters) Param[2]: fontSize (type: int) Param[3]: codepoints (type: int *) Param[4]: codepointCount (type: int) -Function 349: LoadFontFromImage() (3 input parameters) +Function 372: LoadFontFromImage() (3 input parameters) Name: LoadFontFromImage Return type: Font Description: Load font from Image (XNA style) Param[1]: image (type: Image) Param[2]: key (type: Color) Param[3]: firstChar (type: int) -Function 350: LoadFontFromMemory() (6 input parameters) +Function 373: LoadFontFromMemory() (6 input parameters) Name: LoadFontFromMemory Return type: Font Description: Load font from memory buffer, fileType refers to extension: i.e. '.ttf' @@ -3131,12 +3304,12 @@ Function 350: LoadFontFromMemory() (6 input parameters) Param[4]: fontSize (type: int) Param[5]: codepoints (type: int *) Param[6]: codepointCount (type: int) -Function 351: IsFontReady() (1 input parameters) +Function 374: IsFontReady() (1 input parameters) Name: IsFontReady Return type: bool Description: Check if a font is ready Param[1]: font (type: Font) -Function 352: LoadFontData() (6 input parameters) +Function 375: LoadFontData() (6 input parameters) Name: LoadFontData Return type: GlyphInfo * Description: Load font data for further use @@ -3146,7 +3319,7 @@ Function 352: LoadFontData() (6 input parameters) Param[4]: codepoints (type: int *) Param[5]: codepointCount (type: int) Param[6]: type (type: int) -Function 353: GenImageFontAtlas() (6 input parameters) +Function 376: GenImageFontAtlas() (6 input parameters) Name: GenImageFontAtlas Return type: Image Description: Generate image font atlas using chars info @@ -3156,30 +3329,30 @@ Function 353: GenImageFontAtlas() (6 input parameters) Param[4]: fontSize (type: int) Param[5]: padding (type: int) Param[6]: packMethod (type: int) -Function 354: UnloadFontData() (2 input parameters) +Function 377: UnloadFontData() (2 input parameters) Name: UnloadFontData Return type: void Description: Unload font chars info data (RAM) Param[1]: glyphs (type: GlyphInfo *) Param[2]: glyphCount (type: int) -Function 355: UnloadFont() (1 input parameters) +Function 378: UnloadFont() (1 input parameters) Name: UnloadFont Return type: void Description: Unload font from GPU memory (VRAM) Param[1]: font (type: Font) -Function 356: ExportFontAsCode() (2 input parameters) +Function 379: ExportFontAsCode() (2 input parameters) Name: ExportFontAsCode Return type: bool Description: Export font as code file, returns true on success Param[1]: font (type: Font) Param[2]: fileName (type: const char *) -Function 357: DrawFPS() (2 input parameters) +Function 380: DrawFPS() (2 input parameters) Name: DrawFPS Return type: void Description: Draw current FPS Param[1]: posX (type: int) Param[2]: posY (type: int) -Function 358: DrawText() (5 input parameters) +Function 381: DrawText() (5 input parameters) Name: DrawText Return type: void Description: Draw text (using default font) @@ -3188,7 +3361,7 @@ Function 358: DrawText() (5 input parameters) Param[3]: posY (type: int) Param[4]: fontSize (type: int) Param[5]: color (type: Color) -Function 359: DrawTextEx() (6 input parameters) +Function 382: DrawTextEx() (6 input parameters) Name: DrawTextEx Return type: void Description: Draw text using font and additional parameters @@ -3198,7 +3371,7 @@ Function 359: DrawTextEx() (6 input parameters) Param[4]: fontSize (type: float) Param[5]: spacing (type: float) Param[6]: tint (type: Color) -Function 360: DrawTextPro() (8 input parameters) +Function 383: DrawTextPro() (8 input parameters) Name: DrawTextPro Return type: void Description: Draw text using Font and pro parameters (rotation) @@ -3210,7 +3383,7 @@ Function 360: DrawTextPro() (8 input parameters) Param[6]: fontSize (type: float) Param[7]: spacing (type: float) Param[8]: tint (type: Color) -Function 361: DrawTextCodepoint() (5 input parameters) +Function 384: DrawTextCodepoint() (5 input parameters) Name: DrawTextCodepoint Return type: void Description: Draw one character (codepoint) @@ -3219,7 +3392,7 @@ Function 361: DrawTextCodepoint() (5 input parameters) Param[3]: position (type: Vector2) Param[4]: fontSize (type: float) Param[5]: tint (type: Color) -Function 362: DrawTextCodepoints() (7 input parameters) +Function 385: DrawTextCodepoints() (7 input parameters) Name: DrawTextCodepoints Return type: void Description: Draw multiple character (codepoint) @@ -3230,18 +3403,18 @@ Function 362: DrawTextCodepoints() (7 input parameters) Param[5]: fontSize (type: float) Param[6]: spacing (type: float) Param[7]: tint (type: Color) -Function 363: SetTextLineSpacing() (1 input parameters) +Function 386: SetTextLineSpacing() (1 input parameters) Name: SetTextLineSpacing Return type: void Description: Set vertical line spacing when drawing with line-breaks Param[1]: spacing (type: int) -Function 364: MeasureText() (2 input parameters) +Function 387: MeasureText() (2 input parameters) Name: MeasureText Return type: int Description: Measure string width for default font Param[1]: text (type: const char *) Param[2]: fontSize (type: int) -Function 365: MeasureTextEx() (4 input parameters) +Function 388: MeasureTextEx() (4 input parameters) Name: MeasureTextEx Return type: Vector2 Description: Measure string size for Font @@ -3249,180 +3422,180 @@ Function 365: MeasureTextEx() (4 input parameters) Param[2]: text (type: const char *) Param[3]: fontSize (type: float) Param[4]: spacing (type: float) -Function 366: GetGlyphIndex() (2 input parameters) +Function 389: GetGlyphIndex() (2 input parameters) Name: GetGlyphIndex Return type: int Description: Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found Param[1]: font (type: Font) Param[2]: codepoint (type: int) -Function 367: GetGlyphInfo() (2 input parameters) +Function 390: GetGlyphInfo() (2 input parameters) Name: GetGlyphInfo Return type: GlyphInfo Description: Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found Param[1]: font (type: Font) Param[2]: codepoint (type: int) -Function 368: GetGlyphAtlasRec() (2 input parameters) +Function 391: GetGlyphAtlasRec() (2 input parameters) Name: GetGlyphAtlasRec Return type: Rectangle Description: Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found Param[1]: font (type: Font) Param[2]: codepoint (type: int) -Function 369: LoadUTF8() (2 input parameters) +Function 392: LoadUTF8() (2 input parameters) Name: LoadUTF8 Return type: char * Description: Load UTF-8 text encoded from codepoints array Param[1]: codepoints (type: const int *) Param[2]: length (type: int) -Function 370: UnloadUTF8() (1 input parameters) +Function 393: UnloadUTF8() (1 input parameters) Name: UnloadUTF8 Return type: void Description: Unload UTF-8 text encoded from codepoints array Param[1]: text (type: char *) -Function 371: LoadCodepoints() (2 input parameters) +Function 394: LoadCodepoints() (2 input parameters) Name: LoadCodepoints Return type: int * Description: Load all codepoints from a UTF-8 text string, codepoints count returned by parameter Param[1]: text (type: const char *) Param[2]: count (type: int *) -Function 372: UnloadCodepoints() (1 input parameters) +Function 395: UnloadCodepoints() (1 input parameters) Name: UnloadCodepoints Return type: void Description: Unload codepoints data from memory Param[1]: codepoints (type: int *) -Function 373: GetCodepointCount() (1 input parameters) +Function 396: GetCodepointCount() (1 input parameters) Name: GetCodepointCount Return type: int Description: Get total number of codepoints in a UTF-8 encoded string Param[1]: text (type: const char *) -Function 374: GetCodepoint() (2 input parameters) +Function 397: GetCodepoint() (2 input parameters) Name: GetCodepoint Return type: int Description: Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure Param[1]: text (type: const char *) Param[2]: codepointSize (type: int *) -Function 375: GetCodepointNext() (2 input parameters) +Function 398: GetCodepointNext() (2 input parameters) Name: GetCodepointNext Return type: int Description: Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure Param[1]: text (type: const char *) Param[2]: codepointSize (type: int *) -Function 376: GetCodepointPrevious() (2 input parameters) +Function 399: GetCodepointPrevious() (2 input parameters) Name: GetCodepointPrevious Return type: int Description: Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure Param[1]: text (type: const char *) Param[2]: codepointSize (type: int *) -Function 377: CodepointToUTF8() (2 input parameters) +Function 400: CodepointToUTF8() (2 input parameters) Name: CodepointToUTF8 Return type: const char * Description: Encode one codepoint into UTF-8 byte array (array length returned as parameter) Param[1]: codepoint (type: int) Param[2]: utf8Size (type: int *) -Function 378: TextCopy() (2 input parameters) +Function 401: TextCopy() (2 input parameters) Name: TextCopy Return type: int Description: Copy one string to another, returns bytes copied Param[1]: dst (type: char *) Param[2]: src (type: const char *) -Function 379: TextIsEqual() (2 input parameters) +Function 402: TextIsEqual() (2 input parameters) Name: TextIsEqual Return type: bool Description: Check if two text string are equal Param[1]: text1 (type: const char *) Param[2]: text2 (type: const char *) -Function 380: TextLength() (1 input parameters) +Function 403: TextLength() (1 input parameters) Name: TextLength Return type: unsigned int Description: Get text length, checks for '\0' ending Param[1]: text (type: const char *) -Function 381: TextFormat() (2 input parameters) +Function 404: TextFormat() (2 input parameters) Name: TextFormat Return type: const char * Description: Text formatting with variables (sprintf() style) Param[1]: text (type: const char *) Param[2]: args (type: ...) -Function 382: TextSubtext() (3 input parameters) +Function 405: TextSubtext() (3 input parameters) Name: TextSubtext Return type: const char * Description: Get a piece of a text string Param[1]: text (type: const char *) Param[2]: position (type: int) Param[3]: length (type: int) -Function 383: TextReplace() (3 input parameters) +Function 406: TextReplace() (3 input parameters) Name: TextReplace Return type: char * Description: Replace text string (WARNING: memory must be freed!) Param[1]: text (type: char *) Param[2]: replace (type: const char *) Param[3]: by (type: const char *) -Function 384: TextInsert() (3 input parameters) +Function 407: TextInsert() (3 input parameters) Name: TextInsert Return type: char * Description: Insert text in a position (WARNING: memory must be freed!) Param[1]: text (type: const char *) Param[2]: insert (type: const char *) Param[3]: position (type: int) -Function 385: TextJoin() (3 input parameters) +Function 408: TextJoin() (3 input parameters) Name: TextJoin Return type: const char * Description: Join text strings with delimiter Param[1]: textList (type: const char **) Param[2]: count (type: int) Param[3]: delimiter (type: const char *) -Function 386: TextSplit() (3 input parameters) +Function 409: TextSplit() (3 input parameters) Name: TextSplit Return type: const char ** Description: Split text into multiple strings Param[1]: text (type: const char *) Param[2]: delimiter (type: char) Param[3]: count (type: int *) -Function 387: TextAppend() (3 input parameters) +Function 410: TextAppend() (3 input parameters) Name: TextAppend Return type: void Description: Append text at specific position and move cursor! Param[1]: text (type: char *) Param[2]: append (type: const char *) Param[3]: position (type: int *) -Function 388: TextFindIndex() (2 input parameters) +Function 411: TextFindIndex() (2 input parameters) Name: TextFindIndex Return type: int Description: Find first text occurrence within a string Param[1]: text (type: const char *) Param[2]: find (type: const char *) -Function 389: TextToUpper() (1 input parameters) +Function 412: TextToUpper() (1 input parameters) Name: TextToUpper Return type: const char * Description: Get upper case version of provided string Param[1]: text (type: const char *) -Function 390: TextToLower() (1 input parameters) +Function 413: TextToLower() (1 input parameters) Name: TextToLower Return type: const char * Description: Get lower case version of provided string Param[1]: text (type: const char *) -Function 391: TextToPascal() (1 input parameters) +Function 414: TextToPascal() (1 input parameters) Name: TextToPascal Return type: const char * Description: Get Pascal case notation version of provided string Param[1]: text (type: const char *) -Function 392: TextToInteger() (1 input parameters) +Function 415: TextToInteger() (1 input parameters) Name: TextToInteger Return type: int Description: Get integer value from text (negative values not supported) Param[1]: text (type: const char *) -Function 393: DrawLine3D() (3 input parameters) +Function 416: DrawLine3D() (3 input parameters) Name: DrawLine3D Return type: void Description: Draw a line in 3D world space Param[1]: startPos (type: Vector3) Param[2]: endPos (type: Vector3) Param[3]: color (type: Color) -Function 394: DrawPoint3D() (2 input parameters) +Function 417: DrawPoint3D() (2 input parameters) Name: DrawPoint3D Return type: void Description: Draw a point in 3D space, actually a small line Param[1]: position (type: Vector3) Param[2]: color (type: Color) -Function 395: DrawCircle3D() (5 input parameters) +Function 418: DrawCircle3D() (5 input parameters) Name: DrawCircle3D Return type: void Description: Draw a circle in 3D world space @@ -3431,7 +3604,7 @@ Function 395: DrawCircle3D() (5 input parameters) Param[3]: rotationAxis (type: Vector3) Param[4]: rotationAngle (type: float) Param[5]: color (type: Color) -Function 396: DrawTriangle3D() (4 input parameters) +Function 419: DrawTriangle3D() (4 input parameters) Name: DrawTriangle3D Return type: void Description: Draw a color-filled triangle (vertex in counter-clockwise order!) @@ -3439,14 +3612,14 @@ Function 396: DrawTriangle3D() (4 input parameters) Param[2]: v2 (type: Vector3) Param[3]: v3 (type: Vector3) Param[4]: color (type: Color) -Function 397: DrawTriangleStrip3D() (3 input parameters) +Function 420: DrawTriangleStrip3D() (3 input parameters) Name: DrawTriangleStrip3D Return type: void Description: Draw a triangle strip defined by points Param[1]: points (type: Vector3 *) Param[2]: pointCount (type: int) Param[3]: color (type: Color) -Function 398: DrawCube() (5 input parameters) +Function 421: DrawCube() (5 input parameters) Name: DrawCube Return type: void Description: Draw cube @@ -3455,14 +3628,14 @@ Function 398: DrawCube() (5 input parameters) Param[3]: height (type: float) Param[4]: length (type: float) Param[5]: color (type: Color) -Function 399: DrawCubeV() (3 input parameters) +Function 422: DrawCubeV() (3 input parameters) Name: DrawCubeV Return type: void Description: Draw cube (Vector version) Param[1]: position (type: Vector3) Param[2]: size (type: Vector3) Param[3]: color (type: Color) -Function 400: DrawCubeWires() (5 input parameters) +Function 423: DrawCubeWires() (5 input parameters) Name: DrawCubeWires Return type: void Description: Draw cube wires @@ -3471,21 +3644,21 @@ Function 400: DrawCubeWires() (5 input parameters) Param[3]: height (type: float) Param[4]: length (type: float) Param[5]: color (type: Color) -Function 401: DrawCubeWiresV() (3 input parameters) +Function 424: DrawCubeWiresV() (3 input parameters) Name: DrawCubeWiresV Return type: void Description: Draw cube wires (Vector version) Param[1]: position (type: Vector3) Param[2]: size (type: Vector3) Param[3]: color (type: Color) -Function 402: DrawSphere() (3 input parameters) +Function 425: DrawSphere() (3 input parameters) Name: DrawSphere Return type: void Description: Draw sphere Param[1]: centerPos (type: Vector3) Param[2]: radius (type: float) Param[3]: color (type: Color) -Function 403: DrawSphereEx() (5 input parameters) +Function 426: DrawSphereEx() (5 input parameters) Name: DrawSphereEx Return type: void Description: Draw sphere with extended parameters @@ -3494,7 +3667,7 @@ Function 403: DrawSphereEx() (5 input parameters) Param[3]: rings (type: int) Param[4]: slices (type: int) Param[5]: color (type: Color) -Function 404: DrawSphereWires() (5 input parameters) +Function 427: DrawSphereWires() (5 input parameters) Name: DrawSphereWires Return type: void Description: Draw sphere wires @@ -3503,7 +3676,7 @@ Function 404: DrawSphereWires() (5 input parameters) Param[3]: rings (type: int) Param[4]: slices (type: int) Param[5]: color (type: Color) -Function 405: DrawCylinder() (6 input parameters) +Function 428: DrawCylinder() (6 input parameters) Name: DrawCylinder Return type: void Description: Draw a cylinder/cone @@ -3513,7 +3686,7 @@ Function 405: DrawCylinder() (6 input parameters) Param[4]: height (type: float) Param[5]: slices (type: int) Param[6]: color (type: Color) -Function 406: DrawCylinderEx() (6 input parameters) +Function 429: DrawCylinderEx() (6 input parameters) Name: DrawCylinderEx Return type: void Description: Draw a cylinder with base at startPos and top at endPos @@ -3523,7 +3696,7 @@ Function 406: DrawCylinderEx() (6 input parameters) Param[4]: endRadius (type: float) Param[5]: sides (type: int) Param[6]: color (type: Color) -Function 407: DrawCylinderWires() (6 input parameters) +Function 430: DrawCylinderWires() (6 input parameters) Name: DrawCylinderWires Return type: void Description: Draw a cylinder/cone wires @@ -3533,7 +3706,7 @@ Function 407: DrawCylinderWires() (6 input parameters) Param[4]: height (type: float) Param[5]: slices (type: int) Param[6]: color (type: Color) -Function 408: DrawCylinderWiresEx() (6 input parameters) +Function 431: DrawCylinderWiresEx() (6 input parameters) Name: DrawCylinderWiresEx Return type: void Description: Draw a cylinder wires with base at startPos and top at endPos @@ -3543,7 +3716,7 @@ Function 408: DrawCylinderWiresEx() (6 input parameters) Param[4]: endRadius (type: float) Param[5]: sides (type: int) Param[6]: color (type: Color) -Function 409: DrawCapsule() (6 input parameters) +Function 432: DrawCapsule() (6 input parameters) Name: DrawCapsule Return type: void Description: Draw a capsule with the center of its sphere caps at startPos and endPos @@ -3553,7 +3726,7 @@ Function 409: DrawCapsule() (6 input parameters) Param[4]: slices (type: int) Param[5]: rings (type: int) Param[6]: color (type: Color) -Function 410: DrawCapsuleWires() (6 input parameters) +Function 433: DrawCapsuleWires() (6 input parameters) Name: DrawCapsuleWires Return type: void Description: Draw capsule wireframe with the center of its sphere caps at startPos and endPos @@ -3563,51 +3736,51 @@ Function 410: DrawCapsuleWires() (6 input parameters) Param[4]: slices (type: int) Param[5]: rings (type: int) Param[6]: color (type: Color) -Function 411: DrawPlane() (3 input parameters) +Function 434: DrawPlane() (3 input parameters) Name: DrawPlane Return type: void Description: Draw a plane XZ Param[1]: centerPos (type: Vector3) Param[2]: size (type: Vector2) Param[3]: color (type: Color) -Function 412: DrawRay() (2 input parameters) +Function 435: DrawRay() (2 input parameters) Name: DrawRay Return type: void Description: Draw a ray line Param[1]: ray (type: Ray) Param[2]: color (type: Color) -Function 413: DrawGrid() (2 input parameters) +Function 436: DrawGrid() (2 input parameters) Name: DrawGrid Return type: void Description: Draw a grid (centered at (0, 0, 0)) Param[1]: slices (type: int) Param[2]: spacing (type: float) -Function 414: LoadModel() (1 input parameters) +Function 437: LoadModel() (1 input parameters) Name: LoadModel Return type: Model Description: Load model from files (meshes and materials) Param[1]: fileName (type: const char *) -Function 415: LoadModelFromMesh() (1 input parameters) +Function 438: LoadModelFromMesh() (1 input parameters) Name: LoadModelFromMesh Return type: Model Description: Load model from generated mesh (default material) Param[1]: mesh (type: Mesh) -Function 416: IsModelReady() (1 input parameters) +Function 439: IsModelReady() (1 input parameters) Name: IsModelReady Return type: bool Description: Check if a model is ready Param[1]: model (type: Model) -Function 417: UnloadModel() (1 input parameters) +Function 440: UnloadModel() (1 input parameters) Name: UnloadModel Return type: void Description: Unload model (including meshes) from memory (RAM and/or VRAM) Param[1]: model (type: Model) -Function 418: GetModelBoundingBox() (1 input parameters) +Function 441: GetModelBoundingBox() (1 input parameters) Name: GetModelBoundingBox Return type: BoundingBox Description: Compute model bounding box limits (considers all meshes) Param[1]: model (type: Model) -Function 419: DrawModel() (4 input parameters) +Function 442: DrawModel() (4 input parameters) Name: DrawModel Return type: void Description: Draw a model (with texture if set) @@ -3615,7 +3788,7 @@ Function 419: DrawModel() (4 input parameters) Param[2]: position (type: Vector3) Param[3]: scale (type: float) Param[4]: tint (type: Color) -Function 420: DrawModelEx() (6 input parameters) +Function 443: DrawModelEx() (6 input parameters) Name: DrawModelEx Return type: void Description: Draw a model with extended parameters @@ -3625,7 +3798,7 @@ Function 420: DrawModelEx() (6 input parameters) Param[4]: rotationAngle (type: float) Param[5]: scale (type: Vector3) Param[6]: tint (type: Color) -Function 421: DrawModelWires() (4 input parameters) +Function 444: DrawModelWires() (4 input parameters) Name: DrawModelWires Return type: void Description: Draw a model wires (with texture if set) @@ -3633,7 +3806,7 @@ Function 421: DrawModelWires() (4 input parameters) Param[2]: position (type: Vector3) Param[3]: scale (type: float) Param[4]: tint (type: Color) -Function 422: DrawModelWiresEx() (6 input parameters) +Function 445: DrawModelWiresEx() (6 input parameters) Name: DrawModelWiresEx Return type: void Description: Draw a model wires (with texture if set) with extended parameters @@ -3643,13 +3816,13 @@ Function 422: DrawModelWiresEx() (6 input parameters) Param[4]: rotationAngle (type: float) Param[5]: scale (type: Vector3) Param[6]: tint (type: Color) -Function 423: DrawBoundingBox() (2 input parameters) +Function 446: DrawBoundingBox() (2 input parameters) Name: DrawBoundingBox Return type: void Description: Draw bounding box (wires) Param[1]: box (type: BoundingBox) Param[2]: color (type: Color) -Function 424: DrawBillboard() (5 input parameters) +Function 447: DrawBillboard() (5 input parameters) Name: DrawBillboard Return type: void Description: Draw a billboard texture @@ -3658,7 +3831,7 @@ Function 424: DrawBillboard() (5 input parameters) Param[3]: position (type: Vector3) Param[4]: size (type: float) Param[5]: tint (type: Color) -Function 425: DrawBillboardRec() (6 input parameters) +Function 448: DrawBillboardRec() (6 input parameters) Name: DrawBillboardRec Return type: void Description: Draw a billboard texture defined by source @@ -3668,7 +3841,7 @@ Function 425: DrawBillboardRec() (6 input parameters) Param[4]: position (type: Vector3) Param[5]: size (type: Vector2) Param[6]: tint (type: Color) -Function 426: DrawBillboardPro() (9 input parameters) +Function 449: DrawBillboardPro() (9 input parameters) Name: DrawBillboardPro Return type: void Description: Draw a billboard texture defined by source and rotation @@ -3681,13 +3854,13 @@ Function 426: DrawBillboardPro() (9 input parameters) Param[7]: origin (type: Vector2) Param[8]: rotation (type: float) Param[9]: tint (type: Color) -Function 427: UploadMesh() (2 input parameters) +Function 450: UploadMesh() (2 input parameters) Name: UploadMesh Return type: void Description: Upload mesh vertex data in GPU and provide VAO/VBO ids Param[1]: mesh (type: Mesh *) Param[2]: dynamic (type: bool) -Function 428: UpdateMeshBuffer() (5 input parameters) +Function 451: UpdateMeshBuffer() (5 input parameters) Name: UpdateMeshBuffer Return type: void Description: Update mesh vertex data in GPU for a specific buffer index @@ -3696,19 +3869,19 @@ Function 428: UpdateMeshBuffer() (5 input parameters) Param[3]: data (type: const void *) Param[4]: dataSize (type: int) Param[5]: offset (type: int) -Function 429: UnloadMesh() (1 input parameters) +Function 452: UnloadMesh() (1 input parameters) Name: UnloadMesh Return type: void Description: Unload mesh data from CPU and GPU Param[1]: mesh (type: Mesh) -Function 430: DrawMesh() (3 input parameters) +Function 453: DrawMesh() (3 input parameters) Name: DrawMesh Return type: void Description: Draw a 3d mesh with material and transform Param[1]: mesh (type: Mesh) Param[2]: material (type: Material) Param[3]: transform (type: Matrix) -Function 431: DrawMeshInstanced() (4 input parameters) +Function 454: DrawMeshInstanced() (4 input parameters) Name: DrawMeshInstanced Return type: void Description: Draw multiple mesh instances with material and different transforms @@ -3716,29 +3889,29 @@ Function 431: DrawMeshInstanced() (4 input parameters) Param[2]: material (type: Material) Param[3]: transforms (type: const Matrix *) Param[4]: instances (type: int) -Function 432: ExportMesh() (2 input parameters) +Function 455: ExportMesh() (2 input parameters) Name: ExportMesh Return type: bool Description: Export mesh data to file, returns true on success Param[1]: mesh (type: Mesh) Param[2]: fileName (type: const char *) -Function 433: GetMeshBoundingBox() (1 input parameters) +Function 456: GetMeshBoundingBox() (1 input parameters) Name: GetMeshBoundingBox Return type: BoundingBox Description: Compute mesh bounding box limits Param[1]: mesh (type: Mesh) -Function 434: GenMeshTangents() (1 input parameters) +Function 457: GenMeshTangents() (1 input parameters) Name: GenMeshTangents Return type: void Description: Compute mesh tangents Param[1]: mesh (type: Mesh *) -Function 435: GenMeshPoly() (2 input parameters) +Function 458: GenMeshPoly() (2 input parameters) Name: GenMeshPoly Return type: Mesh Description: Generate polygonal mesh Param[1]: sides (type: int) Param[2]: radius (type: float) -Function 436: GenMeshPlane() (4 input parameters) +Function 459: GenMeshPlane() (4 input parameters) Name: GenMeshPlane Return type: Mesh Description: Generate plane mesh (with subdivisions) @@ -3746,42 +3919,42 @@ Function 436: GenMeshPlane() (4 input parameters) Param[2]: length (type: float) Param[3]: resX (type: int) Param[4]: resZ (type: int) -Function 437: GenMeshCube() (3 input parameters) +Function 460: GenMeshCube() (3 input parameters) Name: GenMeshCube Return type: Mesh Description: Generate cuboid mesh Param[1]: width (type: float) Param[2]: height (type: float) Param[3]: length (type: float) -Function 438: GenMeshSphere() (3 input parameters) +Function 461: GenMeshSphere() (3 input parameters) Name: GenMeshSphere Return type: Mesh Description: Generate sphere mesh (standard sphere) Param[1]: radius (type: float) Param[2]: rings (type: int) Param[3]: slices (type: int) -Function 439: GenMeshHemiSphere() (3 input parameters) +Function 462: GenMeshHemiSphere() (3 input parameters) Name: GenMeshHemiSphere Return type: Mesh Description: Generate half-sphere mesh (no bottom cap) Param[1]: radius (type: float) Param[2]: rings (type: int) Param[3]: slices (type: int) -Function 440: GenMeshCylinder() (3 input parameters) +Function 463: GenMeshCylinder() (3 input parameters) Name: GenMeshCylinder Return type: Mesh Description: Generate cylinder mesh Param[1]: radius (type: float) Param[2]: height (type: float) Param[3]: slices (type: int) -Function 441: GenMeshCone() (3 input parameters) +Function 464: GenMeshCone() (3 input parameters) Name: GenMeshCone Return type: Mesh Description: Generate cone/pyramid mesh Param[1]: radius (type: float) Param[2]: height (type: float) Param[3]: slices (type: int) -Function 442: GenMeshTorus() (4 input parameters) +Function 465: GenMeshTorus() (4 input parameters) Name: GenMeshTorus Return type: Mesh Description: Generate torus mesh @@ -3789,7 +3962,7 @@ Function 442: GenMeshTorus() (4 input parameters) Param[2]: size (type: float) Param[3]: radSeg (type: int) Param[4]: sides (type: int) -Function 443: GenMeshKnot() (4 input parameters) +Function 466: GenMeshKnot() (4 input parameters) Name: GenMeshKnot Return type: Mesh Description: Generate trefoil knot mesh @@ -3797,84 +3970,84 @@ Function 443: GenMeshKnot() (4 input parameters) Param[2]: size (type: float) Param[3]: radSeg (type: int) Param[4]: sides (type: int) -Function 444: GenMeshHeightmap() (2 input parameters) +Function 467: GenMeshHeightmap() (2 input parameters) Name: GenMeshHeightmap Return type: Mesh Description: Generate heightmap mesh from image data Param[1]: heightmap (type: Image) Param[2]: size (type: Vector3) -Function 445: GenMeshCubicmap() (2 input parameters) +Function 468: GenMeshCubicmap() (2 input parameters) Name: GenMeshCubicmap Return type: Mesh Description: Generate cubes-based map mesh from image data Param[1]: cubicmap (type: Image) Param[2]: cubeSize (type: Vector3) -Function 446: LoadMaterials() (2 input parameters) +Function 469: LoadMaterials() (2 input parameters) Name: LoadMaterials Return type: Material * Description: Load materials from model file Param[1]: fileName (type: const char *) Param[2]: materialCount (type: int *) -Function 447: LoadMaterialDefault() (0 input parameters) +Function 470: LoadMaterialDefault() (0 input parameters) Name: LoadMaterialDefault Return type: Material Description: Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps) No input parameters -Function 448: IsMaterialReady() (1 input parameters) +Function 471: IsMaterialReady() (1 input parameters) Name: IsMaterialReady Return type: bool Description: Check if a material is ready Param[1]: material (type: Material) -Function 449: UnloadMaterial() (1 input parameters) +Function 472: UnloadMaterial() (1 input parameters) Name: UnloadMaterial Return type: void Description: Unload material from GPU memory (VRAM) Param[1]: material (type: Material) -Function 450: SetMaterialTexture() (3 input parameters) +Function 473: SetMaterialTexture() (3 input parameters) Name: SetMaterialTexture Return type: void Description: Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...) Param[1]: material (type: Material *) Param[2]: mapType (type: int) Param[3]: texture (type: Texture2D) -Function 451: SetModelMeshMaterial() (3 input parameters) +Function 474: SetModelMeshMaterial() (3 input parameters) Name: SetModelMeshMaterial Return type: void Description: Set material for a mesh Param[1]: model (type: Model *) Param[2]: meshId (type: int) Param[3]: materialId (type: int) -Function 452: LoadModelAnimations() (2 input parameters) +Function 475: LoadModelAnimations() (2 input parameters) Name: LoadModelAnimations Return type: ModelAnimation * Description: Load model animations from file Param[1]: fileName (type: const char *) Param[2]: animCount (type: int *) -Function 453: UpdateModelAnimation() (3 input parameters) +Function 476: UpdateModelAnimation() (3 input parameters) Name: UpdateModelAnimation Return type: void Description: Update model animation pose Param[1]: model (type: Model) Param[2]: anim (type: ModelAnimation) Param[3]: frame (type: int) -Function 454: UnloadModelAnimation() (1 input parameters) +Function 477: UnloadModelAnimation() (1 input parameters) Name: UnloadModelAnimation Return type: void Description: Unload animation data Param[1]: anim (type: ModelAnimation) -Function 455: UnloadModelAnimations() (2 input parameters) +Function 478: UnloadModelAnimations() (2 input parameters) Name: UnloadModelAnimations Return type: void Description: Unload animation array data Param[1]: animations (type: ModelAnimation *) Param[2]: animCount (type: int) -Function 456: IsModelAnimationValid() (2 input parameters) +Function 479: IsModelAnimationValid() (2 input parameters) Name: IsModelAnimationValid Return type: bool Description: Check model animation skeleton match Param[1]: model (type: Model) Param[2]: anim (type: ModelAnimation) -Function 457: CheckCollisionSpheres() (4 input parameters) +Function 480: CheckCollisionSpheres() (4 input parameters) Name: CheckCollisionSpheres Return type: bool Description: Check collision between two spheres @@ -3882,40 +4055,40 @@ Function 457: CheckCollisionSpheres() (4 input parameters) Param[2]: radius1 (type: float) Param[3]: center2 (type: Vector3) Param[4]: radius2 (type: float) -Function 458: CheckCollisionBoxes() (2 input parameters) +Function 481: CheckCollisionBoxes() (2 input parameters) Name: CheckCollisionBoxes Return type: bool Description: Check collision between two bounding boxes Param[1]: box1 (type: BoundingBox) Param[2]: box2 (type: BoundingBox) -Function 459: CheckCollisionBoxSphere() (3 input parameters) +Function 482: CheckCollisionBoxSphere() (3 input parameters) Name: CheckCollisionBoxSphere Return type: bool Description: Check collision between box and sphere Param[1]: box (type: BoundingBox) Param[2]: center (type: Vector3) Param[3]: radius (type: float) -Function 460: GetRayCollisionSphere() (3 input parameters) +Function 483: GetRayCollisionSphere() (3 input parameters) Name: GetRayCollisionSphere Return type: RayCollision Description: Get collision info between ray and sphere Param[1]: ray (type: Ray) Param[2]: center (type: Vector3) Param[3]: radius (type: float) -Function 461: GetRayCollisionBox() (2 input parameters) +Function 484: GetRayCollisionBox() (2 input parameters) Name: GetRayCollisionBox Return type: RayCollision Description: Get collision info between ray and box Param[1]: ray (type: Ray) Param[2]: box (type: BoundingBox) -Function 462: GetRayCollisionMesh() (3 input parameters) +Function 485: GetRayCollisionMesh() (3 input parameters) Name: GetRayCollisionMesh Return type: RayCollision Description: Get collision info between ray and mesh Param[1]: ray (type: Ray) Param[2]: mesh (type: Mesh) Param[3]: transform (type: Matrix) -Function 463: GetRayCollisionTriangle() (4 input parameters) +Function 486: GetRayCollisionTriangle() (4 input parameters) Name: GetRayCollisionTriangle Return type: RayCollision Description: Get collision info between ray and triangle @@ -3923,7 +4096,7 @@ Function 463: GetRayCollisionTriangle() (4 input parameters) Param[2]: p1 (type: Vector3) Param[3]: p2 (type: Vector3) Param[4]: p3 (type: Vector3) -Function 464: GetRayCollisionQuad() (5 input parameters) +Function 487: GetRayCollisionQuad() (5 input parameters) Name: GetRayCollisionQuad Return type: RayCollision Description: Get collision info between ray and quad @@ -3932,153 +4105,158 @@ Function 464: GetRayCollisionQuad() (5 input parameters) Param[3]: p2 (type: Vector3) Param[4]: p3 (type: Vector3) Param[5]: p4 (type: Vector3) -Function 465: InitAudioDevice() (0 input parameters) +Function 488: InitAudioDevice() (0 input parameters) Name: InitAudioDevice Return type: void Description: Initialize audio device and context No input parameters -Function 466: CloseAudioDevice() (0 input parameters) +Function 489: CloseAudioDevice() (0 input parameters) Name: CloseAudioDevice Return type: void Description: Close the audio device and context No input parameters -Function 467: IsAudioDeviceReady() (0 input parameters) +Function 490: IsAudioDeviceReady() (0 input parameters) Name: IsAudioDeviceReady Return type: bool Description: Check if audio device has been initialized successfully No input parameters -Function 468: SetMasterVolume() (1 input parameters) +Function 491: SetMasterVolume() (1 input parameters) Name: SetMasterVolume Return type: void Description: Set master volume (listener) Param[1]: volume (type: float) -Function 469: LoadWave() (1 input parameters) +Function 492: GetMasterVolume() (0 input parameters) + Name: GetMasterVolume + Return type: float + Description: Get master volume (listener) + No input parameters +Function 493: LoadWave() (1 input parameters) Name: LoadWave Return type: Wave Description: Load wave data from file Param[1]: fileName (type: const char *) -Function 470: LoadWaveFromMemory() (3 input parameters) +Function 494: LoadWaveFromMemory() (3 input parameters) Name: LoadWaveFromMemory Return type: Wave Description: Load wave from memory buffer, fileType refers to extension: i.e. '.wav' Param[1]: fileType (type: const char *) Param[2]: fileData (type: const unsigned char *) Param[3]: dataSize (type: int) -Function 471: IsWaveReady() (1 input parameters) +Function 495: IsWaveReady() (1 input parameters) Name: IsWaveReady Return type: bool Description: Checks if wave data is ready Param[1]: wave (type: Wave) -Function 472: LoadSound() (1 input parameters) +Function 496: LoadSound() (1 input parameters) Name: LoadSound Return type: Sound Description: Load sound from file Param[1]: fileName (type: const char *) -Function 473: LoadSoundFromWave() (1 input parameters) +Function 497: LoadSoundFromWave() (1 input parameters) Name: LoadSoundFromWave Return type: Sound Description: Load sound from wave data Param[1]: wave (type: Wave) -Function 474: LoadSoundAlias() (1 input parameters) +Function 498: LoadSoundAlias() (1 input parameters) Name: LoadSoundAlias Return type: Sound Description: Create a new sound that shares the same sample data as the source sound, does not own the sound data Param[1]: source (type: Sound) -Function 475: IsSoundReady() (1 input parameters) +Function 499: IsSoundReady() (1 input parameters) Name: IsSoundReady Return type: bool Description: Checks if a sound is ready Param[1]: sound (type: Sound) -Function 476: UpdateSound() (3 input parameters) +Function 500: UpdateSound() (3 input parameters) Name: UpdateSound Return type: void Description: Update sound buffer with new data Param[1]: sound (type: Sound) Param[2]: data (type: const void *) Param[3]: sampleCount (type: int) -Function 477: UnloadWave() (1 input parameters) +Function 501: UnloadWave() (1 input parameters) Name: UnloadWave Return type: void Description: Unload wave data Param[1]: wave (type: Wave) -Function 478: UnloadSound() (1 input parameters) +Function 502: UnloadSound() (1 input parameters) Name: UnloadSound Return type: void Description: Unload sound Param[1]: sound (type: Sound) -Function 479: UnloadSoundAlias() (1 input parameters) +Function 503: UnloadSoundAlias() (1 input parameters) Name: UnloadSoundAlias Return type: void Description: Unload a sound alias (does not deallocate sample data) Param[1]: alias (type: Sound) -Function 480: ExportWave() (2 input parameters) +Function 504: ExportWave() (2 input parameters) Name: ExportWave Return type: bool Description: Export wave data to file, returns true on success Param[1]: wave (type: Wave) Param[2]: fileName (type: const char *) -Function 481: ExportWaveAsCode() (2 input parameters) +Function 505: ExportWaveAsCode() (2 input parameters) Name: ExportWaveAsCode Return type: bool Description: Export wave sample data to code (.h), returns true on success Param[1]: wave (type: Wave) Param[2]: fileName (type: const char *) -Function 482: PlaySound() (1 input parameters) +Function 506: PlaySound() (1 input parameters) Name: PlaySound Return type: void Description: Play a sound Param[1]: sound (type: Sound) -Function 483: StopSound() (1 input parameters) +Function 507: StopSound() (1 input parameters) Name: StopSound Return type: void Description: Stop playing a sound Param[1]: sound (type: Sound) -Function 484: PauseSound() (1 input parameters) +Function 508: PauseSound() (1 input parameters) Name: PauseSound Return type: void Description: Pause a sound Param[1]: sound (type: Sound) -Function 485: ResumeSound() (1 input parameters) +Function 509: ResumeSound() (1 input parameters) Name: ResumeSound Return type: void Description: Resume a paused sound Param[1]: sound (type: Sound) -Function 486: IsSoundPlaying() (1 input parameters) +Function 510: IsSoundPlaying() (1 input parameters) Name: IsSoundPlaying Return type: bool Description: Check if a sound is currently playing Param[1]: sound (type: Sound) -Function 487: SetSoundVolume() (2 input parameters) +Function 511: SetSoundVolume() (2 input parameters) Name: SetSoundVolume Return type: void Description: Set volume for a sound (1.0 is max level) Param[1]: sound (type: Sound) Param[2]: volume (type: float) -Function 488: SetSoundPitch() (2 input parameters) +Function 512: SetSoundPitch() (2 input parameters) Name: SetSoundPitch Return type: void Description: Set pitch for a sound (1.0 is base level) Param[1]: sound (type: Sound) Param[2]: pitch (type: float) -Function 489: SetSoundPan() (2 input parameters) +Function 513: SetSoundPan() (2 input parameters) Name: SetSoundPan Return type: void Description: Set pan for a sound (0.5 is center) Param[1]: sound (type: Sound) Param[2]: pan (type: float) -Function 490: WaveCopy() (1 input parameters) +Function 514: WaveCopy() (1 input parameters) Name: WaveCopy Return type: Wave Description: Copy a wave to a new wave Param[1]: wave (type: Wave) -Function 491: WaveCrop() (3 input parameters) +Function 515: WaveCrop() (3 input parameters) Name: WaveCrop Return type: void Description: Crop a wave to defined samples range Param[1]: wave (type: Wave *) Param[2]: initSample (type: int) Param[3]: finalSample (type: int) -Function 492: WaveFormat() (4 input parameters) +Function 516: WaveFormat() (4 input parameters) Name: WaveFormat Return type: void Description: Convert wave data to desired format @@ -4086,203 +4264,203 @@ Function 492: WaveFormat() (4 input parameters) Param[2]: sampleRate (type: int) Param[3]: sampleSize (type: int) Param[4]: channels (type: int) -Function 493: LoadWaveSamples() (1 input parameters) +Function 517: LoadWaveSamples() (1 input parameters) Name: LoadWaveSamples Return type: float * Description: Load samples data from wave as a 32bit float data array Param[1]: wave (type: Wave) -Function 494: UnloadWaveSamples() (1 input parameters) +Function 518: UnloadWaveSamples() (1 input parameters) Name: UnloadWaveSamples Return type: void Description: Unload samples data loaded with LoadWaveSamples() Param[1]: samples (type: float *) -Function 495: LoadMusicStream() (1 input parameters) +Function 519: LoadMusicStream() (1 input parameters) Name: LoadMusicStream Return type: Music Description: Load music stream from file Param[1]: fileName (type: const char *) -Function 496: LoadMusicStreamFromMemory() (3 input parameters) +Function 520: LoadMusicStreamFromMemory() (3 input parameters) Name: LoadMusicStreamFromMemory Return type: Music Description: Load music stream from data Param[1]: fileType (type: const char *) Param[2]: data (type: const unsigned char *) Param[3]: dataSize (type: int) -Function 497: IsMusicReady() (1 input parameters) +Function 521: IsMusicReady() (1 input parameters) Name: IsMusicReady Return type: bool Description: Checks if a music stream is ready Param[1]: music (type: Music) -Function 498: UnloadMusicStream() (1 input parameters) +Function 522: UnloadMusicStream() (1 input parameters) Name: UnloadMusicStream Return type: void Description: Unload music stream Param[1]: music (type: Music) -Function 499: PlayMusicStream() (1 input parameters) +Function 523: PlayMusicStream() (1 input parameters) Name: PlayMusicStream Return type: void Description: Start music playing Param[1]: music (type: Music) -Function 500: IsMusicStreamPlaying() (1 input parameters) +Function 524: IsMusicStreamPlaying() (1 input parameters) Name: IsMusicStreamPlaying Return type: bool Description: Check if music is playing Param[1]: music (type: Music) -Function 501: UpdateMusicStream() (1 input parameters) +Function 525: UpdateMusicStream() (1 input parameters) Name: UpdateMusicStream Return type: void Description: Updates buffers for music streaming Param[1]: music (type: Music) -Function 502: StopMusicStream() (1 input parameters) +Function 526: StopMusicStream() (1 input parameters) Name: StopMusicStream Return type: void Description: Stop music playing Param[1]: music (type: Music) -Function 503: PauseMusicStream() (1 input parameters) +Function 527: PauseMusicStream() (1 input parameters) Name: PauseMusicStream Return type: void Description: Pause music playing Param[1]: music (type: Music) -Function 504: ResumeMusicStream() (1 input parameters) +Function 528: ResumeMusicStream() (1 input parameters) Name: ResumeMusicStream Return type: void Description: Resume playing paused music Param[1]: music (type: Music) -Function 505: SeekMusicStream() (2 input parameters) +Function 529: SeekMusicStream() (2 input parameters) Name: SeekMusicStream Return type: void Description: Seek music to a position (in seconds) Param[1]: music (type: Music) Param[2]: position (type: float) -Function 506: SetMusicVolume() (2 input parameters) +Function 530: SetMusicVolume() (2 input parameters) Name: SetMusicVolume Return type: void Description: Set volume for music (1.0 is max level) Param[1]: music (type: Music) Param[2]: volume (type: float) -Function 507: SetMusicPitch() (2 input parameters) +Function 531: SetMusicPitch() (2 input parameters) Name: SetMusicPitch Return type: void Description: Set pitch for a music (1.0 is base level) Param[1]: music (type: Music) Param[2]: pitch (type: float) -Function 508: SetMusicPan() (2 input parameters) +Function 532: SetMusicPan() (2 input parameters) Name: SetMusicPan Return type: void Description: Set pan for a music (0.5 is center) Param[1]: music (type: Music) Param[2]: pan (type: float) -Function 509: GetMusicTimeLength() (1 input parameters) +Function 533: GetMusicTimeLength() (1 input parameters) Name: GetMusicTimeLength Return type: float Description: Get music time length (in seconds) Param[1]: music (type: Music) -Function 510: GetMusicTimePlayed() (1 input parameters) +Function 534: GetMusicTimePlayed() (1 input parameters) Name: GetMusicTimePlayed Return type: float Description: Get current music time played (in seconds) Param[1]: music (type: Music) -Function 511: LoadAudioStream() (3 input parameters) +Function 535: LoadAudioStream() (3 input parameters) Name: LoadAudioStream Return type: AudioStream Description: Load audio stream (to stream raw audio pcm data) Param[1]: sampleRate (type: unsigned int) Param[2]: sampleSize (type: unsigned int) Param[3]: channels (type: unsigned int) -Function 512: IsAudioStreamReady() (1 input parameters) +Function 536: IsAudioStreamReady() (1 input parameters) Name: IsAudioStreamReady Return type: bool Description: Checks if an audio stream is ready Param[1]: stream (type: AudioStream) -Function 513: UnloadAudioStream() (1 input parameters) +Function 537: UnloadAudioStream() (1 input parameters) Name: UnloadAudioStream Return type: void Description: Unload audio stream and free memory Param[1]: stream (type: AudioStream) -Function 514: UpdateAudioStream() (3 input parameters) +Function 538: UpdateAudioStream() (3 input parameters) Name: UpdateAudioStream Return type: void Description: Update audio stream buffers with data Param[1]: stream (type: AudioStream) Param[2]: data (type: const void *) Param[3]: frameCount (type: int) -Function 515: IsAudioStreamProcessed() (1 input parameters) +Function 539: IsAudioStreamProcessed() (1 input parameters) Name: IsAudioStreamProcessed Return type: bool Description: Check if any audio stream buffers requires refill Param[1]: stream (type: AudioStream) -Function 516: PlayAudioStream() (1 input parameters) +Function 540: PlayAudioStream() (1 input parameters) Name: PlayAudioStream Return type: void Description: Play audio stream Param[1]: stream (type: AudioStream) -Function 517: PauseAudioStream() (1 input parameters) +Function 541: PauseAudioStream() (1 input parameters) Name: PauseAudioStream Return type: void Description: Pause audio stream Param[1]: stream (type: AudioStream) -Function 518: ResumeAudioStream() (1 input parameters) +Function 542: ResumeAudioStream() (1 input parameters) Name: ResumeAudioStream Return type: void Description: Resume audio stream Param[1]: stream (type: AudioStream) -Function 519: IsAudioStreamPlaying() (1 input parameters) +Function 543: IsAudioStreamPlaying() (1 input parameters) Name: IsAudioStreamPlaying Return type: bool Description: Check if audio stream is playing Param[1]: stream (type: AudioStream) -Function 520: StopAudioStream() (1 input parameters) +Function 544: StopAudioStream() (1 input parameters) Name: StopAudioStream Return type: void Description: Stop audio stream Param[1]: stream (type: AudioStream) -Function 521: SetAudioStreamVolume() (2 input parameters) +Function 545: SetAudioStreamVolume() (2 input parameters) Name: SetAudioStreamVolume Return type: void Description: Set volume for audio stream (1.0 is max level) Param[1]: stream (type: AudioStream) Param[2]: volume (type: float) -Function 522: SetAudioStreamPitch() (2 input parameters) +Function 546: SetAudioStreamPitch() (2 input parameters) Name: SetAudioStreamPitch Return type: void Description: Set pitch for audio stream (1.0 is base level) Param[1]: stream (type: AudioStream) Param[2]: pitch (type: float) -Function 523: SetAudioStreamPan() (2 input parameters) +Function 547: SetAudioStreamPan() (2 input parameters) Name: SetAudioStreamPan Return type: void Description: Set pan for audio stream (0.5 is centered) Param[1]: stream (type: AudioStream) Param[2]: pan (type: float) -Function 524: SetAudioStreamBufferSizeDefault() (1 input parameters) +Function 548: SetAudioStreamBufferSizeDefault() (1 input parameters) Name: SetAudioStreamBufferSizeDefault Return type: void Description: Default size for new audio streams Param[1]: size (type: int) -Function 525: SetAudioStreamCallback() (2 input parameters) +Function 549: SetAudioStreamCallback() (2 input parameters) Name: SetAudioStreamCallback Return type: void Description: Audio thread callback to request new data Param[1]: stream (type: AudioStream) Param[2]: callback (type: AudioCallback) -Function 526: AttachAudioStreamProcessor() (2 input parameters) +Function 550: AttachAudioStreamProcessor() (2 input parameters) Name: AttachAudioStreamProcessor Return type: void Description: Attach audio stream processor to stream, receives the samples as s Param[1]: stream (type: AudioStream) Param[2]: processor (type: AudioCallback) -Function 527: DetachAudioStreamProcessor() (2 input parameters) +Function 551: DetachAudioStreamProcessor() (2 input parameters) Name: DetachAudioStreamProcessor Return type: void Description: Detach audio stream processor from stream Param[1]: stream (type: AudioStream) Param[2]: processor (type: AudioCallback) -Function 528: AttachAudioMixedProcessor() (1 input parameters) +Function 552: AttachAudioMixedProcessor() (1 input parameters) Name: AttachAudioMixedProcessor Return type: void Description: Attach audio stream processor to the entire audio pipeline, receives the samples as s Param[1]: processor (type: AudioCallback) -Function 529: DetachAudioMixedProcessor() (1 input parameters) +Function 553: DetachAudioMixedProcessor() (1 input parameters) Name: DetachAudioMixedProcessor Return type: void Description: Detach audio stream processor from the entire audio pipeline diff --git a/parser/output/raylib_api.xml b/parser/output/raylib_api.xml index aa7605b8b..15cb77dce 100644 --- a/parser/output/raylib_api.xml +++ b/parser/output/raylib_api.xml @@ -2,10 +2,10 @@ - - + + - + @@ -58,7 +58,7 @@ - + @@ -283,6 +283,16 @@ + + + + + + + + + + @@ -660,16 +670,16 @@ - + - - + + @@ -785,13 +795,6 @@ - - - - - - - @@ -931,18 +934,33 @@ - - + + + + + + + + + + + + - - + + + + + + + @@ -950,6 +968,9 @@ + + + @@ -968,9 +989,6 @@ - - - @@ -1091,6 +1109,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -1106,13 +1147,13 @@ - - - + + + @@ -1246,55 +1287,28 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + - - - - - @@ -1335,6 +1349,11 @@ + + + + + @@ -1481,6 +1500,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1688,6 +1806,11 @@ + + + + + @@ -2632,6 +2755,8 @@ + + diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index cc606a4a2..ee258d604 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -5,7 +5,7 @@ project(example) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Dependencies -set(RAYLIB_VERSION 4.5.0) +set(RAYLIB_VERSION 5.0) find_package(raylib ${RAYLIB_VERSION} QUIET) # QUIET or REQUIRED if (NOT raylib_FOUND) # If there's none, fetch and build raylib include(FetchContent) @@ -40,4 +40,4 @@ if (APPLE) target_link_libraries(${PROJECT_NAME} "-framework IOKit") target_link_libraries(${PROJECT_NAME} "-framework Cocoa") target_link_libraries(${PROJECT_NAME} "-framework OpenGL") -endif() \ No newline at end of file +endif() diff --git a/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h b/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h index 2c033c912..8776d4349 100644 --- a/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h +++ b/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h @@ -375,6 +375,7 @@ RLAPI void ImageAlphaClear(Image *image, Color color, float threshold); RLAPI void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image RLAPI void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel RLAPI void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation +RLAPI void ImageKernelConvolution(Image *image, float* kernel, int kernelSize); // Apply Custom Square image convolution kernel RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm) RLAPI void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm) RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5092bdf47..919efeb4d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ # Setup the project and settings project(raylib C) -set(PROJECT_VERSION 4.5.0) -set(API_VERSION 450) +set(PROJECT_VERSION 5.0.0) +set(API_VERSION 500) include(GNUInstallDirs) include(JoinPaths) @@ -62,12 +62,10 @@ if (NOT BUILD_SHARED_LIBS) add_library(raylib_static ALIAS raylib) else() MESSAGE(STATUS "Building raylib shared library") - if (WIN32) - target_compile_definitions(raylib - PRIVATE $ - INTERFACE $ - ) - endif () + target_compile_definitions(raylib + PRIVATE $ + INTERFACE $ + ) endif() if (${PLATFORM} MATCHES "Web") @@ -84,6 +82,11 @@ if (WITH_PIC OR BUILD_SHARED_LIBS) set_property(TARGET raylib PROPERTY POSITION_INDEPENDENT_CODE ON) endif () +if (BUILD_SHARED_LIBS) + # Hide raylib's symbols by default so RLAPI can expose them + set_property(TARGET raylib PROPERTY C_VISIBILITY_PRESET hidden) +endif () + target_link_libraries(raylib "${LIBS_PRIVATE}") # Sets some compile time definitions for the pre-processor diff --git a/src/Makefile b/src/Makefile index 2ee0c5a06..ca978f777 100644 --- a/src/Makefile +++ b/src/Makefile @@ -114,7 +114,7 @@ HOST_PLATFORM_OS ?= WINDOWS PLATFORM_OS ?= WINDOWS # Determine PLATFORM_OS when required -ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB)) +ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB PLATFORM_ANDROID)) # No uname.exe on MinGW!, but OS=Windows_NT on Windows! # ifeq ($(UNAME),Msys) -> Windows ifeq ($(OS),Windows_NT) @@ -189,8 +189,12 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) ANDROID_NDK ?= C:/android-ndk ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/windows-x86_64 else - ANDROID_NDK ?= /usr/lib/android/ndk - ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64 + ANDROID_NDK ?= /usr/lib/android/ndk + ifeq ($(PLATFORM_OS), OSX) + ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/darwin-x86_64 + else + ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64 + endif endif # NOTE: Sysroot can also be reference from $(ANDROID_NDK)/sysroot @@ -376,7 +380,7 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) # -Werror=format-security CFLAGS += -Wa,--noexecstack -Wformat -no-canonical-prefixes # Preprocessor macro definitions - CFLAGS += -D__ANDROID__ -DPLATFORM_ANDROID -D__ANDROID_API__=$(ANDROID_API_VERSION) -DMAL_NO_OSS + CFLAGS += -D__ANDROID__ -DPLATFORM_ANDROID -D__ANDROID_API__=$(ANDROID_API_VERSION) endif # Define required compilation flags for raylib SHARED lib @@ -385,7 +389,13 @@ ifeq ($(RAYLIB_LIBTYPE),SHARED) # BE CAREFUL: It seems that for gcc -fpic is not the same as -fPIC # MinGW32 just doesn't need -fPIC, it shows warnings CFLAGS += -fPIC -DBUILD_LIBTYPE_SHARED + + # hide all symbols by default, so RLAPI can expose them + ifeq ($(PLATFORM_OS),$(filter $(PLATFORM_OS), LINUX BSD OSX)) + CFLAGS += -fvisibility=hidden + endif endif + ifeq ($(PLATFORM),PLATFORM_DRM) # without EGL_NO_X11 eglplatform.h tears Xlib.h in which tears X.h in # which contains a conflicting type Font diff --git a/src/external/rprand.h b/src/external/rprand.h index c9b460cd6..7e27d980f 100644 --- a/src/external/rprand.h +++ b/src/external/rprand.h @@ -200,8 +200,7 @@ int *rprand_load_sequence(unsigned int count, int min, int max) for (unsigned int i = 0; i < count;) { - value = ((int)rprand_xoshiro()%(abs(max - min) + 1)) + min; - value_is_dup = false; + value = ((unsigned int)rprand_xoshiro()%(abs(max - min) + 1)) + min; for (int j = 0; j < i; j++) { @@ -217,6 +216,8 @@ int *rprand_load_sequence(unsigned int count, int min, int max) sequence[i] = value; i++; } + + value_is_dup = false; } return sequence; diff --git a/src/platforms/rcore_desktop.c b/src/platforms/rcore_desktop.c index 05c390f97..0dfcacd81 100644 --- a/src/platforms/rcore_desktop.c +++ b/src/platforms/rcore_desktop.c @@ -129,7 +129,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i static void CharCallback(GLFWwindow *window, unsigned int key); // GLFW3 Char Key Callback, runs on key pressed (get char value) static void MouseButtonCallback(GLFWwindow *window, int button, int action, int mods); // GLFW3 Mouse Button Callback, runs on mouse button pressed static void MouseCursorPosCallback(GLFWwindow *window, double x, double y); // GLFW3 Cursor Position Callback, runs on mouse move -static void MouseScrollCallback(GLFWwindow *window, double xoffset, double yoffset); // GLFW3 Srolling Callback, runs on mouse wheel +static void MouseScrollCallback(GLFWwindow *window, double xoffset, double yoffset); // GLFW3 Scrolling Callback, runs on mouse wheel static void CursorEnterCallback(GLFWwindow *window, int enter); // GLFW3 Cursor Enter Callback, cursor enters client area static void JoystickCallback(int jid, int event); // GLFW3 Joystick Connected/Disconnected Callback @@ -1137,7 +1137,7 @@ void PollInputEvents(void) //for (int i = 0; i < MAX_TOUCH_POINTS; i++) CORE.Input.Touch.position[i] = (Vector2){ 0, 0 }; // Map touch position to mouse position for convenience - // WARNING: If the target desktop device supports touch screen, this behavious should be reviewed! + // WARNING: If the target desktop device supports touch screen, this behaviour should be reviewed! // TODO: GLFW does not support multi-touch input just yet // https://www.codeproject.com/Articles/668404/Programming-for-Multi-Touch // https://docs.microsoft.com/en-us/windows/win32/wintouch/getting-started-with-multi-touch-messages @@ -1739,7 +1739,8 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int // WARNING: GLFW could only return GLFW_PRESS (1) or GLFW_RELEASE (0) for now, // but future releases may add more actions (i.e. GLFW_REPEAT) CORE.Input.Mouse.currentButtonState[button] = action; - + CORE.Input.Touch.currentTouchState[button] = action; + #if defined(SUPPORT_GESTURES_SYSTEM) && defined(SUPPORT_MOUSE_GESTURES) // Process mouse events as touches to be able to use mouse-gestures GestureEvent gestureEvent = { 0 }; diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index 96e557024..e1e6e4c9a 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -48,8 +48,14 @@ * **********************************************************************************************/ -#include "SDL.h" // SDL base library (window/rendered, input, timming... functionality) -#include "SDL_opengl.h" // SDL OpenGL functionality (if required, instead of internal renderer) +#include "SDL.h" // SDL base library (window/rendered, input, timing... functionality) + +#if defined(GRAPHICS_API_OPENGL_ES2) + // It seems it does not need to be included to work + //#include "SDL_opengles2.h" +#else + #include "SDL_opengl.h" // SDL OpenGL functionality (if required, instead of internal renderer) +#endif //---------------------------------------------------------------------------------- // Types and Structures Definition @@ -493,9 +499,9 @@ void SetWindowIcon(Image image) bmask = 0x001F, amask = 0; depth = 16, pitch = image.width * 2; break; - case PIXELFORMAT_UNCOMPRESSED_R8G8B8: - rmask = 0xFF0000, gmask = 0x00FF00; - bmask = 0x0000FF, amask = 0; + case PIXELFORMAT_UNCOMPRESSED_R8G8B8: // Uses BGR for 24-bit + rmask = 0x0000FF, gmask = 0x00FF00; + bmask = 0xFF0000, amask = 0; depth = 24, pitch = image.width * 3; break; case PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: @@ -592,7 +598,7 @@ void SetWindowMonitor(int monitor) // NOTE: // 1. SDL started supporting moving exclusive fullscreen windows between displays on SDL3, // see commit https://github.com/libsdl-org/SDL/commit/3f5ef7dd422057edbcf3e736107e34be4b75d9ba - // 2. A workround for SDL2 is leaving fullscreen, moving the window, then entering full screen again. + // 2. A workaround for SDL2 is leaving fullscreen, moving the window, then entering full screen again. const bool wasFullscreen = ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) ? true : false; const int screenWidth = CORE.Window.screen.width; @@ -611,7 +617,7 @@ void SetWindowMonitor(int monitor) // ending up positioned partly outside the target display. // 2. The workaround for that is, previously to moving the window, // setting the window size to the target display size, so they match. - // 3. It was't done here because we can't assume changing the window size automatically + // 3. It wasn't done here because we can't assume changing the window size automatically // is acceptable behavior by the user. SDL_SetWindowPosition(platform.window, usableBounds.x, usableBounds.y); CORE.Window.position.x = usableBounds.x; @@ -935,6 +941,8 @@ int SetGamepadMappings(const char *mappings) // Set mouse position XY void SetMousePosition(int x, int y) { + SDL_WarpMouseInWindow(platform.window, x, y); + CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y }; CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition; } @@ -961,9 +969,6 @@ void PollInputEvents(void) CORE.Input.Keyboard.keyPressedQueueCount = 0; CORE.Input.Keyboard.charPressedQueueCount = 0; - // Reset key repeats - for (int i = 0; i < MAX_KEYBOARD_KEYS; i++) CORE.Input.Keyboard.keyRepeatInFrame[i] = 0; - // Reset mouse wheel CORE.Input.Mouse.currentWheelMove.x = 0; CORE.Input.Mouse.currentWheelMove.y = 0; @@ -991,7 +996,7 @@ void PollInputEvents(void) CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition; int touchAction = -1; // 0-TOUCH_ACTION_UP, 1-TOUCH_ACTION_DOWN, 2-TOUCH_ACTION_MOVE - bool gestureUpdate = false; // Flag to note gestures require to update + bool realTouch = false; // Flag to differentiate real touch gestures from mouse ones // Register previous keys states // NOTE: Android supports up to 260 keys @@ -1004,7 +1009,7 @@ void PollInputEvents(void) // Register previous mouse states for (int i = 0; i < MAX_MOUSE_BUTTONS; i++) CORE.Input.Mouse.previousButtonState[i] = CORE.Input.Mouse.currentButtonState[i]; - // Poll input events for current plaform + // Poll input events for current platform //----------------------------------------------------------------------------- /* // WARNING: Indexes into this array are obtained by using SDL_Scancode values, not SDL_Keycode values @@ -1089,6 +1094,8 @@ void PollInputEvents(void) KeyboardKey key = ConvertScancodeToKey(event.key.keysym.scancode); if (key != KEY_NULL) CORE.Input.Keyboard.currentKeyState[key] = 1; + if (event.key.repeat) CORE.Input.Keyboard.keyRepeatInFrame[key] = 1; + // TODO: Put exitKey verification outside the switch? if (CORE.Input.Keyboard.currentKeyState[CORE.Input.Keyboard.exitKey]) { @@ -1102,6 +1109,25 @@ void PollInputEvents(void) if (key != KEY_NULL) CORE.Input.Keyboard.currentKeyState[key] = 0; } break; + case SDL_TEXTINPUT: + { + // Check if there is space available in the key queue + if (CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) + { + // Add character to the queue + CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = event.text.text[0]; + CORE.Input.Keyboard.keyPressedQueueCount++; + } + + // Check if there is space available in the queue + if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE) + { + // Add character to the queue + CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = event.text.text[0]; + CORE.Input.Keyboard.charPressedQueueCount++; + } + } break; + // Check mouse events case SDL_MOUSEBUTTONDOWN: { @@ -1112,9 +1138,9 @@ void PollInputEvents(void) else if (btn == 1) btn = 2; CORE.Input.Mouse.currentButtonState[btn] = 1; + CORE.Input.Touch.currentTouchState[btn] = 1; touchAction = 1; - gestureUpdate = true; } break; case SDL_MOUSEBUTTONUP: { @@ -1125,9 +1151,9 @@ void PollInputEvents(void) else if (btn == 1) btn = 2; CORE.Input.Mouse.currentButtonState[btn] = 0; + CORE.Input.Touch.currentTouchState[btn] = 0; touchAction = 0; - gestureUpdate = true; } break; case SDL_MOUSEWHEEL: { @@ -1150,7 +1176,38 @@ void PollInputEvents(void) CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition; touchAction = 2; - gestureUpdate = true; + } break; + + // Check touch events + // NOTE: These cases need to be reviewed on a real touch screen + case SDL_FINGERDOWN: + { + const int touchId = (int)event.tfinger.fingerId; + CORE.Input.Touch.currentTouchState[touchId] = 1; + CORE.Input.Touch.position[touchId].x = event.tfinger.x * CORE.Window.screen.width; + CORE.Input.Touch.position[touchId].y = event.tfinger.y * CORE.Window.screen.height; + + touchAction = 1; + realTouch = true; + } break; + case SDL_FINGERUP: + { + const int touchId = (int)event.tfinger.fingerId; + CORE.Input.Touch.currentTouchState[touchId] = 0; + CORE.Input.Touch.position[touchId].x = event.tfinger.x * CORE.Window.screen.width; + CORE.Input.Touch.position[touchId].y = event.tfinger.y * CORE.Window.screen.height; + + touchAction = 0; + realTouch = true; + } break; + case SDL_FINGERMOTION: + { + const int touchId = (int)event.tfinger.fingerId; + CORE.Input.Touch.position[touchId].x = event.tfinger.x * CORE.Window.screen.width; + CORE.Input.Touch.position[touchId].y = event.tfinger.y * CORE.Window.screen.height; + + touchAction = 2; + realTouch = true; } break; // Check gamepad events @@ -1175,7 +1232,7 @@ void PollInputEvents(void) } #if defined(SUPPORT_GESTURES_SYSTEM) - if (gestureUpdate) + if (touchAction > -1) { // Process mouse events as touches to be able to use mouse-gestures GestureEvent gestureEvent = { 0 }; @@ -1190,7 +1247,7 @@ void PollInputEvents(void) gestureEvent.pointCount = 1; // Register touch points position, only one point registered - if (touchAction == 2) gestureEvent.position[0] = CORE.Input.Touch.position[0]; + if (touchAction == 2 || realTouch) gestureEvent.position[0] = CORE.Input.Touch.position[0]; else gestureEvent.position[0] = GetMousePosition(); // Normalize gestureEvent.position[0] for CORE.Window.screen.width and CORE.Window.screen.height @@ -1199,6 +1256,8 @@ void PollInputEvents(void) // Gesture data is sent to gestures-system for processing ProcessGestureEvent(gestureEvent); + + touchAction = -1; } #endif } @@ -1310,7 +1369,7 @@ int InitPlatform(void) // Init OpenGL context platform.glContext = SDL_GL_CreateContext(platform.window); - // Check window and glContext have been initialized succesfully + // Check window and glContext have been initialized successfully if ((platform.window != NULL) && (platform.glContext != NULL)) { CORE.Window.ready = true; @@ -1351,10 +1410,15 @@ int InitPlatform(void) //if (platform.gamepadgamepad == NULL) TRACELOG(LOG_WARNING, "PLATFORM: Unable to open game controller [ERROR: %s]", SDL_GetError()); } + // Disable mouse events being interpreted as touch events + // NOTE: This is wanted because there are SDL_FINGER* events available which provide unique data + // Due to the way PollInputEvents() and rgestures.h are currently implemented, setting this won't break SUPPORT_MOUSE_GESTURES + SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0"); + SDL_EventState(SDL_DROPFILE, SDL_ENABLE); //---------------------------------------------------------------------------- - // Initialize timming system + // Initialize timing system //---------------------------------------------------------------------------- // NOTE: No need to call InitTimer(), let SDL manage it internally CORE.Time.previous = GetTime(); // Get time as double diff --git a/src/platforms/rcore_drm.c b/src/platforms/rcore_drm.c index 00c46e0df..3449e6993 100644 --- a/src/platforms/rcore_drm.c +++ b/src/platforms/rcore_drm.c @@ -545,9 +545,6 @@ void PollInputEvents(void) CORE.Input.Keyboard.keyPressedQueueCount = 0; CORE.Input.Keyboard.charPressedQueueCount = 0; - // Reset key repeats - for (int i = 0; i < MAX_KEYBOARD_KEYS; i++) CORE.Input.Keyboard.keyRepeatInFrame[i] = 0; - // Reset last gamepad button/axis registered state CORE.Input.Gamepad.lastButtonPressed = 0; // GAMEPAD_BUTTON_UNKNOWN //CORE.Input.Gamepad.axisCount = 0; @@ -573,6 +570,7 @@ void PollInputEvents(void) { CORE.Input.Mouse.previousButtonState[i] = CORE.Input.Mouse.currentButtonState[i]; CORE.Input.Mouse.currentButtonState[i] = platform.currentButtonStateEvdev[i]; + CORE.Input.Touch.currentTouchState[i] = platform.currentButtonStateEvdev[i]; } // Register gamepads buttons events @@ -603,7 +601,6 @@ void PollInputEvents(void) struct input_event event = { 0 }; int touchAction = -1; // 0-TOUCH_ACTION_UP, 1-TOUCH_ACTION_DOWN, 2-TOUCH_ACTION_MOVE - bool gestureUpdate = false; // Flag to note gestures require to update // Try to read data from the mouse/touch/gesture and only continue if successful while (read(fd, &event, sizeof(event)) == (int)sizeof(event)) @@ -622,7 +619,6 @@ void PollInputEvents(void) CORE.Input.Touch.position[0].x = CORE.Input.Mouse.currentPosition.x; touchAction = 2; // TOUCH_ACTION_MOVE - gestureUpdate = true; } if (event.code == REL_Y) @@ -636,7 +632,6 @@ void PollInputEvents(void) CORE.Input.Touch.position[0].y = CORE.Input.Mouse.currentPosition.y; touchAction = 2; // TOUCH_ACTION_MOVE - gestureUpdate = true; } if (event.code == REL_WHEEL) platform.eventWheelMove.y += event.value; @@ -652,7 +647,6 @@ void PollInputEvents(void) CORE.Input.Touch.position[0].x = (event.value - platform.absRange.x)*CORE.Window.screen.width/platform.absRange.width; // Scale according to absRange touchAction = 2; // TOUCH_ACTION_MOVE - gestureUpdate = true; } if (event.code == ABS_Y) @@ -661,7 +655,6 @@ void PollInputEvents(void) CORE.Input.Touch.position[0].y = (event.value - platform.absRange.y)*CORE.Window.screen.height/platform.absRange.height; // Scale according to absRange touchAction = 2; // TOUCH_ACTION_MOVE - gestureUpdate = true; } // Multitouch movement @@ -697,7 +690,6 @@ void PollInputEvents(void) platform.currentButtonStateEvdev[MOUSE_BUTTON_LEFT] = 0; touchAction = 0; // TOUCH_ACTION_UP - gestureUpdate = true; } if (event.value && !previousMouseLeftButtonState) @@ -705,7 +697,6 @@ void PollInputEvents(void) platform.currentButtonStateEvdev[MOUSE_BUTTON_LEFT] = 1; touchAction = 1; // TOUCH_ACTION_DOWN - gestureUpdate = true; } } @@ -721,7 +712,6 @@ void PollInputEvents(void) if (event.value > 0) touchAction = 1; // TOUCH_ACTION_DOWN else touchAction = 0; // TOUCH_ACTION_UP - gestureUpdate = true; } if (event.code == BTN_RIGHT) platform.currentButtonStateEvdev[MOUSE_BUTTON_RIGHT] = event.value; @@ -750,7 +740,7 @@ void PollInputEvents(void) } #if defined(SUPPORT_GESTURES_SYSTEM) - if (gestureUpdate) + if (touchAction > -1) { GestureEvent gestureEvent = { 0 }; @@ -765,7 +755,7 @@ void PollInputEvents(void) ProcessGestureEvent(gestureEvent); - gestureUpdate = false; + touchAction = -1; } #endif } @@ -1696,6 +1686,7 @@ static void PollKeyboardEvents(void) // Event interface: 'value' is the value the event carries. Either a relative change for EV_REL, // absolute new value for EV_ABS (joysticks ...), or 0 for EV_KEY for release, 1 for keypress and 2 for autorepeat CORE.Input.Keyboard.currentKeyState[keycode] = (event.value >= 1)? 1 : 0; + CORE.Input.Keyboard.keyRepeatInFrame[keycode] = (event.value == 2)? 1 : 0; if (event.value >= 1) { CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = keycode; // Register last key pressed diff --git a/src/platforms/rcore_template.c b/src/platforms/rcore_template.c index 5d4721c84..01e52af58 100644 --- a/src/platforms/rcore_template.c +++ b/src/platforms/rcore_template.c @@ -420,7 +420,7 @@ void PollInputEvents(void) CORE.Input.Keyboard.keyRepeatInFrame[i] = 0; } - // TODO: Poll input events for current plaform + // TODO: Poll input events for current platform } @@ -561,13 +561,13 @@ int InitPlatform(void) // TODO: Initialize input events system // It could imply keyboard, mouse, gamepad, touch... - // Depending on the platform libraries/SDK it could use a callbacks mechanims + // Depending on the platform libraries/SDK it could use a callback mechanism // For system events and inputs evens polling on a per-frame basis, use PollInputEvents() //---------------------------------------------------------------------------- // ... //---------------------------------------------------------------------------- - // TODO: Initialize timming system + // TODO: Initialize timing system //---------------------------------------------------------------------------- InitTimer(); //---------------------------------------------------------------------------- diff --git a/src/platforms/rcore_web.c b/src/platforms/rcore_web.c index d8fa54305..396ce30e5 100644 --- a/src/platforms/rcore_web.c +++ b/src/platforms/rcore_web.c @@ -73,6 +73,7 @@ //---------------------------------------------------------------------------------- typedef struct { GLFWwindow *handle; // GLFW window handle (graphic device) + bool ourFullscreen; // Internal var to filter our handling of fullscreen vs the user handling of fullscreen } PlatformData; //---------------------------------------------------------------------------------- @@ -140,6 +141,37 @@ bool WindowShouldClose(void) // Toggle fullscreen mode void ToggleFullscreen(void) { + platform.ourFullscreen = true; + bool enterFullscreen = false; + + const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0); + if (wasFullscreen) + { + EM_ASM(document.exitFullscreen();); + + if (CORE.Window.flags & FLAG_FULLSCREEN_MODE) enterFullscreen = false; + else enterFullscreen = true; + + CORE.Window.fullscreen = false; + CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE; + CORE.Window.flags &= ~FLAG_BORDERLESS_WINDOWED_MODE; + } + else enterFullscreen = true; + + if (enterFullscreen) + { + // NOTE: The setTimeouts handle the browser mode change delay + EM_ASM( + setTimeout(function() + { + Module.requestFullscreen(false, false); + }, 100); + ); + CORE.Window.fullscreen = true; + CORE.Window.flags |= FLAG_FULLSCREEN_MODE; + } + + // NOTE: Old notes below: /* EM_ASM ( @@ -204,14 +236,44 @@ void ToggleFullscreen(void) CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE; } */ - - CORE.Window.fullscreen = !CORE.Window.fullscreen; // Toggle fullscreen flag } // Toggle borderless windowed mode void ToggleBorderlessWindowed(void) { - TRACELOG(LOG_WARNING, "ToggleBorderlessWindowed() not available on target platform"); + platform.ourFullscreen = true; + bool enterBorderless = false; + + const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0); + if (wasFullscreen) + { + EM_ASM(document.exitFullscreen();); + + if (CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) enterBorderless = false; + else enterBorderless = true; + + CORE.Window.fullscreen = false; + CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE; + CORE.Window.flags &= ~FLAG_BORDERLESS_WINDOWED_MODE; + } + else enterBorderless = true; + + if (enterBorderless) + { + // NOTE: 1. The setTimeouts handle the browser mode change delay + // 2. The style unset handles the possibility of a width="value%" like on the default shell.html file + EM_ASM( + setTimeout(function() + { + Module.requestFullscreen(false, true); + setTimeout(function() + { + canvas.style.width="unset"; + }, 100); + }, 100); + ); + CORE.Window.flags |= FLAG_BORDERLESS_WINDOWED_MODE; + } } // Set window state: maximized, if resizable @@ -235,13 +297,215 @@ void RestoreWindow(void) // Set window configuration state using flags void SetWindowState(unsigned int flags) { - TRACELOG(LOG_WARNING, "SetWindowState() not available on target platform"); + // Check previous state and requested state to apply required changes + // NOTE: In most cases the functions already change the flags internally + + // State change: FLAG_VSYNC_HINT + if ((flags & FLAG_VSYNC_HINT) > 0) + { + TRACELOG(LOG_WARNING, "SetWindowState(FLAG_VSYNC_HINT) not available on target platform"); + } + + // State change: FLAG_BORDERLESS_WINDOWED_MODE + if (((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) != (flags & FLAG_BORDERLESS_WINDOWED_MODE)) && ((flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0)) + { + ToggleBorderlessWindowed(); // NOTE: Window state flag updated inside function + } + + // State change: FLAG_FULLSCREEN_MODE + if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) != (flags & FLAG_FULLSCREEN_MODE)) + { + ToggleFullscreen(); // NOTE: Window state flag updated inside function + } + + // State change: FLAG_WINDOW_RESIZABLE + if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) != (flags & FLAG_WINDOW_RESIZABLE)) && ((flags & FLAG_WINDOW_RESIZABLE) > 0)) + { + glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_TRUE); + CORE.Window.flags |= FLAG_WINDOW_RESIZABLE; + } + + // State change: FLAG_WINDOW_UNDECORATED + if ((flags & FLAG_WINDOW_UNDECORATED) > 0) + { + TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_UNDECORATED) not available on target platform"); + } + + // State change: FLAG_WINDOW_HIDDEN + if ((flags & FLAG_WINDOW_HIDDEN) > 0) + { + TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_HIDDEN) not available on target platform"); + } + + // State change: FLAG_WINDOW_MINIMIZED + if ((flags & FLAG_WINDOW_MINIMIZED) > 0) + { + TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_MINIMIZED) not available on target platform"); + } + + // State change: FLAG_WINDOW_MAXIMIZED + if ((flags & FLAG_WINDOW_MAXIMIZED) > 0) + { + TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_MAXIMIZED) not available on target platform"); + } + + // State change: FLAG_WINDOW_UNFOCUSED + if ((flags & FLAG_WINDOW_UNFOCUSED) > 0) + { + TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_UNFOCUSED) not available on target platform"); + } + + // State change: FLAG_WINDOW_TOPMOST + if ((flags & FLAG_WINDOW_TOPMOST) > 0) + { + TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_TOPMOST) not available on target platform"); + } + + // State change: FLAG_WINDOW_ALWAYS_RUN + if ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0) + { + TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_ALWAYS_RUN) not available on target platform"); + } + + // The following states can not be changed after window creation + // NOTE: Review for PLATFORM_WEB + + // State change: FLAG_WINDOW_TRANSPARENT + if ((flags & FLAG_WINDOW_TRANSPARENT) > 0) + { + TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_TRANSPARENT) not available on target platform"); + } + + // State change: FLAG_WINDOW_HIGHDPI + if ((flags & FLAG_WINDOW_HIGHDPI) > 0) + { + TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_HIGHDPI) not available on target platform"); + } + + // State change: FLAG_WINDOW_MOUSE_PASSTHROUGH + if ((flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0) + { + TRACELOG(LOG_WARNING, "SetWindowState(FLAG_WINDOW_MOUSE_PASSTHROUGH) not available on target platform"); + } + + // State change: FLAG_MSAA_4X_HINT + if ((flags & FLAG_MSAA_4X_HINT) > 0) + { + TRACELOG(LOG_WARNING, "SetWindowState(FLAG_MSAA_4X_HINT) not available on target platform"); + } + + // State change: FLAG_INTERLACED_HINT + if ((flags & FLAG_INTERLACED_HINT) > 0) + { + TRACELOG(LOG_WARNING, "SetWindowState(FLAG_INTERLACED_HINT) not available on target platform"); + } } // Clear window configuration state flags void ClearWindowState(unsigned int flags) { - TRACELOG(LOG_WARNING, "ClearWindowState() not available on target platform"); + // Check previous state and requested state to apply required changes + // NOTE: In most cases the functions already change the flags internally + + // State change: FLAG_VSYNC_HINT + if ((flags & FLAG_VSYNC_HINT) > 0) + { + TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_VSYNC_HINT) not available on target platform"); + } + + // State change: FLAG_BORDERLESS_WINDOWED_MODE + if (((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0) && ((flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0)) + { + ToggleBorderlessWindowed(); // NOTE: Window state flag updated inside function + } + + // State change: FLAG_FULLSCREEN_MODE + if (((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) && ((flags & FLAG_FULLSCREEN_MODE) > 0)) + { + ToggleFullscreen(); // NOTE: Window state flag updated inside function + } + + // State change: FLAG_WINDOW_RESIZABLE + if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0) && ((flags & FLAG_WINDOW_RESIZABLE) > 0)) + { + glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_FALSE); + CORE.Window.flags &= ~FLAG_WINDOW_RESIZABLE; + } + + // State change: FLAG_WINDOW_HIDDEN + if ((flags & FLAG_WINDOW_HIDDEN) > 0) + { + TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_HIDDEN) not available on target platform"); + } + + // State change: FLAG_WINDOW_MINIMIZED + if ((flags & FLAG_WINDOW_MINIMIZED) > 0) + { + TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_MINIMIZED) not available on target platform"); + } + + // State change: FLAG_WINDOW_MAXIMIZED + if ((flags & FLAG_WINDOW_MAXIMIZED) > 0) + { + TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_MAXIMIZED) not available on target platform"); + } + + // State change: FLAG_WINDOW_UNDECORATED + if ((flags & FLAG_WINDOW_UNDECORATED) > 0) + { + TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_UNDECORATED) not available on target platform"); + } + + // State change: FLAG_WINDOW_UNFOCUSED + if ((flags & FLAG_WINDOW_UNFOCUSED) > 0) + { + TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_UNFOCUSED) not available on target platform"); + } + + // State change: FLAG_WINDOW_TOPMOST + if ((flags & FLAG_WINDOW_TOPMOST) > 0) + { + TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_TOPMOST) not available on target platform"); + } + + // State change: FLAG_WINDOW_ALWAYS_RUN + if ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0) + { + TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_ALWAYS_RUN) not available on target platform"); + } + + // The following states can not be changed after window creation + // NOTE: Review for PLATFORM_WEB + + // State change: FLAG_WINDOW_TRANSPARENT + if ((flags & FLAG_WINDOW_TRANSPARENT) > 0) + { + TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_TRANSPARENT) not available on target platform"); + } + + // State change: FLAG_WINDOW_HIGHDPI + if ((flags & FLAG_WINDOW_HIGHDPI) > 0) + { + TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_HIGHDPI) not available on target platform"); + } + + // State change: FLAG_WINDOW_MOUSE_PASSTHROUGH + if ((flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0) + { + TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_WINDOW_MOUSE_PASSTHROUGH) not available on target platform"); + } + + // State change: FLAG_MSAA_4X_HINT + if ((flags & FLAG_MSAA_4X_HINT) > 0) + { + TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_MSAA_4X_HINT) not available on target platform"); + } + + // State change: FLAG_INTERLACED_HINT + if ((flags & FLAG_INTERLACED_HINT) > 0) + { + TRACELOG(LOG_WARNING, "ClearWindowState(FLAG_INTERLACED_HINT) not available on target platform"); + } } // Set icon for window @@ -344,15 +608,19 @@ Vector2 GetMonitorPosition(int monitor) // Get selected monitor width (currently used by monitor) int GetMonitorWidth(int monitor) { - TRACELOG(LOG_WARNING, "GetMonitorWidth() not implemented on target platform"); - return 0; + // NOTE: Returned value is limited to the current monitor where the browser window is located + int width = 0; + width = EM_ASM_INT( { return screen.width; }, 0); + return width; } // Get selected monitor height (currently used by monitor) int GetMonitorHeight(int monitor) { - TRACELOG(LOG_WARNING, "GetMonitorHeight() not implemented on target platform"); - return 0; + // NOTE: Returned value is limited to the current monitor where the browser window is located + int height = 0; + height = EM_ASM_INT( { return screen.height; }, 0); + return height; } // Get selected monitor physical width in millimetres @@ -386,8 +654,11 @@ const char *GetMonitorName(int monitor) // Get window position XY on monitor Vector2 GetWindowPosition(void) { - TRACELOG(LOG_WARNING, "GetWindowPosition() not implemented on target platform"); - return (Vector2){ 0, 0 }; + // NOTE: Returned position is relative to the current monitor where the browser window is located + Vector2 position = { 0, 0 }; + position.x = (float)EM_ASM_INT( { return window.screenX; }, 0); + position.y = (float)EM_ASM_INT( { return window.screenY; }, 0); + return position; } // Get window scale DPI factor for current monitor @@ -664,7 +935,7 @@ void PollInputEvents(void) // TODO: This code does not seem to do anything?? //if (CORE.Window.eventWaiting) glfwWaitEvents(); // Wait for in input events before continue (drawing is paused) - //else glfwPollEvents(); // Poll input events: keyboard/mouse/window events (callbacks) --> WARNING: Where is key input reseted? + //else glfwPollEvents(); // Poll input events: keyboard/mouse/window events (callbacks) --> WARNING: Where is key input reset? } //---------------------------------------------------------------------------------- @@ -716,8 +987,13 @@ int InitPlatform(void) if ((CORE.Window.flags & FLAG_WINDOW_TOPMOST) > 0) glfwWindowHint(GLFW_FLOATING, GLFW_TRUE); else glfwWindowHint(GLFW_FLOATING, GLFW_FALSE); - // NOTE: Some GLFW flags are not supported on HTML5 - // e.g.: GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_SCALE_TO_MONITOR, GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_MOUSE_PASSTHROUGH + // NOTE: Some GLFW flags are not supported on HTML5 + // e.g.: GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_MOUSE_PASSTHROUGH + + // Scale content area based on the monitor content scale where window is placed on + // NOTE: This feature requires emscripten 3.1.51 + //if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); + //else glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE); if (CORE.Window.flags & FLAG_MSAA_4X_HINT) { @@ -775,6 +1051,9 @@ int InitPlatform(void) CORE.Window.display.width = CORE.Window.screen.width; CORE.Window.display.height = CORE.Window.screen.height; + // Init fullscreen toggle required var: + platform.ourFullscreen = false; + if (CORE.Window.fullscreen) { // remember center for switchinging from fullscreen to window @@ -908,7 +1187,7 @@ int InitPlatform(void) // Initialize input events callbacks //---------------------------------------------------------------------------- // Setup callback functions for the DOM events - emscripten_set_fullscreenchange_callback("#canvas", NULL, 1, EmscriptenFullscreenChangeCallback); + emscripten_set_fullscreenchange_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, 1, EmscriptenFullscreenChangeCallback); // WARNING: Below resize code was breaking fullscreen mode for sample games and examples, it needs review // Check fullscreen change events(note this is done on the window since most browsers don't support this on #canvas) @@ -937,7 +1216,7 @@ int InitPlatform(void) emscripten_set_gamepaddisconnected_callback(NULL, 1, EmscriptenGamepadCallback); //---------------------------------------------------------------------------- - // Initialize timming system + // Initialize timing system //---------------------------------------------------------------------------- InitTimer(); //---------------------------------------------------------------------------- @@ -1093,6 +1372,7 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int // WARNING: GLFW could only return GLFW_PRESS (1) or GLFW_RELEASE (0) for now, // but future releases may add more actions (i.e. GLFW_REPEAT) CORE.Input.Mouse.currentButtonState[button] = action; + CORE.Input.Touch.currentTouchState[button] = action; #if defined(SUPPORT_GESTURES_SYSTEM) && defined(SUPPORT_MOUSE_GESTURES) // Process mouse events as touches to be able to use mouse-gestures @@ -1171,7 +1451,19 @@ static void CursorEnterCallback(GLFWwindow *window, int enter) // Register fullscreen change events static EM_BOOL EmscriptenFullscreenChangeCallback(int eventType, const EmscriptenFullscreenChangeEvent *event, void *userData) { - // TODO: Implement EmscriptenFullscreenChangeCallback()? + // NOTE: 1. Reset the fullscreen flags if the user left fullscreen manually by pressing the Escape key + // 2. Which is a necessary safeguard because that case will bypass the toggles CORE.Window.flags resets + if (platform.ourFullscreen) platform.ourFullscreen = false; + else + { + const bool wasFullscreen = EM_ASM_INT( { if (document.fullscreenElement) return 1; }, 0); + if (!wasFullscreen) + { + CORE.Window.fullscreen = false; + CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE; + CORE.Window.flags &= ~FLAG_BORDERLESS_WINDOWED_MODE; + } + } return 1; // The event was consumed by the callback handler } diff --git a/src/raudio.c b/src/raudio.c index e38e51e6c..c321aa501 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -167,6 +167,10 @@ typedef struct tagBITMAPINFOHEADER { #define MA_NO_WAV #define MA_NO_FLAC #define MA_NO_MP3 +#define MA_NO_RESOURCE_MANAGER +#define MA_NO_NODE_GRAPH +#define MA_NO_ENGINE +#define MA_NO_GENERATION // Threading model: Default: [0] COINIT_MULTITHREADED: COM calls objects on any thread (free threading) #define MA_COINIT_VALUE 2 // [2] COINIT_APARTMENTTHREADED: Each object has its own thread (apartment model) diff --git a/src/raylib.h b/src/raylib.h index 1c4c4a09f..206b26573 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1,6 +1,6 @@ /********************************************************************************************** * -* raylib v5.0 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com) +* raylib v5.1-dev - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com) * * FEATURES: * - NO external dependencies, all required libraries included with raylib @@ -82,21 +82,26 @@ #include // Required for: va_list - Only used by TraceLogCallback #define RAYLIB_VERSION_MAJOR 5 -#define RAYLIB_VERSION_MINOR 0 +#define RAYLIB_VERSION_MINOR 1 #define RAYLIB_VERSION_PATCH 0 -#define RAYLIB_VERSION "5.0" +#define RAYLIB_VERSION "5.1-dev" -// Function specifiers in case library is build/used as a shared library (Windows) +// Function specifiers in case library is build/used as a shared library // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll +// NOTE: visibility("default") attribute makes symbols "visible" when compiled with -fvisibility=hidden #if defined(_WIN32) + #if defined(__TINYC__) + #define __declspec(x) __attribute__((x)) + #endif #if defined(BUILD_LIBTYPE_SHARED) - #if defined(__TINYC__) - #define __declspec(x) __attribute__((x)) - #endif #define RLAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll) #elif defined(USE_LIBTYPE_SHARED) #define RLAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll) #endif +#else + #if defined(BUILD_LIBTYPE_SHARED) + #define RLAPI __attribute__((visibility("default"))) // We are building as a Unix shared library (.so/.dylib) + #endif #endif #ifndef RLAPI @@ -479,7 +484,6 @@ typedef struct VrDeviceInfo { int vResolution; // Vertical resolution in pixels float hScreenSize; // Horizontal size in meters float vScreenSize; // Vertical size in meters - float vScreenCenter; // Screen center in meters float eyeToScreenDistance; // Distance between eye and display in meters float lensSeparationDistance; // Lens separation distance in meters float interpupillaryDistance; // IPD (distance between pupils) in meters @@ -1329,6 +1333,7 @@ RLAPI void ImageAlphaClear(Image *image, Color color, float threshold); RLAPI void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image RLAPI void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel RLAPI void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation +RLAPI void ImageKernelConvolution(Image *image, float* kernel, int kernelSize); // Apply Custom Square image convolution kernel RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm) RLAPI void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm) RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color @@ -1475,6 +1480,7 @@ RLAPI const char *TextToUpper(const char *text); // Get upp RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string RLAPI int TextToInteger(const char *text); // Get integer value from text (negative values not supported) +RLAPI float TextToFloat(const char *text); // Get float value from text (negative values not supported) //------------------------------------------------------------------------------------ // Basic 3d Shapes Drawing Functions (Module: models) @@ -1530,9 +1536,10 @@ RLAPI void UpdateMeshBuffer(Mesh mesh, int index, const void *data, int dataSize RLAPI void UnloadMesh(Mesh mesh); // Unload mesh data from CPU and GPU RLAPI void DrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform RLAPI void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, int instances); // Draw multiple mesh instances with material and different transforms -RLAPI bool ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file, returns true on success RLAPI BoundingBox GetMeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits RLAPI void GenMeshTangents(Mesh *mesh); // Compute mesh tangents +RLAPI bool ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file, returns true on success +RLAPI bool ExportMeshAsCode(Mesh mesh, const char *fileName); // Export mesh as code file (.h) defining multiple arrays of vertex attributes // Mesh generation functions RLAPI Mesh GenMeshPoly(int sides, float radius); // Generate polygonal mesh diff --git a/src/raymath.h b/src/raymath.h index ff6017039..069c9464e 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -59,7 +59,9 @@ // Function specifiers definition #if defined(RAYMATH_IMPLEMENTATION) #if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED) - #define RMAPI __declspec(dllexport) extern inline // We are building raylib as a Win32 shared library (.dll). + #define RMAPI __declspec(dllexport) extern inline // We are building raylib as a Win32 shared library (.dll) + #elif defined(BUILD_LIBTYPE_SHARED) + #define RMAPI __attribute__((visibility("default"))) // We are building raylib as a Unix shared library (.so/.dylib) #elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED) #define RMAPI __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll) #else diff --git a/src/rcamera.h b/src/rcamera.h index c999370f5..3fe151fa2 100644 --- a/src/rcamera.h +++ b/src/rcamera.h @@ -449,7 +449,7 @@ void UpdateCamera(Camera *camera, int mode) bool moveInWorldPlane = ((mode == CAMERA_FIRST_PERSON) || (mode == CAMERA_THIRD_PERSON)); bool rotateAroundTarget = ((mode == CAMERA_THIRD_PERSON) || (mode == CAMERA_ORBITAL)); - bool lockView = ((mode == CAMERA_FIRST_PERSON) || (mode == CAMERA_THIRD_PERSON) || (mode == CAMERA_ORBITAL)); + bool lockView = ((mode == CAMERA_FREE) || (mode == CAMERA_FIRST_PERSON) || (mode == CAMERA_THIRD_PERSON) || (mode == CAMERA_ORBITAL)); bool rotateUp = false; if (mode == CAMERA_ORBITAL) @@ -471,31 +471,30 @@ void UpdateCamera(Camera *camera, int mode) if (IsKeyDown(KEY_E)) CameraRoll(camera, CAMERA_ROTATION_SPEED); // Camera movement - if (!IsGamepadAvailable(0)) + // Camera pan (for CAMERA_FREE) + if ((mode == CAMERA_FREE) && (IsMouseButtonDown(MOUSE_BUTTON_MIDDLE))) { - // Camera pan (for CAMERA_FREE) - if ((mode == CAMERA_FREE) && (IsMouseButtonDown(MOUSE_BUTTON_MIDDLE))) - { - const Vector2 mouseDelta = GetMouseDelta(); - if (mouseDelta.x > 0.0f) CameraMoveRight(camera, CAMERA_PAN_SPEED, moveInWorldPlane); - if (mouseDelta.x < 0.0f) CameraMoveRight(camera, -CAMERA_PAN_SPEED, moveInWorldPlane); - if (mouseDelta.y > 0.0f) CameraMoveUp(camera, -CAMERA_PAN_SPEED); - if (mouseDelta.y < 0.0f) CameraMoveUp(camera, CAMERA_PAN_SPEED); - } - else - { - // Mouse support - CameraYaw(camera, -mousePositionDelta.x*CAMERA_MOUSE_MOVE_SENSITIVITY, rotateAroundTarget); - CameraPitch(camera, -mousePositionDelta.y*CAMERA_MOUSE_MOVE_SENSITIVITY, lockView, rotateAroundTarget, rotateUp); - } - - // Keyboard support - if (IsKeyDown(KEY_W)) CameraMoveForward(camera, CAMERA_MOVE_SPEED, moveInWorldPlane); - if (IsKeyDown(KEY_A)) CameraMoveRight(camera, -CAMERA_MOVE_SPEED, moveInWorldPlane); - if (IsKeyDown(KEY_S)) CameraMoveForward(camera, -CAMERA_MOVE_SPEED, moveInWorldPlane); - if (IsKeyDown(KEY_D)) CameraMoveRight(camera, CAMERA_MOVE_SPEED, moveInWorldPlane); + const Vector2 mouseDelta = GetMouseDelta(); + if (mouseDelta.x > 0.0f) CameraMoveRight(camera, CAMERA_PAN_SPEED, moveInWorldPlane); + if (mouseDelta.x < 0.0f) CameraMoveRight(camera, -CAMERA_PAN_SPEED, moveInWorldPlane); + if (mouseDelta.y > 0.0f) CameraMoveUp(camera, -CAMERA_PAN_SPEED); + if (mouseDelta.y < 0.0f) CameraMoveUp(camera, CAMERA_PAN_SPEED); } else + { + // Mouse support + CameraYaw(camera, -mousePositionDelta.x*CAMERA_MOUSE_MOVE_SENSITIVITY, rotateAroundTarget); + CameraPitch(camera, -mousePositionDelta.y*CAMERA_MOUSE_MOVE_SENSITIVITY, lockView, rotateAroundTarget, rotateUp); + } + + // Keyboard support + if (IsKeyDown(KEY_W)) CameraMoveForward(camera, CAMERA_MOVE_SPEED, moveInWorldPlane); + if (IsKeyDown(KEY_A)) CameraMoveRight(camera, -CAMERA_MOVE_SPEED, moveInWorldPlane); + if (IsKeyDown(KEY_S)) CameraMoveForward(camera, -CAMERA_MOVE_SPEED, moveInWorldPlane); + if (IsKeyDown(KEY_D)) CameraMoveRight(camera, CAMERA_MOVE_SPEED, moveInWorldPlane); + + // Gamepad movement + if (IsGamepadAvailable(0)) { // Gamepad controller support CameraYaw(camera, -(GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_X) * 2)*CAMERA_MOUSE_MOVE_SENSITIVITY, rotateAroundTarget); diff --git a/src/rcore.c b/src/rcore.c index 45398891b..8691be304 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1192,8 +1192,8 @@ VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device) // NOTE: Camera movement might seem more natural if we model the head. // Our axis of rotation is the base of our head, so we might want to add // some y (base of head to eye level) and -z (center of head to eye protrusion) to the camera positions. - config.viewOffset[0] = MatrixTranslate(-device.interpupillaryDistance*0.5f, 0.075f, 0.045f); - config.viewOffset[1] = MatrixTranslate(device.interpupillaryDistance*0.5f, 0.075f, 0.045f); + config.viewOffset[0] = MatrixTranslate(device.interpupillaryDistance*0.5f, 0.075f, 0.045f); + config.viewOffset[1] = MatrixTranslate(-device.interpupillaryDistance*0.5f, 0.075f, 0.045f); // Compute eyes Viewports /* @@ -2623,8 +2623,9 @@ void PlayAutomationEvent(AutomationEvent event) { CORE.Input.Gamepad.axisState[event.params[0]][event.params[1]] = ((float)event.params[2]/32768.0f); } break; + #if defined(SUPPORT_GESTURES_SYSTEM) case INPUT_GESTURE: GESTURES.current = event.params[0]; break; // param[0]: gesture (enum Gesture) -> rgestures.h: GESTURES.current - + #endif // Window event case WINDOW_CLOSE: CORE.Window.shouldClose = true; break; case WINDOW_MAXIMIZE: MaximizeWindow(); break; @@ -2632,11 +2633,13 @@ void PlayAutomationEvent(AutomationEvent event) case WINDOW_RESIZE: SetWindowSize(event.params[0], event.params[1]); break; // Custom event + #if defined(SUPPORT_SCREEN_CAPTURE) case ACTION_TAKE_SCREENSHOT: { TakeScreenshot(TextFormat("screenshot%03i.png", screenshotCounter)); screenshotCounter++; } break; + #endif case ACTION_SETTARGETFPS: SetTargetFPS(event.params[0]); break; default: break; } @@ -3507,6 +3510,7 @@ static void RecordAutomationEvent(void) } //------------------------------------------------------------------------------------- +#if defined(SUPPORT_GESTURES_SYSTEM) // Gestures input currentEventList->events recording //------------------------------------------------------------------------------------- if (GESTURES.current != GESTURE_NONE) @@ -3524,6 +3528,7 @@ static void RecordAutomationEvent(void) if (currentEventList->count == currentEventList->capacity) return; // Security check } //------------------------------------------------------------------------------------- +#endif // Window events recording //------------------------------------------------------------------------------------- diff --git a/src/rlgl.h b/src/rlgl.h index 6cf9c7e99..4b3184986 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -1,6 +1,6 @@ /********************************************************************************************** * -* rlgl v4.5 - A multi-OpenGL abstraction layer with an immediate-mode style API +* rlgl v5.0 - A multi-OpenGL abstraction layer with an immediate-mode style API * * DESCRIPTION: * An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0) @@ -109,16 +109,18 @@ #define RLGL_VERSION "4.5" -// Function specifiers in case library is build/used as a shared library (Windows) +// Function specifiers in case library is build/used as a shared library // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll -#if defined(_WIN32) - #if defined(BUILD_LIBTYPE_SHARED) - #define RLAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll) - #elif defined(USE_LIBTYPE_SHARED) - #define RLAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll) - #endif +// NOTE: visibility(default) attribute makes symbols "visible" when compiled with -fvisibility=hidden +#if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED) + #define RLAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll) +#elif defined(BUILD_LIBTYPE_SHARED) + #define RLAPI __attribute__((visibility("default"))) // We are building he library as a Unix shared library (.so/.dylib) +#elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED) + #define RLAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll) #endif + // Function specifiers definition #ifndef RLAPI #define RLAPI // Functions defined as 'extern' by default (implicit specifiers) @@ -555,14 +557,14 @@ typedef enum { extern "C" { // Prevents name mangling of functions #endif -RLAPI void rlMatrixMode(int mode); // Choose the current matrix to be transformed -RLAPI void rlPushMatrix(void); // Push the current matrix to stack -RLAPI void rlPopMatrix(void); // Pop latest inserted matrix from stack -RLAPI void rlLoadIdentity(void); // Reset current matrix to identity matrix -RLAPI void rlTranslatef(float x, float y, float z); // Multiply the current matrix by a translation matrix -RLAPI void rlRotatef(float angle, float x, float y, float z); // Multiply the current matrix by a rotation matrix -RLAPI void rlScalef(float x, float y, float z); // Multiply the current matrix by a scaling matrix -RLAPI void rlMultMatrixf(const float *matf); // Multiply the current matrix by another matrix +RLAPI void rlMatrixMode(int mode); // Choose the current matrix to be transformed +RLAPI void rlPushMatrix(void); // Push the current matrix to stack +RLAPI void rlPopMatrix(void); // Pop latest inserted matrix from stack +RLAPI void rlLoadIdentity(void); // Reset current matrix to identity matrix +RLAPI void rlTranslatef(float x, float y, float z); // Multiply the current matrix by a translation matrix +RLAPI void rlRotatef(float angle, float x, float y, float z); // Multiply the current matrix by a rotation matrix +RLAPI void rlScalef(float x, float y, float z); // Multiply the current matrix by a scaling matrix +RLAPI void rlMultMatrixf(const float *matf); // Multiply the current matrix by another matrix RLAPI void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar); RLAPI void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar); RLAPI void rlViewport(int x, int y, int width, int height); // Set the viewport area @@ -570,15 +572,15 @@ RLAPI void rlViewport(int x, int y, int width, int height); // Set the viewport //------------------------------------------------------------------------------------ // Functions Declaration - Vertex level operations //------------------------------------------------------------------------------------ -RLAPI void rlBegin(int mode); // Initialize drawing mode (how to organize vertex) -RLAPI void rlEnd(void); // Finish vertex providing -RLAPI void rlVertex2i(int x, int y); // Define one vertex (position) - 2 int -RLAPI void rlVertex2f(float x, float y); // Define one vertex (position) - 2 float -RLAPI void rlVertex3f(float x, float y, float z); // Define one vertex (position) - 3 float -RLAPI void rlTexCoord2f(float x, float y); // Define one vertex (texture coordinate) - 2 float -RLAPI void rlNormal3f(float x, float y, float z); // Define one vertex (normal) - 3 float -RLAPI void rlColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a); // Define one vertex (color) - 4 byte -RLAPI void rlColor3f(float x, float y, float z); // Define one vertex (color) - 3 float +RLAPI void rlBegin(int mode); // Initialize drawing mode (how to organize vertex) +RLAPI void rlEnd(void); // Finish vertex providing +RLAPI void rlVertex2i(int x, int y); // Define one vertex (position) - 2 int +RLAPI void rlVertex2f(float x, float y); // Define one vertex (position) - 2 float +RLAPI void rlVertex3f(float x, float y, float z); // Define one vertex (position) - 3 float +RLAPI void rlTexCoord2f(float x, float y); // Define one vertex (texture coordinate) - 2 float +RLAPI void rlNormal3f(float x, float y, float z); // Define one vertex (normal) - 3 float +RLAPI void rlColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a); // Define one vertex (color) - 4 byte +RLAPI void rlColor3f(float x, float y, float z); // Define one vertex (color) - 3 float RLAPI void rlColor4f(float x, float y, float z, float w); // Define one vertex (color) - 4 float //------------------------------------------------------------------------------------ @@ -592,13 +594,13 @@ RLAPI bool rlEnableVertexArray(unsigned int vaoId); // Enable vertex array ( RLAPI void rlDisableVertexArray(void); // Disable vertex array (VAO, if supported) RLAPI void rlEnableVertexBuffer(unsigned int id); // Enable vertex buffer (VBO) RLAPI void rlDisableVertexBuffer(void); // Disable vertex buffer (VBO) -RLAPI void rlEnableVertexBufferElement(unsigned int id);// Enable vertex buffer element (VBO element) +RLAPI void rlEnableVertexBufferElement(unsigned int id); // Enable vertex buffer element (VBO element) RLAPI void rlDisableVertexBufferElement(void); // Disable vertex buffer element (VBO element) RLAPI void rlEnableVertexAttribute(unsigned int index); // Enable vertex attribute index -RLAPI void rlDisableVertexAttribute(unsigned int index);// Disable vertex attribute index +RLAPI void rlDisableVertexAttribute(unsigned int index); // Disable vertex attribute index #if defined(GRAPHICS_API_OPENGL_11) -RLAPI void rlEnableStatePointer(int vertexAttribType, void *buffer); // Enable attribute state pointer -RLAPI void rlDisableStatePointer(int vertexAttribType); // Disable attribute state pointer +RLAPI void rlEnableStatePointer(int vertexAttribType, void *buffer); // Enable attribute state pointer +RLAPI void rlDisableStatePointer(int vertexAttribType); // Disable attribute state pointer #endif // Textures state @@ -621,7 +623,7 @@ RLAPI void rlActiveDrawBuffers(int count); // Activate multiple dra RLAPI void rlBlitFramebuffer(int srcX, int srcY, int srcWidth, int srcHeight, int dstX, int dstY, int dstWidth, int dstHeight, int bufferMask); // Blit active framebuffer to main framebuffer // General render state -RLAPI void rlEnableColorBlend(void); // Enable color blending +RLAPI void rlEnableColorBlend(void); // Enable color blending RLAPI void rlDisableColorBlend(void); // Disable color blending RLAPI void rlEnableDepthTest(void); // Enable depth test RLAPI void rlDisableDepthTest(void); // Disable depth test @@ -634,7 +636,7 @@ RLAPI void rlEnableScissorTest(void); // Enable scissor test RLAPI void rlDisableScissorTest(void); // Disable scissor test RLAPI void rlScissor(int x, int y, int width, int height); // Scissor test RLAPI void rlEnableWireMode(void); // Enable wire mode -RLAPI void rlEnablePointMode(void); // Enable point mode +RLAPI void rlEnablePointMode(void); // Enable point mode RLAPI void rlDisableWireMode(void); // Disable wire mode ( and point ) maybe rename RLAPI void rlSetLineWidth(float width); // Set the line drawing width RLAPI float rlGetLineWidth(void); // Get the line drawing width @@ -671,48 +673,48 @@ RLAPI int *rlGetShaderLocsDefault(void); // Get default shader lo // Render batch management // NOTE: rlgl provides a default render batch to behave like OpenGL 1.1 immediate mode // but this render batch API is exposed in case of custom batches are required -RLAPI rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements); // Load a render batch system -RLAPI void rlUnloadRenderBatch(rlRenderBatch batch); // Unload render batch system -RLAPI void rlDrawRenderBatch(rlRenderBatch *batch); // Draw render batch data (Update->Draw->Reset) -RLAPI void rlSetRenderBatchActive(rlRenderBatch *batch); // Set the active render batch for rlgl (NULL for default internal) -RLAPI void rlDrawRenderBatchActive(void); // Update and draw internal render batch -RLAPI bool rlCheckRenderBatchLimit(int vCount); // Check internal buffer overflow for a given number of vertex +RLAPI rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements); // Load a render batch system +RLAPI void rlUnloadRenderBatch(rlRenderBatch batch); // Unload render batch system +RLAPI void rlDrawRenderBatch(rlRenderBatch *batch); // Draw render batch data (Update->Draw->Reset) +RLAPI void rlSetRenderBatchActive(rlRenderBatch *batch); // Set the active render batch for rlgl (NULL for default internal) +RLAPI void rlDrawRenderBatchActive(void); // Update and draw internal render batch +RLAPI bool rlCheckRenderBatchLimit(int vCount); // Check internal buffer overflow for a given number of vertex RLAPI void rlSetTexture(unsigned int id); // Set current texture for render batch and check buffers limits //------------------------------------------------------------------------------------------------------------------------ // Vertex buffers management -RLAPI unsigned int rlLoadVertexArray(void); // Load vertex array (vao) if supported -RLAPI unsigned int rlLoadVertexBuffer(const void *buffer, int size, bool dynamic); // Load a vertex buffer attribute -RLAPI unsigned int rlLoadVertexBufferElement(const void *buffer, int size, bool dynamic); // Load a new attributes element buffer -RLAPI void rlUpdateVertexBuffer(unsigned int bufferId, const void *data, int dataSize, int offset); // Update GPU buffer with new data -RLAPI void rlUpdateVertexBufferElements(unsigned int id, const void *data, int dataSize, int offset); // Update vertex buffer elements with new data -RLAPI void rlUnloadVertexArray(unsigned int vaoId); -RLAPI void rlUnloadVertexBuffer(unsigned int vboId); -RLAPI void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, const void *pointer); -RLAPI void rlSetVertexAttributeDivisor(unsigned int index, int divisor); -RLAPI void rlSetVertexAttributeDefault(int locIndex, const void *value, int attribType, int count); // Set vertex attribute default value -RLAPI void rlDrawVertexArray(int offset, int count); -RLAPI void rlDrawVertexArrayElements(int offset, int count, const void *buffer); -RLAPI void rlDrawVertexArrayInstanced(int offset, int count, int instances); -RLAPI void rlDrawVertexArrayElementsInstanced(int offset, int count, const void *buffer, int instances); +RLAPI unsigned int rlLoadVertexArray(void); // Load vertex array (vao) if supported +RLAPI unsigned int rlLoadVertexBuffer(const void *buffer, int size, bool dynamic); // Load a vertex buffer object +RLAPI unsigned int rlLoadVertexBufferElement(const void *buffer, int size, bool dynamic); // Load vertex buffer elements object +RLAPI void rlUpdateVertexBuffer(unsigned int bufferId, const void *data, int dataSize, int offset); // Update vertex buffer object data on GPU buffer +RLAPI void rlUpdateVertexBufferElements(unsigned int id, const void *data, int dataSize, int offset); // Update vertex buffer elements data on GPU buffer +RLAPI void rlUnloadVertexArray(unsigned int vaoId); // Unload vertex array (vao) +RLAPI void rlUnloadVertexBuffer(unsigned int vboId); // Unload vertex buffer object +RLAPI void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, const void *pointer); // Set vertex attribute data configuration +RLAPI void rlSetVertexAttributeDivisor(unsigned int index, int divisor); // Set vertex attribute data divisor +RLAPI void rlSetVertexAttributeDefault(int locIndex, const void *value, int attribType, int count); // Set vertex attribute default value, when attribute to provided +RLAPI void rlDrawVertexArray(int offset, int count); // Draw vertex array (currently active vao) +RLAPI void rlDrawVertexArrayElements(int offset, int count, const void *buffer); // Draw vertex array elements +RLAPI void rlDrawVertexArrayInstanced(int offset, int count, int instances); // Draw vertex array (currently active vao) with instancing +RLAPI void rlDrawVertexArrayElementsInstanced(int offset, int count, const void *buffer, int instances); // Draw vertex array elements with instancing // Textures management -RLAPI unsigned int rlLoadTexture(const void *data, int width, int height, int format, int mipmapCount); // Load texture in GPU -RLAPI unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer); // Load depth texture/renderbuffer (to be attached to fbo) -RLAPI unsigned int rlLoadTextureCubemap(const void *data, int size, int format); // Load texture cubemap -RLAPI void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data); // Update GPU texture with new data -RLAPI void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType); // Get OpenGL internal formats +RLAPI unsigned int rlLoadTexture(const void *data, int width, int height, int format, int mipmapCount); // Load texture data +RLAPI unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer); // Load depth texture/renderbuffer (to be attached to fbo) +RLAPI unsigned int rlLoadTextureCubemap(const void *data, int size, int format); // Load texture cubemap data +RLAPI void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data); // Update texture with new data on GPU +RLAPI void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType); // Get OpenGL internal formats RLAPI const char *rlGetPixelFormatName(unsigned int format); // Get name string for pixel format RLAPI void rlUnloadTexture(unsigned int id); // Unload texture from GPU memory RLAPI void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int *mipmaps); // Generate mipmap data for selected texture -RLAPI void *rlReadTexturePixels(unsigned int id, int width, int height, int format); // Read texture pixel data +RLAPI void *rlReadTexturePixels(unsigned int id, int width, int height, int format); // Read texture pixel data RLAPI unsigned char *rlReadScreenPixels(int width, int height); // Read screen pixel data (color buffer) // Framebuffer management (fbo) RLAPI unsigned int rlLoadFramebuffer(int width, int height); // Load an empty framebuffer -RLAPI void rlFramebufferAttach(unsigned int fboId, unsigned int texId, int attachType, int texType, int mipLevel); // Attach texture/renderbuffer to a framebuffer +RLAPI void rlFramebufferAttach(unsigned int fboId, unsigned int texId, int attachType, int texType, int mipLevel); // Attach texture/renderbuffer to a framebuffer RLAPI bool rlFramebufferComplete(unsigned int id); // Verify framebuffer is complete RLAPI void rlUnloadFramebuffer(unsigned int id); // Delete framebuffer from GPU @@ -723,14 +725,14 @@ RLAPI unsigned int rlLoadShaderProgram(unsigned int vShaderId, unsigned int fSha RLAPI void rlUnloadShaderProgram(unsigned int id); // Unload shader program RLAPI int rlGetLocationUniform(unsigned int shaderId, const char *uniformName); // Get shader location uniform RLAPI int rlGetLocationAttrib(unsigned int shaderId, const char *attribName); // Get shader location attribute -RLAPI void rlSetUniform(int locIndex, const void *value, int uniformType, int count); // Set shader value uniform +RLAPI void rlSetUniform(int locIndex, const void *value, int uniformType, int count); // Set shader value uniform RLAPI void rlSetUniformMatrix(int locIndex, Matrix mat); // Set shader value matrix RLAPI void rlSetUniformSampler(int locIndex, unsigned int textureId); // Set shader value sampler RLAPI void rlSetShader(unsigned int id, int *locs); // Set shader currently active (id and locations) // Compute shader management RLAPI unsigned int rlLoadComputeShaderProgram(unsigned int shaderId); // Load compute shader program -RLAPI void rlComputeShaderDispatch(unsigned int groupX, unsigned int groupY, unsigned int groupZ); // Dispatch compute shader (equivalent to *draw* for graphics pipeline) +RLAPI void rlComputeShaderDispatch(unsigned int groupX, unsigned int groupY, unsigned int groupZ); // Dispatch compute shader (equivalent to *draw* for graphics pipeline) // Shader buffer storage object management (ssbo) RLAPI unsigned int rlLoadShaderBuffer(unsigned int size, const void *data, int usageHint); // Load shader storage buffer object (SSBO) @@ -773,6 +775,12 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad #if defined(RLGL_IMPLEMENTATION) +// Expose OpenGL functions from glad in raylib +#if defined(BUILD_LIBTYPE_SHARED) + #define GLAD_API_CALL_EXPORT + #define GLAD_API_CALL_EXPORT_BUILD +#endif + #if defined(GRAPHICS_API_OPENGL_11) #if defined(__APPLE__) #include // OpenGL 1.1 library for OSX @@ -3787,6 +3795,10 @@ unsigned int rlLoadVertexArray(void) void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, const void *pointer) { #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + // NOTE: Data type could be: GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT + // Additional types (depends on OpenGL version or extensions): + // - GL_HALF_FLOAT, GL_FLOAT, GL_DOUBLE, GL_FIXED, + // - GL_INT_2_10_10_10_REV, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_10F_11F_11F_REV glVertexAttribPointer(index, compSize, type, normalized, stride, pointer); #endif } diff --git a/src/rmodels.c b/src/rmodels.c index 229d373fc..84c7d9cbe 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -1850,6 +1850,104 @@ bool ExportMesh(Mesh mesh, const char *fileName) return success; } +// Export mesh as code file (.h) defining multiple arrays of vertex attributes +bool ExportMeshAsCode(Mesh mesh, const char *fileName) +{ + bool success = false; + +#ifndef TEXT_BYTES_PER_LINE + #define TEXT_BYTES_PER_LINE 20 +#endif + + // NOTE: Text data buffer size is fixed to 64MB + char *txtData = (char *)RL_CALLOC(64*1024*1024, sizeof(char)); // 64 MB + + int byteCount = 0; + byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n"); + byteCount += sprintf(txtData + byteCount, "// //\n"); + byteCount += sprintf(txtData + byteCount, "// MeshAsCode exporter v1.0 - Mesh vertex data exported as arrays //\n"); + byteCount += sprintf(txtData + byteCount, "// //\n"); + byteCount += sprintf(txtData + byteCount, "// more info and bugs-report: github.com/raysan5/raylib //\n"); + byteCount += sprintf(txtData + byteCount, "// feedback and support: ray[at]raylib.com //\n"); + byteCount += sprintf(txtData + byteCount, "// //\n"); + byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2023 Ramon Santamaria (@raysan5) //\n"); + byteCount += sprintf(txtData + byteCount, "// //\n"); + byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n\n"); + + // Get file name from path and convert variable name to uppercase + char varFileName[256] = { 0 }; + strcpy(varFileName, GetFileNameWithoutExt(fileName)); + for (int i = 0; varFileName[i] != '\0'; i++) if ((varFileName[i] >= 'a') && (varFileName[i] <= 'z')) { varFileName[i] = varFileName[i] - 32; } + + // Add image information + byteCount += sprintf(txtData + byteCount, "// Mesh basic information\n"); + byteCount += sprintf(txtData + byteCount, "#define %s_VERTEX_COUNT %i\n", varFileName, mesh.vertexCount); + byteCount += sprintf(txtData + byteCount, "#define %s_TRIANGLE_COUNT %i\n\n", varFileName, mesh.triangleCount); + + // Define vertex attributes data as separate arrays + //----------------------------------------------------------------------------------------- + if (mesh.vertices != NULL) // Vertex position (XYZ - 3 components per vertex - float) + { + byteCount += sprintf(txtData + byteCount, "static float %s_VERTEX_DATA[%i] = { ", varFileName, mesh.vertexCount*3); + for (int i = 0; i < mesh.vertexCount*3 - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "%.3ff,\n" : "%.3ff, "), mesh.vertices[i]); + byteCount += sprintf(txtData + byteCount, "%.3ff };\n\n", mesh.vertices[mesh.vertexCount*3 - 1]); + } + + if (mesh.texcoords != NULL) // Vertex texture coordinates (UV - 2 components per vertex - float) + { + byteCount += sprintf(txtData + byteCount, "static float %s_TEXCOORD_DATA[%i] = { ", varFileName, mesh.vertexCount*2); + for (int i = 0; i < mesh.vertexCount*2 - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "%.3ff,\n" : "%.3ff, "), mesh.texcoords[i]); + byteCount += sprintf(txtData + byteCount, "%.3ff };\n\n", mesh.texcoords[mesh.vertexCount*2 - 1]); + } + + if (mesh.texcoords2 != NULL) // Vertex texture coordinates (UV - 2 components per vertex - float) + { + byteCount += sprintf(txtData + byteCount, "static float %s_TEXCOORD2_DATA[%i] = { ", varFileName, mesh.vertexCount*2); + for (int i = 0; i < mesh.vertexCount*2 - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "%.3ff,\n" : "%.3ff, "), mesh.texcoords2[i]); + byteCount += sprintf(txtData + byteCount, "%.3ff };\n\n", mesh.texcoords2[mesh.vertexCount*2 - 1]); + } + + if (mesh.normals != NULL) // Vertex normals (XYZ - 3 components per vertex - float) + { + byteCount += sprintf(txtData + byteCount, "static float %s_NORMAL_DATA[%i] = { ", varFileName, mesh.vertexCount*3); + for (int i = 0; i < mesh.vertexCount*3 - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "%.3ff,\n" : "%.3ff, "), mesh.normals[i]); + byteCount += sprintf(txtData + byteCount, "%.3ff };\n\n", mesh.normals[mesh.vertexCount*3 - 1]); + } + + if (mesh.tangents != NULL) // Vertex tangents (XYZW - 4 components per vertex - float) + { + byteCount += sprintf(txtData + byteCount, "static float %s_TANGENT_DATA[%i] = { ", varFileName, mesh.vertexCount*4); + for (int i = 0; i < mesh.vertexCount*4 - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "%.3ff,\n" : "%.3ff, "), mesh.tangents[i]); + byteCount += sprintf(txtData + byteCount, "%.3ff };\n\n", mesh.tangents[mesh.vertexCount*4 - 1]); + } + + if (mesh.colors != NULL) // Vertex colors (RGBA - 4 components per vertex - unsigned char) + { + byteCount += sprintf(txtData + byteCount, "static unsigned char %s_COLOR_DATA[%i] = { ", varFileName, mesh.vertexCount*4); + for (int i = 0; i < mesh.vertexCount*4 - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%x,\n" : "0x%x, "), mesh.colors[i]); + byteCount += sprintf(txtData + byteCount, "0x%x };\n\n", mesh.colors[mesh.vertexCount*4 - 1]); + } + + if (mesh.indices != NULL) // Vertex indices (3 index per triangle - unsigned short) + { + byteCount += sprintf(txtData + byteCount, "static unsigned short %s_INDEX_DATA[%i] = { ", varFileName, mesh.triangleCount*3); + for (int i = 0; i < mesh.triangleCount*3 - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "%i,\n" : "%i, "), mesh.indices[i]); + byteCount += sprintf(txtData + byteCount, "%i };\n", mesh.indices[mesh.triangleCount*3 - 1]); + } + //----------------------------------------------------------------------------------------- + + // NOTE: Text data size exported is determined by '\0' (NULL) character + success = SaveFileText(fileName, txtData); + + RL_FREE(txtData); + + //if (success != 0) TRACELOG(LOG_INFO, "FILEIO: [%s] Image as code exported successfully", fileName); + //else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to export image as code", fileName); + + return success; +} + + #if defined(SUPPORT_FILEFORMAT_OBJ) || defined(SUPPORT_FILEFORMAT_MTL) // Process obj materials static void ProcessMaterialsOBJ(Material *materials, tinyobj_material_t *mats, int materialCount) @@ -5155,16 +5253,29 @@ static Model LoadGLTF(const char *fileName) if ((attribute->component_type == cgltf_component_type_r_8u) && (attribute->type == cgltf_type_vec4)) { - // Init raylib mesh bone ids to copy glTF attribute data + // Handle 8-bit unsigned byte, vec4 format model.meshes[meshIndex].boneIds = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(unsigned char)); - - // Load 4 components of unsigned char data type into mesh.boneIds - // for cgltf_attribute_type_joints we have: - // - data.meshes[0] (256 vertices) - // - 256 values, provided as cgltf_type_vec4 of bytes (4 byte per joint, stride 4) LOAD_ATTRIBUTE(attribute, 4, unsigned char, model.meshes[meshIndex].boneIds) } - else TRACELOG(LOG_WARNING, "MODEL: [%s] Joint attribute data format not supported, use vec4 u8", fileName); + else if ((attribute->component_type == cgltf_component_type_r_16u) && (attribute->type == cgltf_type_vec2)) + { + // Handle 16-bit unsigned short, vec2 format + model.meshes[meshIndex].boneIds = RL_CALLOC(model.meshes[meshIndex].vertexCount*2, sizeof(unsigned short)); + LOAD_ATTRIBUTE(attribute, 2, unsigned short, model.meshes[meshIndex].boneIds) + } + else if ((attribute->component_type == cgltf_component_type_r_32u) && (attribute->type == cgltf_type_vec4)) + { + // Handle 32-bit unsigned int, vec4 format + model.meshes[meshIndex].boneIds = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(unsigned int)); + LOAD_ATTRIBUTE(attribute, 4, unsigned int, model.meshes[meshIndex].boneIds) + } + else if ((attribute->component_type == cgltf_component_type_r_32f) && (attribute->type == cgltf_type_vec2)) + { + // Handle 32-bit float, vec2 format + model.meshes[meshIndex].boneIds = RL_CALLOC(model.meshes[meshIndex].vertexCount*2, sizeof(float)); + LOAD_ATTRIBUTE(attribute, 2, float, model.meshes[meshIndex].boneIds) + } + else TRACELOG(LOG_WARNING, "MODEL: [%s] Joint attribute data format not supported", fileName); } else if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_weights) // WEIGHTS_n (vec4 / u8, u16, f32) { diff --git a/src/rshapes.c b/src/rshapes.c index bababf8cf..b8c17e702 100644 --- a/src/rshapes.c +++ b/src/rshapes.c @@ -1546,10 +1546,96 @@ void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, fl // Draw spline: linear, minimum 2 points void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color) { + if (pointCount < 2) return; + +#if defined(SUPPORT_SPLINE_MITERS) + Vector2 prevNormal = (Vector2){-(points[1].y - points[0].y), (points[1].x - points[0].x)}; + float prevLength = sqrtf(prevNormal.x*prevNormal.x + prevNormal.y*prevNormal.y); + + if (prevLength > 0.0f) + { + prevNormal.x /= prevLength; + prevNormal.y /= prevLength; + } + else + { + prevNormal.x = 0.0f; + prevNormal.y = 0.0f; + } + + Vector2 prevRadius = { 0.5f*thick*prevNormal.x, 0.5f*thick*prevNormal.y }; + + for (int i = 0; i < pointCount - 1; i++) + { + Vector2 normal = { 0 }; + + if (i < pointCount - 2) + { + normal = (Vector2){-(points[i + 2].y - points[i + 1].y), (points[i + 2].x - points[i + 1].x)}; + float normalLength = sqrtf(normal.x*normal.x + normal.y*normal.y); + + if (normalLength > 0.0f) + { + normal.x /= normalLength; + normal.y /= normalLength; + } + else + { + normal.x = 0.0f; + normal.y = 0.0f; + } + } + else + { + normal = prevNormal; + } + + Vector2 radius = { prevNormal.x + normal.x, prevNormal.y + normal.y }; + float radiusLength = sqrtf(radius.x*radius.x + radius.y*radius.y); + + if (radiusLength > 0.0f) + { + radius.x /= radiusLength; + radius.y /= radiusLength; + } + else + { + radius.x = 0.0f; + radius.y = 0.0f; + } + + float cosTheta = radius.x*normal.x + radius.y*normal.y; + + if (cosTheta != 0.0f) + { + radius.x *= (thick*0.5f/cosTheta); + radius.y *= (thick*0.5f/cosTheta); + } + else + { + radius.x = 0.0f; + radius.y = 0.0f; + } + + Vector2 strip[4] = { + { points[i].x - prevRadius.x, points[i].y - prevRadius.y }, + { points[i].x + prevRadius.x, points[i].y + prevRadius.y }, + { points[i + 1].x - radius.x, points[i + 1].y - radius.y }, + { points[i + 1].x + radius.x, points[i + 1].y + radius.y } + }; + + DrawTriangleStrip(strip, 4, color); + + prevRadius = radius; + prevNormal = normal; + } + +#else // !SUPPORT_SPLINE_MITTERS + Vector2 delta = { 0 }; float length = 0.0f; float scale = 0.0f; - + for (int i = 0; i < pointCount - 1; i++) { delta = (Vector2){ points[i + 1].x - points[i].x, points[i + 1].y - points[i].y }; @@ -1567,8 +1653,10 @@ void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color) DrawTriangleStrip(strip, 4, color); } -#if defined(SUPPORT_SPLINE_SEGMENT_CAPS) +#endif +#if defined(SUPPORT_SPLINE_SEGMENT_CAPS) + // TODO: Add spline segment rounded caps at the begin/end of the spline #endif } @@ -1718,7 +1806,7 @@ void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color co void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color) { if (pointCount < 3) return; - + for (int i = 0; i < pointCount - 2; i++) { DrawSplineSegmentBezierQuadratic(points[i], points[i + 1], points[i + 2], thick, color); @@ -1729,7 +1817,7 @@ void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Col void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color) { if (pointCount < 4) return; - + for (int i = 0; i < pointCount - 3; i++) { DrawSplineSegmentBezierCubic(points[i], points[i + 1], points[i + 2], points[i + 3], thick, color); @@ -1740,7 +1828,7 @@ void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color c void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color) { // NOTE: For the linear spline we don't use subdivisions, just a single quad - + Vector2 delta = { p2.x - p1.x, p2.y - p1.y }; float length = sqrtf(delta.x*delta.x + delta.y*delta.y); @@ -1768,9 +1856,9 @@ void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, floa Vector2 currentPoint = { 0 }; Vector2 nextPoint = { 0 }; float t = 0.0f; - + Vector2 points[2*SPLINE_SEGMENT_DIVISIONS + 2] = { 0 }; - + float a[4] = { 0 }; float b[4] = { 0 }; @@ -1825,7 +1913,7 @@ void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 currentPoint = p1; Vector2 nextPoint = { 0 }; float t = 0.0f; - + Vector2 points[2*SPLINE_SEGMENT_DIVISIONS + 2] = { 0 }; for (int i = 0; i <= SPLINE_SEGMENT_DIVISIONS; i++) @@ -2132,11 +2220,11 @@ bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec) { bool collision = false; - int recCenterX = (int)(rec.x + rec.width/2.0f); - int recCenterY = (int)(rec.y + rec.height/2.0f); + float recCenterX = rec.x + rec.width/2.0f; + float recCenterY = rec.y + rec.height/2.0f; - float dx = fabsf(center.x - (float)recCenterX); - float dy = fabsf(center.y - (float)recCenterY); + float dx = fabsf(center.x - recCenterX); + float dy = fabsf(center.y - recCenterY); if (dx > (rec.width/2.0f + radius)) { return false; } if (dy > (rec.height/2.0f + radius)) { return false; } diff --git a/src/rtext.c b/src/rtext.c index dd7c83f39..2a6aa1273 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -604,7 +604,6 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz // Fill fontChars in case not provided externally // NOTE: By default we fill glyphCount consecutively, starting at 32 (Space) - if (codepoints == NULL) { codepoints = (int *)RL_MALLOC(codepointCount*sizeof(int)); @@ -612,7 +611,7 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz genFontChars = true; } - chars = (GlyphInfo *)RL_MALLOC(codepointCount*sizeof(GlyphInfo)); + chars = (GlyphInfo *)RL_CALLOC(codepointCount, sizeof(GlyphInfo)); // NOTE: Using simple packaging, one char after another for (int i = 0; i < codepointCount; i++) @@ -626,54 +625,67 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz // stbtt_GetCodepointBitmapBox() -- how big the bitmap must be // stbtt_MakeCodepointBitmap() -- renders into bitmap you provide - if (type != FONT_SDF) chars[i].image.data = stbtt_GetCodepointBitmap(&fontInfo, scaleFactor, scaleFactor, ch, &chw, &chh, &chars[i].offsetX, &chars[i].offsetY); - else if (ch != 32) chars[i].image.data = stbtt_GetCodepointSDF(&fontInfo, scaleFactor, ch, FONT_SDF_CHAR_PADDING, FONT_SDF_ON_EDGE_VALUE, FONT_SDF_PIXEL_DIST_SCALE, &chw, &chh, &chars[i].offsetX, &chars[i].offsetY); - else chars[i].image.data = NULL; + // Check if a glyph is available in the font + // WARNING: if (index == 0), glyph not found, it could fallback to default .notdef glyph (if defined in font) + int index = stbtt_FindGlyphIndex(&fontInfo, ch); - stbtt_GetCodepointHMetrics(&fontInfo, ch, &chars[i].advanceX, NULL); - chars[i].advanceX = (int)((float)chars[i].advanceX*scaleFactor); - - // Load characters images - chars[i].image.width = chw; - chars[i].image.height = chh; - chars[i].image.mipmaps = 1; - chars[i].image.format = PIXELFORMAT_UNCOMPRESSED_GRAYSCALE; - - chars[i].offsetY += (int)((float)ascent*scaleFactor); - - // NOTE: We create an empty image for space character, it could be further required for atlas packing - if (ch == 32) + if (index > 0) { - Image imSpace = { - .data = RL_CALLOC(chars[i].advanceX*fontSize, 2), - .width = chars[i].advanceX, - .height = fontSize, - .mipmaps = 1, - .format = PIXELFORMAT_UNCOMPRESSED_GRAYSCALE - }; - - chars[i].image = imSpace; - } - - if (type == FONT_BITMAP) - { - // Aliased bitmap (black & white) font generation, avoiding anti-aliasing - // NOTE: For optimum results, bitmap font should be generated at base pixel size - for (int p = 0; p < chw*chh; p++) + switch (type) { - if (((unsigned char *)chars[i].image.data)[p] < FONT_BITMAP_ALPHA_THRESHOLD) ((unsigned char *)chars[i].image.data)[p] = 0; - else ((unsigned char *)chars[i].image.data)[p] = 255; + case FONT_DEFAULT: + case FONT_BITMAP: chars[i].image.data = stbtt_GetCodepointBitmap(&fontInfo, scaleFactor, scaleFactor, ch, &chw, &chh, &chars[i].offsetX, &chars[i].offsetY); break; + case FONT_SDF: if (ch != 32) chars[i].image.data = stbtt_GetCodepointSDF(&fontInfo, scaleFactor, ch, FONT_SDF_CHAR_PADDING, FONT_SDF_ON_EDGE_VALUE, FONT_SDF_PIXEL_DIST_SCALE, &chw, &chh, &chars[i].offsetX, &chars[i].offsetY); break; + default: break; + } + + if (chars[i].image.data != NULL) // Glyph data has been found in the font + { + stbtt_GetCodepointHMetrics(&fontInfo, ch, &chars[i].advanceX, NULL); + chars[i].advanceX = (int)((float)chars[i].advanceX*scaleFactor); + + // Load characters images + chars[i].image.width = chw; + chars[i].image.height = chh; + chars[i].image.mipmaps = 1; + chars[i].image.format = PIXELFORMAT_UNCOMPRESSED_GRAYSCALE; + + chars[i].offsetY += (int)((float)ascent*scaleFactor); + } + + // NOTE: We create an empty image for space character, + // it could be further required for atlas packing + if (ch == 32) + { + stbtt_GetCodepointHMetrics(&fontInfo, ch, &chars[i].advanceX, NULL); + chars[i].advanceX = (int)((float)chars[i].advanceX*scaleFactor); + + Image imSpace = { + .data = RL_CALLOC(chars[i].advanceX*fontSize, 2), + .width = chars[i].advanceX, + .height = fontSize, + .mipmaps = 1, + .format = PIXELFORMAT_UNCOMPRESSED_GRAYSCALE + }; + + chars[i].image = imSpace; + } + + if (type == FONT_BITMAP) + { + // Aliased bitmap (black & white) font generation, avoiding anti-aliasing + // NOTE: For optimum results, bitmap font should be generated at base pixel size + for (int p = 0; p < chw*chh; p++) + { + if (((unsigned char *)chars[i].image.data)[p] < FONT_BITMAP_ALPHA_THRESHOLD) ((unsigned char *)chars[i].image.data)[p] = 0; + else ((unsigned char *)chars[i].image.data)[p] = 255; + } } } - - // Get bounding box for character (maybe offset to account for chars that dip above or below the line) - /* - int chX1, chY1, chX2, chY2; - stbtt_GetCodepointBitmapBox(&fontInfo, ch, scaleFactor, scaleFactor, &chX1, &chY1, &chX2, &chY2); - - TRACELOGD("FONT: Character box measures: %i, %i, %i, %i", chX1, chY1, chX2 - chX1, chY2 - chY1); - TRACELOGD("FONT: Character offsetY: %i", (int)((float)ascent*scaleFactor) + chY1); - */ + else + { + // TODO: Use some fallback glyph for codepoints not found in the font + } } } else TRACELOG(LOG_WARNING, "FONT: Failed to process TTF font data"); @@ -1409,6 +1421,28 @@ int TextToInteger(const char *text) return value*sign; } +float TextToFloat(const char *text) +{ + float value = 0.0f; + float sign = 1.0f; + + if ((text[0] == '+') || (text[0] == '-')) + { + if (text[0] == '-') sign = -1; + text++; + } + int i = 0; + for (; ((text[i] >= '0') && (text[i] <= '9')); ++i) value = value*10.0f + (float)(text[i] - '0'); + if (text[i++] != '.') return value*sign; + float divisor = 10.0f; + for (; ((text[i] >= '0') && (text[i] <= '9')); ++i) + { + value += ((float)(text[i] - '0'))/divisor; + divisor = divisor*10.0f; + } + return value; +} + #if defined(SUPPORT_TEXT_MANIPULATION) // Copy one string to another, returns bytes copied int TextCopy(char *dst, const char *src) @@ -2017,7 +2051,8 @@ static int GetLine(const char *origin, char *buffer, int maxLength) // REQUIRES: strstr(), sscanf(), strrchr(), memcpy() static Font LoadBMFont(const char *fileName) { - #define MAX_BUFFER_SIZE 256 + #define MAX_BUFFER_SIZE 256 + #define MAX_FONT_IMAGE_PAGES 8 Font font = { 0 }; @@ -2029,7 +2064,8 @@ static Font LoadBMFont(const char *fileName) int imWidth = 0; int imHeight = 0; - char imFileName[129] = { 0 }; + int pageCount = 1; + char imFileName[MAX_FONT_IMAGE_PAGES][129] = { 0 }; int base = 0; // Useless data int readBytes = 0; // Data bytes read @@ -2048,17 +2084,26 @@ static Font LoadBMFont(const char *fileName) // Read line data readBytes = GetLine(fileTextPtr, buffer, MAX_BUFFER_SIZE); searchPoint = strstr(buffer, "lineHeight"); - readVars = sscanf(searchPoint, "lineHeight=%i base=%i scaleW=%i scaleH=%i", &fontSize, &base, &imWidth, &imHeight); + readVars = sscanf(searchPoint, "lineHeight=%i base=%i scaleW=%i scaleH=%i pages=%i", &fontSize, &base, &imWidth, &imHeight, &pageCount); fileTextPtr += (readBytes + 1); if (readVars < 4) { UnloadFileText(fileText); return font; } // Some data not available, file malformed + + if (pageCount > MAX_FONT_IMAGE_PAGES) + { + TRACELOG(LOG_WARNING, "FONT: [%s] Font defines more pages than supported: %i/%i", fileName, pageCount, MAX_FONT_IMAGE_PAGES); + pageCount = MAX_FONT_IMAGE_PAGES; + } - readBytes = GetLine(fileTextPtr, buffer, MAX_BUFFER_SIZE); - searchPoint = strstr(buffer, "file"); - readVars = sscanf(searchPoint, "file=\"%128[^\"]\"", imFileName); - fileTextPtr += (readBytes + 1); + for (int i = 0; i < pageCount; i++) + { + readBytes = GetLine(fileTextPtr, buffer, MAX_BUFFER_SIZE); + searchPoint = strstr(buffer, "file"); + readVars = sscanf(searchPoint, "file=\"%128[^\"]\"", imFileName[i]); + fileTextPtr += (readBytes + 1); - if (readVars < 1) { UnloadFileText(fileText); return font; } // No fileName read + if (readVars < 1) { UnloadFileText(fileText); return font; } // No fileName read + } readBytes = GetLine(fileTextPtr, buffer, MAX_BUFFER_SIZE); searchPoint = strstr(buffer, "count"); @@ -2067,50 +2112,56 @@ static Font LoadBMFont(const char *fileName) if (readVars < 1) { UnloadFileText(fileText); return font; } // No glyphCount read - // Compose correct path using route of .fnt file (fileName) and imFileName - char *imPath = NULL; - char *lastSlash = NULL; + // Load all required images for further compose + Image *imFonts = (Image *)RL_CALLOC(pageCount, sizeof(Image)); // Font atlases, multiple images - lastSlash = strrchr(fileName, '/'); - if (lastSlash == NULL) lastSlash = strrchr(fileName, '\\'); - - if (lastSlash != NULL) + for (int i = 0; i < pageCount; i++) { - // NOTE: We need some extra space to avoid memory corruption on next allocations! - imPath = (char *)RL_CALLOC(TextLength(fileName) - TextLength(lastSlash) + TextLength(imFileName) + 4, 1); - memcpy(imPath, fileName, TextLength(fileName) - TextLength(lastSlash) + 1); - memcpy(imPath + TextLength(fileName) - TextLength(lastSlash) + 1, imFileName, TextLength(imFileName)); - } - else imPath = imFileName; + imFonts[i] = LoadImage(TextFormat("%s/%s", GetDirectoryPath(fileName), imFileName[i])); - TRACELOGD(" > Image loading path: %s", imPath); - - Image imFont = LoadImage(imPath); - - if (imFont.format == PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) - { - // Convert image to GRAYSCALE + ALPHA, using the mask as the alpha channel - Image imFontAlpha = { - .data = RL_CALLOC(imFont.width*imFont.height, 2), - .width = imFont.width, - .height = imFont.height, - .mipmaps = 1, - .format = PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA - }; - - for (int p = 0, i = 0; p < (imFont.width*imFont.height*2); p += 2, i++) + if (imFonts[i].format == PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) { - ((unsigned char *)(imFontAlpha.data))[p] = 0xff; - ((unsigned char *)(imFontAlpha.data))[p + 1] = ((unsigned char *)imFont.data)[i]; - } + // Convert image to GRAYSCALE + ALPHA, using the mask as the alpha channel + Image imFontAlpha = { + .data = RL_CALLOC(imFonts[i].width*imFonts[i].height, 2), + .width = imFonts[i].width, + .height = imFonts[i].height, + .mipmaps = 1, + .format = PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA + }; - UnloadImage(imFont); - imFont = imFontAlpha; + for (int p = 0, pi = 0; p < (imFonts[i].width*imFonts[i].height*2); p += 2, pi++) + { + ((unsigned char *)(imFontAlpha.data))[p] = 0xff; + ((unsigned char *)(imFontAlpha.data))[p + 1] = ((unsigned char *)imFonts[i].data)[pi]; + } + + UnloadImage(imFonts[i]); + imFonts[i] = imFontAlpha; + } } - font.texture = LoadTextureFromImage(imFont); + Image fullFont = imFonts[0]; + for (int i = 1; i < pageCount; i++) UnloadImage(imFonts[i]); - if (lastSlash != NULL) RL_FREE(imPath); + // If multiple atlas, then merge atlas + // NOTE: WARNING: This process could be really slow! + if (pageCount > 1) + { + // Resize font atlas to draw additional images + ImageResizeCanvas(&fullFont, imWidth, imHeight*pageCount, 0, 0, BLACK); + + for (int i = 1; i < pageCount; i++) + { + Rectangle srcRec = { 0.0f, 0.0f, (float)imWidth, (float)imHeight }; + Rectangle destRec = { 0.0f, (float)imHeight*(float)i, (float)imWidth, (float)imHeight }; + ImageDraw(&fullFont, imFonts[i], srcRec, destRec, WHITE); + } + } + + RL_FREE(imFonts); + + font.texture = LoadTextureFromImage(fullFont); // Fill font characters info data font.baseSize = fontSize; @@ -2119,19 +2170,19 @@ static Font LoadBMFont(const char *fileName) font.glyphs = (GlyphInfo *)RL_MALLOC(glyphCount*sizeof(GlyphInfo)); font.recs = (Rectangle *)RL_MALLOC(glyphCount*sizeof(Rectangle)); - int charId, charX, charY, charWidth, charHeight, charOffsetX, charOffsetY, charAdvanceX; + int charId, charX, charY, charWidth, charHeight, charOffsetX, charOffsetY, charAdvanceX, pageID; for (int i = 0; i < glyphCount; i++) { readBytes = GetLine(fileTextPtr, buffer, MAX_BUFFER_SIZE); - readVars = sscanf(buffer, "char id=%i x=%i y=%i width=%i height=%i xoffset=%i yoffset=%i xadvance=%i", - &charId, &charX, &charY, &charWidth, &charHeight, &charOffsetX, &charOffsetY, &charAdvanceX); + readVars = sscanf(buffer, "char id=%i x=%i y=%i width=%i height=%i xoffset=%i yoffset=%i xadvance=%i page=%i", + &charId, &charX, &charY, &charWidth, &charHeight, &charOffsetX, &charOffsetY, &charAdvanceX, &pageID); fileTextPtr += (readBytes + 1); - if (readVars == 8) // Make sure all char data has been properly read + if (readVars == 9) // Make sure all char data has been properly read { // Get character rectangle in the font atlas texture - font.recs[i] = (Rectangle){ (float)charX, (float)charY, (float)charWidth, (float)charHeight }; + font.recs[i] = (Rectangle){ (float)charX, (float)charY + (float)imHeight*pageID, (float)charWidth, (float)charHeight }; // Save data properly in sprite font font.glyphs[i].value = charId; @@ -2139,13 +2190,13 @@ static Font LoadBMFont(const char *fileName) font.glyphs[i].offsetY = charOffsetY; font.glyphs[i].advanceX = charAdvanceX; - // Fill character image data from imFont data - font.glyphs[i].image = ImageFromImage(imFont, font.recs[i]); + // Fill character image data from full font data + font.glyphs[i].image = ImageFromImage(fullFont, font.recs[i]); } else TRACELOG(LOG_WARNING, "FONT: [%s] Some characters data not correctly provided", fileName); } - UnloadImage(imFont); + UnloadImage(fullFont); UnloadFileText(fileText); if (font.texture.id == 0) @@ -2158,6 +2209,7 @@ static Font LoadBMFont(const char *fileName) return font; } + #endif #endif // SUPPORT_MODULE_RTEXT diff --git a/src/rtextures.c b/src/rtextures.c index 98586db73..d42304c7d 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -213,14 +213,14 @@ #define STBIR_MALLOC(size,c) ((void)(c), RL_MALLOC(size)) #define STBIR_FREE(ptr,c) ((void)(c), RL_FREE(ptr)) #define STB_IMAGE_RESIZE_IMPLEMENTATION -#include "external/stb_image_resize2.h" // Required for: stbir_resize_uint8_linear() [ImageResize()] +#include "external/stb_image_resize2.h" // Required for: stbir_resize_uint8_linear() [ImageResize()] #if defined(SUPPORT_FILEFORMAT_SVG) - #define NANOSVG_IMPLEMENTATION // Expands implementation - #include "external/nanosvg.h" + #define NANOSVG_IMPLEMENTATION // Expands implementation + #include "external/nanosvg.h" - #define NANOSVGRAST_IMPLEMENTATION - #include "external/nanosvgrast.h" + #define NANOSVGRAST_IMPLEMENTATION + #include "external/nanosvgrast.h" #endif //---------------------------------------------------------------------------------- @@ -1959,29 +1959,24 @@ void ImageBlurGaussian(Image *image, int blurSize) { float avgG = 0.0f; float avgB = 0.0f; float avgAlpha = 0.0f; - int convolutionSize = blurSize+1; + int convolutionSize = blurSize; - for (int i = 0; i < blurSize+1; i++) + for (int i = 0; i < blurSize; i++) { avgR += pixelsCopy1[row*image->width + i].x; avgG += pixelsCopy1[row*image->width + i].y; avgB += pixelsCopy1[row*image->width + i].z; avgAlpha += pixelsCopy1[row*image->width + i].w; - } + } - pixelsCopy2[row*image->width].x = avgR/convolutionSize; - pixelsCopy2[row*image->width].y = avgG/convolutionSize; - pixelsCopy2[row*image->width].z = avgB/convolutionSize; - pixelsCopy2[row*image->width].w = avgAlpha/convolutionSize; - - for (int x = 1; x < image->width; x++) + for (int x = 0; x < image->width; x++) { - if (x-blurSize >= 0) + if (x-blurSize-1 >= 0) { - avgR -= pixelsCopy1[row*image->width + x-blurSize].x; - avgG -= pixelsCopy1[row*image->width + x-blurSize].y; - avgB -= pixelsCopy1[row*image->width + x-blurSize].z; - avgAlpha -= pixelsCopy1[row*image->width + x-blurSize].w; + avgR -= pixelsCopy1[row*image->width + x-blurSize-1].x; + avgG -= pixelsCopy1[row*image->width + x-blurSize-1].y; + avgB -= pixelsCopy1[row*image->width + x-blurSize-1].z; + avgAlpha -= pixelsCopy1[row*image->width + x-blurSize-1].w; convolutionSize--; } @@ -1999,7 +1994,7 @@ void ImageBlurGaussian(Image *image, int blurSize) { pixelsCopy2[row*image->width + x].z = avgB/convolutionSize; pixelsCopy2[row*image->width + x].w = avgAlpha/convolutionSize; } - } + } // Vertical motion blur for (int col = 0; col < image->width; col++) @@ -2008,9 +2003,9 @@ void ImageBlurGaussian(Image *image, int blurSize) { float avgG = 0.0f; float avgB = 0.0f; float avgAlpha = 0.0f; - int convolutionSize = blurSize+1; + int convolutionSize = blurSize; - for (int i = 0; i < blurSize+1; i++) + for (int i = 0; i < blurSize; i++) { avgR += pixelsCopy2[i*image->width + col].x; avgG += pixelsCopy2[i*image->width + col].y; @@ -2018,19 +2013,14 @@ void ImageBlurGaussian(Image *image, int blurSize) { avgAlpha += pixelsCopy2[i*image->width + col].w; } - pixelsCopy1[col].x = (unsigned char) (avgR/convolutionSize); - pixelsCopy1[col].y = (unsigned char) (avgG/convolutionSize); - pixelsCopy1[col].z = (unsigned char) (avgB/convolutionSize); - pixelsCopy1[col].w = (unsigned char) (avgAlpha/convolutionSize); - - for (int y = 1; y < image->height; y++) + for (int y = 0; y < image->height; y++) { - if (y-blurSize >= 0) + if (y-blurSize-1 >= 0) { - avgR -= pixelsCopy2[(y-blurSize)*image->width + col].x; - avgG -= pixelsCopy2[(y-blurSize)*image->width + col].y; - avgB -= pixelsCopy2[(y-blurSize)*image->width + col].z; - avgAlpha -= pixelsCopy2[(y-blurSize)*image->width + col].w; + avgR -= pixelsCopy2[(y-blurSize-1)*image->width + col].x; + avgG -= pixelsCopy2[(y-blurSize-1)*image->width + col].y; + avgB -= pixelsCopy2[(y-blurSize-1)*image->width + col].z; + avgAlpha -= pixelsCopy2[(y-blurSize-1)*image->width + col].w; convolutionSize--; } if (y+blurSize < image->height) @@ -2082,6 +2072,148 @@ void ImageBlurGaussian(Image *image, int blurSize) { ImageFormat(image, format); } +// The kernel matrix is assumed to be square. Only supply the width of the kernel. +void ImageKernelConvolution(Image *image, float* kernel, int kernelSize){ + + if ((image->data == NULL) || (image->width == 0) || (image->height == 0) || kernel == NULL) return; + + int kernelWidth = (int)sqrtf((float)kernelSize); + if (kernelWidth*kernelWidth != kernelSize) + { + TRACELOG(LOG_WARNING, "IMAGE: Convolution kernel must be square to be applied"); + return; + } + + Color *pixels = LoadImageColors(*image); + + Vector4 *imageCopy2 = RL_MALLOC((image->height)*(image->width)*sizeof(Vector4)); + Vector4 *temp = RL_MALLOC(kernelSize*sizeof(Vector4)); + + + for(int i = 0; i < kernelSize; i++){ + temp[i].x = 0.0f; + temp[i].y = 0.0f; + temp[i].z = 0.0f; + temp[i].w = 0.0f; + } + + float rRes = 0.0f; + float gRes = 0.0f; + float bRes = 0.0f; + float aRes = 0.0f; + + + int startRange, endRange; + if(kernelWidth % 2 == 0) + { + startRange = -kernelWidth/2; + endRange = kernelWidth/2; + } else + { + startRange = -kernelWidth/2; + endRange = kernelWidth/2+1; + } + for(int x = 0; x < image->height; x++) + { + for(int y = 0; y < image->width; y++) + { + + for(int xk = startRange; xk < endRange; xk++) + { + for(int yk = startRange; yk < endRange; yk++) + { + int xkabs = xk + kernelWidth/2; + int ykabs = yk + kernelWidth/2; + size_t imgindex = image->width * (x+xk) + (y+yk); + if(imgindex < 0 || imgindex >= image->width * image->height){ + temp[kernelWidth * xkabs + ykabs].x = 0.0f; + temp[kernelWidth * xkabs + ykabs].y = 0.0f; + temp[kernelWidth * xkabs + ykabs].z = 0.0f; + temp[kernelWidth * xkabs + ykabs].w = 0.0f; + } else { + temp[kernelWidth * xkabs + ykabs].x = ((float)pixels[imgindex].r)/255.0f * kernel[kernelWidth * xkabs + ykabs]; + temp[kernelWidth * xkabs + ykabs].y = ((float)pixels[imgindex].g)/255.0f * kernel[kernelWidth * xkabs + ykabs]; + temp[kernelWidth * xkabs + ykabs].z = ((float)pixels[imgindex].b)/255.0f * kernel[kernelWidth * xkabs + ykabs]; + temp[kernelWidth * xkabs + ykabs].w = ((float)pixels[imgindex].a)/255.0f * kernel[kernelWidth * xkabs + ykabs]; + } + } + } + + for(int i = 0; i < kernelSize; i++) + { + rRes += temp[i].x; + gRes += temp[i].y; + bRes += temp[i].z; + aRes += temp[i].w; + } + + if(rRes < 0.0f) + { + rRes = 0.0f; + } + if(gRes < 0.0f) + { + gRes = 0.0f; + } + if(bRes < 0.0f) + { + bRes = 0.0f; + } + + if(rRes > 1.0f) + { + rRes = 1.0f; + } + if(gRes > 1.0f) + { + gRes = 1.0f; + } + if(bRes > 1.0f) + { + bRes = 1.0f; + } + + imageCopy2[image->width * (x) + (y)].x = rRes; + imageCopy2[image->width * (x) + (y)].y = gRes; + imageCopy2[image->width * (x) + (y)].z = bRes; + imageCopy2[image->width * (x) + (y)].w = aRes; + + rRes = 0.0f; + gRes = 0.0f; + bRes = 0.0f; + aRes = 0.0f; + + for(int i = 0; i < kernelSize; i++) + { + temp[i].x = 0.0f; + temp[i].y = 0.0f; + temp[i].z = 0.0f; + temp[i].w = 0.0f; + } + } + } + + for (int i = 0; i < (image->width) * (image->height); i++) + { + float alpha = (float)imageCopy2[i].w; + pixels[i].r = (unsigned char)((imageCopy2[i].x)*255.0f); + pixels[i].g = (unsigned char)((imageCopy2[i].y)*255.0f); + pixels[i].b = (unsigned char)((imageCopy2[i].z)*255.0f); + pixels[i].a = (unsigned char)((alpha)*255.0f); + // printf("pixels[%d] = %d", i, pixels[i].r); + } + + + int format = image->format; + RL_FREE(image->data); + RL_FREE(imageCopy2); + RL_FREE(temp); + + image->data = pixels; + image->format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8; + ImageFormat(image, format); +} + // Generate all mipmap levels for a provided image // NOTE 1: Supports POT and NPOT images // NOTE 2: image.data is scaled to include mipmap levels @@ -3564,7 +3696,7 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color // Draw text (default font) within an image (destination) void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color) { -#if defined(SUPPORT_MODULE_RTEXT) +#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_DEFAULT_FONT) // Make sure default font is loaded to be used on image text drawing if (GetFontDefault().texture.id == 0) LoadFontDefault();