diff --git a/examples/README.md b/examples/README.md index 46e995df0..05855670b 100644 --- a/examples/README.md +++ b/examples/README.md @@ -32,7 +32,7 @@ Examples using raylib[core](../src/rcore.c) platform functionality like window c | [core_input_gamepad](core/core_input_gamepad.c) | core_input_gamepad | ⭐☆☆☆ | 1.1 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) | | [core_input_multitouch](core/core_input_multitouch.c) | core_input_multitouch | ⭐☆☆☆ | 2.1 | 2.5 | [Berni](https://github.com/Berni8k) | | [core_input_gestures](core/core_input_gestures.c) | core_input_gestures | ⭐⭐☆☆ | 1.4 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) | -| [core_input_gestures_testbed](core/core_input_gestures_testbed.c) | core_input_gestures_testbed | ⭐⭐⭐☆ | 4.6 | 5.6 | [ubkp](https://github.com/ubkp) | +| [core_input_gestures_testbed](core/core_input_gestures_testbed.c) | core_input_gestures_testbed | ⭐⭐⭐☆ | 4.6-dev | 5.6-dev | [ubkp](https://github.com/ubkp) | | [core_input_virtual_controls](core/core_input_virtual_controls.c) | core_input_virtual_controls | ⭐⭐☆☆ | 5.0 | 5.0 | [oblerion](https://github.com/oblerion) | | [core_2d_camera](core/core_2d_camera.c) | core_2d_camera | ⭐⭐☆☆ | 1.5 | 3.0 | [Ramon Santamaria](https://github.com/raysan5) | | [core_2d_camera_mouse_zoom](core/core_2d_camera_mouse_zoom.c) | core_2d_camera_mouse_zoom | ⭐⭐☆☆ | 4.2 | 4.2 | [Jeffery Myers](https://github.com/JeffM2501) | @@ -117,7 +117,7 @@ Examples using raylib textures functionality, including image/textures loading/g | [textures_fog_of_war](textures/textures_fog_of_war.c) | textures_fog_of_war | ⭐⭐⭐☆ | 4.2 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) | | [textures_gif_player](textures/textures_gif_player.c) | textures_gif_player | ⭐⭐⭐☆ | 4.2 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) | | [textures_image_kernel](textures/textures_image_kernel.c) | textures_image_kernel | ⭐⭐⭐⭐️ | 1.3 | 1.3 | [Karim Salem](https://github.com/kimo-s) | -| [textures_image_channel](textures/textures_image_channel.c) | textures_image_channel | ⭐⭐☆☆ | 5.1 | 5.1 | [Bruno Cabral](https://github.com/brccabral) | +| [textures_image_channel](textures/textures_image_channel.c) | textures_image_channel | ⭐⭐☆☆ | 5.1-dev | 5.1-dev | [Bruno Cabral](https://github.com/brccabral) | | [textures_image_rotate](textures/textures_image_rotate.c) | textures_image_rotate | ⭐⭐☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) | | [textures_textured_curve](textures/textures_textured_curve.c) | textures_textured_curve | ⭐⭐⭐☆ | 4.5 | 4.5 | [Jeffery Myers](https://github.com/JeffM2501) | @@ -169,7 +169,7 @@ Examples using raylib models functionality, including models loading/generation | [models_draw_cube_texture](models/models_draw_cube_texture.c) | models_draw_cube_texture | ⭐⭐☆☆ | 4.5 | 4.5 | [Ramon Santamaria](https://github.com/raysan5) | | [models_gpu_skinning](models/models_gpu_skinning.c) | models_gpu_skinning | ⭐⭐⭐☆ | 4.5 | 4.5 | [Daniel Holden](https://github.com/orangeduck) | | [models_bone_socket](models/models_bone_socket.c) | models_bone_socket | ⭐⭐⭐⭐️ | 4.5 | 4.5 | [iP](https://github.com/ipzaur) | -| [models_tesseract_view](models/models_tesseract_view.c) | models_tesseract_view | ⭐⭐☆☆ | 5.6 | 5.6 | [Timothy van der Valk](https://github.com/arceryz) | +| [models_tesseract_view](models/models_tesseract_view.c) | models_tesseract_view | ⭐⭐☆☆ | 5.6-dev | 5.6-dev | [Timothy van der Valk](https://github.com/arceryz) | ### category: shaders [29] @@ -202,10 +202,10 @@ Examples using raylib shaders functionality, including shaders loading, paramete | [shaders_shadowmap](shaders/shaders_shadowmap.c) | shaders_shadowmap | ⭐⭐⭐⭐️ | 5.0 | 5.0 | [TheManTheMythTheGameDev](https://github.com/TheManTheMythTheGameDev) | | [shaders_vertex_displacement](shaders/shaders_vertex_displacement.c) | shaders_vertex_displacement | ⭐⭐⭐☆ | 5.0 | 4.5 | [Alex ZH](https://github.com/ZzzhHe) | | [shaders_write_depth](shaders/shaders_write_depth.c) | shaders_write_depth | ⭐⭐☆☆ | 4.2 | 4.2 | [Buğra Alptekin Sarı](https://github.com/BugraAlptekinSari) | -| [shaders_basic_pbr](shaders/shaders_basic_pbr.c) | shaders_basic_pbr | ⭐⭐⭐⭐️ | 5.0 | 5.1 | [Afan OLOVCIC](https://github.com/_DevDad) | +| [shaders_basic_pbr](shaders/shaders_basic_pbr.c) | shaders_basic_pbr | ⭐⭐⭐⭐️ | 5.0 | 5.1-dev | [Afan OLOVCIC](https://github.com/_DevDad) | | [shaders_lightmap](shaders/shaders_lightmap.c) | shaders_lightmap | ⭐⭐⭐☆ | 4.5 | 4.5 | [Jussi Viitala](https://github.com/nullstare) | | [shaders_rounded_rectangle](shaders/shaders_rounded_rectangle.c) | shaders_rounded_rectangle | ⭐⭐⭐☆ | 5.5 | 5.5 | [Anstro Pleuton](https://github.com/anstropleuton) | -| [shaders_view_depth](shaders/shaders_view_depth.c) | shaders_view_depth | ⭐⭐⭐☆ | 5.6 | 5.6 | [Luís Almeida](https://github.com/luis605) | +| [shaders_view_depth](shaders/shaders_view_depth.c) | shaders_view_depth | ⭐⭐⭐☆ | 5.6-dev | 5.6-dev | [Luís Almeida](https://github.com/luis605) | ### category: audio [8] diff --git a/examples/others/rlgl_compute_shader.c b/examples/others/rlgl_compute_shader.c index e62f5abc0..4704b4a7c 100644 --- a/examples/others/rlgl_compute_shader.c +++ b/examples/others/rlgl_compute_shader.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [others] example - compute shader - game of life +* raylib [others] example - compute shader * * NOTE: This example requires raylib OpenGL 4.3 versions for compute shaders support, * shaders used in this example are #version 430 (OpenGL 4.3) @@ -57,7 +57,7 @@ int main(void) const int screenWidth = GOL_WIDTH; const int screenHeight = GOL_WIDTH; - InitWindow(screenWidth, screenHeight, "raylib [others] example - compute shader - game of life"); + InitWindow(screenWidth, screenHeight, "raylib [others] example - compute shader"); const Vector2 resolution = { screenWidth, screenHeight }; unsigned int brushSize = 8; diff --git a/examples/others/rlgl_standalone.c b/examples/others/rlgl_standalone.c index a022863fe..094884ffd 100644 --- a/examples/others/rlgl_standalone.c +++ b/examples/others/rlgl_standalone.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [others] example - Using rlgl module as standalone module +* raylib [others] example - standalone * * rlgl library is an abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, ES 2.0) * that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...) diff --git a/examples/shaders/shaders_view_depth.c b/examples/shaders/shaders_view_depth.c index f4eecf7e2..f75edde5b 100644 --- a/examples/shaders/shaders_view_depth.c +++ b/examples/shaders/shaders_view_depth.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [shaders] example - render depth texture +* raylib [shaders] example - view depth * * Example complexity rating: [★★★☆] 3/4 * @@ -36,7 +36,7 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [shaders] example - render depth texture"); + InitWindow(screenWidth, screenHeight, "raylib [shaders] example - view depth"); // Init camera Camera camera = { 0 }; diff --git a/examples/textures/textures_image_channel.c b/examples/textures/textures_image_channel.c index 56e544142..6ebbe2f68 100644 --- a/examples/textures/textures_image_channel.c +++ b/examples/textures/textures_image_channel.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - extract channel from image +* raylib [textures] example - image channel * * NOTE: Images are loaded in CPU memory (RAM); textures are loaded in GPU memory (VRAM) * @@ -29,7 +29,7 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [textures] example - extract channel from image"); + InitWindow(screenWidth, screenHeight, "raylib [textures] example - image channel"); Image fudesumiImage = LoadImage("resources/fudesumi.png"); diff --git a/tools/rexm/rexm.c b/tools/rexm/rexm.c index 9f3558745..e1ce5aa89 100644 --- a/tools/rexm/rexm.c +++ b/tools/rexm/rexm.c @@ -605,9 +605,8 @@ int main(int argc, char *argv[]) system(TextFormat("make -C %s -f Makefile.Web %s/%s PLATFORM=PLATFORM_WEB -B", exBasePath, exCategory, exName)); #endif // Update generated .html metadata - char exHtmlPath[512] = { 0 }; - strcpy(exHtmlPath, TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName)); // WARNING: Cache path for saving - UpdateWebMetadata(exHtmlPath, TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName)); + UpdateWebMetadata(TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName), + TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName)); // Copy results to web side FileCopy(TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName), @@ -691,9 +690,8 @@ int main(int argc, char *argv[]) system(TextFormat("make -C %s -f Makefile.Web %s/%s PLATFORM=PLATFORM_WEB -B", exBasePath, exRecategory, exRename)); #endif // Update generated .html metadata - char exHtmlPath[512] = { 0 }; - strcpy(exHtmlPath, TextFormat("%s/%s/%s.html", exBasePath, exCategory, exRename)); // WARNING: Cache path for saving - UpdateWebMetadata(exHtmlPath, TextFormat("%s/%s/%s.c", exBasePath, exCategory, exRename)); + UpdateWebMetadata(TextFormat("%s/%s/%s.html", exBasePath, exCategory, exRename), + TextFormat("%s/%s/%s.c", exBasePath, exCategory, exRename)); // Copy results to web side FileCopy(TextFormat("%s/%s/%s.html", exBasePath, exRecategory, exRename), @@ -1091,12 +1089,12 @@ int main(int argc, char *argv[]) #endif // Update generated .html metadata - char exHtmlPath[512] = { 0 }; - strcpy(exHtmlPath, TextFormat("%s/%s/%s.html", exBasePath, exInfo->category, exInfo->name)); // WARNING: Cache path for saving - UpdateWebMetadata(exHtmlPath, TextFormat("%s/%s/%s.c", exBasePath, exInfo->category, exInfo->name)); + UpdateWebMetadata(TextFormat("%s/%s/%s.html", exBasePath, exInfo->category, exInfo->name), + TextFormat("%s/%s/%s.c", exBasePath, exInfo->category, exInfo->name)); // Copy results to web side - FileCopy(exHtmlPath, TextFormat("%s/%s/%s.html", exWebPath, exInfo->category, exInfo->name)); + FileCopy(TextFormat("%s/%s/%s.html", exBasePath, exInfo->category, exInfo->name), + TextFormat("%s/%s/%s.html", exWebPath, exInfo->category, exInfo->name)); FileCopy(TextFormat("%s/%s/%s.data", exBasePath, exInfo->category, exInfo->name), TextFormat("%s/%s/%s.data", exWebPath, exInfo->category, exInfo->name)); FileCopy(TextFormat("%s/%s/%s.wasm", exBasePath, exInfo->category, exInfo->name), @@ -1106,9 +1104,12 @@ int main(int argc, char *argv[]) exInfo->status &= ~VALID_MISSING_WEB_OUTPUT; exInfo->status &= ~VALID_MISSING_WEB_METADATA; + } + if (exInfo->status & VALID_INCONSISTENT_INFO) + { // Update source code header info - UpdateSourceMetadata(TextFormat("%s/%s/%s.html", exBasePath, exInfo->category, exInfo->name), exInfo); + UpdateSourceMetadata(TextFormat("%s/%s/%s.c", exBasePath, exInfo->category, exInfo->name), exInfo); } } } @@ -1285,9 +1286,8 @@ int main(int argc, char *argv[]) #endif // Update generated .html metadata - char exHtmlPath[512] = { 0 }; - strcpy(exHtmlPath, TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName)); // WARNING: Cache path for saving - UpdateWebMetadata(exHtmlPath, TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName)); + UpdateWebMetadata(TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName), + TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName)); // Copy results to web side FileCopy(TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName), @@ -1936,7 +1936,7 @@ static int ParseExampleInfoLine(const char *line, rlExampleInfo *entry) int tokenCount = 0; char **tokens = TextSplit(line, ';', &tokenCount); - if (tokenCount != 7) LOG("REXM: WARNING: Example collection line contains invalid numbe of tokens: %i", tokenCount); + if (tokenCount != 9) LOG("REXM: WARNING: Example collection line contains invalid number of tokens: %i\n", tokenCount); // Get category and name strcpy(entry->category, tokens[0]); @@ -1966,10 +1966,10 @@ static int ParseExampleInfoLine(const char *line, rlExampleInfo *entry) entry->yearReviewed = TextToInteger(tokens[6]); // Get author and github - if (tokens[6][0] == '"') tokens[6] += 1; - if (tokens[6][strlen(tokens[6]) - 1] == '"') tokens[6][strlen(tokens[6]) - 1] = '\0'; - strcpy(entry->author, tokens[6]); - strcpy(entry->authorGitHub, tokens[7] + 1); // Skip '@' + if (tokens[7][0] == '"') tokens[7] += 1; + if (tokens[7][strlen(tokens[7]) - 1] == '"') tokens[7][strlen(tokens[7]) - 1] = '\0'; + strcpy(entry->author, tokens[7]); + strcpy(entry->authorGitHub, tokens[8] + 1); // Skip '@' return 1; } @@ -2274,8 +2274,13 @@ static void UpdateSourceMetadata(const char *exSrcPath, const rlExampleInfo *inf { if (FileExists(exSrcPath) && IsFileExtension(exSrcPath, ".c")) { - char *exText = LoadFileText(exSrcPath); + // WARNING: Cache a copy of exSrcPath to avoid modifications by TextFormat() + char exSourcePath[512] = { 0 }; + strcpy(exSourcePath, exSrcPath); + + char *exText = LoadFileText(exSourcePath); char *exTextUpdated[6] = { 0 }; // Pointers to multiple updated text versions + char *exTextUpdatedPtr = NULL; char exNameFormated[256] = { 0 }; // Example name without category and using spaces int exNameIndex = TextFindIndex(info->name, "_"); @@ -2327,11 +2332,16 @@ static void UpdateSourceMetadata(const char *exSrcPath, const rlExampleInfo *inf // Update contributors names // String: "* Example contributed by Contributor Name (@github_user) and reviewed by Ramon Santamaria (@raysan5)" // WARNING: Not all examples are contributed by someone, so the result of this replace can be NULL (string not found) - exTextUpdated[5] = TextReplaceBetween(exTextUpdated[4], - TextFormat("%s (@%s", info->author, info->authorGitHub), "* Example contributed by ", ")"); + if (exTextUpdated[4] != NULL) + { + exTextUpdated[5] = TextReplaceBetween(exTextUpdated[4], + TextFormat("%s (@%s", info->author, info->authorGitHub), "* Example contributed by ", ")"); + } + else exTextUpdatedPtr = exTextUpdated[3]; - if (exTextUpdated[5] != NULL) SaveFileText(exSrcPath, exTextUpdated[5]); - else SaveFileText(exSrcPath, exTextUpdated[4]); + if (exTextUpdated[5] != NULL) exTextUpdatedPtr = exTextUpdated[5]; + + SaveFileText(exSourcePath, exTextUpdatedPtr); for (int i = 0; i < 6; i++) { MemFree(exTextUpdated[i]); exTextUpdated[i] = NULL; } @@ -2344,7 +2354,11 @@ static void UpdateWebMetadata(const char *exHtmlPath, const char *exFilePath) { if (FileExists(exHtmlPath) && IsFileExtension(exHtmlPath, ".html")) { - char *exHtmlText = LoadFileText(exHtmlPath); + // WARNING: Cache a copy of exHtmlPath to avoid modifications by TextFormat() + char exHtmlPathCopy[512] = { 0 }; + strcpy(exHtmlPathCopy, exHtmlPath); + + char *exHtmlText = LoadFileText(exHtmlPathCopy); char *exHtmlTextUpdated[6] = { 0 }; // Pointers to multiple updated text versions char exName[64] = { 0 }; // Example name: fileName without extension @@ -2353,7 +2367,7 @@ static void UpdateWebMetadata(const char *exHtmlPath, const char *exFilePath) char exTitle[64] = { 0 }; // Example title: fileName without extension, replacing underscores by spaces // Get example name: replace underscore by spaces - strcpy(exName, GetFileNameWithoutExt(exHtmlPath)); + strcpy(exName, GetFileNameWithoutExt(exHtmlPathCopy)); strcpy(exTitle, exName); for (int i = 0; (i < 256) && (exTitle[i] != '\0'); i++) { if (exTitle[i] == '_') exTitle[i] = ' '; } @@ -2380,7 +2394,7 @@ static void UpdateWebMetadata(const char *exHtmlPath, const char *exFilePath) exHtmlTextUpdated[5] = TextReplace(exHtmlTextUpdated[4], "https://github.com/raysan5/raylib", TextFormat("https://github.com/raysan5/raylib/blob/master/examples/%s/%s.c", exCategory, exName)); - SaveFileText(exHtmlPath, exHtmlTextUpdated[5]); + SaveFileText(exHtmlPathCopy, exHtmlTextUpdated[5]); //LOG("INFO: [%s] Updated successfully\n",files.paths[i]); //LOG(" - Name / Title: %s / %s\n", exName, exTitle);