Merge branch 'master' into features/ios-platform
This commit is contained in:
commit
bfbfeeb654
30 changed files with 5864 additions and 5121 deletions
|
|
@ -11,7 +11,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
||||||
| [raylib-beef](https://github.com/Starpelly/raylib-beef) | **5.5** | [Beef](https://www.beeflang.org) | MIT |
|
| [raylib-beef](https://github.com/Starpelly/raylib-beef) | **5.5** | [Beef](https://www.beeflang.org) | MIT |
|
||||||
| [raybit](https://github.com/Alex-Velez/raybit) | **5.0** | [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) | MIT |
|
| [raybit](https://github.com/Alex-Velez/raybit) | **5.0** | [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) | MIT |
|
||||||
| [raylib-c3](https://github.com/c3lang/vendor/tree/main/libraries/raylib6.c3l) | **6** | [C3](https://c3-lang.org) | MIT |
|
| [raylib-c3](https://github.com/c3lang/vendor/tree/main/libraries/raylib6.c3l) | **6** | [C3](https://c3-lang.org) | MIT |
|
||||||
| [raylib-cs](https://github.com/raylib-cs/raylib-cs) | **5.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib |
|
| [raylib-cs](https://github.com/raylib-cs/raylib-cs) | **6.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib |
|
||||||
| [Raylib-CsLo](https://github.com/NotNotTech/Raylib-CsLo) | 4.2 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
|
| [Raylib-CsLo](https://github.com/NotNotTech/Raylib-CsLo) | 4.2 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
|
||||||
| [Raylib-CSharp-Vinculum](https://github.com/ZeroElectric/Raylib-CSharp-Vinculum) | **5.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
|
| [Raylib-CSharp-Vinculum](https://github.com/ZeroElectric/Raylib-CSharp-Vinculum) | **5.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
|
||||||
| [Raylib-CSharp](https://github.com/MrScautHD/Raylib-CSharp) | **5.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MIT |
|
| [Raylib-CSharp](https://github.com/MrScautHD/Raylib-CSharp) | **5.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MIT |
|
||||||
|
|
@ -26,6 +26,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
||||||
| [raylib-cr](https://github.com/sol-vin/raylib-cr) | 4.6-dev (5e1a81) | [Crystal](https://crystal-lang.org) | Apache-2.0 |
|
| [raylib-cr](https://github.com/sol-vin/raylib-cr) | 4.6-dev (5e1a81) | [Crystal](https://crystal-lang.org) | Apache-2.0 |
|
||||||
| [ray-cyber](https://github.com/fubark/ray-cyber) | **5.0** | [Cyber](https://cyberscript.dev) | MIT |
|
| [ray-cyber](https://github.com/fubark/ray-cyber) | **5.0** | [Cyber](https://cyberscript.dev) | MIT |
|
||||||
| [dart-raylib](https://gitlab.com/wolfenrain/dart-raylib) | 4.0 | [Dart](https://dart.dev) | MIT |
|
| [dart-raylib](https://gitlab.com/wolfenrain/dart-raylib) | 4.0 | [Dart](https://dart.dev) | MIT |
|
||||||
|
| [raylib_dart](https://pub.dev/packages/raylib_dart) | 6.0 | [Dart](https://dart.dev) | MIT |
|
||||||
| [bindbc-raylib3](https://github.com/o3o/bindbc-raylib3) | **5.0** | [D](https://dlang.org) | BSL-1.0 |
|
| [bindbc-raylib3](https://github.com/o3o/bindbc-raylib3) | **5.0** | [D](https://dlang.org) | BSL-1.0 |
|
||||||
| [dray](https://github.com/redthing1/dray) | **5.0** | [D](https://dlang.org) | Apache-2.0 |
|
| [dray](https://github.com/redthing1/dray) | **5.0** | [D](https://dlang.org) | Apache-2.0 |
|
||||||
| [raylib-d](https://github.com/schveiguy/raylib-d) | **6.0** | [D](https://dlang.org) | Zlib |
|
| [raylib-d](https://github.com/schveiguy/raylib-d) | **6.0** | [D](https://dlang.org) | Zlib |
|
||||||
|
|
@ -49,7 +50,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
||||||
| [Raylib.jl](https://github.com/chengchingwen/Raylib.jl) | 4.2 | [Julia](https://julialang.org) | Zlib |
|
| [Raylib.jl](https://github.com/chengchingwen/Raylib.jl) | 4.2 | [Julia](https://julialang.org) | Zlib |
|
||||||
| [kaylib](https://github.com/electronstudio/kaylib) | 3.7 | [Kotlin/native](https://kotlinlang.org) | **???** |
|
| [kaylib](https://github.com/electronstudio/kaylib) | 3.7 | [Kotlin/native](https://kotlinlang.org) | **???** |
|
||||||
| [KaylibKit](https://codeberg.org/Kenta/KaylibKit) | 4.5 | [Kotlin/native](https://kotlinlang.org) | Zlib |
|
| [KaylibKit](https://codeberg.org/Kenta/KaylibKit) | 4.5 | [Kotlin/native](https://kotlinlang.org) | Zlib |
|
||||||
| [raylib-lua](https://github.com/TSnake41/raylib-lua) | 5.0 | [Lua](http://www.lua.org) | ISC |
|
| [raylib-lua](https://github.com/TSnake41/raylib-lua) | 5.5 | [Lua](http://www.lua.org) | ISC |
|
||||||
| [raylib-lua-bindings (WIP)](https://github.com/legendaryredfox/raylib-lua-bindings) | 5.5 | [Lua](http://www.lua.org) | ISC |
|
| [raylib-lua-bindings (WIP)](https://github.com/legendaryredfox/raylib-lua-bindings) | 5.5 | [Lua](http://www.lua.org) | ISC |
|
||||||
| [ReiLua](https://github.com/nullstare/ReiLua) | 5.5 | [Lua](http://www.lua.org) | MIT |
|
| [ReiLua](https://github.com/nullstare/ReiLua) | 5.5 | [Lua](http://www.lua.org) | MIT |
|
||||||
| [raylib-lua-sol](https://github.com/RobLoach/raylib-lua-sol) | 5.5 | [Lua](http://www.lua.org) | Zlib |
|
| [raylib-lua-sol](https://github.com/RobLoach/raylib-lua-sol) | 5.5 | [Lua](http://www.lua.org) | Zlib |
|
||||||
|
|
@ -62,7 +63,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
||||||
| [node-raylib](https://github.com/RobLoach/node-raylib) | 4.5 | [Node.js](https://nodejs.org/en) | Zlib |
|
| [node-raylib](https://github.com/RobLoach/node-raylib) | 4.5 | [Node.js](https://nodejs.org/en) | Zlib |
|
||||||
| [raylib-odin](https://github.com/odin-lang/Odin/tree/master/vendor/raylib) | **5.5** | [Odin](https://odin-lang.org) | Zlib |
|
| [raylib-odin](https://github.com/odin-lang/Odin/tree/master/vendor/raylib) | **5.5** | [Odin](https://odin-lang.org) | Zlib |
|
||||||
| [raylib_odin_bindings](https://github.com/Deathbat2190/raylib_odin_bindings) | 4.0-dev | [Odin](https://odin-lang.org) | MIT |
|
| [raylib_odin_bindings](https://github.com/Deathbat2190/raylib_odin_bindings) | 4.0-dev | [Odin](https://odin-lang.org) | MIT |
|
||||||
| [raylib-ocaml](https://github.com/tjammer/raylib-ocaml) | **5.0** | [OCaml](https://ocaml.org) | MIT |
|
| [raylib-ocaml](https://github.com/tjammer/raylib-ocaml) | **6.0** | [OCaml](https://ocaml.org) | MIT |
|
||||||
| [TurboRaylib](https://github.com/turborium/TurboRaylib) | 4.5 | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT |
|
| [TurboRaylib](https://github.com/turborium/TurboRaylib) | 4.5 | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT |
|
||||||
| [Ray4Laz](https://github.com/GuvaCode/Ray4Laz) | **6.0** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)/[Delphi](https://en.wikipedia.org/wiki/Delphi_(software)) | Zlib |
|
| [Ray4Laz](https://github.com/GuvaCode/Ray4Laz) | **6.0** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)/[Delphi](https://en.wikipedia.org/wiki/Delphi_(software)) | Zlib |
|
||||||
| [Raylib.4.0.Pascal](https://github.com/sysrpl/Raylib.4.0.Pascal) | 4.0 | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal) | Zlib |
|
| [Raylib.4.0.Pascal](https://github.com/sysrpl/Raylib.4.0.Pascal) | 4.0 | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal) | Zlib |
|
||||||
|
|
@ -90,7 +91,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
||||||
| [raylib-vapi](https://github.com/lxmcf/raylib-vapi) | **6.0** | [Vala](https://vala.dev) | Zlib |
|
| [raylib-vapi](https://github.com/lxmcf/raylib-vapi) | **6.0** | [Vala](https://vala.dev) | Zlib |
|
||||||
| [raylib-wave](https://github.com/wavefnd/raylib-wave) | **auto** |[Wave](http://wave-lang.dev) | Zlib |
|
| [raylib-wave](https://github.com/wavefnd/raylib-wave) | **auto** |[Wave](http://wave-lang.dev) | Zlib |
|
||||||
| [raylib-wren](https://github.com/TSnake41/raylib-wren) | 4.5 | [Wren](http://wren.io) | ISC |
|
| [raylib-wren](https://github.com/TSnake41/raylib-wren) | 4.5 | [Wren](http://wren.io) | ISC |
|
||||||
| [raylib-zig](https://github.com/raylib-zig/raylib-zig) | **5.6-dev** | [Zig](https://ziglang.org) | MIT |
|
| [raylib-zig](https://github.com/raylib-zig/raylib-zig) | **6.0** | [Zig](https://ziglang.org) | MIT |
|
||||||
| [raylib.zig](https://github.com/ryupold/raylib.zig) | **5.1-dev** | [Zig](https://ziglang.org) | MIT |
|
| [raylib.zig](https://github.com/ryupold/raylib.zig) | **5.1-dev** | [Zig](https://ziglang.org) | MIT |
|
||||||
| [raylib-zig-bindings](https://github.com/L-Briand/raylib-zig-bindings) | **5.0** | [Zig](https://ziglang.org) | Zlib |
|
| [raylib-zig-bindings](https://github.com/L-Briand/raylib-zig-bindings) | **5.0** | [Zig](https://ziglang.org) | Zlib |
|
||||||
| [hare-raylib](https://git.sr.ht/~evantj/hare-raylib) | **auto** | [Hare](https://harelang.org) | Zlib |
|
| [hare-raylib](https://git.sr.ht/~evantj/hare-raylib) | **auto** | [Hare](https://harelang.org) | Zlib |
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.22)
|
||||||
#this change avoid the warning that appear when we include raylib using Cmake fatch content
|
#this change avoid the warning that appear when we include raylib using Cmake fatch content
|
||||||
project(raylib)
|
project(raylib)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,13 +53,19 @@ int main(void)
|
||||||
Model model = LoadModel("resources/models/gltf/robot.glb"); // Load character model
|
Model model = LoadModel("resources/models/gltf/robot.glb"); // Load character model
|
||||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model world position
|
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model world position
|
||||||
|
|
||||||
|
#if SUPPORT_GPU_SKINNING
|
||||||
|
// WARNING: SUPPORT_GPU_SKINNING is required to be enabled at raylib compile time (disabled by default)
|
||||||
|
// It will skip loading CPU required buffers to store animation updated data, so, both modes are exclusive
|
||||||
|
|
||||||
// Load skinning shader
|
// Load skinning shader
|
||||||
// WARNING: It requires SUPPORT_GPU_SKINNING enabled on raylib (disabled by default)
|
// NOTE: It must be a valid shader, following raylib attribs/uniform conventions for GPU skinning
|
||||||
Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION),
|
Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION),
|
||||||
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
|
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
|
||||||
|
|
||||||
// Assign skinning shader to all materials shaders
|
// Skinning shader could be required to be assigned to all materials shaders, just to make
|
||||||
//for (int i = 0; i < model.materialCount; i++) model.materials[i].shader = skinningShader;
|
// sure required uniforms are being updated for the mesh using that material (and shader)
|
||||||
|
for (int i = 0; i < model.materialCount; i++) model.materials[i].shader = skinningShader;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Load model animations
|
// Load model animations
|
||||||
int animCount = 0;
|
int animCount = 0;
|
||||||
|
|
@ -244,6 +250,12 @@ int main(void)
|
||||||
if (GuiDropdownBox((Rectangle){ GetScreenWidth() - 170.0f, 10, 160, 24 }, TextJoin(animNames, animCount, ";"),
|
if (GuiDropdownBox((Rectangle){ GetScreenWidth() - 170.0f, 10, 160, 24 }, TextJoin(animNames, animCount, ";"),
|
||||||
&animIndex1, dropdownEditMode1)) dropdownEditMode1 = !dropdownEditMode1;
|
&animIndex1, dropdownEditMode1)) dropdownEditMode1 = !dropdownEditMode1;
|
||||||
|
|
||||||
|
GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SIZE, GuiGetFont().baseSize*2);
|
||||||
|
GuiLabel((Rectangle){ 0, GetScreenHeight() - 100.0f, GetScreenWidth(), 40 }, "PRESS SPACE to START BLENDING");
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SIZE, GuiGetFont().baseSize);
|
||||||
|
GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||||
|
|
||||||
// Draw playing timeline with keyframes for anim0[]
|
// Draw playing timeline with keyframes for anim0[]
|
||||||
GuiProgressBar((Rectangle){ 60, GetScreenHeight() - 60.0f, GetScreenWidth() - 180.0f, 20 }, "ANIM 0",
|
GuiProgressBar((Rectangle){ 60, GetScreenHeight() - 60.0f, GetScreenWidth() - 180.0f, 20 }, "ANIM 0",
|
||||||
TextFormat("FRAME: %.2f / %i", animFrameProgress0, anims[animIndex0].keyframeCount),
|
TextFormat("FRAME: %.2f / %i", animFrameProgress0, anims[animIndex0].keyframeCount),
|
||||||
|
|
@ -269,7 +281,9 @@ int main(void)
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadModelAnimations(anims, animCount); // Unload model animation
|
UnloadModelAnimations(anims, animCount); // Unload model animation
|
||||||
UnloadModel(model); // Unload model and meshes/material
|
UnloadModel(model); // Unload model and meshes/material
|
||||||
|
#if SUPPORT_GPU_SKINNING
|
||||||
UnloadShader(skinningShader); // Unload GPU skinning shader
|
UnloadShader(skinningShader); // Unload GPU skinning shader
|
||||||
|
#endif
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -52,12 +52,19 @@ int main(void)
|
||||||
Model model = LoadModel("resources/models/gltf/greenman.glb"); // Load character model
|
Model model = LoadModel("resources/models/gltf/greenman.glb"); // Load character model
|
||||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||||
|
|
||||||
|
#if SUPPORT_GPU_SKINNING
|
||||||
|
// WARNING: SUPPORT_GPU_SKINNING is required to be enabled at raylib compile time (disabled by default)
|
||||||
|
// It will skip loading CPU required buffers to store animation updated data, so, both modes are exclusive
|
||||||
|
|
||||||
// Load skinning shader
|
// Load skinning shader
|
||||||
// WARNING: GPU skinning must be enabled in raylib with a compilation flag,
|
// NOTE: It must be a valid shader, following raylib attribs/uniform conventions for GPU skinning
|
||||||
// if not enabled, CPU skinning will be used instead
|
|
||||||
Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION),
|
Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION),
|
||||||
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
|
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
|
||||||
model.materials[1].shader = skinningShader;
|
|
||||||
|
// Skinning shader could be required to be assigned to all materials shaders, just to make
|
||||||
|
// sure required uniforms are being updated for the mesh using that material (and shader)
|
||||||
|
model.materials[1].shader = skinningShader; // Just assigning to materials[1] for this model
|
||||||
|
#endif
|
||||||
|
|
||||||
// Load gltf model animations
|
// Load gltf model animations
|
||||||
int animCount = 0;
|
int animCount = 0;
|
||||||
|
|
@ -111,7 +118,9 @@ int main(void)
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadModelAnimations(anims, animCount); // Unload model animation
|
UnloadModelAnimations(anims, animCount); // Unload model animation
|
||||||
UnloadModel(model); // Unload model and meshes/material
|
UnloadModel(model); // Unload model and meshes/material
|
||||||
|
#if SUPPORT_GPU_SKINNING
|
||||||
UnloadShader(skinningShader); // Unload GPU skinning shader
|
UnloadShader(skinningShader); // Unload GPU skinning shader
|
||||||
|
#endif
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ int main(void)
|
||||||
{
|
{
|
||||||
// Cast a ray from the screen center (where crosshair would be)
|
// Cast a ray from the screen center (where crosshair would be)
|
||||||
Vector2 screenCenter = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
Vector2 screenCenter = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
||||||
Ray ray = GetMouseRay(screenCenter, camera);
|
Ray ray = GetScreenToWorldRay(screenCenter, camera);
|
||||||
|
|
||||||
// Check ray collision with all voxels
|
// Check ray collision with all voxels
|
||||||
float closestDistance = 99999.0f;
|
float closestDistance = 99999.0f;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,8 @@ int main(void)
|
||||||
Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM)
|
Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM)
|
||||||
|
|
||||||
// Draw one image over the other with a scaling of 1.5f
|
// Draw one image over the other with a scaling of 1.5f
|
||||||
ImageDraw(&parrots, cat, (Rectangle){ 0, 0, (float)cat.width, (float)cat.height }, (Rectangle){ 30, 40, cat.width*1.5f, cat.height*1.5f }, WHITE);
|
ImageDrawImagePro(&parrots, cat, (Rectangle){ 0, 0, (float)cat.width, (float)cat.height },
|
||||||
|
(Rectangle){ 30, 40, cat.width*1.5f, cat.height*1.5f }, (Vector2){ 0 }, 0.0f, WHITE);
|
||||||
ImageCrop(&parrots, (Rectangle){ 0, 50, (float)parrots.width, (float)parrots.height - 100 }); // Crop resulting image
|
ImageCrop(&parrots, (Rectangle){ 0, 50, (float)parrots.width, (float)parrots.height - 100 }); // Crop resulting image
|
||||||
|
|
||||||
// Draw on the image with a few image draw methods
|
// Draw on the image with a few image draw methods
|
||||||
|
|
|
||||||
|
|
@ -30,18 +30,24 @@ set(raylib_public_headers
|
||||||
|
|
||||||
# Sources to be compiled
|
# Sources to be compiled
|
||||||
set(raylib_sources
|
set(raylib_sources
|
||||||
raudio.c
|
|
||||||
rcore.c
|
rcore.c
|
||||||
rmodels.c
|
|
||||||
rshapes.c
|
rshapes.c
|
||||||
rtext.c
|
rtext.c
|
||||||
rtextures.c
|
rtextures.c
|
||||||
)
|
)
|
||||||
|
|
||||||
if (${PLATFORM} STREQUAL "iOS")
|
if (${PLATFORM} STREQUAL "iOS")
|
||||||
list(APPEND raylib_sources
|
list(APPEND raylib_sources rcore_ios_main.m)
|
||||||
rcore_ios_main.m
|
endif()
|
||||||
)
|
|
||||||
|
# Only build raudio if it's enabled
|
||||||
|
if (NOT DEFINED SUPPORT_MODULE_RAUDIO OR SUPPORT_MODULE_RAUDIO)
|
||||||
|
list(APPEND raylib_sources raudio.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Only build rmodels if it's enabled
|
||||||
|
if (NOT DEFINED SUPPORT_MODULE_RMODELS OR SUPPORT_MODULE_RMODELS)
|
||||||
|
list(APPEND raylib_sources rmodels.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# <root>/cmake/GlfwImport.cmake handles the details around the inclusion of glfw
|
# <root>/cmake/GlfwImport.cmake handles the details around the inclusion of glfw
|
||||||
|
|
@ -54,10 +60,10 @@ endif ()
|
||||||
# Produces a variable LIBS_PRIVATE that will be used later
|
# Produces a variable LIBS_PRIVATE that will be used later
|
||||||
include(LibraryConfigurations)
|
include(LibraryConfigurations)
|
||||||
|
|
||||||
if (SUPPORT_MODULE_RAUDIO)
|
if (DEFINED SUPPORT_MODULE_RAUDIO AND NOT SUPPORT_MODULE_RAUDIO)
|
||||||
MESSAGE(STATUS "Audio Backend: miniaudio")
|
|
||||||
else ()
|
|
||||||
MESSAGE(STATUS "Audio Backend: None (-DCUSTOMIZE_BUILD=ON -DSUPPORT_MODULE_RAUDIO=OFF)")
|
MESSAGE(STATUS "Audio Backend: None (-DCUSTOMIZE_BUILD=ON -DSUPPORT_MODULE_RAUDIO=OFF)")
|
||||||
|
else ()
|
||||||
|
MESSAGE(STATUS "Audio Backend: miniaudio")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_library(raylib ${raylib_sources} ${raylib_public_headers})
|
add_library(raylib ${raylib_sources} ${raylib_public_headers})
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,9 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
ifeq ($(ANDROID_ARCH),x86_64)
|
ifeq ($(ANDROID_ARCH),x86_64)
|
||||||
ANDROID_COMPILER_ARCH = x86_64
|
ANDROID_COMPILER_ARCH = x86_64
|
||||||
endif
|
endif
|
||||||
|
ifndef ANDROID_COMPILER_ARCH
|
||||||
|
$(error ANDROID_COMPILER_ARCH: Unknown ANDROID_ARCH=$(ANDROID_ARCH))
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define raylib graphics api depending on selected platform
|
# Define raylib graphics api depending on selected platform
|
||||||
|
|
|
||||||
4340
src/external/RGFW/RGFW.h
vendored
4340
src/external/RGFW/RGFW.h
vendored
File diff suppressed because it is too large
Load diff
124
src/external/rlsw.h
vendored
124
src/external/rlsw.h
vendored
|
|
@ -164,17 +164,10 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fast power-of-two texture wrap (SW_REPEAT mode only)
|
// Full NPOT texture support (enabled by default)
|
||||||
// When defined, textures whose width/height are powers of two use a bitmask
|
// When disabled, SW_REPEAT requires POT on its axis (fast bitmask wrap)
|
||||||
// wrap (`x & (size-1)`) instead of `floorf`-based fractional wrap or the signed `%` chain in the linear sampler
|
// SW_CLAMP remains supported for any dimension, per-axis
|
||||||
// Saves a software divide on Xtensa and a few instructions everywhere
|
#define SW_SUPPORT_NPOT_TEXTURE true
|
||||||
// NPOT textures keep using the original path via a runtime `(size & (size-1)) == 0` check,
|
|
||||||
// so SW_REPEAT remains correct for them
|
|
||||||
// The only observable behavior change is for POT textures sampled with negative UV coordinates:
|
|
||||||
// bitmask wrap (two's complement) can differ from `sw_fract` by one texel
|
|
||||||
// Off by default to keep bit-for-bit behavior; opt in if you control your asset UVs
|
|
||||||
//
|
|
||||||
//#define SW_TEXTURE_REPEAT_POT_FAST
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// OpenGL Compatibility Types
|
// OpenGL Compatibility Types
|
||||||
|
|
@ -2406,6 +2399,14 @@ static inline bool sw_texture_alloc(sw_texture_t *texture, const void *data, int
|
||||||
int bpp = SW_PIXELFORMAT_SIZE[format];
|
int bpp = SW_PIXELFORMAT_SIZE[format];
|
||||||
int newSize = w*h*bpp;
|
int newSize = w*h*bpp;
|
||||||
|
|
||||||
|
if (texture->pixels == NULL)
|
||||||
|
{
|
||||||
|
texture->minFilter = SW_NEAREST;
|
||||||
|
texture->magFilter = SW_NEAREST;
|
||||||
|
texture->sWrap = SW_CLAMP;
|
||||||
|
texture->tWrap = SW_CLAMP;
|
||||||
|
}
|
||||||
|
|
||||||
if (newSize > texture->allocSz)
|
if (newSize > texture->allocSz)
|
||||||
{
|
{
|
||||||
void *ptr = SW_REALLOC(texture->pixels, newSize);
|
void *ptr = SW_REALLOC(texture->pixels, newSize);
|
||||||
|
|
@ -2470,38 +2471,25 @@ static inline void sw_texture_sample_nearest(float *SW_RESTRICT color, const sw_
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
#ifdef SW_TEXTURE_REPEAT_POT_FAST
|
#if SW_SUPPORT_NPOT_TEXTURE
|
||||||
if ((tex->sWrap == SW_REPEAT) && ((tex->width & tex->wMinus1) == 0))
|
if (tex->sWrap == SW_REPEAT) x = (int)(sw_fract(u)*tex->width);
|
||||||
{
|
else x = (int)(sw_saturate(u)*tex->width);
|
||||||
x = (int)(u*tex->width) & tex->wMinus1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
u = (tex->sWrap == SW_REPEAT)? sw_fract(u) : sw_saturate(u);
|
|
||||||
x = (int)(u*tex->width);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef SW_TEXTURE_REPEAT_POT_FAST
|
if (tex->tWrap == SW_REPEAT) y = (int)(sw_fract(v)*tex->height);
|
||||||
if ((tex->tWrap == SW_REPEAT) && ((tex->height & tex->hMinus1) == 0))
|
else y = (int)(sw_saturate(v)*tex->height);
|
||||||
{
|
#else
|
||||||
y = (int)(v*tex->height) & tex->hMinus1;
|
if (tex->sWrap == SW_REPEAT) x = (int)(u*tex->width) & tex->wMinus1;
|
||||||
}
|
else x = (int)(sw_saturate(u)*tex->width);
|
||||||
else
|
|
||||||
|
if (tex->tWrap == SW_REPEAT) y = (int)(v*tex->height) & tex->hMinus1;
|
||||||
|
else y = (int)(sw_saturate(v)*tex->height);
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
v = (tex->tWrap == SW_REPEAT)? sw_fract(v) : sw_saturate(v);
|
|
||||||
y = (int)(v*tex->height);
|
|
||||||
}
|
|
||||||
|
|
||||||
tex->readColor(color, tex->pixels, y*tex->width + x);
|
tex->readColor(color, tex->pixels, y*tex->width + x);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void sw_texture_sample_linear(float *SW_RESTRICT color, const sw_texture_t *SW_RESTRICT tex, float u, float v)
|
static inline void sw_texture_sample_linear(float *SW_RESTRICT color, const sw_texture_t *SW_RESTRICT tex, float u, float v)
|
||||||
{
|
{
|
||||||
// TODO: With a bit more cleverness the number of operations can
|
|
||||||
// be clearly reduced, but for now it works fine
|
|
||||||
|
|
||||||
float xf = (u*tex->width) - 0.5f;
|
float xf = (u*tex->width) - 0.5f;
|
||||||
float yf = (v*tex->height) - 0.5f;
|
float yf = (v*tex->height) - 0.5f;
|
||||||
|
|
||||||
|
|
@ -2514,41 +2502,36 @@ static inline void sw_texture_sample_linear(float *SW_RESTRICT color, const sw_t
|
||||||
int x1 = x0 + 1;
|
int x1 = x0 + 1;
|
||||||
int y1 = y0 + 1;
|
int y1 = y0 + 1;
|
||||||
|
|
||||||
if (tex->sWrap == SW_CLAMP)
|
if (tex->sWrap == SW_REPEAT)
|
||||||
{
|
|
||||||
x0 = (x0 > tex->wMinus1)? tex->wMinus1 : x0;
|
|
||||||
x1 = (x1 > tex->wMinus1)? tex->wMinus1 : x1;
|
|
||||||
}
|
|
||||||
#ifdef SW_TEXTURE_REPEAT_POT_FAST
|
|
||||||
else if ((tex->width & tex->wMinus1) == 0)
|
|
||||||
{
|
|
||||||
// POT fast path: bitmask wrap covers negative ints via two's complement
|
|
||||||
x0 = x0 & tex->wMinus1;
|
|
||||||
x1 = x1 & tex->wMinus1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
#if SW_SUPPORT_NPOT_TEXTURE
|
||||||
x0 = (x0%tex->width + tex->width)%tex->width;
|
x0 = (x0%tex->width + tex->width)%tex->width;
|
||||||
x1 = (x1%tex->width + tex->width)%tex->width;
|
x1 = (x1%tex->width + tex->width)%tex->width;
|
||||||
|
#else
|
||||||
|
x0 = x0 & tex->wMinus1;
|
||||||
|
x1 = x1 & tex->wMinus1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tex->tWrap == SW_CLAMP)
|
|
||||||
{
|
|
||||||
y0 = (y0 > tex->hMinus1)? tex->hMinus1 : y0;
|
|
||||||
y1 = (y1 > tex->hMinus1)? tex->hMinus1 : y1;
|
|
||||||
}
|
|
||||||
#ifdef SW_TEXTURE_REPEAT_POT_FAST
|
|
||||||
else if ((tex->height & tex->hMinus1) == 0)
|
|
||||||
{
|
|
||||||
y0 = y0 & tex->hMinus1;
|
|
||||||
y1 = y1 & tex->hMinus1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
x0 = sw_clamp_int(x0, 0, tex->wMinus1);
|
||||||
|
x1 = sw_clamp_int(x1, 0, tex->wMinus1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tex->tWrap == SW_REPEAT)
|
||||||
|
{
|
||||||
|
#if SW_SUPPORT_NPOT_TEXTURE
|
||||||
y0 = (y0%tex->height + tex->height)%tex->height;
|
y0 = (y0%tex->height + tex->height)%tex->height;
|
||||||
y1 = (y1%tex->height + tex->height)%tex->height;
|
y1 = (y1%tex->height + tex->height)%tex->height;
|
||||||
|
#else
|
||||||
|
y0 = y0 & tex->hMinus1;
|
||||||
|
y1 = y1 & tex->hMinus1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
y0 = sw_clamp_int(y0, 0, tex->hMinus1);
|
||||||
|
y1 = sw_clamp_int(y1, 0, tex->hMinus1);
|
||||||
}
|
}
|
||||||
|
|
||||||
float c00[4], c10[4], c01[4], c11[4];
|
float c00[4], c10[4], c01[4], c11[4];
|
||||||
|
|
@ -5187,11 +5170,25 @@ void swTexParameteri(int param, int value)
|
||||||
case SW_TEXTURE_WRAP_S:
|
case SW_TEXTURE_WRAP_S:
|
||||||
{
|
{
|
||||||
if (!sw_is_texture_wrap_valid(value)) { RLSW.errCode = SW_INVALID_ENUM; return; }
|
if (!sw_is_texture_wrap_valid(value)) { RLSW.errCode = SW_INVALID_ENUM; return; }
|
||||||
|
#if !SW_SUPPORT_NPOT_TEXTURE
|
||||||
|
if (value == SW_REPEAT && (RLSW.boundTexture->width & RLSW.boundTexture->wMinus1) != 0)
|
||||||
|
{
|
||||||
|
RLSW.errCode = SW_INVALID_OPERATION;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
RLSW.boundTexture->sWrap = (SWwrap)value;
|
RLSW.boundTexture->sWrap = (SWwrap)value;
|
||||||
} break;
|
} break;
|
||||||
case SW_TEXTURE_WRAP_T:
|
case SW_TEXTURE_WRAP_T:
|
||||||
{
|
{
|
||||||
if (!sw_is_texture_wrap_valid(value)) { RLSW.errCode = SW_INVALID_ENUM; return; }
|
if (!sw_is_texture_wrap_valid(value)) { RLSW.errCode = SW_INVALID_ENUM; return; }
|
||||||
|
#if !SW_SUPPORT_NPOT_TEXTURE
|
||||||
|
if (value == SW_REPEAT && (RLSW.boundTexture->height & RLSW.boundTexture->hMinus1) != 0)
|
||||||
|
{
|
||||||
|
RLSW.errCode = SW_INVALID_OPERATION;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
RLSW.boundTexture->tWrap = (SWwrap)value;
|
RLSW.boundTexture->tWrap = (SWwrap)value;
|
||||||
} break;
|
} break;
|
||||||
default: RLSW.errCode = SW_INVALID_ENUM; break;
|
default: RLSW.errCode = SW_INVALID_ENUM; break;
|
||||||
|
|
@ -5574,8 +5571,7 @@ static void SW_RASTER_TRIANGLE(const sw_vertex_t *v0, const sw_vertex_t *v1, con
|
||||||
if (v1->position[1] > v2->position[1]) { const sw_vertex_t *tmp = v1; v1 = v2; v2 = tmp; }
|
if (v1->position[1] > v2->position[1]) { const sw_vertex_t *tmp = v1; v1 = v2; v2 = tmp; }
|
||||||
if (v0->position[1] > v1->position[1]) { const sw_vertex_t *tmp = v0; v0 = v1; v1 = tmp; }
|
if (v0->position[1] > v1->position[1]) { const sw_vertex_t *tmp = v0; v0 = v1; v1 = tmp; }
|
||||||
|
|
||||||
// Extracting coordinates from the sorted vertices
|
// Extracting Y coordinates from the sorted vertices
|
||||||
// Put x away for safe keeping; only y is used right now; silences warnings
|
|
||||||
float y0 = v0->position[1];
|
float y0 = v0->position[1];
|
||||||
float y1 = v1->position[1];
|
float y1 = v1->position[1];
|
||||||
float y2 = v2->position[1];
|
float y2 = v2->position[1];
|
||||||
|
|
|
||||||
|
|
@ -473,8 +473,7 @@ void SetWindowFocused(void)
|
||||||
// Get native window handle
|
// Get native window handle
|
||||||
void *GetWindowHandle(void)
|
void *GetWindowHandle(void)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "GetWindowHandle() not implemented on target platform");
|
return (void *)platform.app->window; // Type: ANativeWindow*
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get number of monitors
|
// Get number of monitors
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ typedef struct {
|
||||||
// Local storage for the window handle returned by glfwGetX11Window
|
// Local storage for the window handle returned by glfwGetX11Window
|
||||||
// This is needed as X11 handles are integers and may not fit inside a pointer depending on platform
|
// This is needed as X11 handles are integers and may not fit inside a pointer depending on platform
|
||||||
// Storing the handle locally and returning a pointer in GetWindowHandle allows the code to work regardless of pointer width
|
// Storing the handle locally and returning a pointer in GetWindowHandle allows the code to work regardless of pointer width
|
||||||
XID windowHandleX11;
|
Window windowHandleX11; // Underlying type: unsigned long (XID, Window)
|
||||||
#endif
|
#endif
|
||||||
} PlatformData;
|
} PlatformData;
|
||||||
|
|
||||||
|
|
@ -764,9 +764,10 @@ void SetWindowFocused(void)
|
||||||
// Get native window handle
|
// Get native window handle
|
||||||
void *GetWindowHandle(void)
|
void *GetWindowHandle(void)
|
||||||
{
|
{
|
||||||
|
void *handle = NULL;
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
// NOTE: Returned handle is: void *HWND (windows.h)
|
handle = glfwGetWin32Window(platform.handle); // Type: HWND
|
||||||
return glfwGetWin32Window(platform.handle);
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
#if defined(_GLFW_WAYLAND)
|
#if defined(_GLFW_WAYLAND)
|
||||||
|
|
@ -774,28 +775,27 @@ void *GetWindowHandle(void)
|
||||||
int platformID = glfwGetPlatform();
|
int platformID = glfwGetPlatform();
|
||||||
if (platformID == GLFW_PLATFORM_WAYLAND)
|
if (platformID == GLFW_PLATFORM_WAYLAND)
|
||||||
{
|
{
|
||||||
return glfwGetWaylandWindow(platform.handle);
|
handle = (void *)glfwGetWaylandWindow(platform.handle); // Type: struct wl_surface*
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
platform.windowHandleX11 = glfwGetX11Window(platform.handle);
|
platform.windowHandleX11 = glfwGetX11Window(platform.handle); // Type: Window (unsigned long)
|
||||||
return &platform.windowHandleX11;
|
handle = &platform.windowHandleX11;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
return glfwGetWaylandWindow(platform.handle);
|
handle = (void *)glfwGetWaylandWindow(platform.handle);
|
||||||
#endif
|
#endif
|
||||||
#elif defined(_GLFW_X11)
|
#elif defined(_GLFW_X11)
|
||||||
// Store the window handle localy and return a pointer to the variable instead
|
// Store the window handle locally and return a pointer to the variable instead
|
||||||
platform.windowHandleX11 = glfwGetX11Window(platform.handle);
|
platform.windowHandleX11 = glfwGetX11Window(platform.handle);
|
||||||
return &platform.windowHandleX11;
|
handle = &platform.windowHandleX11;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
// NOTE: Returned handle is: (objc_object *)
|
handle = (void *)glfwGetCocoaWindow(platform.handle); // Type: NSWindow*
|
||||||
return (void *)glfwGetCocoaWindow(platform.handle);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get number of monitors
|
// Get number of monitors
|
||||||
|
|
@ -839,7 +839,7 @@ int GetCurrentMonitor(void)
|
||||||
// this is probably an overengineered solution for a side case
|
// this is probably an overengineered solution for a side case
|
||||||
// trying to match SDL behaviour
|
// trying to match SDL behaviour
|
||||||
|
|
||||||
int closestDist = 0x7FFFFFFF;
|
unsigned int closestDist = 0xFFFFFFFFu;
|
||||||
|
|
||||||
// Window center position
|
// Window center position
|
||||||
int wcx = 0;
|
int wcx = 0;
|
||||||
|
|
@ -883,7 +883,14 @@ int GetCurrentMonitor(void)
|
||||||
|
|
||||||
int dx = wcx - xclosest;
|
int dx = wcx - xclosest;
|
||||||
int dy = wcy - yclosest;
|
int dy = wcy - yclosest;
|
||||||
int dist = (dx*dx) + (dy*dy);
|
|
||||||
|
// Unsigned to dodge signed overflow UB; (-x)^2 == x^2 mod 2^32 so sign drops out.
|
||||||
|
// If |dx| or |dy| >= 65536, dist wraps and the wrong monitor may win.
|
||||||
|
// Not a concern for realistic monitor layouts.
|
||||||
|
unsigned int ux = (unsigned int)dx;
|
||||||
|
unsigned int uy = (unsigned int)dy;
|
||||||
|
unsigned int dist = ux*ux + uy*uy;
|
||||||
|
|
||||||
if (dist < closestDist)
|
if (dist < closestDist)
|
||||||
{
|
{
|
||||||
index = i;
|
index = i;
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@
|
||||||
|
|
||||||
void ShowCursor(void);
|
void ShowCursor(void);
|
||||||
void CloseWindow(void);
|
void CloseWindow(void);
|
||||||
double get_time_seconds(void);
|
double GetTimeSeconds(void);
|
||||||
|
|
||||||
#if defined(__unix__) || defined(__linux__)
|
#if defined(__unix__) || defined(__linux__)
|
||||||
#define _XTYPEDEF_FONT
|
#define _XTYPEDEF_FONT
|
||||||
|
|
@ -184,6 +184,9 @@ typedef struct {
|
||||||
i32 surfaceWidth;
|
i32 surfaceWidth;
|
||||||
i32 surfaceHeight;
|
i32 surfaceHeight;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__linux__) && defined(RGFW_X11)
|
||||||
|
Window windowHandleX11; // Underlying type: unsigned long
|
||||||
|
#endif
|
||||||
} PlatformData;
|
} PlatformData;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
@ -307,113 +310,113 @@ static PlatformData platform = { 0 }; // Platform specific
|
||||||
|
|
||||||
static const unsigned short RGFW_keyConvertTable[] = {
|
static const unsigned short RGFW_keyConvertTable[] = {
|
||||||
[RGFW_keyNULL] = KEY_NULL,
|
[RGFW_keyNULL] = KEY_NULL,
|
||||||
[RGFW_apostrophe] = KEY_APOSTROPHE,
|
[RGFW_keyApostrophe] = KEY_APOSTROPHE,
|
||||||
[RGFW_comma] = KEY_COMMA,
|
[RGFW_keyComma] = KEY_COMMA,
|
||||||
[RGFW_minus] = KEY_MINUS,
|
[RGFW_keyMinus] = KEY_MINUS,
|
||||||
[RGFW_period] = KEY_PERIOD,
|
[RGFW_keyPeriod] = KEY_PERIOD,
|
||||||
[RGFW_slash] = KEY_SLASH,
|
[RGFW_keySlash] = KEY_SLASH,
|
||||||
[RGFW_0] = KEY_ZERO,
|
[RGFW_key0] = KEY_ZERO,
|
||||||
[RGFW_1] = KEY_ONE,
|
[RGFW_key1] = KEY_ONE,
|
||||||
[RGFW_2] = KEY_TWO,
|
[RGFW_key2] = KEY_TWO,
|
||||||
[RGFW_3] = KEY_THREE,
|
[RGFW_key3] = KEY_THREE,
|
||||||
[RGFW_4] = KEY_FOUR,
|
[RGFW_key4] = KEY_FOUR,
|
||||||
[RGFW_5] = KEY_FIVE,
|
[RGFW_key5] = KEY_FIVE,
|
||||||
[RGFW_6] = KEY_SIX,
|
[RGFW_key6] = KEY_SIX,
|
||||||
[RGFW_7] = KEY_SEVEN,
|
[RGFW_key7] = KEY_SEVEN,
|
||||||
[RGFW_8] = KEY_EIGHT,
|
[RGFW_key8] = KEY_EIGHT,
|
||||||
[RGFW_9] = KEY_NINE,
|
[RGFW_key9] = KEY_NINE,
|
||||||
[RGFW_semicolon] = KEY_SEMICOLON,
|
[RGFW_keySemicolon] = KEY_SEMICOLON,
|
||||||
[RGFW_equals] = KEY_EQUAL,
|
[RGFW_keyEquals] = KEY_EQUAL,
|
||||||
[RGFW_a] = KEY_A,
|
[RGFW_keyA] = KEY_A,
|
||||||
[RGFW_b] = KEY_B,
|
[RGFW_keyB] = KEY_B,
|
||||||
[RGFW_c] = KEY_C,
|
[RGFW_keyC] = KEY_C,
|
||||||
[RGFW_d] = KEY_D,
|
[RGFW_keyD] = KEY_D,
|
||||||
[RGFW_e] = KEY_E,
|
[RGFW_keyE] = KEY_E,
|
||||||
[RGFW_f] = KEY_F,
|
[RGFW_keyF] = KEY_F,
|
||||||
[RGFW_g] = KEY_G,
|
[RGFW_keyG] = KEY_G,
|
||||||
[RGFW_h] = KEY_H,
|
[RGFW_keyH] = KEY_H,
|
||||||
[RGFW_i] = KEY_I,
|
[RGFW_keyI] = KEY_I,
|
||||||
[RGFW_j] = KEY_J,
|
[RGFW_keyJ] = KEY_J,
|
||||||
[RGFW_k] = KEY_K,
|
[RGFW_keyK] = KEY_K,
|
||||||
[RGFW_l] = KEY_L,
|
[RGFW_keyL] = KEY_L,
|
||||||
[RGFW_m] = KEY_M,
|
[RGFW_keyM] = KEY_M,
|
||||||
[RGFW_n] = KEY_N,
|
[RGFW_keyN] = KEY_N,
|
||||||
[RGFW_o] = KEY_O,
|
[RGFW_keyO] = KEY_O,
|
||||||
[RGFW_p] = KEY_P,
|
[RGFW_keyP] = KEY_P,
|
||||||
[RGFW_q] = KEY_Q,
|
[RGFW_keyQ] = KEY_Q,
|
||||||
[RGFW_r] = KEY_R,
|
[RGFW_keyR] = KEY_R,
|
||||||
[RGFW_s] = KEY_S,
|
[RGFW_keyS] = KEY_S,
|
||||||
[RGFW_t] = KEY_T,
|
[RGFW_keyT] = KEY_T,
|
||||||
[RGFW_u] = KEY_U,
|
[RGFW_keyU] = KEY_U,
|
||||||
[RGFW_v] = KEY_V,
|
[RGFW_keyV] = KEY_V,
|
||||||
[RGFW_w] = KEY_W,
|
[RGFW_keyW] = KEY_W,
|
||||||
[RGFW_x] = KEY_X,
|
[RGFW_keyX] = KEY_X,
|
||||||
[RGFW_y] = KEY_Y,
|
[RGFW_keyY] = KEY_Y,
|
||||||
[RGFW_z] = KEY_Z,
|
[RGFW_keyZ] = KEY_Z,
|
||||||
[RGFW_bracket] = KEY_LEFT_BRACKET,
|
[RGFW_keyBracket] = KEY_LEFT_BRACKET,
|
||||||
[RGFW_backSlash] = KEY_BACKSLASH,
|
[RGFW_keyBackSlash] = KEY_BACKSLASH,
|
||||||
[RGFW_closeBracket] = KEY_RIGHT_BRACKET,
|
[RGFW_keyCloseBracket] = KEY_RIGHT_BRACKET,
|
||||||
[RGFW_backtick] = KEY_GRAVE,
|
[RGFW_keyBacktick] = KEY_GRAVE,
|
||||||
[RGFW_space] = KEY_SPACE,
|
[RGFW_keySpace] = KEY_SPACE,
|
||||||
[RGFW_escape] = KEY_ESCAPE,
|
[RGFW_keyEscape] = KEY_ESCAPE,
|
||||||
[RGFW_return] = KEY_ENTER,
|
[RGFW_keyReturn] = KEY_ENTER,
|
||||||
[RGFW_tab] = KEY_TAB,
|
[RGFW_keyTab] = KEY_TAB,
|
||||||
[RGFW_backSpace] = KEY_BACKSPACE,
|
[RGFW_keyBackSpace] = KEY_BACKSPACE,
|
||||||
[RGFW_insert] = KEY_INSERT,
|
[RGFW_keyInsert] = KEY_INSERT,
|
||||||
[RGFW_delete] = KEY_DELETE,
|
[RGFW_keyDelete] = KEY_DELETE,
|
||||||
[RGFW_right] = KEY_RIGHT,
|
[RGFW_keyRight] = KEY_RIGHT,
|
||||||
[RGFW_left] = KEY_LEFT,
|
[RGFW_keyLeft] = KEY_LEFT,
|
||||||
[RGFW_down] = KEY_DOWN,
|
[RGFW_keyDown] = KEY_DOWN,
|
||||||
[RGFW_up] = KEY_UP,
|
[RGFW_keyUp] = KEY_UP,
|
||||||
[RGFW_pageUp] = KEY_PAGE_UP,
|
[RGFW_keyPageUp] = KEY_PAGE_UP,
|
||||||
[RGFW_pageDown] = KEY_PAGE_DOWN,
|
[RGFW_keyPageDown] = KEY_PAGE_DOWN,
|
||||||
[RGFW_home] = KEY_HOME,
|
[RGFW_keyHome] = KEY_HOME,
|
||||||
[RGFW_end] = KEY_END,
|
[RGFW_keyEnd] = KEY_END,
|
||||||
[RGFW_capsLock] = KEY_CAPS_LOCK,
|
[RGFW_keyCapsLock] = KEY_CAPS_LOCK,
|
||||||
[RGFW_scrollLock] = KEY_SCROLL_LOCK,
|
[RGFW_keyScrollLock] = KEY_SCROLL_LOCK,
|
||||||
[RGFW_numLock] = KEY_NUM_LOCK,
|
[RGFW_keyNumLock] = KEY_NUM_LOCK,
|
||||||
[RGFW_printScreen] = KEY_PRINT_SCREEN,
|
[RGFW_keyPrintScreen] = KEY_PRINT_SCREEN,
|
||||||
[RGFW_pause] = KEY_PAUSE,
|
[RGFW_keyPause] = KEY_PAUSE,
|
||||||
[RGFW_F1] = KEY_F1,
|
[RGFW_keyF1] = KEY_F1,
|
||||||
[RGFW_F2] = KEY_F2,
|
[RGFW_keyF2] = KEY_F2,
|
||||||
[RGFW_F3] = KEY_F3,
|
[RGFW_keyF3] = KEY_F3,
|
||||||
[RGFW_F4] = KEY_F4,
|
[RGFW_keyF4] = KEY_F4,
|
||||||
[RGFW_F5] = KEY_F5,
|
[RGFW_keyF5] = KEY_F5,
|
||||||
[RGFW_F6] = KEY_F6,
|
[RGFW_keyF6] = KEY_F6,
|
||||||
[RGFW_F7] = KEY_F7,
|
[RGFW_keyF7] = KEY_F7,
|
||||||
[RGFW_F8] = KEY_F8,
|
[RGFW_keyF8] = KEY_F8,
|
||||||
[RGFW_F9] = KEY_F9,
|
[RGFW_keyF9] = KEY_F9,
|
||||||
[RGFW_F10] = KEY_F10,
|
[RGFW_keyF10] = KEY_F10,
|
||||||
[RGFW_F11] = KEY_F11,
|
[RGFW_keyF11] = KEY_F11,
|
||||||
[RGFW_F12] = KEY_F12,
|
[RGFW_keyF12] = KEY_F12,
|
||||||
[RGFW_shiftL] = KEY_LEFT_SHIFT,
|
[RGFW_keyShiftL] = KEY_LEFT_SHIFT,
|
||||||
[RGFW_controlL] = KEY_LEFT_CONTROL,
|
[RGFW_keyControlL] = KEY_LEFT_CONTROL,
|
||||||
[RGFW_altL] = KEY_LEFT_ALT,
|
[RGFW_keyAltL] = KEY_LEFT_ALT,
|
||||||
[RGFW_superL] = KEY_LEFT_SUPER,
|
[RGFW_keySuperL] = KEY_LEFT_SUPER,
|
||||||
// #ifndef RGFW_MACOS
|
// #ifndef RGFW_MACOS
|
||||||
[RGFW_shiftR] = KEY_RIGHT_SHIFT,
|
[RGFW_keyShiftR] = KEY_RIGHT_SHIFT,
|
||||||
[RGFW_controlR] = KEY_RIGHT_CONTROL,
|
[RGFW_keyControlR] = KEY_RIGHT_CONTROL,
|
||||||
[RGFW_altR] = KEY_RIGHT_ALT,
|
[RGFW_keyAltR] = KEY_RIGHT_ALT,
|
||||||
[RGFW_superR] = KEY_RIGHT_SUPER,
|
[RGFW_keySuperR] = KEY_RIGHT_SUPER,
|
||||||
// #endif
|
// #endif
|
||||||
[RGFW_menu] = KEY_KB_MENU,
|
[RGFW_keyMenu] = KEY_KB_MENU,
|
||||||
[RGFW_kp0] = KEY_KP_0,
|
[RGFW_keyPad0] = KEY_KP_0,
|
||||||
[RGFW_kp1] = KEY_KP_1,
|
[RGFW_keyPad1] = KEY_KP_1,
|
||||||
[RGFW_kp2] = KEY_KP_2,
|
[RGFW_keyPad2] = KEY_KP_2,
|
||||||
[RGFW_kp3] = KEY_KP_3,
|
[RGFW_keyPad3] = KEY_KP_3,
|
||||||
[RGFW_kp4] = KEY_KP_4,
|
[RGFW_keyPad4] = KEY_KP_4,
|
||||||
[RGFW_kp5] = KEY_KP_5,
|
[RGFW_keyPad5] = KEY_KP_5,
|
||||||
[RGFW_kp6] = KEY_KP_6,
|
[RGFW_keyPad6] = KEY_KP_6,
|
||||||
[RGFW_kp7] = KEY_KP_7,
|
[RGFW_keyPad7] = KEY_KP_7,
|
||||||
[RGFW_kp8] = KEY_KP_8,
|
[RGFW_keyPad8] = KEY_KP_8,
|
||||||
[RGFW_kp9] = KEY_KP_9,
|
[RGFW_keyPad9] = KEY_KP_9,
|
||||||
[RGFW_kpPeriod] = KEY_KP_DECIMAL,
|
[RGFW_keyPadPeriod] = KEY_KP_DECIMAL,
|
||||||
[RGFW_kpSlash] = KEY_KP_DIVIDE,
|
[RGFW_keyPadSlash] = KEY_KP_DIVIDE,
|
||||||
[RGFW_kpMultiply] = KEY_KP_MULTIPLY,
|
[RGFW_keyPadMultiply] = KEY_KP_MULTIPLY,
|
||||||
[RGFW_kpMinus] = KEY_KP_SUBTRACT,
|
[RGFW_keyPadMinus] = KEY_KP_SUBTRACT,
|
||||||
[RGFW_kpPlus] = KEY_KP_ADD,
|
[RGFW_keyPadPlus] = KEY_KP_ADD,
|
||||||
[RGFW_kpReturn] = KEY_KP_ENTER,
|
[RGFW_keyPadReturn] = KEY_KP_ENTER,
|
||||||
[RGFW_kpEqual] = KEY_KP_EQUAL,
|
[RGFW_keyPadEqual] = KEY_KP_EQUAL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int mg_buttonConvertTable[] = {
|
static int mg_buttonConvertTable[] = {
|
||||||
|
|
@ -453,14 +456,297 @@ static int mg_axisConvertTable[] = {
|
||||||
[MG_AXIS_HAT_DPAD_DOWN] = -1,
|
[MG_AXIS_HAT_DPAD_DOWN] = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static KeyboardKey ConvertScancodeToKey(u32 keycode);
|
||||||
|
void RemapMouseToTouch(int touchAction);
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------
|
||||||
|
// RGFW Callbacks (instead of the older polling)
|
||||||
|
// ---------------------------------------------------------------------------------
|
||||||
|
static void RGFW_cb_mousenotifyfunc(const RGFW_event* e)
|
||||||
|
{
|
||||||
|
if (e->common.win != platform.window) return;
|
||||||
|
|
||||||
|
CORE.Input.Mouse.cursorOnScreen = e->mouse.inWindow;
|
||||||
|
}
|
||||||
|
// static void RGFW_cb_windowclosefunc(const RGFW_event* e)
|
||||||
|
// {
|
||||||
|
// if (e->common.win != platform.window) return;
|
||||||
|
|
||||||
|
// // we don't want to close here. raylib handles it
|
||||||
|
// // RGFW_window_setShouldClose(platform.window, true);
|
||||||
|
// }
|
||||||
|
static void RGFW_cb_dropfunc(const RGFW_event* e)
|
||||||
|
{
|
||||||
|
if (e->common.win != platform.window) return;
|
||||||
|
|
||||||
|
if (CORE.Window.dropFileCount == 0)
|
||||||
|
{
|
||||||
|
CORE.Window.dropFilepaths = (char **)RL_CALLOC(1024, sizeof(char *));
|
||||||
|
|
||||||
|
CORE.Window.dropFilepaths[CORE.Window.dropFileCount] = (char *)RL_CALLOC(MAX_FILEPATH_LENGTH, sizeof(char));
|
||||||
|
strcpy(CORE.Window.dropFilepaths[CORE.Window.dropFileCount], e->drop.value->data);
|
||||||
|
|
||||||
|
CORE.Window.dropFileCount++;
|
||||||
|
}
|
||||||
|
else if (CORE.Window.dropFileCount < 1024)
|
||||||
|
{
|
||||||
|
CORE.Window.dropFilepaths[CORE.Window.dropFileCount] = (char *)RL_CALLOC(MAX_FILEPATH_LENGTH, sizeof(char));
|
||||||
|
strcpy(CORE.Window.dropFilepaths[CORE.Window.dropFileCount], e->drop.value->data);
|
||||||
|
|
||||||
|
CORE.Window.dropFileCount++;
|
||||||
|
}
|
||||||
|
else TRACELOG(LOG_WARNING, "FILE: Maximum drag and drop files at once is limited to 1024 files!");
|
||||||
|
}
|
||||||
|
static void RGFW_cb_windowresizefunc(const RGFW_event* e)
|
||||||
|
{
|
||||||
|
if (e->common.win != platform.window) return;
|
||||||
|
|
||||||
|
CORE.Window.resizedLastFrame = true;
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
||||||
|
{
|
||||||
|
RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window);
|
||||||
|
SetupViewport(platform.window->w*currentMonitor->pixelRatio, platform.window->h*currentMonitor->pixelRatio);
|
||||||
|
CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f);
|
||||||
|
|
||||||
|
CORE.Window.screen.width = platform.window->w;
|
||||||
|
CORE.Window.screen.height = platform.window->h;
|
||||||
|
CORE.Window.render.width = CORE.Window.screen.width*currentMonitor->pixelRatio;
|
||||||
|
CORE.Window.render.height = CORE.Window.screen.height*currentMonitor->pixelRatio;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetupViewport(platform.window->w, platform.window->h);
|
||||||
|
CORE.Window.screen.width = platform.window->w;
|
||||||
|
CORE.Window.screen.height = platform.window->h;
|
||||||
|
CORE.Window.render.width = CORE.Window.screen.width;
|
||||||
|
CORE.Window.render.height = CORE.Window.screen.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||||
|
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||||
|
#elif defined(PLATFORM_WEB_RGFW)
|
||||||
|
// do nothing but prevent other behavior
|
||||||
|
#else
|
||||||
|
SetupViewport(platform.window->w, platform.window->h);
|
||||||
|
|
||||||
|
// Consider content scaling if required
|
||||||
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
||||||
|
{
|
||||||
|
Vector2 scaleDpi = GetWindowScaleDPI();
|
||||||
|
CORE.Window.screen.width = (int)(platform.window->w/scaleDpi.x);
|
||||||
|
CORE.Window.screen.height = (int)(platform.window->h/scaleDpi.y);
|
||||||
|
CORE.Window.screenScale = MatrixScale(scaleDpi.x, scaleDpi.y, 1.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CORE.Window.screen.width = platform.window->w;
|
||||||
|
CORE.Window.screen.height = platform.window->h;
|
||||||
|
}
|
||||||
|
|
||||||
|
CORE.Window.currentFbo.width = CORE.Window.screen.width;
|
||||||
|
CORE.Window.currentFbo.height = CORE.Window.screen.height;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window);
|
||||||
|
CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f);
|
||||||
|
SetupViewport(platform.window->w*currentMonitor->pixelRatio, platform.window->h*currentMonitor->pixelRatio);
|
||||||
|
|
||||||
|
CORE.Window.render.width = CORE.Window.screen.width*currentMonitor->pixelRatio;
|
||||||
|
CORE.Window.render.height = CORE.Window.screen.height*currentMonitor->pixelRatio;
|
||||||
|
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||||
|
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||||
|
#endif
|
||||||
|
platform.surfaceWidth = CORE.Window.currentFbo.width;
|
||||||
|
platform.surfaceHeight = CORE.Window.currentFbo.height;
|
||||||
|
|
||||||
|
// in software mode we dont have the viewport so we need to reverse the highdpi changes
|
||||||
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
||||||
|
{
|
||||||
|
Vector2 scaleDpi = GetWindowScaleDPI();
|
||||||
|
platform.surfaceWidth *= scaleDpi.x;
|
||||||
|
platform.surfaceHeight *= scaleDpi.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (platform.surfacePixels != NULL)
|
||||||
|
{
|
||||||
|
RL_FREE(platform.surfacePixels);
|
||||||
|
platform.surfacePixels = RL_MALLOC(platform.surfaceWidth*platform.surfaceHeight*4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (platform.surface != NULL)
|
||||||
|
{
|
||||||
|
RGFW_surface_free(platform.surface);
|
||||||
|
platform.surface = RGFW_window_createSurface(platform.window, platform.surfacePixels, platform.surfaceWidth, platform.surfaceHeight, RGFW_formatBGRA8);
|
||||||
|
swResize(platform.surfaceWidth, platform.surfaceHeight);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
static void RGFW_cb_windowmaximizefunc(const RGFW_event* e)
|
||||||
|
{
|
||||||
|
if (e->common.win != platform.window) return;
|
||||||
|
|
||||||
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED); // The window was maximized
|
||||||
|
}
|
||||||
|
static void RGFW_cb_windowminimizefunc(const RGFW_event* e)
|
||||||
|
{
|
||||||
|
if (e->common.win != platform.window) return;
|
||||||
|
|
||||||
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED); // The window was iconified
|
||||||
|
}
|
||||||
|
static void RGFW_cb_windowrestorefunc(const RGFW_event* e)
|
||||||
|
{
|
||||||
|
if (e->common.win != platform.window) return;
|
||||||
|
|
||||||
|
if (RGFW_window_isMaximized(platform.window))
|
||||||
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED); // The window was restored
|
||||||
|
if (RGFW_window_isMinimized(platform.window))
|
||||||
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MINIMIZED); // The window was restored
|
||||||
|
}
|
||||||
|
static void RGFW_cb_windowmovefunc(const RGFW_event* e)
|
||||||
|
{
|
||||||
|
if (e->common.win != platform.window) return;
|
||||||
|
|
||||||
|
CORE.Window.position.x = platform.window->x;
|
||||||
|
CORE.Window.position.y = platform.window->x;
|
||||||
|
}
|
||||||
|
static void RGFW_cb_keycharfunc(const RGFW_event* e)
|
||||||
|
{
|
||||||
|
if (e->common.win != platform.window) return;
|
||||||
|
|
||||||
|
// NOTE: event.text.text data comes an UTF-8 text sequence but registering codepoints (int)
|
||||||
|
// Check if there is space available in the queue
|
||||||
|
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
||||||
|
{
|
||||||
|
// Add character (codepoint) to the queue
|
||||||
|
CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = e->keyChar.value;
|
||||||
|
CORE.Input.Keyboard.charPressedQueueCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void RGFW_cb_scrollfunc(const RGFW_event* e)
|
||||||
|
{
|
||||||
|
if (e->common.win != platform.window) return;
|
||||||
|
|
||||||
|
CORE.Input.Mouse.currentWheelMove.x += e->delta.x;
|
||||||
|
CORE.Input.Mouse.currentWheelMove.y += e->delta.y;
|
||||||
|
}
|
||||||
|
static void RGFW_cb_mousebuttonfunc(const RGFW_event* e)
|
||||||
|
{
|
||||||
|
if (e->common.win != platform.window) return;
|
||||||
|
|
||||||
|
int btn = e->button.value;
|
||||||
|
if (btn == RGFW_mouseLeft) btn = 1;
|
||||||
|
else if (btn == RGFW_mouseRight) btn = 2;
|
||||||
|
else if (btn == RGFW_mouseMiddle) btn = 3;
|
||||||
|
|
||||||
|
// pressed or released
|
||||||
|
if (e->button.state){
|
||||||
|
CORE.Input.Mouse.currentButtonState[btn - 1] = 1;
|
||||||
|
CORE.Input.Touch.currentTouchState[btn - 1] = 1;
|
||||||
|
|
||||||
|
// simulate touch with the mouse
|
||||||
|
RemapMouseToTouch(1);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
CORE.Input.Mouse.currentButtonState[btn - 1] = 0;
|
||||||
|
CORE.Input.Touch.currentTouchState[btn - 1] = 0;
|
||||||
|
|
||||||
|
// simulate touch with the mouse
|
||||||
|
RemapMouseToTouch(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void RGFW_cb_mouserawmotionfunc(const RGFW_event* e)
|
||||||
|
{
|
||||||
|
if (!RGFW_window_isRawMouseMode(platform.window))
|
||||||
|
{
|
||||||
|
// if not raw, use non-raw motion. this prevents the doubled events
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float mouseX = 0.0f;
|
||||||
|
float mouseY = 0.0f;
|
||||||
|
mouseX = e->delta.x;
|
||||||
|
mouseY = e->delta.y;
|
||||||
|
|
||||||
|
#if defined(__EMSCRIPTEN__)
|
||||||
|
double canvasWidth = 0.0;
|
||||||
|
double canvasHeight = 0.0;
|
||||||
|
emscripten_get_element_css_size("#canvas", &canvasWidth, &canvasHeight);
|
||||||
|
mouseX *= ((float)GetScreenWidth()/(float)canvasWidth);
|
||||||
|
mouseY *= ((float)GetScreenHeight()/(float)canvasHeight);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CORE.Input.Mouse.currentPosition.x += mouseX;
|
||||||
|
CORE.Input.Mouse.currentPosition.y += mouseY;
|
||||||
|
|
||||||
|
// simulate touch with the mouse
|
||||||
|
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
|
||||||
|
RemapMouseToTouch(2);
|
||||||
|
}
|
||||||
|
static void RGFW_cb_mousemotionfunc(const RGFW_event* e)
|
||||||
|
{
|
||||||
|
if (RGFW_window_isRawMouseMode(platform.window))
|
||||||
|
{
|
||||||
|
// if raw, use raw motion. this prevents the doubled events
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float mouseX = 0.0f;
|
||||||
|
float mouseY = 0.0f;
|
||||||
|
mouseX = e->mouse.x;
|
||||||
|
mouseY = e->mouse.y;
|
||||||
|
|
||||||
|
#if defined(__EMSCRIPTEN__)
|
||||||
|
double canvasWidth = 0.0;
|
||||||
|
double canvasHeight = 0.0;
|
||||||
|
emscripten_get_element_css_size("#canvas", &canvasWidth, &canvasHeight);
|
||||||
|
mouseX *= ((float)GetScreenWidth()/(float)canvasWidth);
|
||||||
|
mouseY *= ((float)GetScreenHeight()/(float)canvasHeight);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CORE.Input.Mouse.currentPosition.x = mouseX;
|
||||||
|
CORE.Input.Mouse.currentPosition.y = mouseY;
|
||||||
|
|
||||||
|
// simulate touch with the mouse
|
||||||
|
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
|
||||||
|
RemapMouseToTouch(2);
|
||||||
|
}
|
||||||
|
static void RGFW_cb_keyfunc(const RGFW_keyEvent* e)
|
||||||
|
{
|
||||||
|
if (e->win != platform.window) return;
|
||||||
|
|
||||||
|
KeyboardKey key = ConvertScancodeToKey(e->value);
|
||||||
|
if (key == KEY_NULL) return;
|
||||||
|
|
||||||
|
// pressed or released
|
||||||
|
if (e->state)
|
||||||
|
{
|
||||||
|
// If key was up, add it to the key pressed queue
|
||||||
|
if ((CORE.Input.Keyboard.currentKeyState[key] == 0) && (CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE))
|
||||||
|
{
|
||||||
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = key;
|
||||||
|
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
CORE.Input.Keyboard.currentKeyState[key] = 1;
|
||||||
|
|
||||||
|
if (CORE.Input.Keyboard.currentKeyState[CORE.Input.Keyboard.exitKey]) RGFW_window_setShouldClose(platform.window, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CORE.Input.Keyboard.currentKeyState[key] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Internal Functions Declaration
|
// Module Internal Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
||||||
bool InitGraphicsDevice(void); // Initialize graphics device
|
bool InitGraphicsDevice(void); // Initialize graphics device
|
||||||
|
|
||||||
static KeyboardKey ConvertScancodeToKey(u32 keycode);
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Declaration
|
// Module Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
@ -473,10 +759,9 @@ static KeyboardKey ConvertScancodeToKey(u32 keycode);
|
||||||
// Check if application should close
|
// Check if application should close
|
||||||
bool WindowShouldClose(void)
|
bool WindowShouldClose(void)
|
||||||
{
|
{
|
||||||
if (CORE.Window.shouldClose == false)
|
if (CORE.Window.shouldClose == false) CORE.Window.shouldClose = RGFW_window_shouldClose(platform.window);
|
||||||
CORE.Window.shouldClose = RGFW_window_shouldClose(platform.window);
|
|
||||||
if (CORE.Window.ready) return CORE.Window.shouldClose;
|
if (CORE.Window.ready) return CORE.Window.shouldClose;
|
||||||
else return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle fullscreen mode
|
// Toggle fullscreen mode
|
||||||
|
|
@ -851,15 +1136,25 @@ void SetWindowFocused(void)
|
||||||
// Get native window handle
|
// Get native window handle
|
||||||
void *GetWindowHandle(void)
|
void *GetWindowHandle(void)
|
||||||
{
|
{
|
||||||
if (platform.window == NULL) return NULL;
|
void *handle = NULL;
|
||||||
|
|
||||||
#if defined(RGFW_WASM)
|
if (platform.window != NULL)
|
||||||
return (void *)&platform.window->src.ctx;
|
{
|
||||||
#elif defined(RGFW_WAYLAND)
|
#if defined(_WIN32)
|
||||||
return (void *)platform.window->src.surface;
|
handle = (void *)platform.window->src.window; // Type: HWND
|
||||||
#else
|
#elif defined(__linux__)
|
||||||
return (void *)platform.window->src.window;
|
#if defined(RGFW_X11)
|
||||||
|
platform.windowHandleX11 = platform.window->src.window; // Type: Window (unsigned long)
|
||||||
|
handle = &platform.window->src.window;
|
||||||
|
#elif defined(RGFW_WAYLAND)
|
||||||
|
handle = (void *)platform.window->src.surface; // Type: struct wl_surface*
|
||||||
|
#endif
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
handle = (void *)platform.window->src.window; // Type: id, NSWindow*
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get number of monitors
|
// Get number of monitors
|
||||||
|
|
@ -1168,7 +1463,7 @@ double GetTime(void)
|
||||||
{
|
{
|
||||||
// CORE.Time.base is nanoseconds as integer
|
// CORE.Time.base is nanoseconds as integer
|
||||||
double baseTime = (double)CORE.Time.base*1e-9;
|
double baseTime = (double)CORE.Time.base*1e-9;
|
||||||
double time = get_time_seconds() - baseTime;
|
double time = GetTimeSeconds() - baseTime;
|
||||||
|
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
@ -1275,9 +1570,6 @@ void PollInputEvents(void)
|
||||||
// Map touch position to mouse position for convenience
|
// Map touch position to mouse position for convenience
|
||||||
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
|
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 realTouch = false; // Flag to differentiate real touch gestures from mouse ones
|
|
||||||
|
|
||||||
// Register previous keys states
|
// Register previous keys states
|
||||||
// NOTE: Android supports up to 260 keys
|
// NOTE: Android supports up to 260 keys
|
||||||
for (int i = 0; i < MAX_KEYBOARD_KEYS; i++)
|
for (int i = 0; i < MAX_KEYBOARD_KEYS; i++)
|
||||||
|
|
@ -1309,291 +1601,9 @@ void PollInputEvents(void)
|
||||||
CORE.Time.previous = GetTime();
|
CORE.Time.previous = GetTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
RGFW_event rgfw_event;
|
//-----------------------------------------------------------------------------
|
||||||
while (RGFW_window_checkEvent(platform.window, &rgfw_event))
|
// using RGFW callbacks instead of polling
|
||||||
{
|
RGFW_pollEvents();
|
||||||
// All input events can be processed after polling
|
|
||||||
switch (rgfw_event.type)
|
|
||||||
{
|
|
||||||
case RGFW_mouseEnter: CORE.Input.Mouse.cursorOnScreen = true; break;
|
|
||||||
case RGFW_mouseLeave: CORE.Input.Mouse.cursorOnScreen = false; break;
|
|
||||||
case RGFW_quit:
|
|
||||||
RGFW_window_setShouldClose(platform.window, true);
|
|
||||||
return;
|
|
||||||
case RGFW_dataDrop: // Dropped file
|
|
||||||
{
|
|
||||||
for (int i = 0; i < rgfw_event.drop.count; i++)
|
|
||||||
{
|
|
||||||
if (CORE.Window.dropFileCount == 0)
|
|
||||||
{
|
|
||||||
// When a new file is dropped, reserve a fixed number of slots for all possible dropped files
|
|
||||||
// at the moment limiting the number of drops at once to 1024 files but this behaviour should probably be reviewed
|
|
||||||
// TODO: Pointers should probably be reallocated for any new file added...
|
|
||||||
CORE.Window.dropFilepaths = (char **)RL_CALLOC(1024, sizeof(char *));
|
|
||||||
|
|
||||||
CORE.Window.dropFilepaths[CORE.Window.dropFileCount] = (char *)RL_CALLOC(MAX_FILEPATH_LENGTH, sizeof(char));
|
|
||||||
strcpy(CORE.Window.dropFilepaths[CORE.Window.dropFileCount], rgfw_event.drop.files[i]);
|
|
||||||
|
|
||||||
CORE.Window.dropFileCount++;
|
|
||||||
}
|
|
||||||
else if (CORE.Window.dropFileCount < 1024)
|
|
||||||
{
|
|
||||||
CORE.Window.dropFilepaths[CORE.Window.dropFileCount] = (char *)RL_CALLOC(MAX_FILEPATH_LENGTH, sizeof(char));
|
|
||||||
strcpy(CORE.Window.dropFilepaths[CORE.Window.dropFileCount], rgfw_event.drop.files[i]);
|
|
||||||
|
|
||||||
CORE.Window.dropFileCount++;
|
|
||||||
}
|
|
||||||
else TRACELOG(LOG_WARNING, "FILE: Maximum drag and drop files at once is limited to 1024 files!");
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
|
|
||||||
// Window events are also polled (Minimized, maximized, close...)
|
|
||||||
case RGFW_windowResized:
|
|
||||||
{
|
|
||||||
// set flag that the window was resized
|
|
||||||
CORE.Window.resizedLastFrame = true;
|
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
|
||||||
{
|
|
||||||
RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window);
|
|
||||||
SetupViewport(platform.window->w*currentMonitor->pixelRatio, platform.window->h*currentMonitor->pixelRatio);
|
|
||||||
CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f);
|
|
||||||
|
|
||||||
CORE.Window.screen.width = platform.window->w;
|
|
||||||
CORE.Window.screen.height = platform.window->h;
|
|
||||||
CORE.Window.render.width = CORE.Window.screen.width*currentMonitor->pixelRatio;
|
|
||||||
CORE.Window.render.height = CORE.Window.screen.height*currentMonitor->pixelRatio;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetupViewport(platform.window->w, platform.window->h);
|
|
||||||
CORE.Window.screen.width = platform.window->w;
|
|
||||||
CORE.Window.screen.height = platform.window->h;
|
|
||||||
CORE.Window.render.width = CORE.Window.screen.width;
|
|
||||||
CORE.Window.render.height = CORE.Window.screen.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
|
||||||
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
|
||||||
#elif defined(PLATFORM_WEB_RGFW)
|
|
||||||
// do nothing but prevent other behavior
|
|
||||||
#else
|
|
||||||
SetupViewport(platform.window->w, platform.window->h);
|
|
||||||
|
|
||||||
// Consider content scaling if required
|
|
||||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
|
||||||
{
|
|
||||||
Vector2 scaleDpi = GetWindowScaleDPI();
|
|
||||||
CORE.Window.screen.width = (int)(platform.window->w/scaleDpi.x);
|
|
||||||
CORE.Window.screen.height = (int)(platform.window->h/scaleDpi.y);
|
|
||||||
CORE.Window.screenScale = MatrixScale(scaleDpi.x, scaleDpi.y, 1.0f);
|
|
||||||
|
|
||||||
// Mouse scale does not seem to be needed
|
|
||||||
//SetMouseScale(1.0f/scaleDpi.x, 1.0f/scaleDpi.y);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CORE.Window.screen.width = platform.window->w;
|
|
||||||
CORE.Window.screen.height = platform.window->h;
|
|
||||||
}
|
|
||||||
|
|
||||||
CORE.Window.currentFbo.width = CORE.Window.screen.width;
|
|
||||||
CORE.Window.currentFbo.height = CORE.Window.screen.height;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window);
|
|
||||||
CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f);
|
|
||||||
SetupViewport(platform.window->w*currentMonitor->pixelRatio, platform.window->h*currentMonitor->pixelRatio);
|
|
||||||
|
|
||||||
CORE.Window.render.width = CORE.Window.screen.width*currentMonitor->pixelRatio;
|
|
||||||
CORE.Window.render.height = CORE.Window.screen.height*currentMonitor->pixelRatio;
|
|
||||||
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
|
||||||
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
|
||||||
#endif
|
|
||||||
platform.surfaceWidth = CORE.Window.currentFbo.width;
|
|
||||||
platform.surfaceHeight = CORE.Window.currentFbo.height;
|
|
||||||
|
|
||||||
// in software mode we dont have the viewport so we need to reverse the highdpi changes
|
|
||||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
|
||||||
{
|
|
||||||
Vector2 scaleDpi = GetWindowScaleDPI();
|
|
||||||
platform.surfaceWidth *= scaleDpi.x;
|
|
||||||
platform.surfaceHeight *= scaleDpi.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (platform.surfacePixels != NULL)
|
|
||||||
{
|
|
||||||
RL_FREE(platform.surfacePixels);
|
|
||||||
platform.surfacePixels = RL_MALLOC(platform.surfaceWidth*platform.surfaceHeight*4);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (platform.surface != NULL)
|
|
||||||
{
|
|
||||||
RGFW_surface_free(platform.surface);
|
|
||||||
platform.surface = RGFW_window_createSurface(platform.window, platform.surfacePixels, platform.surfaceWidth, platform.surfaceHeight, RGFW_formatBGRA8);
|
|
||||||
swResize(platform.surfaceWidth, platform.surfaceHeight);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} break;
|
|
||||||
case RGFW_windowMaximized:
|
|
||||||
{
|
|
||||||
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED); // The window was maximized
|
|
||||||
} break;
|
|
||||||
case RGFW_windowMinimized:
|
|
||||||
{
|
|
||||||
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED); // The window was iconified
|
|
||||||
} break;
|
|
||||||
case RGFW_windowRestored:
|
|
||||||
{
|
|
||||||
if (RGFW_window_isMaximized(platform.window))
|
|
||||||
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED); // The window was restored
|
|
||||||
if (RGFW_window_isMinimized(platform.window))
|
|
||||||
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MINIMIZED); // The window was restored
|
|
||||||
} break;
|
|
||||||
case RGFW_windowMoved:
|
|
||||||
{
|
|
||||||
CORE.Window.position.x = platform.window->x;
|
|
||||||
CORE.Window.position.y = platform.window->x;
|
|
||||||
} break;
|
|
||||||
|
|
||||||
// Keyboard events
|
|
||||||
case RGFW_keyPressed:
|
|
||||||
{
|
|
||||||
KeyboardKey key = ConvertScancodeToKey(rgfw_event.key.value);
|
|
||||||
if (key != KEY_NULL)
|
|
||||||
{
|
|
||||||
// If key was up, add it to the key pressed queue
|
|
||||||
if ((CORE.Input.Keyboard.currentKeyState[key] == 0) && (CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE))
|
|
||||||
{
|
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = key;
|
|
||||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
CORE.Input.Keyboard.currentKeyState[key] = 1;
|
|
||||||
|
|
||||||
if (CORE.Input.Keyboard.currentKeyState[CORE.Input.Keyboard.exitKey]) RGFW_window_setShouldClose(platform.window, true);
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
case RGFW_keyReleased:
|
|
||||||
{
|
|
||||||
KeyboardKey key = ConvertScancodeToKey(rgfw_event.key.value);
|
|
||||||
if (key != KEY_NULL) CORE.Input.Keyboard.currentKeyState[key] = 0;
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case RGFW_keyChar:
|
|
||||||
{
|
|
||||||
// NOTE: event.text.text data comes an UTF-8 text sequence but registering codepoints (int)
|
|
||||||
// Check if there is space available in the queue
|
|
||||||
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
|
||||||
{
|
|
||||||
// Add character (codepoint) to the queue
|
|
||||||
CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = rgfw_event.keyChar.value;
|
|
||||||
CORE.Input.Keyboard.charPressedQueueCount++;
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
|
|
||||||
// Check mouse events
|
|
||||||
case RGFW_mouseScroll:
|
|
||||||
{
|
|
||||||
CORE.Input.Mouse.currentWheelMove.x += rgfw_event.scroll.x;
|
|
||||||
CORE.Input.Mouse.currentWheelMove.y += rgfw_event.scroll.y;
|
|
||||||
} break;
|
|
||||||
case RGFW_mouseButtonPressed:
|
|
||||||
{
|
|
||||||
int btn = rgfw_event.button.value;
|
|
||||||
if (btn == RGFW_mouseLeft) btn = 1;
|
|
||||||
else if (btn == RGFW_mouseRight) btn = 2;
|
|
||||||
else if (btn == RGFW_mouseMiddle) btn = 3;
|
|
||||||
|
|
||||||
CORE.Input.Mouse.currentButtonState[btn - 1] = 1;
|
|
||||||
CORE.Input.Touch.currentTouchState[btn - 1] = 1;
|
|
||||||
|
|
||||||
touchAction = 1;
|
|
||||||
} break;
|
|
||||||
case RGFW_mouseButtonReleased:
|
|
||||||
{
|
|
||||||
int btn = rgfw_event.button.value;
|
|
||||||
if (btn == RGFW_mouseLeft) btn = 1;
|
|
||||||
else if (btn == RGFW_mouseRight) btn = 2;
|
|
||||||
else if (btn == RGFW_mouseMiddle) btn = 3;
|
|
||||||
|
|
||||||
CORE.Input.Mouse.currentButtonState[btn - 1] = 0;
|
|
||||||
CORE.Input.Touch.currentTouchState[btn - 1] = 0;
|
|
||||||
|
|
||||||
touchAction = 0;
|
|
||||||
} break;
|
|
||||||
case RGFW_mousePosChanged:
|
|
||||||
{
|
|
||||||
float mouseX = 0.0f;
|
|
||||||
float mouseY = 0.0f;
|
|
||||||
if (RGFW_window_isCaptured(platform.window))
|
|
||||||
{
|
|
||||||
mouseX = (float)rgfw_event.mouse.vecX;
|
|
||||||
mouseY = (float)rgfw_event.mouse.vecY;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mouseX = (float)rgfw_event.mouse.x;
|
|
||||||
mouseY = (float)rgfw_event.mouse.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(__EMSCRIPTEN__)
|
|
||||||
double canvasWidth = 0.0;
|
|
||||||
double canvasHeight = 0.0;
|
|
||||||
emscripten_get_element_css_size("#canvas", &canvasWidth, &canvasHeight);
|
|
||||||
mouseX *= ((float)GetScreenWidth()/(float)canvasWidth);
|
|
||||||
mouseY *= ((float)GetScreenHeight()/(float)canvasHeight);
|
|
||||||
#endif
|
|
||||||
if (RGFW_window_isCaptured(platform.window))
|
|
||||||
{
|
|
||||||
CORE.Input.Mouse.currentPosition.x += mouseX;
|
|
||||||
CORE.Input.Mouse.currentPosition.y += mouseY;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CORE.Input.Mouse.currentPosition.x = mouseX;
|
|
||||||
CORE.Input.Mouse.currentPosition.y = mouseY;
|
|
||||||
}
|
|
||||||
|
|
||||||
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
|
|
||||||
touchAction = 2;
|
|
||||||
} break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if SUPPORT_GESTURES_SYSTEM
|
|
||||||
if (touchAction > -1)
|
|
||||||
{
|
|
||||||
// Process mouse events as touches to be able to use mouse-gestures
|
|
||||||
GestureEvent gestureEvent = { 0 };
|
|
||||||
|
|
||||||
// Register touch actions
|
|
||||||
gestureEvent.touchAction = touchAction;
|
|
||||||
|
|
||||||
// Assign a pointer ID
|
|
||||||
gestureEvent.pointId[0] = 0;
|
|
||||||
|
|
||||||
// Register touch points count
|
|
||||||
gestureEvent.pointCount = 1;
|
|
||||||
|
|
||||||
// Register touch points position, only one point registered
|
|
||||||
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
|
|
||||||
gestureEvent.position[0].x /= (float)GetScreenWidth();
|
|
||||||
gestureEvent.position[0].y /= (float)GetScreenHeight();
|
|
||||||
|
|
||||||
// Gesture data is sent to gestures-system for processing
|
|
||||||
ProcessGestureEvent(gestureEvent);
|
|
||||||
|
|
||||||
touchAction = -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
mg_event gamepad_event;
|
mg_event gamepad_event;
|
||||||
|
|
@ -1650,9 +1660,12 @@ void PollInputEvents(void)
|
||||||
|
|
||||||
int axisCount = 0;
|
int axisCount = 0;
|
||||||
for (int i = 0; i < MG_AXIS_COUNT; i += 1) {
|
for (int i = 0; i < MG_AXIS_COUNT; i += 1) {
|
||||||
if (platform.minigamepad.gamepads[gamepadIndex].axes[i].supported) {
|
if (platform.minigamepad.gamepads[gamepadIndex].axes[i].supported)
|
||||||
|
{
|
||||||
axisCount += 1;
|
axisCount += 1;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1873,6 +1886,25 @@ int InitPlatform(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Set callbacks
|
||||||
|
RGFW_setEventCallback(RGFW_mouseEnter, RGFW_cb_mousenotifyfunc);
|
||||||
|
RGFW_setEventCallback(RGFW_mouseLeave, RGFW_cb_mousenotifyfunc);
|
||||||
|
// RGFW_setEventCallback(RGFW_windowClose, RGFW_cb_windowclosefunc); // do not close here. let raylib handle it
|
||||||
|
RGFW_setEventCallback(RGFW_dataDrop, RGFW_cb_dropfunc);
|
||||||
|
RGFW_setEventCallback(RGFW_windowResized, RGFW_cb_windowresizefunc);
|
||||||
|
RGFW_setEventCallback(RGFW_windowMaximized, RGFW_cb_windowmaximizefunc);
|
||||||
|
RGFW_setEventCallback(RGFW_windowMinimized, RGFW_cb_windowminimizefunc);
|
||||||
|
RGFW_setEventCallback(RGFW_windowRestored, RGFW_cb_windowrestorefunc);
|
||||||
|
RGFW_setEventCallback(RGFW_windowMoved, RGFW_cb_windowmovefunc);
|
||||||
|
RGFW_setEventCallback(RGFW_keyChar, RGFW_cb_keycharfunc);
|
||||||
|
RGFW_setEventCallback(RGFW_mouseScroll, RGFW_cb_scrollfunc);
|
||||||
|
RGFW_setEventCallback(RGFW_mouseButtonPressed, RGFW_cb_mousebuttonfunc);
|
||||||
|
RGFW_setEventCallback(RGFW_mouseButtonReleased, RGFW_cb_mousebuttonfunc);
|
||||||
|
RGFW_setEventCallback(RGFW_mouseRawMotion, RGFW_cb_mouserawmotionfunc);
|
||||||
|
RGFW_setEventCallback(RGFW_mouseMotion, RGFW_cb_mousemotionfunc);
|
||||||
|
RGFW_setEventCallback(RGFW_keyPressed, (RGFW_genericFunc)RGFW_cb_keyfunc);
|
||||||
|
RGFW_setEventCallback(RGFW_keyReleased, (RGFW_genericFunc)RGFW_cb_keyfunc);
|
||||||
|
|
||||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully %s",
|
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully %s",
|
||||||
FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)? "(HighDPI)" : "");
|
FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)? "(HighDPI)" : "");
|
||||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||||
|
|
@ -1994,8 +2026,39 @@ static KeyboardKey ConvertScancodeToKey(u32 keycode)
|
||||||
return (KeyboardKey)RGFW_keyConvertTable[keycode];
|
return (KeyboardKey)RGFW_keyConvertTable[keycode];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// assign mouse to touches
|
||||||
|
// 0-TOUCH_ACTION_UP, 1-TOUCH_ACTION_DOWN, 2-TOUCH_ACTION_MOVE
|
||||||
|
void RemapMouseToTouch(int touchAction)
|
||||||
|
{
|
||||||
|
#if SUPPORT_GESTURES_SYSTEM
|
||||||
|
if (touchAction < 0) return;
|
||||||
|
|
||||||
|
GestureEvent gestureEvent = { 0 };
|
||||||
|
|
||||||
|
// Register touch actions
|
||||||
|
gestureEvent.touchAction = touchAction;
|
||||||
|
|
||||||
|
// Assign a pointer ID
|
||||||
|
gestureEvent.pointId[0] = 0;
|
||||||
|
|
||||||
|
// Register touch points count
|
||||||
|
gestureEvent.pointCount = 1;
|
||||||
|
|
||||||
|
// Register touch points position, only one point registered
|
||||||
|
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
|
||||||
|
gestureEvent.position[0].x /= (float)GetScreenWidth();
|
||||||
|
gestureEvent.position[0].y /= (float)GetScreenHeight();
|
||||||
|
|
||||||
|
// Gesture data is sent to gestures-system for processing
|
||||||
|
ProcessGestureEvent(gestureEvent);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Helper functions for Time
|
// Helper functions for Time
|
||||||
double get_time_seconds(void)
|
double GetTimeSeconds(void)
|
||||||
{
|
{
|
||||||
double currentTime = 0.0;
|
double currentTime = 0.0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@
|
||||||
#include "SDL3/SDL.h"
|
#include "SDL3/SDL.h"
|
||||||
#elif defined(USING_SDL2_PROJECT)
|
#elif defined(USING_SDL2_PROJECT)
|
||||||
#include "SDL2/SDL.h"
|
#include "SDL2/SDL.h"
|
||||||
|
#include "SDL2/SDL_syswm.h" // Required to get window handlers
|
||||||
#else
|
#else
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -101,6 +102,13 @@ typedef struct {
|
||||||
SDL_GameController *gamepad[MAX_GAMEPADS];
|
SDL_GameController *gamepad[MAX_GAMEPADS];
|
||||||
SDL_JoystickID gamepadId[MAX_GAMEPADS]; // Joystick instance ids, they do not start from 0
|
SDL_JoystickID gamepadId[MAX_GAMEPADS]; // Joystick instance ids, they do not start from 0
|
||||||
SDL_Cursor *cursor;
|
SDL_Cursor *cursor;
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
// Local storage for the window handle (X11)
|
||||||
|
// NOTE: On SDL is not possible to know windowing backend at compile time, so,
|
||||||
|
// just in case, avoiding X11 specific types here
|
||||||
|
unsigned long windowHandleX11; // Underlying type for: XID, Window
|
||||||
|
#endif
|
||||||
} PlatformData;
|
} PlatformData;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
@ -920,9 +928,60 @@ void SetWindowFocused(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get native window handle
|
// Get native window handle
|
||||||
|
// NOTE: Handle type depends on OS and windowing system
|
||||||
void *GetWindowHandle(void)
|
void *GetWindowHandle(void)
|
||||||
{
|
{
|
||||||
return (void *)platform.window;
|
void *handle = NULL;
|
||||||
|
|
||||||
|
#if defined(USING_SDL3_PROJECT)
|
||||||
|
// REF: https://github.com/libsdl-org/SDL/blob/main/include/SDL3/SDL_video.h#L1590
|
||||||
|
SDL_PropertiesID props = SDL_GetWindowProperties(platform.window);
|
||||||
|
#if defined(_WIN32)
|
||||||
|
handle = (void *)SDL_GetPointerProperty(props, SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); // Type: HWND
|
||||||
|
#elif defined(__linux__)
|
||||||
|
unsigned long windowId = (unsigned long)SDL_GetNumberProperty(props, SDL_PROP_WINDOW_X11_WINDOW_NUMBER, 0); // Type: unsigned long (XID, Window)
|
||||||
|
if (windowId != 0)
|
||||||
|
{
|
||||||
|
// X11 window ID
|
||||||
|
platform.windowHandleX11 = windowId;
|
||||||
|
handle = &platform.windowHandleX11;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Wayland, get display surface pointer
|
||||||
|
// NOTE: Alternative SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER
|
||||||
|
handle = (void *)SDL_GetPointerProperty(props, SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER, NULL); // Type: struct wl_surface*
|
||||||
|
}
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
handle = (void *)SDL_GetPointerProperty(props, SDL_PROP_WINDOW_COCOA_WINDOW_POINTER, NULL); // Type: NSWindow*
|
||||||
|
#endif
|
||||||
|
#elif defined(USING_SDL2_PROJECT)
|
||||||
|
SDL_SysWMinfo wmInfo = { 0 };
|
||||||
|
SDL_VERSION(&wmInfo.version);
|
||||||
|
if (SDL_GetWindowWMInfo(platform.window, &wmInfo))
|
||||||
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
handle = (void *)wmInfo.info.win.window; // Type: HWND
|
||||||
|
#elif defined(__linux__)
|
||||||
|
if (wmInfo.subsystem == SDL_SYSWM_X11)
|
||||||
|
{
|
||||||
|
// X11, get window ID (unsigned long)
|
||||||
|
platform.windowHandleX11 = (unsigned long)wmInfo.info.x11.window;
|
||||||
|
handle = &platform.windowHandleX11;
|
||||||
|
}
|
||||||
|
else if (wmInfo.subsystem == SDL_SYSWM_WAYLAND)
|
||||||
|
{
|
||||||
|
// Wayland, get display surface pointer
|
||||||
|
// NOTE: Alternative: wmInfo.info.wl.display
|
||||||
|
handle = (void *)wmInfo.info.wl.surface; // Type: struct wl_surface*
|
||||||
|
}
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
handle = (void *)wmInfo.info.cocoa.window; // Type: NSWindow*
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get number of monitors
|
// Get number of monitors
|
||||||
|
|
|
||||||
|
|
@ -1023,7 +1023,7 @@ void SetWindowFocused(void)
|
||||||
// Get native window handle
|
// Get native window handle
|
||||||
void *GetWindowHandle(void)
|
void *GetWindowHandle(void)
|
||||||
{
|
{
|
||||||
return platform.hwnd;
|
return (void *)platform.hwnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetMonitorCount(void)
|
int GetMonitorCount(void)
|
||||||
|
|
@ -1257,8 +1257,9 @@ void OpenURL(const char *url)
|
||||||
if (strchr(url, '\'') != NULL) TRACELOG(LOG_WARNING, "SYSTEM: Provided URL could be potentially malicious, avoid [\'] character");
|
if (strchr(url, '\'') != NULL) TRACELOG(LOG_WARNING, "SYSTEM: Provided URL could be potentially malicious, avoid [\'] character");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *cmd = (char *)RL_CALLOC(strlen(url) + 32, sizeof(char));
|
int len = strlen(url) + 32;
|
||||||
sprintf(cmd, "explorer \"%s\"", url);
|
char *cmd = (char *)RL_CALLOC(len, sizeof(char));
|
||||||
|
snprintf(cmd, len, "explorer \"%s\"", url);
|
||||||
int result = system(cmd);
|
int result = system(cmd);
|
||||||
if (result == -1) TRACELOG(LOG_WARNING, "OpenURL() child process could not be created");
|
if (result == -1) TRACELOG(LOG_WARNING, "OpenURL() child process could not be created");
|
||||||
RL_FREE(cmd);
|
RL_FREE(cmd);
|
||||||
|
|
@ -2033,7 +2034,7 @@ static void HandleKey(WPARAM wparam, LPARAM lparam, char state)
|
||||||
{
|
{
|
||||||
CORE.Input.Keyboard.currentKeyState[key] = state;
|
CORE.Input.Keyboard.currentKeyState[key] = state;
|
||||||
|
|
||||||
if ((key == KEY_ESCAPE) && (state == 1)) CORE.Window.shouldClose = true;
|
if ((key == CORE.Input.Keyboard.exitKey) && (state == 1)) CORE.Window.shouldClose = true;
|
||||||
}
|
}
|
||||||
else TRACELOG(LOG_WARNING, "INPUT: Unknown (or currently unhandled) virtual keycode %d (0x%x)", wparam, wparam);
|
else TRACELOG(LOG_WARNING, "INPUT: Unknown (or currently unhandled) virtual keycode %d (0x%x)", wparam, wparam);
|
||||||
|
|
||||||
|
|
@ -2052,8 +2053,11 @@ static void HandleMouseButton(int button, char state)
|
||||||
static void HandleRawInput(LPARAM lparam)
|
static void HandleRawInput(LPARAM lparam)
|
||||||
{
|
{
|
||||||
RAWINPUT input = { 0 };
|
RAWINPUT input = { 0 };
|
||||||
|
UINT inputSize = 0;
|
||||||
|
|
||||||
|
if (GetRawInputData((HRAWINPUT)lparam, RID_INPUT, NULL, &inputSize, sizeof(RAWINPUTHEADER)) != 0) return;
|
||||||
|
if (inputSize > sizeof(input)) return;
|
||||||
|
|
||||||
UINT inputSize = sizeof(input);
|
|
||||||
UINT size = GetRawInputData((HRAWINPUT)lparam, RID_INPUT, &input, &inputSize, sizeof(RAWINPUTHEADER));
|
UINT size = GetRawInputData((HRAWINPUT)lparam, RID_INPUT, &input, &inputSize, sizeof(RAWINPUTHEADER));
|
||||||
|
|
||||||
if (size == (UINT)-1) TRACELOG(LOG_ERROR, "WIN32: Failed to get raw input data [ERROR: %lu]", GetLastError());
|
if (size == (UINT)-1) TRACELOG(LOG_ERROR, "WIN32: Failed to get raw input data [ERROR: %lu]", GetLastError());
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ bool InitGraphicsDevice(void); // Initialize graphics device
|
||||||
// Module Internal Functions Declaration
|
// Module Internal Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
static int kbhit(void); // Check if a key has been pressed
|
static int kbhit(void); // Check if key has been pressed
|
||||||
static char getch(void) { return getchar(); } // Get pressed character
|
static char getch(void) { return getchar(); } // Get pressed character
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -562,7 +562,7 @@ void ClosePlatform(void)
|
||||||
// Module Internal Functions Definition
|
// Module Internal Functions Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
// Check if a key has been pressed
|
// Check if key has been pressed
|
||||||
static int kbhit(void)
|
static int kbhit(void)
|
||||||
{
|
{
|
||||||
struct termios oldt = { 0 };
|
struct termios oldt = { 0 };
|
||||||
|
|
|
||||||
|
|
@ -1013,7 +1013,7 @@ Sound LoadSoundAlias(Sound source)
|
||||||
return sound;
|
return sound;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a sound is valid (data loaded and buffers initialized)
|
// Check if sound is valid (data loaded and buffers initialized)
|
||||||
bool IsSoundValid(Sound sound)
|
bool IsSoundValid(Sound sound)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
@ -1215,7 +1215,7 @@ void StopSound(Sound sound)
|
||||||
StopAudioBuffer(sound.stream.buffer);
|
StopAudioBuffer(sound.stream.buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a sound is playing
|
// Check if sound is playing
|
||||||
bool IsSoundPlaying(Sound sound)
|
bool IsSoundPlaying(Sound sound)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
@ -1751,7 +1751,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
||||||
return music;
|
return music;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a music stream is valid (context and buffers initialized)
|
// Check if music stream is valid (context and buffers initialized)
|
||||||
bool IsMusicValid(Music music)
|
bool IsMusicValid(Music music)
|
||||||
{
|
{
|
||||||
return ((music.ctxData != NULL) && // Validate context loaded
|
return ((music.ctxData != NULL) && // Validate context loaded
|
||||||
|
|
@ -1784,7 +1784,7 @@ void UnloadMusicStream(Music music)
|
||||||
else if (music.ctxType == MUSIC_AUDIO_QOA) qoaplay_close((qoaplay_desc *)music.ctxData);
|
else if (music.ctxType == MUSIC_AUDIO_QOA) qoaplay_close((qoaplay_desc *)music.ctxData);
|
||||||
#endif
|
#endif
|
||||||
#if SUPPORT_FILEFORMAT_FLAC
|
#if SUPPORT_FILEFORMAT_FLAC
|
||||||
else if (music.ctxType == MUSIC_AUDIO_FLAC) { drflac_close((drflac *)music.ctxData); drflac_free((drflac *)music.ctxData, NULL); }
|
else if (music.ctxType == MUSIC_AUDIO_FLAC) drflac_close((drflac *)music.ctxData);
|
||||||
#endif
|
#endif
|
||||||
#if SUPPORT_FILEFORMAT_XM
|
#if SUPPORT_FILEFORMAT_XM
|
||||||
else if (music.ctxType == MUSIC_MODULE_XM) jar_xm_free_context((jar_xm_context_t *)music.ctxData);
|
else if (music.ctxType == MUSIC_MODULE_XM) jar_xm_free_context((jar_xm_context_t *)music.ctxData);
|
||||||
|
|
|
||||||
169
src/raylib.h
169
src/raylib.h
|
|
@ -1071,7 +1071,7 @@ RLAPI void UnloadVrStereoConfig(VrStereoConfig config); // Unload VR s
|
||||||
// NOTE: Shader functionality is not available on OpenGL 1.1
|
// NOTE: Shader functionality is not available on OpenGL 1.1
|
||||||
RLAPI Shader LoadShader(const char *vsFileName, const char *fsFileName); // Load shader from files and bind default locations
|
RLAPI Shader LoadShader(const char *vsFileName, const char *fsFileName); // Load shader from files and bind default locations
|
||||||
RLAPI Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode); // Load shader from code strings and bind default locations
|
RLAPI Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode); // Load shader from code strings and bind default locations
|
||||||
RLAPI bool IsShaderValid(Shader shader); // Check if a shader is valid (loaded on GPU)
|
RLAPI bool IsShaderValid(Shader shader); // Check if shader is valid (loaded on GPU)
|
||||||
RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
|
RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
|
||||||
RLAPI int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location
|
RLAPI int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location
|
||||||
RLAPI void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType); // Set shader uniform value
|
RLAPI void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType); // Set shader uniform value
|
||||||
|
|
@ -1081,7 +1081,6 @@ RLAPI void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture)
|
||||||
RLAPI void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM)
|
RLAPI void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM)
|
||||||
|
|
||||||
// Screen-space-related functions
|
// Screen-space-related functions
|
||||||
#define GetMouseRay GetScreenToWorldRay // Compatibility hack for previous raylib versions
|
|
||||||
RLAPI Ray GetScreenToWorldRay(Vector2 position, Camera camera); // Get a ray trace from screen position (i.e mouse)
|
RLAPI Ray GetScreenToWorldRay(Vector2 position, Camera camera); // Get a ray trace from screen position (i.e mouse)
|
||||||
RLAPI Ray GetScreenToWorldRayEx(Vector2 position, Camera camera, int width, int height); // Get a ray trace from screen position (i.e mouse) in a viewport
|
RLAPI Ray GetScreenToWorldRayEx(Vector2 position, Camera camera, int width, int height); // Get a ray trace from screen position (i.e mouse) in a viewport
|
||||||
RLAPI Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Get screen space position for a 3d world space position
|
RLAPI Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Get screen space position for a 3d world space position
|
||||||
|
|
@ -1142,14 +1141,14 @@ RLAPI void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custo
|
||||||
RLAPI void SetLoadFileTextCallback(LoadFileTextCallback callback); // Set custom file text data loader
|
RLAPI void SetLoadFileTextCallback(LoadFileTextCallback callback); // Set custom file text data loader
|
||||||
RLAPI void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom file text data saver
|
RLAPI void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom file text data saver
|
||||||
|
|
||||||
RLAPI int FileRename(const char *fileName, const char *fileRename); // Rename file (if exists)
|
RLAPI int FileRename(const char *fileName, const char *fileRename); // Rename file (if exists), returns 0 on success
|
||||||
RLAPI int FileRemove(const char *fileName); // Remove file (if exists)
|
RLAPI int FileRemove(const char *fileName); // Remove file (if exists), returns 0 on success
|
||||||
RLAPI int FileCopy(const char *srcPath, const char *dstPath); // Copy file from one path to another, dstPath created if it doesn't exist
|
RLAPI int FileCopy(const char *srcPath, const char *dstPath); // Copy file from one path to another, dstPath created if it doesn't exist, returns 0 on success
|
||||||
RLAPI int FileMove(const char *srcPath, const char *dstPath); // Move file from one directory to another, dstPath created if it doesn't exist
|
RLAPI int FileMove(const char *srcPath, const char *dstPath); // Move file from one directory to another, dstPath created if it doesn't exist, returns 0 on success
|
||||||
RLAPI int FileTextReplace(const char *fileName, const char *search, const char *replacement); // Replace text in an existing file
|
RLAPI int FileTextReplace(const char *fileName, const char *search, const char *replacement); // Replace text in an existing file, returns 0 on success
|
||||||
RLAPI int FileTextFindIndex(const char *fileName, const char *search); // Find text in existing file
|
RLAPI int FileTextFindIndex(const char *fileName, const char *search); // Find text in existing file, returns -1 if index not found or index otherwise
|
||||||
RLAPI bool FileExists(const char *fileName); // Check if file exists
|
RLAPI bool FileExists(const char *fileName); // Check if file exists
|
||||||
RLAPI bool DirectoryExists(const char *dirPath); // Check if a directory path exists
|
RLAPI bool DirectoryExists(const char *dirPath); // Check if directory path exists
|
||||||
RLAPI bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (recommended include point: .png, .wav)
|
RLAPI bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (recommended include point: .png, .wav)
|
||||||
RLAPI int GetFileLength(const char *fileName); // Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)
|
RLAPI int GetFileLength(const char *fileName); // Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)
|
||||||
RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time)
|
RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time)
|
||||||
|
|
@ -1161,13 +1160,13 @@ RLAPI const char *GetPrevDirectoryPath(const char *dirPath); // Get previ
|
||||||
RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
|
RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
|
||||||
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
|
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
|
||||||
RLAPI int MakeDirectory(const char *dirPath); // Create directories (including full path requested), returns 0 on success
|
RLAPI int MakeDirectory(const char *dirPath); // Create directories (including full path requested), returns 0 on success
|
||||||
RLAPI bool ChangeDirectory(const char *dirPath); // Change working directory, return true on success
|
RLAPI int ChangeDirectory(const char *dirPath); // Change working directory, returns 0 on success
|
||||||
RLAPI bool IsPathFile(const char *path); // Check if a given path is a file or a directory
|
RLAPI bool IsPathFile(const char *path); // Check if given path is a file or a directory
|
||||||
RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
|
RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
|
||||||
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths, files and directories, no subdirs scan
|
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths, files and directories, no subdirs scan
|
||||||
RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and subdir scan; some filters available: `*.*`,`FILES*`,`DIRS*`
|
RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and subdir scan; some filters available: '*.*','FILES*','DIRS*'
|
||||||
RLAPI void UnloadDirectoryFiles(FilePathList files); // Unload filepaths
|
RLAPI void UnloadDirectoryFiles(FilePathList files); // Unload filepaths
|
||||||
RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window
|
RLAPI bool IsFileDropped(void); // Check if file has been dropped into window
|
||||||
RLAPI FilePathList LoadDroppedFiles(void); // Load dropped filepaths
|
RLAPI FilePathList LoadDroppedFiles(void); // Load dropped filepaths
|
||||||
RLAPI void UnloadDroppedFiles(FilePathList files); // Unload dropped filepaths
|
RLAPI void UnloadDroppedFiles(FilePathList files); // Unload dropped filepaths
|
||||||
RLAPI unsigned int GetDirectoryFileCount(const char *dirPath); // Get the file count in a directory
|
RLAPI unsigned int GetDirectoryFileCount(const char *dirPath); // Get the file count in a directory
|
||||||
|
|
@ -1198,23 +1197,23 @@ RLAPI void PlayAutomationEvent(AutomationEvent event); // Play a reco
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Input-related functions: keyboard
|
// Input-related functions: keyboard
|
||||||
RLAPI bool IsKeyPressed(int key); // Check if a key has been pressed once
|
RLAPI bool IsKeyPressed(int key); // Check if key has been pressed once
|
||||||
RLAPI bool IsKeyPressedRepeat(int key); // Check if a key has been pressed again
|
RLAPI bool IsKeyPressedRepeat(int key); // Check if key has been pressed again
|
||||||
RLAPI bool IsKeyDown(int key); // Check if a key is being pressed
|
RLAPI bool IsKeyDown(int key); // Check if key is being pressed
|
||||||
RLAPI bool IsKeyReleased(int key); // Check if a key has been released once
|
RLAPI bool IsKeyReleased(int key); // Check if key has been released once
|
||||||
RLAPI bool IsKeyUp(int key); // Check if a key is NOT being pressed
|
RLAPI bool IsKeyUp(int key); // Check if key is NOT being pressed
|
||||||
RLAPI int GetKeyPressed(void); // Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty
|
RLAPI int GetKeyPressed(void); // Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty
|
||||||
RLAPI int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty
|
RLAPI int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty
|
||||||
RLAPI const char *GetKeyName(int key); // Get name of a QWERTY key on the current keyboard layout (eg returns string 'q' for KEY_A on an AZERTY keyboard)
|
RLAPI const char *GetKeyName(int key); // Get name of a QWERTY key on the current keyboard layout (eg returns string 'q' for KEY_A on an AZERTY keyboard)
|
||||||
RLAPI void SetExitKey(int key); // Set a custom key to exit program (default is ESC)
|
RLAPI void SetExitKey(int key); // Set a custom key to exit program (default is ESC)
|
||||||
|
|
||||||
// Input-related functions: gamepads
|
// Input-related functions: gamepads
|
||||||
RLAPI bool IsGamepadAvailable(int gamepad); // Check if a gamepad is available
|
RLAPI bool IsGamepadAvailable(int gamepad); // Check if gamepad is available
|
||||||
RLAPI const char *GetGamepadName(int gamepad); // Get gamepad internal name id
|
RLAPI const char *GetGamepadName(int gamepad); // Get gamepad internal name id
|
||||||
RLAPI bool IsGamepadButtonPressed(int gamepad, int button); // Check if a gamepad button has been pressed once
|
RLAPI bool IsGamepadButtonPressed(int gamepad, int button); // Check if gamepad button has been pressed once
|
||||||
RLAPI bool IsGamepadButtonDown(int gamepad, int button); // Check if a gamepad button is being pressed
|
RLAPI bool IsGamepadButtonDown(int gamepad, int button); // Check if gamepad button is being pressed
|
||||||
RLAPI bool IsGamepadButtonReleased(int gamepad, int button); // Check if a gamepad button has been released once
|
RLAPI bool IsGamepadButtonReleased(int gamepad, int button); // Check if gamepad button has been released once
|
||||||
RLAPI bool IsGamepadButtonUp(int gamepad, int button); // Check if a gamepad button is NOT being pressed
|
RLAPI bool IsGamepadButtonUp(int gamepad, int button); // Check if gamepad button is NOT being pressed
|
||||||
RLAPI int GetGamepadButtonPressed(void); // Get the last gamepad button pressed
|
RLAPI int GetGamepadButtonPressed(void); // Get the last gamepad button pressed
|
||||||
RLAPI int GetGamepadAxisCount(int gamepad); // Get axis count for a gamepad
|
RLAPI int GetGamepadAxisCount(int gamepad); // Get axis count for a gamepad
|
||||||
RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Get movement value for a gamepad axis
|
RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Get movement value for a gamepad axis
|
||||||
|
|
@ -1222,10 +1221,10 @@ RLAPI int SetGamepadMappings(const char *mappings); // Set internal ga
|
||||||
RLAPI void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration); // Set gamepad vibration for both motors (duration in seconds)
|
RLAPI void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration); // Set gamepad vibration for both motors (duration in seconds)
|
||||||
|
|
||||||
// Input-related functions: mouse
|
// Input-related functions: mouse
|
||||||
RLAPI bool IsMouseButtonPressed(int button); // Check if a mouse button has been pressed once
|
RLAPI bool IsMouseButtonPressed(int button); // Check if mouse button has been pressed once
|
||||||
RLAPI bool IsMouseButtonDown(int button); // Check if a mouse button is being pressed
|
RLAPI bool IsMouseButtonDown(int button); // Check if mouse button is being pressed
|
||||||
RLAPI bool IsMouseButtonReleased(int button); // Check if a mouse button has been released once
|
RLAPI bool IsMouseButtonReleased(int button); // Check if mouse button has been released once
|
||||||
RLAPI bool IsMouseButtonUp(int button); // Check if a mouse button is NOT being pressed
|
RLAPI bool IsMouseButtonUp(int button); // Check if mouse button is NOT being pressed
|
||||||
RLAPI int GetMouseX(void); // Get mouse position X
|
RLAPI int GetMouseX(void); // Get mouse position X
|
||||||
RLAPI int GetMouseY(void); // Get mouse position Y
|
RLAPI int GetMouseY(void); // Get mouse position Y
|
||||||
RLAPI Vector2 GetMousePosition(void); // Get mouse position XY
|
RLAPI Vector2 GetMousePosition(void); // Get mouse position XY
|
||||||
|
|
@ -1248,7 +1247,7 @@ RLAPI int GetTouchPointCount(void); // Get number of t
|
||||||
// Gestures and Touch Handling Functions (Module: rgestures)
|
// Gestures and Touch Handling Functions (Module: rgestures)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
RLAPI void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
|
RLAPI void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
|
||||||
RLAPI bool IsGestureDetected(unsigned int gesture); // Check if a gesture has been detected
|
RLAPI bool IsGestureDetected(unsigned int gesture); // Check if gesture has been detected
|
||||||
RLAPI int GetGestureDetected(void); // Get latest detected gesture
|
RLAPI int GetGestureDetected(void); // Get latest detected gesture
|
||||||
RLAPI float GetGestureHoldDuration(void); // Get gesture hold time in seconds
|
RLAPI float GetGestureHoldDuration(void); // Get gesture hold time in seconds
|
||||||
RLAPI Vector2 GetGestureDragVector(void); // Get gesture drag vector
|
RLAPI Vector2 GetGestureDragVector(void); // Get gesture drag vector
|
||||||
|
|
@ -1268,7 +1267,7 @@ RLAPI void UpdateCameraPro(Camera *camera, Vector3 movement, Vector3 rotation, f
|
||||||
// Set texture and rectangle to be used on shapes drawing
|
// Set texture and rectangle to be used on shapes drawing
|
||||||
// NOTE: It can be useful when using basic shapes and one single font,
|
// NOTE: It can be useful when using basic shapes and one single font,
|
||||||
// defining a font char white rectangle would allow drawing everything in a single draw call
|
// defining a font char white rectangle would allow drawing everything in a single draw call
|
||||||
RLAPI void SetShapesTexture(Texture2D texture, Rectangle source); // Set texture and rectangle to be used on shapes drawing
|
RLAPI void SetShapesTexture(Texture2D texture, Rectangle rec); // Set texture and rectangle to be used on shapes drawing
|
||||||
RLAPI Texture2D GetShapesTexture(void); // Get texture that is used for shapes drawing
|
RLAPI Texture2D GetShapesTexture(void); // Get texture that is used for shapes drawing
|
||||||
RLAPI Rectangle GetShapesTextureRectangle(void); // Get texture source rectangle that is used for shapes drawing
|
RLAPI Rectangle GetShapesTextureRectangle(void); // Get texture source rectangle that is used for shapes drawing
|
||||||
|
|
||||||
|
|
@ -1281,6 +1280,26 @@ RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color
|
||||||
RLAPI void DrawLineStrip(const Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
|
RLAPI void DrawLineStrip(const Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
|
||||||
RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation
|
RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation
|
||||||
RLAPI void DrawLineDashed(Vector2 startPos, Vector2 endPos, int dashSize, int spaceSize, Color color); // Draw a dashed line
|
RLAPI void DrawLineDashed(Vector2 startPos, Vector2 endPos, int dashSize, int spaceSize, Color color); // Draw a dashed line
|
||||||
|
RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle, counter-clockwise vertex order
|
||||||
|
RLAPI void DrawTriangleGradient(Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); // Draw triangle with interpolated colors, counter-clockwise vertex/color order
|
||||||
|
RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline, counter-clockwise vertex order
|
||||||
|
RLAPI void DrawTriangleFan(const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center)
|
||||||
|
RLAPI void DrawTriangleStrip(const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points
|
||||||
|
RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
|
||||||
|
RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
|
||||||
|
RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
|
||||||
|
RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
|
||||||
|
RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom); // Draw a vertical-gradient-filled rectangle
|
||||||
|
RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right); // Draw a horizontal-gradient-filled rectangle
|
||||||
|
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors, counter-clockwise color order
|
||||||
|
RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
|
||||||
|
RLAPI void DrawRectangleLinesEx(Rectangle rec, float thick, Color color); // Draw rectangle outline with line thickness
|
||||||
|
RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
|
||||||
|
RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle lines with rounded edges
|
||||||
|
RLAPI void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, float thick, Color color); // Draw rectangle lines with rounded edges outline and line thickness
|
||||||
|
RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon of n sides
|
||||||
|
RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides
|
||||||
|
RLAPI void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float thick, Color color); // Draw a polygon outline of n sides with line thickness
|
||||||
RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
|
RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
|
||||||
RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
|
RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
|
||||||
RLAPI void DrawCircleGradient(Vector2 center, float radius, Color inner, Color outer); // Draw a gradient-filled circle
|
RLAPI void DrawCircleGradient(Vector2 center, float radius, Color inner, Color outer); // Draw a gradient-filled circle
|
||||||
|
|
@ -1288,32 +1307,13 @@ RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, floa
|
||||||
RLAPI void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw circle sector outline
|
RLAPI void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw circle sector outline
|
||||||
RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
|
RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
|
||||||
RLAPI void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version)
|
RLAPI void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version)
|
||||||
|
RLAPI void DrawCircleLinesEx(Vector2 center, float radius, float thick, Color color); // Draw circle outline with line thickness
|
||||||
RLAPI void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse
|
RLAPI void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse
|
||||||
RLAPI void DrawEllipseV(Vector2 center, float radiusH, float radiusV, Color color); // Draw ellipse (Vector version)
|
RLAPI void DrawEllipseV(Vector2 center, float radiusH, float radiusV, Color color); // Draw ellipse (Vector version)
|
||||||
RLAPI void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse outline
|
RLAPI void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse outline
|
||||||
RLAPI void DrawEllipseLinesV(Vector2 center, float radiusH, float radiusV, Color color); // Draw ellipse outline (Vector version)
|
RLAPI void DrawEllipseLinesV(Vector2 center, float radiusH, float radiusV, Color color); // Draw ellipse outline (Vector version)
|
||||||
RLAPI void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring
|
RLAPI void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring
|
||||||
RLAPI void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring outline
|
RLAPI void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring outline
|
||||||
RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
|
|
||||||
RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
|
|
||||||
RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
|
|
||||||
RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
|
|
||||||
RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom); // Draw a vertical-gradient-filled rectangle
|
|
||||||
RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right); // Draw a horizontal-gradient-filled rectangle
|
|
||||||
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color bottomRight, Color topRight); // Draw a gradient-filled rectangle with custom vertex colors
|
|
||||||
RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
|
|
||||||
RLAPI void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); // Draw rectangle outline with extended parameters
|
|
||||||
RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
|
|
||||||
RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle lines with rounded edges
|
|
||||||
RLAPI void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, float lineThick, Color color); // Draw rectangle lines with rounded edges outline
|
|
||||||
RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
|
|
||||||
RLAPI void DrawTriangleGradient(Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); // Draw triangle with interpolated colors (vertex in counter-clockwise order!)
|
|
||||||
RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!)
|
|
||||||
RLAPI void DrawTriangleFan(const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center)
|
|
||||||
RLAPI void DrawTriangleStrip(const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points
|
|
||||||
RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon of n sides
|
|
||||||
RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides
|
|
||||||
RLAPI void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); // Draw a polygon outline of n sides with extended parameters
|
|
||||||
|
|
||||||
// Splines drawing functions
|
// Splines drawing functions
|
||||||
RLAPI void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
|
RLAPI void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
|
||||||
|
|
@ -1423,21 +1423,26 @@ RLAPI void ImageDrawPixelV(Image *dst, Vector2 position, Color color);
|
||||||
RLAPI void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw line within an image
|
RLAPI void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw line within an image
|
||||||
RLAPI void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color); // Draw line within an image (Vector version)
|
RLAPI void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color); // Draw line within an image (Vector version)
|
||||||
RLAPI void ImageDrawLineEx(Image *dst, Vector2 start, Vector2 end, int thick, Color color); // Draw a line defining thickness within an image
|
RLAPI void ImageDrawLineEx(Image *dst, Vector2 start, Vector2 end, int thick, Color color); // Draw a line defining thickness within an image
|
||||||
RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image
|
RLAPI void ImageDrawLineStrip(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a lines sequence within an image
|
||||||
RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version)
|
|
||||||
RLAPI void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image
|
|
||||||
RLAPI void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color color); // Draw circle outline within an image (Vector version)
|
|
||||||
RLAPI void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle within an image
|
|
||||||
RLAPI void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color); // Draw rectangle within an image (Vector version)
|
|
||||||
RLAPI void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image
|
|
||||||
RLAPI void ImageDrawRectangleLines(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle lines within an image
|
|
||||||
RLAPI void ImageDrawRectangleLinesEx(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image with extended parameters
|
|
||||||
RLAPI void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle within an image
|
RLAPI void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle within an image
|
||||||
RLAPI void ImageDrawTriangleGradient(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); // Draw triangle with interpolated colors within an image
|
RLAPI void ImageDrawTriangleGradient(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); // Draw triangle with interpolated colors within an image
|
||||||
RLAPI void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline within an image
|
RLAPI void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline within an image
|
||||||
RLAPI void ImageDrawTriangleFan(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center)
|
RLAPI void ImageDrawTriangleFan(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center)
|
||||||
RLAPI void ImageDrawTriangleStrip(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image
|
RLAPI void ImageDrawTriangleStrip(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image
|
||||||
RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source)
|
RLAPI void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle within an image
|
||||||
|
RLAPI void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color); // Draw rectangle within an image (Vector version)
|
||||||
|
RLAPI void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image
|
||||||
|
RLAPI void ImageDrawRectangleLines(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle lines within an image
|
||||||
|
RLAPI void ImageDrawRectangleLinesEx(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image with line thickness
|
||||||
|
RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image
|
||||||
|
RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version)
|
||||||
|
RLAPI void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image
|
||||||
|
RLAPI void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color color); // Draw circle outline within an image (Vector version)
|
||||||
|
RLAPI void ImageDrawCircleGradient(Image *dst, Vector2 center, float radius, Color inner, Color outer); // Draw a gradient-filled circle within an image
|
||||||
|
|
||||||
|
RLAPI void ImageDrawImage(Image *dst, Image src, int posX, int posY, Color tint); // Draw an image within an image
|
||||||
|
RLAPI void ImageDrawImageRec(Image *dst, Image src, Rectangle srcRec, Vector2 position, Color tint); // Draw a part of an image defined by a rectangle within an image
|
||||||
|
RLAPI void ImageDrawImagePro(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Vector2 origin, float rotation, Color tint); // Draw a part of an image defined by a rectangle into destination rectangle, with scaling and rotation, within an image
|
||||||
RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
|
RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
|
||||||
RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
|
RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
|
||||||
|
|
||||||
|
|
@ -1447,9 +1452,9 @@ RLAPI Texture2D LoadTexture(const char *fileName);
|
||||||
RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data
|
RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data
|
||||||
RLAPI TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
|
RLAPI TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
|
||||||
RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
|
RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
|
||||||
RLAPI bool IsTextureValid(Texture2D texture); // Check if a texture is valid (loaded in GPU)
|
RLAPI bool IsTextureValid(Texture2D texture); // Check if texture is valid (loaded in GPU)
|
||||||
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
|
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
|
||||||
RLAPI bool IsRenderTextureValid(RenderTexture2D target); // Check if a render texture is valid (loaded in GPU)
|
RLAPI bool IsRenderTextureValid(RenderTexture2D target); // Check if render texture is valid (loaded in GPU)
|
||||||
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
|
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
|
||||||
RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data (pixels should be able to fill texture)
|
RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data (pixels should be able to fill texture)
|
||||||
RLAPI void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data (pixels and rec should fit in texture)
|
RLAPI void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data (pixels and rec should fit in texture)
|
||||||
|
|
@ -1462,10 +1467,10 @@ RLAPI void SetTextureWrap(Texture2D texture, int wrap);
|
||||||
// Texture drawing functions
|
// Texture drawing functions
|
||||||
RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D
|
RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D
|
||||||
RLAPI void DrawTextureV(Texture2D texture, Vector2 position, Color tint); // Draw a Texture2D with position defined as Vector2
|
RLAPI void DrawTextureV(Texture2D texture, Vector2 position, Color tint); // Draw a Texture2D with position defined as Vector2
|
||||||
RLAPI void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); // Draw a Texture2D with extended parameters
|
RLAPI void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); // Draw a Texture2D with rotation and scale
|
||||||
RLAPI void DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color tint); // Draw a part of a texture defined by a rectangle
|
RLAPI void DrawTextureRec(Texture2D texture, Rectangle rec, Vector2 position, Color tint); // Draw a part of a texture defined by a rectangle
|
||||||
RLAPI void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters
|
RLAPI void DrawTexturePro(Texture2D texture, Rectangle srcrec, Rectangle dstrec, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a source rectangle to destination rectangle, with scaling and rotation
|
||||||
RLAPI void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draw a texture (or part of it) that stretches or shrinks nicely
|
RLAPI void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dstrec, Vector2 origin, float rotation, Color tint); // Draw a texture (or part of it) that stretches or shrinks nicely
|
||||||
|
|
||||||
// Color/pixel related functions
|
// Color/pixel related functions
|
||||||
RLAPI bool ColorIsEqual(Color col1, Color col2); // Check if two colors are equal
|
RLAPI bool ColorIsEqual(Color col1, Color col2); // Check if two colors are equal
|
||||||
|
|
@ -1482,7 +1487,7 @@ RLAPI Color ColorAlpha(Color color, float alpha); // G
|
||||||
RLAPI Color ColorAlphaBlend(Color dst, Color src, Color tint); // Get src alpha-blended into dst color with tint
|
RLAPI Color ColorAlphaBlend(Color dst, Color src, Color tint); // Get src alpha-blended into dst color with tint
|
||||||
RLAPI Color ColorLerp(Color color1, Color color2, float factor); // Get color lerp interpolation between two colors, factor [0.0f..1.0f]
|
RLAPI Color ColorLerp(Color color1, Color color2, float factor); // Get color lerp interpolation between two colors, factor [0.0f..1.0f]
|
||||||
RLAPI Color GetColor(unsigned int hexValue); // Get Color structure from hexadecimal value
|
RLAPI Color GetColor(unsigned int hexValue); // Get Color structure from hexadecimal value
|
||||||
RLAPI Color GetPixelColor(void *srcPtr, int format); // Get Color from a source pixel pointer of certain format
|
RLAPI Color GetPixelColor(const void *srcPtr, int format); // Get Color from a source pixel pointer of certain format
|
||||||
RLAPI void SetPixelColor(void *dstPtr, Color color, int format); // Set color formatted into destination pixel pointer
|
RLAPI void SetPixelColor(void *dstPtr, Color color, int format); // Set color formatted into destination pixel pointer
|
||||||
RLAPI int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes for certain format
|
RLAPI int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes for certain format
|
||||||
|
|
||||||
|
|
@ -1493,10 +1498,10 @@ RLAPI int GetPixelDataSize(int width, int height, int format); // G
|
||||||
// Font loading/unloading functions
|
// Font loading/unloading functions
|
||||||
RLAPI Font GetFontDefault(void); // Get the default Font
|
RLAPI Font GetFontDefault(void); // Get the default Font
|
||||||
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
|
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
|
||||||
RLAPI Font LoadFontEx(const char *fileName, int fontSize, const int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height
|
RLAPI Font LoadFontEx(const char *fileName, int fontSize, const int *codepoints, int codepointCount); // Load font from file with defined codepoints and generation size, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height
|
||||||
RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
|
RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
|
||||||
RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
|
RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
|
||||||
RLAPI bool IsFontValid(Font font); // Check if a font is valid (font data loaded, WARNING: GPU texture not checked)
|
RLAPI bool IsFontValid(Font font); // Check if font is valid (font data loaded, WARNING: GPU texture not checked)
|
||||||
RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount, int type, int *glyphCount); // Load font data for further use
|
RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount, int type, int *glyphCount); // Load font data for further use
|
||||||
RLAPI Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
|
RLAPI Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
|
||||||
RLAPI void UnloadFontData(GlyphInfo *glyphs, int glyphCount); // Unload font chars info data (RAM)
|
RLAPI void UnloadFontData(GlyphInfo *glyphs, int glyphCount); // Unload font chars info data (RAM)
|
||||||
|
|
@ -1569,19 +1574,19 @@ RLAPI float TextToFloat(const char *text);
|
||||||
RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space
|
RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space
|
||||||
RLAPI void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line
|
RLAPI void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line
|
||||||
RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
|
RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
|
||||||
RLAPI void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
|
RLAPI void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); // Draw a color-filled triangle, counter-clockwise vertex order
|
||||||
RLAPI void DrawTriangleStrip3D(const Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points
|
RLAPI void DrawTriangleStrip3D(const Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points
|
||||||
RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
|
RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
|
||||||
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
|
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
|
||||||
RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
|
RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
|
||||||
RLAPI void DrawCubeWiresV(Vector3 position, Vector3 size, Color color); // Draw cube wires (Vector version)
|
RLAPI void DrawCubeWiresV(Vector3 position, Vector3 size, Color color); // Draw cube wires (Vector version)
|
||||||
RLAPI void DrawSphere(Vector3 centerPos, float radius, Color color); // Draw sphere
|
RLAPI void DrawSphere(Vector3 centerPos, float radius, Color color); // Draw sphere
|
||||||
RLAPI void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere with extended parameters
|
RLAPI void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere with defined rings and slices
|
||||||
RLAPI void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere wires
|
RLAPI void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere wires
|
||||||
RLAPI void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); // Draw a cylinder/cone
|
RLAPI void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float height, int sides, Color color); // Draw a cylinder/cone
|
||||||
RLAPI void DrawCylinderEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); // Draw a cylinder with base at startPos and top at endPos
|
RLAPI void DrawCylinderEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); // Draw a cylinder with base at startPos and top at endPos
|
||||||
RLAPI void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); // Draw a cylinder/cone wires
|
RLAPI void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int sides, Color color); // Draw a cylinder/cone wires
|
||||||
RLAPI void DrawCylinderWiresEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int slices, Color color); // Draw a cylinder wires with base at startPos and top at endPos
|
RLAPI void DrawCylinderWiresEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); // Draw a cylinder wires with base at startPos and top at endPos
|
||||||
RLAPI void DrawCapsule(Vector3 startPos, Vector3 endPos, float radius, int rings, int slices, Color color); // Draw a capsule with the center of its sphere caps at startPos and endPos
|
RLAPI void DrawCapsule(Vector3 startPos, Vector3 endPos, float radius, int rings, int slices, Color color); // Draw a capsule with the center of its sphere caps at startPos and endPos
|
||||||
RLAPI void DrawCapsuleWires(Vector3 startPos, Vector3 endPos, float radius, int rings, int slices, Color color); // Draw capsule wireframe with the center of its sphere caps at startPos and endPos
|
RLAPI void DrawCapsuleWires(Vector3 startPos, Vector3 endPos, float radius, int rings, int slices, Color color); // Draw capsule wireframe with the center of its sphere caps at startPos and endPos
|
||||||
RLAPI void DrawPlane(Vector3 centerPos, Vector2 size, Color color); // Draw a plane XZ
|
RLAPI void DrawPlane(Vector3 centerPos, Vector2 size, Color color); // Draw a plane XZ
|
||||||
|
|
@ -1595,19 +1600,19 @@ RLAPI void DrawGrid(int slices, float spacing);
|
||||||
// Model management functions
|
// Model management functions
|
||||||
RLAPI Model LoadModel(const char *fileName); // Load model from files (meshes and materials)
|
RLAPI Model LoadModel(const char *fileName); // Load model from files (meshes and materials)
|
||||||
RLAPI Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material)
|
RLAPI Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material)
|
||||||
RLAPI bool IsModelValid(Model model); // Check if a model is valid (loaded in GPU, VAO/VBOs)
|
RLAPI bool IsModelValid(Model model); // Check if model is valid (loaded in GPU, VAO/VBOs)
|
||||||
RLAPI void UnloadModel(Model model); // Unload model (including meshes) from memory (RAM and/or VRAM)
|
RLAPI void UnloadModel(Model model); // Unload model (including meshes) from memory (RAM and/or VRAM)
|
||||||
RLAPI BoundingBox GetModelBoundingBox(Model model); // Compute model bounding box limits (considers all meshes)
|
RLAPI BoundingBox GetModelBoundingBox(Model model); // Compute model bounding box limits (considers all meshes)
|
||||||
|
|
||||||
// Model drawing functions
|
// Model drawing functions
|
||||||
RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)
|
RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)
|
||||||
RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters
|
RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with custom transform
|
||||||
RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
|
RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
|
||||||
RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters
|
RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires with custom transform
|
||||||
RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
|
RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
|
||||||
RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float scale, Color tint); // Draw a billboard texture
|
RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float scale, Color tint); // Draw a billboard texture
|
||||||
RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by source
|
RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle rec, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by rectangle
|
||||||
RLAPI void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); // Draw a billboard texture defined by source and rotation
|
RLAPI void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle rec, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); // Draw a billboard texture defined by source rectangle with scaling and rotation
|
||||||
|
|
||||||
// Mesh management functions
|
// Mesh management functions
|
||||||
RLAPI void UploadMesh(Mesh *mesh, bool dynamic); // Upload mesh vertex data in GPU and provide VAO/VBO ids
|
RLAPI void UploadMesh(Mesh *mesh, bool dynamic); // Upload mesh vertex data in GPU and provide VAO/VBO ids
|
||||||
|
|
@ -1636,7 +1641,7 @@ RLAPI Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize);
|
||||||
// Material loading/unloading functions
|
// Material loading/unloading functions
|
||||||
RLAPI Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file
|
RLAPI Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file
|
||||||
RLAPI Material LoadMaterialDefault(void); // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
|
RLAPI Material LoadMaterialDefault(void); // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
|
||||||
RLAPI bool IsMaterialValid(Material material); // Check if a material is valid (shader assigned, map textures loaded in GPU)
|
RLAPI bool IsMaterialValid(Material material); // Check if material is valid (shader assigned, map textures loaded in GPU)
|
||||||
RLAPI void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM)
|
RLAPI void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM)
|
||||||
RLAPI void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
|
RLAPI void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
|
||||||
RLAPI void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh
|
RLAPI void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh
|
||||||
|
|
@ -1677,7 +1682,7 @@ RLAPI bool IsWaveValid(Wave wave); // Check i
|
||||||
RLAPI Sound LoadSound(const char *fileName); // Load sound from file
|
RLAPI Sound LoadSound(const char *fileName); // Load sound from file
|
||||||
RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound from wave data
|
RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound from wave data
|
||||||
RLAPI Sound LoadSoundAlias(Sound source); // Load sound alias, new sound that shares the same sample data as the source sound, does not own the sound data
|
RLAPI Sound LoadSoundAlias(Sound source); // Load sound alias, new sound that shares the same sample data as the source sound, does not own the sound data
|
||||||
RLAPI bool IsSoundValid(Sound sound); // Check if a sound is valid (data loaded and buffers initialized)
|
RLAPI bool IsSoundValid(Sound sound); // Check if sound is valid (data loaded and buffers initialized)
|
||||||
RLAPI void UpdateSound(Sound sound, const void *data, int frameCount); // Update sound buffer with new data (default data format: 32 bit float, stereo)
|
RLAPI void UpdateSound(Sound sound, const void *data, int frameCount); // Update sound buffer with new data (default data format: 32 bit float, stereo)
|
||||||
RLAPI void UnloadWave(Wave wave); // Unload wave data
|
RLAPI void UnloadWave(Wave wave); // Unload wave data
|
||||||
RLAPI void UnloadSound(Sound sound); // Unload sound
|
RLAPI void UnloadSound(Sound sound); // Unload sound
|
||||||
|
|
@ -1690,7 +1695,7 @@ RLAPI void PlaySound(Sound sound); // Play a
|
||||||
RLAPI void StopSound(Sound sound); // Stop playing a sound
|
RLAPI void StopSound(Sound sound); // Stop playing a sound
|
||||||
RLAPI void PauseSound(Sound sound); // Pause a sound
|
RLAPI void PauseSound(Sound sound); // Pause a sound
|
||||||
RLAPI void ResumeSound(Sound sound); // Resume a paused sound
|
RLAPI void ResumeSound(Sound sound); // Resume a paused sound
|
||||||
RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
|
RLAPI bool IsSoundPlaying(Sound sound); // Check if sound is currently playing
|
||||||
RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
|
RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
|
||||||
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
||||||
RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (-1.0 left, 0.0 center, 1.0 right)
|
RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (-1.0 left, 0.0 center, 1.0 right)
|
||||||
|
|
@ -1703,7 +1708,7 @@ RLAPI void UnloadWaveSamples(float *samples); // Unload
|
||||||
// Music management functions
|
// Music management functions
|
||||||
RLAPI Music LoadMusicStream(const char *fileName); // Load music stream from file
|
RLAPI Music LoadMusicStream(const char *fileName); // Load music stream from file
|
||||||
RLAPI Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data, int dataSize); // Load music stream from data
|
RLAPI Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data, int dataSize); // Load music stream from data
|
||||||
RLAPI bool IsMusicValid(Music music); // Check if a music stream is valid (context and buffers initialized)
|
RLAPI bool IsMusicValid(Music music); // Check if music stream is valid (context and buffers initialized)
|
||||||
RLAPI void UnloadMusicStream(Music music); // Unload music stream
|
RLAPI void UnloadMusicStream(Music music); // Unload music stream
|
||||||
RLAPI void PlayMusicStream(Music music); // Start music playing
|
RLAPI void PlayMusicStream(Music music); // Start music playing
|
||||||
RLAPI bool IsMusicStreamPlaying(Music music); // Check if music is playing
|
RLAPI bool IsMusicStreamPlaying(Music music); // Check if music is playing
|
||||||
|
|
|
||||||
86
src/rcore.c
86
src/rcore.c
|
|
@ -1297,7 +1297,7 @@ Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a shader is valid (loaded on GPU)
|
// Check if shader is valid (loaded on GPU)
|
||||||
bool IsShaderValid(Shader shader)
|
bool IsShaderValid(Shader shader)
|
||||||
{
|
{
|
||||||
return ((shader.id > 0) && // Validate shader id (GPU loaded successfully)
|
return ((shader.id > 0) && // Validate shader id (GPU loaded successfully)
|
||||||
|
|
@ -2209,13 +2209,12 @@ void SetSaveFileTextCallback(SaveFileTextCallback callback)
|
||||||
// NOTE: Only rename file name required, not full path
|
// NOTE: Only rename file name required, not full path
|
||||||
int FileRename(const char *fileName, const char *fileRename)
|
int FileRename(const char *fileName, const char *fileRename)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = -1;
|
||||||
|
|
||||||
if (FileExists(fileName))
|
if (FileExists(fileName))
|
||||||
{
|
{
|
||||||
result = rename(fileName, fileRename);
|
result = rename(fileName, fileRename);
|
||||||
}
|
}
|
||||||
else result = -1;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -2223,13 +2222,12 @@ int FileRename(const char *fileName, const char *fileRename)
|
||||||
// Remove file (if exists)
|
// Remove file (if exists)
|
||||||
int FileRemove(const char *fileName)
|
int FileRemove(const char *fileName)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = -1;
|
||||||
|
|
||||||
if (FileExists(fileName))
|
if (FileExists(fileName))
|
||||||
{
|
{
|
||||||
result = remove(fileName);
|
result = remove(fileName);
|
||||||
}
|
}
|
||||||
else result = -1;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -2238,18 +2236,21 @@ int FileRemove(const char *fileName)
|
||||||
// NOTE: If destination path does not exist, it is created!
|
// NOTE: If destination path does not exist, it is created!
|
||||||
int FileCopy(const char *srcPath, const char *dstPath)
|
int FileCopy(const char *srcPath, const char *dstPath)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = -1;
|
||||||
int srcDataSize = 0;
|
int srcDataSize = 0;
|
||||||
unsigned char *srcFileData = LoadFileData(srcPath, &srcDataSize);
|
unsigned char *srcFileData = LoadFileData(srcPath, &srcDataSize);
|
||||||
|
|
||||||
// Create required paths if they do not exist
|
// Create required paths if they do not exist
|
||||||
if (!DirectoryExists(GetDirectoryPath(dstPath)))
|
if (DirectoryExists(GetDirectoryPath(dstPath))) result = 0; // Already exists
|
||||||
result = MakeDirectory(GetDirectoryPath(dstPath));
|
else result = MakeDirectory(GetDirectoryPath(dstPath));
|
||||||
|
|
||||||
if (result == 0) // Directory created successfully (or already exists)
|
if (result == 0) // Directory created successfully or already exists
|
||||||
{
|
{
|
||||||
if ((srcFileData != NULL) && (srcDataSize > 0))
|
if ((srcFileData != NULL) && (srcDataSize > 0))
|
||||||
result = SaveFileData(dstPath, srcFileData, srcDataSize);
|
{
|
||||||
|
bool saved = SaveFileData(dstPath, srcFileData, srcDataSize);
|
||||||
|
if (saved) result = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UnloadFileData(srcFileData);
|
UnloadFileData(srcFileData);
|
||||||
|
|
@ -2265,11 +2266,18 @@ int FileMove(const char *srcPath, const char *dstPath)
|
||||||
|
|
||||||
if (FileExists(srcPath))
|
if (FileExists(srcPath))
|
||||||
{
|
{
|
||||||
FileCopy(srcPath, dstPath);
|
result = FileCopy(srcPath, dstPath);
|
||||||
|
|
||||||
// Make sure file has been correctly copied before removing
|
if (result == 0)
|
||||||
if (FileExists(dstPath) && (GetFileLength(srcPath) == GetFileLength(dstPath))) result = FileRemove(srcPath);
|
{
|
||||||
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to copy file to [%s]", srcPath, dstPath);
|
// Make sure file has been correctly copied before removing
|
||||||
|
if (FileExists(dstPath) && (GetFileLength(srcPath) == GetFileLength(dstPath)))
|
||||||
|
{
|
||||||
|
result = FileRemove(srcPath);
|
||||||
|
if (result != 0) TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to remove source file after copy", srcPath);
|
||||||
|
}
|
||||||
|
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to copy file to [%s]", srcPath, dstPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Source file does not exist", srcPath);
|
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Source file does not exist", srcPath);
|
||||||
|
|
||||||
|
|
@ -2280,16 +2288,18 @@ int FileMove(const char *srcPath, const char *dstPath)
|
||||||
// WARNING: DEPENDENCY: [rtext] module
|
// WARNING: DEPENDENCY: [rtext] module
|
||||||
int FileTextReplace(const char *fileName, const char *search, const char *replacement)
|
int FileTextReplace(const char *fileName, const char *search, const char *replacement)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = -1;
|
||||||
|
|
||||||
|
#if SUPPORT_MODULE_RTEXT
|
||||||
char *fileText = NULL;
|
char *fileText = NULL;
|
||||||
char *fileTextUpdated = { 0 };
|
char *fileTextUpdated = { 0 };
|
||||||
|
|
||||||
#if SUPPORT_MODULE_RTEXT
|
|
||||||
if (FileExists(fileName))
|
if (FileExists(fileName))
|
||||||
{
|
{
|
||||||
fileText = LoadFileText(fileName);
|
fileText = LoadFileText(fileName);
|
||||||
fileTextUpdated = TextReplaceAlloc(fileText, search, replacement);
|
fileTextUpdated = TextReplaceAlloc(fileText, search, replacement);
|
||||||
result = SaveFileText(fileName, fileTextUpdated);
|
bool saved = SaveFileText(fileName, fileTextUpdated);
|
||||||
|
if (saved) result = 0;
|
||||||
MemFree(fileTextUpdated);
|
MemFree(fileTextUpdated);
|
||||||
UnloadFileText(fileText);
|
UnloadFileText(fileText);
|
||||||
}
|
}
|
||||||
|
|
@ -2399,7 +2409,7 @@ bool IsFileExtension(const char *fileName, const char *ext)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a directory path exists
|
// Check if directory path exists
|
||||||
bool DirectoryExists(const char *dirPath)
|
bool DirectoryExists(const char *dirPath)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
@ -2804,17 +2814,19 @@ int MakeDirectory(const char *dirPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change working directory, returns true on success
|
// Change working directory, returns true on success
|
||||||
bool ChangeDirectory(const char *dirPath)
|
int ChangeDirectory(const char *dirPath)
|
||||||
{
|
{
|
||||||
bool result = CHDIR(dirPath);
|
// NOTE: On success, CHDIR() return 0; on error, returns -1 and errno is set to indicate the error,
|
||||||
|
// depending on the filesystem, other errors can be returned
|
||||||
|
int result = CHDIR(dirPath);
|
||||||
|
|
||||||
if (result != 0) TRACELOG(LOG_WARNING, "SYSTEM: Failed to change to directory: %s", dirPath);
|
if (result != 0) TRACELOG(LOG_WARNING, "SYSTEM: Failed to change to directory: %s", dirPath);
|
||||||
else TRACELOG(LOG_INFO, "SYSTEM: Working Directory: %s", dirPath);
|
else TRACELOG(LOG_INFO, "SYSTEM: Working Directory: %s", dirPath);
|
||||||
|
|
||||||
return (result == 0);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a given path point to a file
|
// Check if given path point to a file
|
||||||
bool IsPathFile(const char *path)
|
bool IsPathFile(const char *path)
|
||||||
{
|
{
|
||||||
struct stat result = { 0 };
|
struct stat result = { 0 };
|
||||||
|
|
@ -2879,7 +2891,7 @@ bool IsFileNameValid(const char *fileName)
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a file has been dropped into window
|
// Check if file has been dropped into window
|
||||||
bool IsFileDropped(void)
|
bool IsFileDropped(void)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
@ -3790,7 +3802,7 @@ void PlayAutomationEvent(AutomationEvent event)
|
||||||
// Module Functions Definition: Input Handling: Keyboard
|
// Module Functions Definition: Input Handling: Keyboard
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Check if a key has been pressed once
|
// Check if key has been pressed once
|
||||||
bool IsKeyPressed(int key)
|
bool IsKeyPressed(int key)
|
||||||
{
|
{
|
||||||
bool pressed = false;
|
bool pressed = false;
|
||||||
|
|
@ -3803,7 +3815,7 @@ bool IsKeyPressed(int key)
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a key has been pressed again
|
// Check if key has been pressed again
|
||||||
bool IsKeyPressedRepeat(int key)
|
bool IsKeyPressedRepeat(int key)
|
||||||
{
|
{
|
||||||
bool repeat = false;
|
bool repeat = false;
|
||||||
|
|
@ -3816,7 +3828,7 @@ bool IsKeyPressedRepeat(int key)
|
||||||
return repeat;
|
return repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a key is being pressed (key held down)
|
// Check if key is being pressed (key held down)
|
||||||
bool IsKeyDown(int key)
|
bool IsKeyDown(int key)
|
||||||
{
|
{
|
||||||
bool down = false;
|
bool down = false;
|
||||||
|
|
@ -3829,7 +3841,7 @@ bool IsKeyDown(int key)
|
||||||
return down;
|
return down;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a key has been released once
|
// Check if key has been released once
|
||||||
bool IsKeyReleased(int key)
|
bool IsKeyReleased(int key)
|
||||||
{
|
{
|
||||||
bool released = false;
|
bool released = false;
|
||||||
|
|
@ -3842,7 +3854,7 @@ bool IsKeyReleased(int key)
|
||||||
return released;
|
return released;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a key is NOT being pressed (key not held down)
|
// Check if key is NOT being pressed (key not held down)
|
||||||
bool IsKeyUp(int key)
|
bool IsKeyUp(int key)
|
||||||
{
|
{
|
||||||
bool up = false;
|
bool up = false;
|
||||||
|
|
@ -3913,7 +3925,7 @@ void SetExitKey(int key)
|
||||||
// NOTE: Functions with a platform-specific implementation on rcore_<platform>.c
|
// NOTE: Functions with a platform-specific implementation on rcore_<platform>.c
|
||||||
//int SetGamepadMappings(const char *mappings)
|
//int SetGamepadMappings(const char *mappings)
|
||||||
|
|
||||||
// Check if a gamepad is available
|
// Check if gamepad is available
|
||||||
bool IsGamepadAvailable(int gamepad)
|
bool IsGamepadAvailable(int gamepad)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
@ -3929,7 +3941,7 @@ const char *GetGamepadName(int gamepad)
|
||||||
return CORE.Input.Gamepad.name[gamepad];
|
return CORE.Input.Gamepad.name[gamepad];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a gamepad button has been pressed once
|
// Check if gamepad button has been pressed once
|
||||||
bool IsGamepadButtonPressed(int gamepad, int button)
|
bool IsGamepadButtonPressed(int gamepad, int button)
|
||||||
{
|
{
|
||||||
bool pressed = false;
|
bool pressed = false;
|
||||||
|
|
@ -3942,7 +3954,7 @@ bool IsGamepadButtonPressed(int gamepad, int button)
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a gamepad button is being pressed
|
// Check if gamepad button is being pressed
|
||||||
bool IsGamepadButtonDown(int gamepad, int button)
|
bool IsGamepadButtonDown(int gamepad, int button)
|
||||||
{
|
{
|
||||||
bool down = false;
|
bool down = false;
|
||||||
|
|
@ -3955,7 +3967,7 @@ bool IsGamepadButtonDown(int gamepad, int button)
|
||||||
return down;
|
return down;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a gamepad button has NOT been pressed once
|
// Check if gamepad button has NOT been pressed once
|
||||||
bool IsGamepadButtonReleased(int gamepad, int button)
|
bool IsGamepadButtonReleased(int gamepad, int button)
|
||||||
{
|
{
|
||||||
bool released = false;
|
bool released = false;
|
||||||
|
|
@ -3968,7 +3980,7 @@ bool IsGamepadButtonReleased(int gamepad, int button)
|
||||||
return released;
|
return released;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a gamepad button is NOT being pressed
|
// Check if gamepad button is NOT being pressed
|
||||||
bool IsGamepadButtonUp(int gamepad, int button)
|
bool IsGamepadButtonUp(int gamepad, int button)
|
||||||
{
|
{
|
||||||
bool up = false;
|
bool up = false;
|
||||||
|
|
@ -4017,7 +4029,7 @@ float GetGamepadAxisMovement(int gamepad, int axis)
|
||||||
//void SetMousePosition(int x, int y)
|
//void SetMousePosition(int x, int y)
|
||||||
//void SetMouseCursor(int cursor)
|
//void SetMouseCursor(int cursor)
|
||||||
|
|
||||||
// Check if a mouse button has been pressed once
|
// Check if mouse button has been pressed once
|
||||||
bool IsMouseButtonPressed(int button)
|
bool IsMouseButtonPressed(int button)
|
||||||
{
|
{
|
||||||
bool pressed = false;
|
bool pressed = false;
|
||||||
|
|
@ -4033,7 +4045,7 @@ bool IsMouseButtonPressed(int button)
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a mouse button is being pressed
|
// Check if mouse button is being pressed
|
||||||
bool IsMouseButtonDown(int button)
|
bool IsMouseButtonDown(int button)
|
||||||
{
|
{
|
||||||
bool down = false;
|
bool down = false;
|
||||||
|
|
@ -4049,7 +4061,7 @@ bool IsMouseButtonDown(int button)
|
||||||
return down;
|
return down;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a mouse button has been released once
|
// Check if mouse button has been released once
|
||||||
bool IsMouseButtonReleased(int button)
|
bool IsMouseButtonReleased(int button)
|
||||||
{
|
{
|
||||||
bool released = false;
|
bool released = false;
|
||||||
|
|
@ -4065,7 +4077,7 @@ bool IsMouseButtonReleased(int button)
|
||||||
return released;
|
return released;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a mouse button is NOT being pressed
|
// Check if mouse button is NOT being pressed
|
||||||
bool IsMouseButtonUp(int button)
|
bool IsMouseButtonUp(int button)
|
||||||
{
|
{
|
||||||
bool up = false;
|
bool up = false;
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ void UpdateGestures(void); // Update gestures detec
|
||||||
|
|
||||||
#if defined(RGESTURES_STANDALONE)
|
#if defined(RGESTURES_STANDALONE)
|
||||||
void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
|
void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
|
||||||
bool IsGestureDetected(int gesture); // Check if a gesture has been detected
|
bool IsGestureDetected(int gesture); // Check if gesture has been detected
|
||||||
int GetGestureDetected(void); // Get latest detected gesture
|
int GetGestureDetected(void); // Get latest detected gesture
|
||||||
|
|
||||||
float GetGestureHoldDuration(void); // Get gesture hold time in seconds
|
float GetGestureHoldDuration(void); // Get gesture hold time in seconds
|
||||||
|
|
@ -257,7 +257,7 @@ void SetGesturesEnabled(unsigned int flags)
|
||||||
GESTURES.enabledFlags = flags;
|
GESTURES.enabledFlags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a gesture have been detected
|
// Check if gesture have been detected
|
||||||
bool IsGestureDetected(unsigned int gesture)
|
bool IsGestureDetected(unsigned int gesture)
|
||||||
{
|
{
|
||||||
if ((GESTURES.enabledFlags & GESTURES.current) == gesture) return true;
|
if ((GESTURES.enabledFlags & GESTURES.current) == gesture) return true;
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue