13 Коміти

Автор SHA1 Повідомлення Дата
  Ray 1948453394 Update README.md 4 тижднів тому
  Ray b044b52955 UPDATED: `examples.js` example addition working 4 тижднів тому
  Ray 528ad4964d UPDATE: `Makefile` example addition working 4 тижднів тому
  Ray e76c5f7d64 Update rexm.c 4 тижднів тому
  Ray 0533987f80 Merge branch 'master' of https://github.com/raysan5/raylib 4 тижднів тому
  Ray e01f3f158e Remove some testing code 4 тижднів тому
  github-actions[bot] 42619ea2df Update raylib_api.* by CI 4 тижднів тому
  Ray c60763d19e UPDATED: `LoadExamplesData()` to support filtering and sorting 4 тижднів тому
  Ray 1c8eef9b0b Update raylib and generate `ARM64` libraries for Windows, Linux, macOS 4 тижднів тому
  Ray d3fe9e5036 Merge branch 'master' of https://github.com/raysan5/raylib 4 тижднів тому
  Ray 159a9eac4a Update build_example_web.bat 4 тижднів тому
  Ray c4d733e864
Merge pull request #5082 from JeffM2501/render_target_size 4 тижднів тому
  Jeffery Myers bf536d68e1 Make GetRenderWidth and GetREnderHeight return the FBO size if one is active. 4 тижднів тому
9 змінених файлів з 236 додано та 54 видалено
  1. +7
    -6
      examples/README.md
  2. +2
    -2
      examples/build_example_web.bat
  3. +218
    -41
      examples/rexm.c
  4. +1
    -1
      parser/output/raylib_api.json
  5. +1
    -1
      parser/output/raylib_api.lua
  6. +1
    -1
      parser/output/raylib_api.txt
  7. +1
    -1
      parser/output/raylib_api.xml
  8. +1
    -1
      src/raylib.h
  9. +4
    -0
      src/rcore.c

+ 7
- 6
examples/README.md Переглянути файл

@ -20,7 +20,7 @@ You may find it easier to use than other toolchains, especially when it comes to
### category: core
Examples using raylib core platform functionality like window creation, inputs, drawing modes and system functionality.
Examples using raylib [core](../src/rcore.c) platform functionality like window creation, inputs, drawing modes and system functionality.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
@ -63,7 +63,7 @@ Examples using raylib core platform functionality like window creation, inputs,
### category: shapes
Examples using raylib shapes drawing functionality, provided by raylib [shapes](../src/shapes.c) module.
Examples using raylib shapes drawing functionality, provided by raylib [shapes](../src/rshapes.c) module.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
@ -87,9 +87,10 @@ Examples using raylib shapes drawing functionality, provided by raylib [shapes](
| 53 | [shapes_splines_drawing](shapes/shapes_splines_drawing.c) | <img src="shapes/shapes_splines_drawing.png" alt="shapes_splines_drawing" width="80"> | ⭐️⭐️⭐️☆ | 5.0 | 5.0 | [Ray](https://github.com/raysan5) |
| 54 | [shapes_digital_clock](shapes/shapes_digital_clock.c) | <img src="shapes/shapes_digital_clock.png" alt="shapes_digital_clock" width="80"> | ⭐️⭐️☆☆ | 5.5 | 5.5 | [Hamza RAHAL](https://github.com/rhmz-rhl) |
| 55 | [shapes_double_pendulum](shapes/shapes_double_pendulum.c) | <img src="shapes/shapes_double_pendulum.png" alt="shapes_double_pendulum" width="80"> | ⭐️⭐️☆☆ | 5.5 | 5.5 | [JoeCheong](https://github.com/Joecheong2006) |
### category: textures
Examples using raylib textures functionality, including image/textures loading/generation and drawing, provided by raylib [textures](../src/textures.c) modul
Examples using raylib textures functionality, including image/textures loading/generation and drawing, provided by raylib [textures](../src/rtextures.c) module.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
@ -122,7 +123,7 @@ Examples using raylib textures functionality, including image/textures loading/g
### category: text
Examples using raylib text functionality, including sprite fonts loading/generation and text drawing, provided by raylib [text](../src/text.c) module.
Examples using raylib text functionality, including sprite fonts loading/generation and text drawing, provided by raylib [text](../src/rtext.c) module.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
@ -141,7 +142,7 @@ Examples using raylib text functionality, including sprite fonts loading/generat
### category: models
Examples using raylib models functionality, including models loading/generation and drawing, provided by raylib [models](../src/models.c) module.
Examples using raylib models functionality, including models loading/generation and drawing, provided by raylib [models](../src/rmodels.c) module.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
@ -206,7 +207,7 @@ Examples using raylib shaders functionality, including shaders loading, paramete
### category: audio
Examples using raylib audio functionality, including sound/music loading and playing. This functionality is provided by raylib [raudio](../src/raudio.c) module. Note this module can be used standalone independently of raylib, check [raudio_standalone](others/raudio_standalone.c) example.
Examples using raylib audio functionality, including sound/music loading and playing. This functionality is provided by raylib [raudio](../src/raudio.c) module. Note this module can be used standalone independently of raylib.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|

+ 2
- 2
examples/build_example_web.bat Переглянути файл

@ -1,10 +1,10 @@
::@echo off
:: .
:: Compile your examples for web using: build_example_web.bat <example_category>\<example_name>
:: Compile your examples for web using: build_example_web.bat <example_category>/<example_name>
:: .
set "INPUT_FILE=%1"
:: Change delimiter for the FOR loop
for /f "tokens=1-10 delims=\" %%a in ("%INPUT_FILE%") do (
for /f "tokens=1-10 delims=/" %%a in ("%INPUT_FILE%") do (
set CATEGORY=%%a
set FILENAME=%%b
)

+ 218
- 41
examples/rexm.c Переглянути файл

@ -64,12 +64,12 @@
// raylib example info struct
typedef struct {
char category[16];
char name[64];
char name[128];
char stars;
float verCreated;
float verUpdated;
char author[64];
char authorGitHub[32];
char authorGitHub[64];
} rlExampleInfo;
// Example management operations
@ -82,6 +82,10 @@ typedef enum {
OP_VALIDATE = 5, // Validate examples, using [examples_list.txt] as main source by default
} rlExampleOperation;
#define MAX_EXAMPLE_CATEGORIES 8
static const char *exCategories[MAX_EXAMPLE_CATEGORIES] = { "core", "shapes", "textures", "text", "models", "shaders", "audio", "others" };
//----------------------------------------------------------------------------------
// Module specific functions declaration
//----------------------------------------------------------------------------------
@ -91,7 +95,9 @@ static int FileRename(const char *fileName, const char *fileRename);
static int FileRemove(const char *fileName);
// Load examples collection information
static rlExampleInfo *LoadExamplesData(const char *fileName, int *exCount);
// NOTE 1: Load by category: "ALL", "core", "shapes", "textures", "text", "models", "shaders", others"
// NOTE 2: Sort examples list on request flag
static rlExampleInfo *LoadExamplesData(const char *fileName, const char *category, bool sort, int *exCount);
static void UnloadExamplesData(rlExampleInfo *exInfo);
// Get text lines (by line-breaks '\n')
@ -104,7 +110,7 @@ static int ParseExampleInfoLine(const char *line, rlExampleInfo *entry);
// Sort array of strings by name
// WARNING: items[] pointers are reorganized
static void SortStringsByName(char **items, int count);
static void SortExampleByName(rlExampleInfo *items, int count);
//------------------------------------------------------------------------------------
// Program main entry point
@ -117,8 +123,8 @@ int main(int argc, char *argv[])
char *exWebPath = "C:/GitHub/raylib.com/examples";
char *exTemplateFilePath = "C:/GitHub/raylib/examples/examples_template.c";
char *exTemplateScreenshot = "C:/GitHub/raylib/examples/examples_template.png";
char *exCollectionList = "C:/GitHub/raylib/examples/examples_list.txt";
char *exCollectionListPath = "C:/GitHub/raylib/examples/examples_list.txt";
char inFileName[1024] = { 0 }; // Example input filename (to be added)
char exName[64] = { 0 }; // Example name, without extension: core_basic_window
@ -203,12 +209,29 @@ int main(int argc, char *argv[])
}
}
// Load examples collection information
//exInfo = LoadExamplesData(exCollectionListPath, "core", true, &exInfoCount);
//for (int i = 0; i < exInfoCount; i++) printf("%i - %s [%i]\n", i + 1, exInfo[i].name, exInfo[i].stars);
switch (opCode)
{
case 1: // Create: New example from template
{
// Create: raylib/examples/<category>/<category>_example_name.c
FileCopy(exTemplateFilePath, TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName));
char *exText = LoadFileText(exTemplateFilePath);
char *exTextUpdated[6] = { 0 };
int exIndex = TextFindIndex(exText, "/****************");
exTextUpdated[0] = TextReplace(exText + exIndex, "<module>", exCategory);
exTextUpdated[1] = TextReplace(exTextUpdated[0], "<name>", exName + strlen(exCategory) + 1);
//TextReplace(newExample, "<user_name>", "Ray");
//TextReplace(newExample, "@<user_github>", "@raysan5");
//TextReplace(newExample, "<year_created>", 2025);
//TextReplace(newExample, "<year_updated>", 2025);
SaveFileText(TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName), exTextUpdated[1]);
for (int i = 0; i < 6; i++) { MemFree(exTextUpdated[i]); exTextUpdated[i] = NULL; }
UnloadFileText(exText);
}
case 2: // Add: Example from command-line input filename
{
@ -220,45 +243,174 @@ int main(int argc, char *argv[])
// Copy: raylib/examples/<category>/resources/... // WARNING: To be updated manually!
// Check if example is already listed
// If not, add to the main examples_list
// TODO: Update the required files to add new example in the required position (ordered by category and name),
// it could require some logic to make it possible...
// Add example to the main collection list, if not already there
// NOTE: Required format: shapes;shapes_basic_shapes;;1.0;4.2;"Ray";@raysan5
//------------------------------------------------------------------------------------------------
char *exColInfo = LoadFileText(exCollectionListPath);
if (TextFindIndex(exColInfo, exName) == -1) // Example not found
{
char *exColInfoUpdated = (char *)RL_CALLOC(2*1024*1024, 1); // Updated list copy, 2MB
// Add example to the main list, by category
// by default add it last in the category list
// NOTE: When populating to other files, lists are sorted by name
int nextCatIndex = 0;
if (strcmp(exCategory, "core") == 0) nextCatIndex = 1;
else if (strcmp(exCategory, "shapes") == 0) nextCatIndex = 2;
else if (strcmp(exCategory, "textures") == 0) nextCatIndex = 3;
else if (strcmp(exCategory, "text") == 0) nextCatIndex = 4;
else if (strcmp(exCategory, "models") == 0) nextCatIndex = 5;
else if (strcmp(exCategory, "shaders") == 0) nextCatIndex = 6;
else if (strcmp(exCategory, "audio") == 0) nextCatIndex = 7;
else if (strcmp(exCategory, "others") == 0) nextCatIndex = -1; // Add to EOF
if (nextCatIndex == -1)
{
// Add example to the end of the list
int endIndex = (int)strlen(exColInfo);
memcpy(exColInfoUpdated, exColInfo, endIndex);
sprintf(exColInfoUpdated + endIndex, TextFormat("\n%s/%s\n", exCategory, exName));
}
else
{
// Add example to the end of the category list
// TODO: Get required example info from example file header (if provided)
// NOTE: If no example info is provided (other than category/name), just using some default values
int catIndex = TextFindIndex(exColInfo, exCategories[nextCatIndex]);
memcpy(exColInfoUpdated, exColInfo, catIndex);
int textWritenSize = sprintf(exColInfoUpdated + catIndex, TextFormat("%s;%s;⭐️☆☆☆;6.0;6.0;\"Ray\";@raysan5\n", exCategory, exName));
memcpy(exColInfoUpdated + catIndex + textWritenSize, exColInfo + catIndex, strlen(exColInfo) - catIndex);
}
SaveFileText(exCollectionListPath, exColInfoUpdated);
RL_FREE(exColInfoUpdated);
}
UnloadFileText(exColInfo);
//------------------------------------------------------------------------------------------------
// Edit: raylib/examples/Makefile --> Add new example
//------------------------------------------------------------------------------------------------
/*
char *mkText = LoadFileText(TextFormat("%s/Makefile", exBasePath));
char *mkTextUpdated = (char *)RL_CALLOC(2*1024*1024, 1); // Updated Makefile copy, 2MB
int exListStartIndex = TextFindIndex(mkText, "#EXAMPLES_LIST_START");
int exListEndIndex = TextFindIndex(mkText, "#EXAMPLES_LIST_END");
char *mkTextUpdate = (char *)RL_CALLOC(2*1024*1024, 1); // 2MB
memcpy(mkTextUpdate, mkText, exListStartIndex);
// TODO: Update required lines...
//SaveFileText(TextFormat("%s/Makefile", exBasePath), mkTextUpdate);
int mkIndex = 0;
memcpy(mkTextUpdated, mkText, exListStartIndex);
mkIndex = sprintf(mkTextUpdated + exListStartIndex, "#EXAMPLES_LIST_START\n");
for (int i = 0; i < MAX_EXAMPLE_CATEGORIES; i++)
{
mkIndex += sprintf(mkTextUpdated + exListStartIndex + mkIndex, TextFormat("%s = \\\n", TextToUpper(exCategories[i])));
int exCount = 0;
rlExampleInfo *exCatList = LoadExamplesData(exCollectionListPath, exCategories[i], true, &exCount);
for (int x = 0; x < exCount - 1; x++) mkIndex += sprintf(mkTextUpdated + exListStartIndex + mkIndex, TextFormat(" %s/%s \\\n", exCatList[x].category, exCatList[x].name));
mkIndex += sprintf(mkTextUpdated + exListStartIndex + mkIndex, TextFormat(" %s/%s\n\n", exCatList[exCount - 1].category, exCatList[exCount - 1].name));
UnloadExamplesData(exCatList);
}
// Add the remaining part of the original file
memcpy(mkTextUpdated + exListStartIndex + mkIndex, mkText + exListEndIndex, strlen(mkText) - exListEndIndex);
// Save updated file
SaveFileText(TextFormat("%s/Makefile", exBasePath), mkTextUpdated);
UnloadFileText(mkText);
RL_FREE(mkTextUpdate);
RL_FREE(mkTextUpdated);
*/
//------------------------------------------------------------------------------------------------
// Edit: raylib/examples/Makefile.Web --> Add new example
//------------------------------------------------------------------------------------------------
// TODO.
//------------------------------------------------------------------------------------------------
// Edit: raylib/examples/README.md --> Add new example
//------------------------------------------------------------------------------------------------
// TODO: Use [examples_list.txt] to update/regen README.md
//Look for "| 01 | "
// Lines format: | 01 | [core_basic_window](core/core_basic_window.c) | <img src="core/core_basic_window.png" alt="core_basic_window" width="80"> | | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
//------------------------------------------------------------------------------------------------
// Create: raylib/projects/VS2022/examples/<category>_example_name.vcxproj
//------------------------------------------------------------------------------------------------
FileCopy(TextFormat("%s/../projects/VS2022/examples/core_basic_window.vcxproj", exBasePath),
TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exName));
FileTextReplace(, "core_basic_window", exName);
FileTextReplace(, "..\..\examples\core", TextFormat("..\..\examples\%s", exCategory));
FileTextReplace(TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exName),
"core_basic_window", exName);
FileTextReplace(TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exName),
"..\\..\\examples\\core", TextFormat("..\\..\\examples\\%s", exCategory));
// Edit: raylib/projects/VS2022/raylib.sln --> Add new example project
system(TextFormat("dotnet solution raylib.sln add %s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exName));
system(TextFormat("dotnet solution %s/../projects/VS2022/raylib.sln add %s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exBasePath, exName));
//------------------------------------------------------------------------------------------------
// Edit: raylib.com/common/examples.js --> Add new example
//Entries format: exampleEntry('' , 'core' , 'basic_window'),
// NOTE: Entries format: exampleEntry('' , 'core' , 'basic_window'),
//------------------------------------------------------------------------------------------------
char *jsText = LoadFileText(TextFormat("%s/../common/examples.js", exWebPath));
char *jsTextUpdated = (char *)RL_CALLOC(2*1024*1024, 1); // Updated examples.js copy, 2MB
int exListStartIndex = TextFindIndex(jsText, "//EXAMPLE_DATA_LIST_START");
int exListEndIndex = TextFindIndex(jsText, "//EXAMPLE_DATA_LIST_END");
int mkIndex = 0;
memcpy(jsTextUpdated, jsText, exListStartIndex);
mkIndex = sprintf(jsTextUpdated + exListStartIndex, "#EXAMPLES_LIST_START\n");
int jsIndex = 0;
memcpy(jsTextUpdated, jsText, exListStartIndex);
jsIndex = sprintf(jsTextUpdated + exListStartIndex, "//EXAMPLE_DATA_LIST_START\n");
jsIndex += sprintf(jsTextUpdated + exListStartIndex + jsIndex, " var exampleData = [\n");
// NOTE: We avoid "others" category
for (int i = 0, exCount = 0; i < MAX_EXAMPLE_CATEGORIES - 1; i++)
{
rlExampleInfo *exCatList = LoadExamplesData(exCollectionListPath, exCategories[i], false, &exCount);
for (int x = 0; x < exCount; x++)
{
char stars[16] = { 0 };
for (int s = 0; s < 4; s++)
{
if (s < exCatList[x].stars) strcpy(stars + 3*s, "⭐️");
else strcpy(stars + 3*s, "");
}
if ((i == 6) && (x == (exCount - 1)))
{
// Last line to add, special case to consider
jsIndex += sprintf(jsTextUpdated + exListStartIndex + jsIndex,
TextFormat(" exampleEntry('%s', '%s', '%s')];\n", stars, exCatList[x].category, exCatList[x].name + strlen(exCatList[x].category) + 1));
}
else
{
jsIndex += sprintf(jsTextUpdated + exListStartIndex + jsIndex,
TextFormat(" exampleEntry('%s', '%s', '%s'),\n", stars, exCatList[x].category, exCatList[x].name + strlen(exCatList[x].category) + 1));
}
}
UnloadExamplesData(exCatList);
}
// Add the remaining part of the original file
memcpy(jsTextUpdated + exListStartIndex + jsIndex, jsText + exListEndIndex, strlen(jsText) - exListEndIndex);
// Save updated file
SaveFileText(TextFormat("%s/../common/examples.js", exWebPath), jsTextUpdated);
UnloadFileText(jsText);
RL_FREE(jsTextUpdated);
//------------------------------------------------------------------------------------------------
// Recompile example (on raylib side)
// NOTE: Tools requirements: emscripten, w64devkit
@ -266,7 +418,9 @@ int main(int argc, char *argv[])
// Compile to: raylib.com/examples/<category>/<category>_example_name.data
// Compile to: raylib.com/examples/<category>/<category>_example_name.wasm
// Compile to: raylib.com/examples/<category>/<category>_example_name.js
system(TextFormat("%s/../build_example_web.bat %s\%s", exBasePath, exCategory, exName));
// TODO: WARNING: This .BAT is not portable and it does not consider RESOURCES for Web properly,
// Makefile.Web should be used... but it requires proper editing first!
system(TextFormat("%s/build_example_web.bat %s/%s", exBasePath, exCategory, exName));
// Copy results to web side
FileCopy(TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName),
@ -303,7 +457,7 @@ int main(int argc, char *argv[])
// Recompile example (on raylib side)
// NOTE: Tools requirements: emscripten, w64devkit
system(TextFormat("%s/../build_example_web.bat %s</span>\%s", exBasePath, exCategory, exName));
system(TextFormat("%s/../build_example_web.bat %s/%s", exBasePath, exCategory, exName));
// Copy results to web side
FileCopy(TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName),
@ -382,14 +536,15 @@ int main(int argc, char *argv[])
// Module specific functions definition
//----------------------------------------------------------------------------------
// Load examples collection information
static rlExampleInfo *LoadExamplesData(const char *fileName, int *exCount)
static rlExampleInfo *LoadExamplesData(const char *fileName, ">const char *category, bool sort, int *exCount)
{
#define MAX_EXAMPLES_INFO 256
*exCount = 0;
rlExampleInfo *exInfo = (rlExampleInfo *)RL_CALLOC(MAX_EXAMPLES_INFO, sizeof(rlExampleInfo));
int exCounter = 0;
*exCount = 0;
const char *text = LoadFileText(fileName);
char *text = LoadFileText(fileName);
if (text != NULL)
{
@ -407,11 +562,33 @@ static rlExampleInfo *LoadExamplesData(const char *fileName, int *exCount)
(linePtrs[i][0] == 'a') || // audio
(linePtrs[i][0] == 'o'))) // others
{
if (ParseExampleInfoLine(linePtrs[i], &exInfo[*exCount]) == 0) *exCount += 1;
rlExampleInfo info = { 0 };
int result = ParseExampleInfoLine(linePtrs[i], &info);
if (result == 1) // Success on parsing
{
if (strcmp(category, "ALL") == 0)
{
// Add all examples to the list
memcpy(&exInfo[exCounter], &info, sizeof(rlExampleInfo));
exCounter++;
}
else if (strcmp(info.category, category) == 0)
{
// Get only specific category examples
memcpy(&exInfo[exCounter], &info, sizeof(rlExampleInfo));
exCounter++;
}
}
}
}
UnloadFileText(text);
}
// Sorting required
if (sort) SortExampleByName(exInfo, exCounter);
*exCount = exCounter;
return exInfo;
}
@ -482,7 +659,7 @@ static int FileRemove(const char *fileName)
// WARNING: It does not copy text data, just returns line pointers
static const char **GetTextLines(const char *text, int *count)
{
#define MAX_TEXT_LINE_PTRS 128
#define MAX_TEXT_LINE_PTRS 512
static const char *linePtrs[MAX_TEXT_LINE_PTRS] = { 0 };
for (int i = 0; i < MAX_TEXT_LINE_PTRS; i++) linePtrs[i] = NULL; // Init NULL pointers to substrings
@ -509,7 +686,7 @@ static const char **GetTextLines(const char *text, int *count)
}
// raylib example line info parser
// Parses following line format: coreo">/core_basic_window;;1.0;1.0;"Ray"o">/@raysan5
// Parses following line format: corep">;core_basic_window;;1.0;1.0;"Ray"p">;@raysan5
static int ParseExampleInfoLine(const char *line, rlExampleInfo *entry)
{
#define MAX_EXAMPLE_INFO_LINE_LEN 512
@ -522,8 +699,8 @@ static int ParseExampleInfoLine(const char *line, rlExampleInfo *entry)
char **tokens = TextSplit(line, ';', &tokenCount);
// Get category and name
strncpy(entry->category, tokens[0], sizeof(entry->category));
strncpy(entry->name, tokens[1], sizeof(entry->name));
strcpy(entry->category, tokens[0]);
strcpy(entry->name, tokens[1]);
// Parsing stars
// NOTE: Counting the unicode char occurrences:
@ -547,24 +724,24 @@ static int ParseExampleInfoLine(const char *line, rlExampleInfo *entry)
// Get author and github
char *quote1 = strchr(tokens[5], '"');
char *quote2 = quote1? strchr(quote1 + 1, '"') : NULL;
if (quote1 && quote2) strncpy(entry->author, quote1 + 1, sizeof(entry->author));
strncpy(entry->authorGitHub, tokens[6], sizeof(entry->authorGitHub));
if (quote1 && quote2) strcpy(entry->author, quote1 + 1);
strcpy(entry->authorGitHub, tokens[6]);
return 1;
}
// Text compare, required for qsort() function
static int SortTextCompare(const void *a, const void *b)
static int rlExampleInfoCompare(const void *a, const void *b)
{
const kt">char *str1 = *(const char **)a;
const kt">char *str2 = *(const char **)b;
const n">rlExampleInfo *ex1 = (const rlExampleInfo *)a;
const n">rlExampleInfo *ex2 = (const rlExampleInfo *)b;
return strcmp(str1, str2);
return strcmp(ex1->name, ex2->name);
}
// Sort array of strings by name
// WARNING: items[] pointers are reorganized
static void SortStringsByName(char **items, int count)
static void SortExampleByName(rlExampleInfo *items, int count)
{
qsort(items, count, sizeof(kt">char *), SortTextCompare);
qsort(items, count, sizeof(n">rlExampleInfo), rlExampleInfoCompare);
}

+ 1
- 1
parser/output/raylib_api.json Переглянути файл

@ -9777,7 +9777,7 @@
},
{
"name": "TextFindIndex",
"description": "Find first text occurrence within a string",
"description": "Find first text occurrence within a string, -1 if not found",
"returnType": "int",
"params": [
{

+ 1
- 1
parser/output/raylib_api.lua Переглянути файл

@ -6942,7 +6942,7 @@ return {
},
{
name = "TextFindIndex",
description = "Find first text occurrence within a string",
description = "Find first text occurrence within a string, -1 if not found",
returnType = "int",
params = {
{type = "const char *", name = "text"},

+ 1
- 1
parser/output/raylib_api.txt Переглянути файл

@ -3742,7 +3742,7 @@ Function 434: TextAppend() (3 input parameters)
Function 435: TextFindIndex() (2 input parameters)
Name: TextFindIndex
Return type: int
Description: Find first text occurrence within a string
Description: Find first text occurrence within a string, -1 if not found
Param[1]: text (type: const char *)
Param[2]: find (type: const char *)
Function 436: TextToUpper() (1 input parameters)

+ 1
- 1
parser/output/raylib_api.xml Переглянути файл

@ -2480,7 +2480,7 @@
<Param type="const char *" name="append" desc="" />
<Param type="int *" name="position" desc="" />
</Function>
<Function name="TextFindIndex" retType="int" paramCount="2" desc="Find first text occurrence within a string">
<Function name="TextFindIndex" retType="int" paramCount="2" desc="Find first text occurrence within a string, -1 if not found">
<Param type="const char *" name="text" desc="" />
<Param type="const char *" name="find" desc="" />
</Function>

+ 1
- 1
src/raylib.h Переглянути файл

@ -1516,7 +1516,7 @@ RLAPI char *TextInsert(const char *text, const char *insert, int position);
RLAPI char *TextJoin(char **textList, int count, const char *delimiter); // Join text strings with delimiter
RLAPI char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings, using MAX_TEXTSPLIT_COUNT static strings
RLAPI void TextAppend(char *text, const char *append, int *position); // Append text at specific position and move cursor!
RLAPI int TextFindIndex(const char *text, const char *find); // Find first text occurrence within a string
RLAPI int TextFindIndex(const char *text, const char *find); // Find first text occurrence within a string, -1 if not found
RLAPI char *TextToUpper(const char *text); // Get upper case version of provided string
RLAPI char *TextToLower(const char *text); // Get lower case version of provided string
RLAPI char *TextToPascal(const char *text); // Get Pascal case notation version of provided string

+ 4
- 0
src/rcore.c Переглянути файл

@ -827,6 +827,8 @@ int GetScreenHeight(void)
// Get current render width which is equal to screen width*dpi scale
int GetRenderWidth(void)
{
if (CORE.Window.usingFbo) return CORE.Window.currentFbo.width;
int width = 0;
#if defined(__APPLE__)
Vector2 scale = GetWindowScaleDPI();
@ -840,6 +842,8 @@ int GetRenderWidth(void)
// Get current screen height which is equal to screen height*dpi scale
int GetRenderHeight(void)
{
if (CORE.Window.usingFbo) return CORE.Window.currentFbo.height;
int height = 0;
#if defined(__APPLE__)
Vector2 scale = GetWindowScaleDPI();

Завантаження…
Відмінити
Зберегти