mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-06 06:09:17 -05:00
Compare commits
2 Commits
500494f791
...
11bf3996cf
| Author | SHA1 | Date | |
|---|---|---|---|
| 11bf3996cf | |||
| a7aeb2f2b5 |
@ -99,8 +99,9 @@ typedef enum {
|
|||||||
VALID_NOT_IN_JS = 1 << 9, // Not listed in examples.js
|
VALID_NOT_IN_JS = 1 << 9, // Not listed in examples.js
|
||||||
VALID_INCONSISTENT_INFO = 1 << 10, // Inconsistent info between collection and example header (stars, author...)
|
VALID_INCONSISTENT_INFO = 1 << 10, // Inconsistent info between collection and example header (stars, author...)
|
||||||
VALID_MISSING_WEB_OUTPUT = 1 << 11, // Missing .html/.data/.wasm/.js
|
VALID_MISSING_WEB_OUTPUT = 1 << 11, // Missing .html/.data/.wasm/.js
|
||||||
VALID_INVALID_CATEGORY = 1 << 12, // Not a recognized category
|
VALID_MISSING_WEB_METADATA = 1 << 12, // Missing .html example metadata
|
||||||
VALID_UNKNOWN_ERROR = 1 << 13 // Unknown failure case (fallback)
|
VALID_INVALID_CATEGORY = 1 << 13, // Not a recognized category
|
||||||
|
VALID_UNKNOWN_ERROR = 1 << 14 // Unknown failure case (fallback)
|
||||||
} rlExampleValidationStatus;
|
} rlExampleValidationStatus;
|
||||||
|
|
||||||
// Example management operations
|
// Example management operations
|
||||||
@ -112,6 +113,7 @@ typedef enum {
|
|||||||
OP_REMOVE = 4, // Remove existing example
|
OP_REMOVE = 4, // Remove existing example
|
||||||
OP_VALIDATE = 5, // Validate examples, using [examples_list.txt] as main source by default
|
OP_VALIDATE = 5, // Validate examples, using [examples_list.txt] as main source by default
|
||||||
OP_UPDATE = 6, // Validate and update required examples (as far as possible)
|
OP_UPDATE = 6, // Validate and update required examples (as far as possible)
|
||||||
|
OP_BUILD = 7, // Build example for desktop and web, copy web output
|
||||||
} rlExampleOperation;
|
} rlExampleOperation;
|
||||||
|
|
||||||
static const char *exCategories[REXM_MAX_EXAMPLE_CATEGORIES] = { "core", "shapes", "textures", "text", "models", "shaders", "audio", "others" };
|
static const char *exCategories[REXM_MAX_EXAMPLE_CATEGORIES] = { "core", "shapes", "textures", "text", "models", "shaders", "audio", "others" };
|
||||||
@ -173,7 +175,10 @@ static int AddVSProjectToSolution(const char *projFile, const char *slnFile, con
|
|||||||
|
|
||||||
// Generate unique UUID v4 string
|
// Generate unique UUID v4 string
|
||||||
// Output format: {9A2F48CC-0DA8-47C0-884E-02E37F9BE6C1}
|
// Output format: {9A2F48CC-0DA8-47C0-884E-02E37F9BE6C1}
|
||||||
const char *GenerateUUIDv4(void);
|
static const char *GenerateUUIDv4(void);
|
||||||
|
|
||||||
|
// Update generated Web example .html file metadata
|
||||||
|
static void UpdateWebMetadata(const char *exHtmlPath, const char *exFilePath);
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
@ -356,6 +361,29 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
opCode = OP_UPDATE;
|
opCode = OP_UPDATE;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(argv[1], "build") == 0)
|
||||||
|
{
|
||||||
|
// Build example for PLATFORM_DESKTOP and PLATFORM_WEB
|
||||||
|
// NOTE: Build outputs to default directory, usually where the .c file is located,
|
||||||
|
// to avoid issues with copying resources (at least on Desktop)
|
||||||
|
// Web build files (.html, .wasm, .js, .data) are copied to raylib.com/examples repo
|
||||||
|
// Check for valid upcoming argument
|
||||||
|
if (argc == 2) LOG("WARNING: No example name provided to build\n");
|
||||||
|
else if (argc > 3) LOG("WARNING: Too many arguments provided\n");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Verify example exists in collection to be removed
|
||||||
|
char *exColInfo = LoadFileText(exCollectionFilePath);
|
||||||
|
if (TextFindIndex(exColInfo, argv[2]) != -1) // Example in the collection
|
||||||
|
{
|
||||||
|
strcpy(exName, argv[2]); // Register example name for removal
|
||||||
|
strncpy(exCategory, exName, TextFindIndex(exName, "_"));
|
||||||
|
opCode = OP_BUILD;
|
||||||
|
}
|
||||||
|
else LOG("WARNING: REMOVE: Example not available in the collection\n");
|
||||||
|
UnloadFileText(exColInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (opCode)
|
switch (opCode)
|
||||||
@ -540,25 +568,15 @@ int main(int argc, char *argv[])
|
|||||||
// Compile to: raylib.com/examples/<category>/<category>_example_name.wasm
|
// Compile to: raylib.com/examples/<category>/<category>_example_name.wasm
|
||||||
// Compile to: raylib.com/examples/<category>/<category>_example_name.js
|
// Compile to: raylib.com/examples/<category>/<category>_example_name.js
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
// TODO: Avoid platform-specific .BAT file
|
//putenv("RAYLIB_DIR=C:\\GitHub\\raylib");
|
||||||
/*
|
//putenv("PATH=%PATH%;C:\\raylib\\w64devkit\\bin");
|
||||||
SET RAYLIB_PATH=C:\GitHub\raylib
|
// WARNING: EMSDK_PATH must be set to proper location when calling from GitHub Actions
|
||||||
SET COMPILER_PATH=C:\raylib\w64devkit\bin
|
|
||||||
ENV_SET PATH=$(COMPILER_PATH)
|
|
||||||
SET MAKE=mingw32-make
|
|
||||||
$(MAKE) -f Makefile.Web shaders/shaders_deferred_render PLATFORM=$(PLATFORM) -B
|
|
||||||
|
|
||||||
//int putenv(char *string); // putenv takes a string of the form NAME=VALUE
|
|
||||||
//int setenv(const char *envname, const char *envval, int overwrite);
|
|
||||||
//int unsetenv(const char *name); //unset variable
|
|
||||||
putenv("RAYLIB_DIR=C:\\GitHub\\raylib");
|
|
||||||
putenv("PATH=%PATH%;C:\\raylib\\w64devkit\\bin");
|
|
||||||
setenv("RAYLIB_DIR", "C:\\GitHub\\raylib", 1);
|
|
||||||
unsetenv("RAYLIB_DIR");
|
|
||||||
getenv("RAYLIB_DIR");
|
|
||||||
system(TextFormat("make -f Makefile.Web %s/%s PLATFORM=PLATFORM_WEB -B", exCategory, exName));
|
system(TextFormat("make -f Makefile.Web %s/%s PLATFORM=PLATFORM_WEB -B", exCategory, exName));
|
||||||
*/
|
//system(TextFormat("%s/build_example_web.bat %s/%s", exBasePath, exCategory, exName));
|
||||||
system(TextFormat("%s/build_example_web.bat %s/%s", exBasePath, exCategory, exName));
|
|
||||||
|
// Update generated .html metadata
|
||||||
|
UpdateWebMetadata(TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName),
|
||||||
|
TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName));
|
||||||
|
|
||||||
// Copy results to web side
|
// Copy results to web side
|
||||||
FileCopy(TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName),
|
FileCopy(TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName),
|
||||||
@ -634,8 +652,13 @@ int main(int argc, char *argv[])
|
|||||||
FileRemove(TextFormat("%s/%s/%s.js", exWebPath, exCategory, exName));
|
FileRemove(TextFormat("%s/%s/%s.js", exWebPath, exCategory, exName));
|
||||||
|
|
||||||
// Recompile example (on raylib side)
|
// Recompile example (on raylib side)
|
||||||
// NOTE: Tools requirements: emscripten, w64devkit
|
// WARNING: EMSDK_PATH must be set to proper location when calling from GitHub Actions
|
||||||
system(TextFormat("%s/build_example_web.bat %s/%s", exBasePath, exRecategory, exRename));
|
system(TextFormat("%s/make -f Makefile.Web %s/%s PLATFORM=PLATFORM_WEB -B", exBasePath, exRecategory, exRename));
|
||||||
|
//system(TextFormat("%s/build_example_web.bat %s/%s", exBasePath, exRecategory, exRename));
|
||||||
|
|
||||||
|
// Update generated .html metadata
|
||||||
|
UpdateWebMetadata(TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName),
|
||||||
|
TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName));
|
||||||
|
|
||||||
// Copy results to web side
|
// Copy results to web side
|
||||||
FileCopy(TextFormat("%s/%s/%s.html", exBasePath, exRecategory, exRename),
|
FileCopy(TextFormat("%s/%s/%s.html", exBasePath, exRecategory, exRename),
|
||||||
@ -763,10 +786,10 @@ int main(int argc, char *argv[])
|
|||||||
char *exListUpdated = (char *)RL_CALLOC(REXM_MAX_BUFFER_SIZE, 1);
|
char *exListUpdated = (char *)RL_CALLOC(REXM_MAX_BUFFER_SIZE, 1);
|
||||||
bool listUpdated = false;
|
bool listUpdated = false;
|
||||||
|
|
||||||
int exListLen = strlen(exList);
|
int exListLen = (int)strlen(exList);
|
||||||
strcpy(exListUpdated, exList);
|
strcpy(exListUpdated, exList);
|
||||||
|
|
||||||
for (int i = 0; i < list.count; i++)
|
for (unsigned int i = 0; i < list.count; i++)
|
||||||
{
|
{
|
||||||
if ((strcmp("examples_template", GetFileNameWithoutExt(list.paths[i])) != 0) && // HACK: Skip "examples_template"
|
if ((strcmp("examples_template", GetFileNameWithoutExt(list.paths[i])) != 0) && // HACK: Skip "examples_template"
|
||||||
(TextFindIndex(exList, GetFileNameWithoutExt(list.paths[i])) == -1))
|
(TextFindIndex(exList, GetFileNameWithoutExt(list.paths[i])) == -1))
|
||||||
@ -897,6 +920,23 @@ int main(int argc, char *argv[])
|
|||||||
exInfo->status |= VALID_MISSING_WEB_OUTPUT;
|
exInfo->status |= VALID_MISSING_WEB_OUTPUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate: raylib.com/examples/<category>/<category>_example_name.html -> Metadata
|
||||||
|
if (FileExists(TextFormat("%s/%s/%s.html", exWebPath, exInfo->category, exInfo->name)))
|
||||||
|
{
|
||||||
|
char *exHtmlText = LoadFileText(TextFormat("%s/%s/%s.html", exWebPath, exInfo->category, exInfo->name));
|
||||||
|
|
||||||
|
if ((TextFindIndex(exHtmlText, "raylib web game") > -1) || // title
|
||||||
|
(TextFindIndex(exHtmlText, "New raylib web videogame, developed using raylib videogames library") > -1) || // description
|
||||||
|
(TextFindIndex(exHtmlText, "https://www.raylib.com/common/raylib_logo.png") > -1) || // image
|
||||||
|
(TextFindIndex(exHtmlText, "https://www.raylib.com/games.html") > -1) || // url
|
||||||
|
(TextFindIndex(exHtmlText, "https://github.com/raysan5/raylib") > -1)) // source code button
|
||||||
|
{
|
||||||
|
exInfo->status |= VALID_MISSING_WEB_METADATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnloadFileText(exHtmlText);
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: Additional validation elements
|
// NOTE: Additional validation elements
|
||||||
// Validate: Example naming conventions: <category>/<category>_example_name, valid category
|
// Validate: Example naming conventions: <category>/<category>_example_name, valid category
|
||||||
if ((TextFindIndex(exInfo->name, exInfo->category) == -1) ||
|
if ((TextFindIndex(exInfo->name, exInfo->category) == -1) ||
|
||||||
@ -975,9 +1015,14 @@ int main(int argc, char *argv[])
|
|||||||
// Review: Add/Remove: raylib.com/examples/<category>/<category>_example_name.js
|
// Review: Add/Remove: raylib.com/examples/<category>/<category>_example_name.js
|
||||||
// Solves: VALID_MISSING_WEB_OUTPUT
|
// Solves: VALID_MISSING_WEB_OUTPUT
|
||||||
if ((strcmp(exInfo->category, "others") != 0) && // Skipping "others" category
|
if ((strcmp(exInfo->category, "others") != 0) && // Skipping "others" category
|
||||||
exInfo->status & VALID_MISSING_WEB_OUTPUT)
|
((exInfo->status & VALID_MISSING_WEB_OUTPUT) || (exInfo->status & VALID_MISSING_WEB_METADATA)))
|
||||||
{
|
{
|
||||||
system(TextFormat("%s/build_example_web.bat %s/%s", exBasePath, exInfo->category, exInfo->name));
|
system(TextFormat("%s/make -f Makefile.Web %s/%s PLATFORM=PLATFORM_WEB -B", exBasePath, exInfo->category, exInfo->name));
|
||||||
|
//system(TextFormat("%s/build_example_web.bat %s/%s", exBasePath, exInfo->category, exInfo->name));
|
||||||
|
|
||||||
|
// Update generated .html metadata
|
||||||
|
UpdateWebMetadata(TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName),
|
||||||
|
TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName));
|
||||||
|
|
||||||
// Copy results to web side
|
// Copy results to web side
|
||||||
FileCopy(TextFormat("%s/%s/%s.html", exBasePath, exInfo->category, exInfo->name),
|
FileCopy(TextFormat("%s/%s/%s.html", exBasePath, exInfo->category, exInfo->name),
|
||||||
@ -1022,14 +1067,15 @@ int main(int argc, char *argv[])
|
|||||||
[RDME] VALID_NOT_IN_README // Not listed in README.md
|
[RDME] VALID_NOT_IN_README // Not listed in README.md
|
||||||
[JS] VALID_NOT_IN_JS // Not listed in examples.js
|
[JS] VALID_NOT_IN_JS // Not listed in examples.js
|
||||||
[WOUT] VALID_MISSING_WEB_OUTPUT // Missing .html/.data/.wasm/.js
|
[WOUT] VALID_MISSING_WEB_OUTPUT // Missing .html/.data/.wasm/.js
|
||||||
|
[WMETA] VALID_MISSING_WEB_METADATA // Missing .html example metadata
|
||||||
[INFO] VALID_INCONSISTENT_INFO // Inconsistent info between collection and example header (stars, author...)
|
[INFO] VALID_INCONSISTENT_INFO // Inconsistent info between collection and example header (stars, author...)
|
||||||
[CAT] VALID_INVALID_CATEGORY // Not a recognized category
|
[CAT] VALID_INVALID_CATEGORY // Not a recognized category
|
||||||
|
|
||||||
| [EXAMPLE NAME] | [C] |[CAT]|[INFO]|[PNG]|[WPNG]|[RES]|[MK] |[MKWEB]|[VCX]|[SOL]|[RDME]|[JS] |[WOUT]|
|
| [EXAMPLE NAME] | [C] |[CAT]|[INFO]|[PNG]|[WPNG]|[RES]|[MK] |[MKWEB]|[VCX]|[SOL]|[RDME]|[JS] |[WOUT]|[WMETA]|
|
||||||
|:-----------------------------|:---:|:---:|:----:|:---:|:----:|:---:|:---:|:-----:|:---:|:---:|:----:|:---:|:----:|
|
|:-----------------------------|:---:|:---:|:----:|:---:|:----:|:---:|:---:|:-----:|:---:|:---:|:----:|:---:|:----:|:-----:|
|
||||||
| core_basic_window | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
| core_basic_window | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||||
| shapes_colors_palette | ✘ | ✔ | ✘ | ✔ | ✘ | ✔ | ✔ | ✘ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
| shapes_colors_palette | ✘ | ✔ | ✘ | ✔ | ✘ | ✔ | ✔ | ✘ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||||
| text_format_text | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | ✔ | ✘ | ✔ | ✔ | ✔ |
|
| text_format_text | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | ✔ | ✘ | ✔ | ✔ | ✔ | ✔ |
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *report = (char *)RL_CALLOC(REXM_MAX_BUFFER_SIZE, 1);
|
char *report = (char *)RL_CALLOC(REXM_MAX_BUFFER_SIZE, 1);
|
||||||
@ -1050,14 +1096,15 @@ int main(int argc, char *argv[])
|
|||||||
repIndex += sprintf(report + repIndex, " - [SOL] : Project not included in solution file\n");
|
repIndex += sprintf(report + repIndex, " - [SOL] : Project not included in solution file\n");
|
||||||
repIndex += sprintf(report + repIndex, " - [RDME] : Not listed in README.md\n");
|
repIndex += sprintf(report + repIndex, " - [RDME] : Not listed in README.md\n");
|
||||||
repIndex += sprintf(report + repIndex, " - [JS] : Not listed in Web (examples.js)\n");
|
repIndex += sprintf(report + repIndex, " - [JS] : Not listed in Web (examples.js)\n");
|
||||||
repIndex += sprintf(report + repIndex, " - [WOUT] : Missing Web build (.html/.data/.wasm/.js)\n```\n");
|
repIndex += sprintf(report + repIndex, " - [WOUT] : Missing Web build (.html/.data/.wasm/.js)\n");
|
||||||
|
repIndex += sprintf(report + repIndex, " - [WMETA] : Missing Web .html example metadata\n```\n");
|
||||||
|
|
||||||
repIndex += sprintf(report + repIndex, "| **EXAMPLE NAME** | [C] | [CAT]| [INFO]|[PNG]|[WPNG]| [RES]| [MK] |[MKWEB]| [VCX]| [SOL]|[RDME]|[JS] | [WOUT]|\n");
|
repIndex += sprintf(report + repIndex, "| **EXAMPLE NAME** | [C] | [CAT]| [INFO]|[PNG]|[WPNG]| [RES]| [MK] |[MKWEB]| [VCX]| [SOL]|[RDME]|[JS] | [WOUT]|[WMETA]|\n");
|
||||||
repIndex += sprintf(report + repIndex, "|:---------------------------------|:---:|:----:|:-----:|:---:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|:---:|:-----:|\n");
|
repIndex += sprintf(report + repIndex, "|:---------------------------------|:---:|:----:|:-----:|:---:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|:---:|:-----:|:-----:|\n");
|
||||||
|
|
||||||
for (int i = 0; i < exCollectionCount; i++)
|
for (int i = 0; i < exCollectionCount; i++)
|
||||||
{
|
{
|
||||||
repIndex += sprintf(report + repIndex, "| %-32s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s |\n",
|
repIndex += sprintf(report + repIndex, "| %-32s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s |\n",
|
||||||
exCollection[i].name,
|
exCollection[i].name,
|
||||||
(exCollection[i].status & VALID_MISSING_C)? "❌" : "✔",
|
(exCollection[i].status & VALID_MISSING_C)? "❌" : "✔",
|
||||||
(exCollection[i].status & VALID_INVALID_CATEGORY)? "❌" : "✔",
|
(exCollection[i].status & VALID_INVALID_CATEGORY)? "❌" : "✔",
|
||||||
@ -1071,7 +1118,8 @@ int main(int argc, char *argv[])
|
|||||||
(exCollection[i].status & VALID_NOT_IN_VCXSOL)? "❌" : "✔",
|
(exCollection[i].status & VALID_NOT_IN_VCXSOL)? "❌" : "✔",
|
||||||
(exCollection[i].status & VALID_NOT_IN_README)? "❌" : "✔",
|
(exCollection[i].status & VALID_NOT_IN_README)? "❌" : "✔",
|
||||||
(exCollection[i].status & VALID_NOT_IN_JS)? "❌" : "✔",
|
(exCollection[i].status & VALID_NOT_IN_JS)? "❌" : "✔",
|
||||||
(exCollection[i].status & VALID_MISSING_WEB_OUTPUT)? "❌" : "✔");
|
(exCollection[i].status & VALID_MISSING_WEB_OUTPUT)? "❌" : "✔",
|
||||||
|
(exCollection[i].status & VALID_MISSING_WEB_METADATA)? "❌" : "✔");
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveFileText(TextFormat("%s/../tools/rexm/%s", exBasePath, "examples_report.md"), report);
|
SaveFileText(TextFormat("%s/../tools/rexm/%s", exBasePath, "examples_report.md"), report);
|
||||||
@ -1098,16 +1146,17 @@ int main(int argc, char *argv[])
|
|||||||
repIndex += sprintf(reportIssues + repIndex, " - [SOL] : Project not included in solution file\n");
|
repIndex += sprintf(reportIssues + repIndex, " - [SOL] : Project not included in solution file\n");
|
||||||
repIndex += sprintf(reportIssues + repIndex, " - [RDME] : Not listed in README.md\n");
|
repIndex += sprintf(reportIssues + repIndex, " - [RDME] : Not listed in README.md\n");
|
||||||
repIndex += sprintf(reportIssues + repIndex, " - [JS] : Not listed in Web (examples.js)\n");
|
repIndex += sprintf(reportIssues + repIndex, " - [JS] : Not listed in Web (examples.js)\n");
|
||||||
repIndex += sprintf(reportIssues + repIndex, " - [WOUT] : Missing Web build (.html/.data/.wasm/.js)\n```\n");
|
repIndex += sprintf(reportIssues + repIndex, " - [WOUT] : Missing Web build (.html/.data/.wasm/.js)\n");
|
||||||
|
repIndex += sprintf(reportIssues + repIndex, " - [WMETA] : Missing Web .html example metadata\n```\n");
|
||||||
|
|
||||||
repIndex += sprintf(reportIssues + repIndex, "| **EXAMPLE NAME** | [C] | [CAT]| [INFO]|[PNG]|[WPNG]| [RES]| [MK] |[MKWEB]| [VCX]| [SOL]|[RDME]|[JS] | [WOUT]|\n");
|
repIndex += sprintf(reportIssues + repIndex, "| **EXAMPLE NAME** | [C] | [CAT]| [INFO]|[PNG]|[WPNG]| [RES]| [MK] |[MKWEB]| [VCX]| [SOL]|[RDME]|[JS] | [WOUT]|[WMETA]|\n");
|
||||||
repIndex += sprintf(reportIssues + repIndex, "|:---------------------------------|:---:|:----:|:-----:|:---:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|:---:|:-----:|\n");
|
repIndex += sprintf(reportIssues + repIndex, "|:---------------------------------|:---:|:----:|:-----:|:---:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|:---:|:-----:|:-----:|\n");
|
||||||
|
|
||||||
for (int i = 0; i < exCollectionCount; i++)
|
for (int i = 0; i < exCollectionCount; i++)
|
||||||
{
|
{
|
||||||
if (exCollection[i].status > 0)
|
if (exCollection[i].status > 0)
|
||||||
{
|
{
|
||||||
repIndex += sprintf(reportIssues + repIndex, "| %-32s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s |\n",
|
repIndex += sprintf(reportIssues + repIndex, "| %-32s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s |\n",
|
||||||
exCollection[i].name,
|
exCollection[i].name,
|
||||||
(exCollection[i].status & VALID_MISSING_C)? "❌" : "✔",
|
(exCollection[i].status & VALID_MISSING_C)? "❌" : "✔",
|
||||||
(exCollection[i].status & VALID_INVALID_CATEGORY)? "❌" : "✔",
|
(exCollection[i].status & VALID_INVALID_CATEGORY)? "❌" : "✔",
|
||||||
@ -1121,7 +1170,8 @@ int main(int argc, char *argv[])
|
|||||||
(exCollection[i].status & VALID_NOT_IN_VCXSOL)? "❌" : "✔",
|
(exCollection[i].status & VALID_NOT_IN_VCXSOL)? "❌" : "✔",
|
||||||
(exCollection[i].status & VALID_NOT_IN_README)? "❌" : "✔",
|
(exCollection[i].status & VALID_NOT_IN_README)? "❌" : "✔",
|
||||||
(exCollection[i].status & VALID_NOT_IN_JS)? "❌" : "✔",
|
(exCollection[i].status & VALID_NOT_IN_JS)? "❌" : "✔",
|
||||||
(exCollection[i].status & VALID_MISSING_WEB_OUTPUT)? "❌" : "✔");
|
(exCollection[i].status & VALID_MISSING_WEB_OUTPUT)? "❌" : "✔",
|
||||||
|
(exCollection[i].status & VALID_MISSING_WEB_METADATA)? "❌" : "✔");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1133,6 +1183,41 @@ int main(int argc, char *argv[])
|
|||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
case OP_BUILD:
|
||||||
|
{
|
||||||
|
// Build: raylib.com/examples/<category>/<category>_example_name.html
|
||||||
|
// Build: raylib.com/examples/<category>/<category>_example_name.data
|
||||||
|
// Build: raylib.com/examples/<category>/<category>_example_name.wasm
|
||||||
|
// Build: raylib.com/examples/<category>/<category>_example_name.js
|
||||||
|
if (strcmp(exCategory, "others") != 0) // Skipping "others" category
|
||||||
|
{
|
||||||
|
// Build example for PLATFORM_DESKTOP
|
||||||
|
putenv("RAYLIB_DIR=C:\\GitHub\\raylib");
|
||||||
|
putenv("PATH=%PATH%;C:\\raylib\\w64devkit\\bin");
|
||||||
|
putenv("MAKE=mingw32-make");
|
||||||
|
|
||||||
|
ChangeDirectory(exBasePath);
|
||||||
|
system(TextFormat("%s %s/%s PLATFORM=PLATFORM_DESKTOP -B", getenv("MAKE"), exCategory, exName));
|
||||||
|
|
||||||
|
// Build example for PLATFORM_WEB
|
||||||
|
system(TextFormat("%s -f Makefile.Web %s/%s PLATFORM=PLATFORM_WEB -B", getenv("MAKE"), exCategory, exName));
|
||||||
|
//system(TextFormat("%s/build_example_web.bat %s/%s", exBasePath, exInfo->category, exInfo->name));
|
||||||
|
|
||||||
|
// Update generated .html metadata
|
||||||
|
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),
|
||||||
|
TextFormat("%s/%s/%s.html", exWebPath, exCategory, exName));
|
||||||
|
FileCopy(TextFormat("%s/%s/%s.data", exBasePath, exCategory, exName),
|
||||||
|
TextFormat("%s/%s/%s.data", exWebPath, exCategory, exName));
|
||||||
|
FileCopy(TextFormat("%s/%s/%s.wasm", exBasePath, exCategory, exName),
|
||||||
|
TextFormat("%s/%s/%s.wasm", exWebPath, exCategory, exName));
|
||||||
|
FileCopy(TextFormat("%s/%s/%s.js", exBasePath, exCategory, exName),
|
||||||
|
TextFormat("%s/%s/%s.js", exWebPath, exCategory, exName));
|
||||||
|
}
|
||||||
|
} break;
|
||||||
default: // Help
|
default: // Help
|
||||||
{
|
{
|
||||||
// Supported commands:
|
// Supported commands:
|
||||||
@ -2051,7 +2136,7 @@ static int AddVSProjectToSolution(const char *projFile, const char *slnFile, con
|
|||||||
|
|
||||||
// Generate unique UUID v4 string
|
// Generate unique UUID v4 string
|
||||||
// Output format: {9A2F48CC-0DA8-47C0-884E-02E37F9BE6C1}
|
// Output format: {9A2F48CC-0DA8-47C0-884E-02E37F9BE6C1}
|
||||||
const char *GenerateUUIDv4(void)
|
static const char *GenerateUUIDv4(void)
|
||||||
{
|
{
|
||||||
static char uuid[38] = { 0 };
|
static char uuid[38] = { 0 };
|
||||||
memset(uuid, 0, 38);
|
memset(uuid, 0, 38);
|
||||||
@ -2074,3 +2159,68 @@ const char *GenerateUUIDv4(void)
|
|||||||
|
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update generated Web example .html file metadata
|
||||||
|
static void UpdateWebMetadata(const char *exHtmlPath, const char *exFilePath)
|
||||||
|
{
|
||||||
|
if (FileExists(exHtmlPath) && IsFileExtension(exHtmlPath, ".html"))
|
||||||
|
{
|
||||||
|
char *fileText = LoadFileText(exHtmlPath);
|
||||||
|
char *fileTextUpdated[6] = { 0 }; // Pointers to multiple updated text versions
|
||||||
|
|
||||||
|
char *exText = NULL; // Example code file, required to get description
|
||||||
|
char **lines = NULL; // Pointers to example code lines
|
||||||
|
int lineCount = 0; // Example code line count
|
||||||
|
int lineLength = 0; // Description line length
|
||||||
|
|
||||||
|
char exName[64] = { 0 }; // Example name: fileName without extension
|
||||||
|
char exCategory[16] = { 0 }; // Example category: core, shapes, text, textures, models, audio, shaders
|
||||||
|
char exDescription[256] = { 0 }; // Example description: example text line #3
|
||||||
|
char exTitle[64] = { 0 }; // Example title: fileName without extension, replacing underscores by spaces
|
||||||
|
|
||||||
|
memset(exName, 0, 64);
|
||||||
|
memset(exTitle, 0, 64);
|
||||||
|
memset(exDescription, 0, 256);
|
||||||
|
memset(exCategory, 0, 16);
|
||||||
|
lineLength = 0;
|
||||||
|
|
||||||
|
// Get example name: replace underscore by spaces
|
||||||
|
strcpy(exName, GetFileNameWithoutExt(exHtmlPath));
|
||||||
|
strcpy(exTitle, exName);
|
||||||
|
for (int i = 0; (i < 256) && (exTitle[i] != '\0'); i++) { if (exTitle[i] == '_') exTitle[i] = ' '; }
|
||||||
|
|
||||||
|
// Get example category from exName: copy until first underscore
|
||||||
|
for (int i = 0; (exName[i] != '_'); i++) exCategory[i] = exName[i];
|
||||||
|
|
||||||
|
// Get example description: copy line #3 from example file
|
||||||
|
exText = LoadFileText(exFilePath);
|
||||||
|
lines = LoadTextLines(exText, &lineCount);
|
||||||
|
for (int i = 0; (lines[2][i] != '\n') && (lines[2][i] != '\r'); i++) lineLength++;
|
||||||
|
strncpy(exDescription, lines[2] + 4, lineLength - 4);
|
||||||
|
UnloadFileText(exText);
|
||||||
|
|
||||||
|
// Update example.html required text
|
||||||
|
fileTextUpdated[0] = TextReplace(fileText, "raylib web game", exTitle);
|
||||||
|
fileTextUpdated[1] = TextReplace(fileTextUpdated[0], "New raylib web videogame, developed using raylib videogames library", exDescription);
|
||||||
|
fileTextUpdated[2] = TextReplace(fileTextUpdated[1], "https://www.raylib.com/common/raylib_logo.png",
|
||||||
|
TextFormat("https://raw.githubusercontent.com/raysan5/raylib/master/examples/%s/%s.png", exCategory, exName));
|
||||||
|
fileTextUpdated[3] = TextReplace(fileTextUpdated[2], "https://www.raylib.com/games.html",
|
||||||
|
TextFormat("https://www.raylib.com/examples/%s/%s.html", exCategory, exName));
|
||||||
|
fileTextUpdated[4] = TextReplace(fileTextUpdated[3], "raylib - example", TextFormat("raylib - %s", exName)); // og:site_name
|
||||||
|
fileTextUpdated[5] = TextReplace(fileTextUpdated[4], "https://github.com/raysan5/raylib",
|
||||||
|
TextFormat("https://github.com/raysan5/raylib/blob/master/examples/%s/%s.c", exCategory, exName));
|
||||||
|
|
||||||
|
SaveFileText(exHtmlPath, fileTextUpdated[5]);
|
||||||
|
|
||||||
|
//LOG("INFO: [%s] Updated successfully\n",files.paths[i]);
|
||||||
|
//LOG(" - Name / Title: %s / %s\n", exName, exTitle);
|
||||||
|
//LOG(" - Description: %s\n", exDescription);
|
||||||
|
//LOG(" - URL: %s\n", TextFormat("https://www.raylib.com/examples/%s/%s.html", exCategory, exName));
|
||||||
|
//LOG(" - URL Source: %s\n", TextFormat("https://github.com/raysan5/raylib/blob/master/examples/%s/%s.c", exCategory, exName));
|
||||||
|
|
||||||
|
for (int i = 0; i < 6; i++) { MemFree(fileTextUpdated[i]); fileTextUpdated[i] = NULL; }
|
||||||
|
|
||||||
|
UnloadTextLines(lines);
|
||||||
|
UnloadFileText(fileText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user