Update C sources

This commit is contained in:
Milan Nikolic 2023-11-18 13:56:50 +01:00
parent 7637a03441
commit a1c890e8cb
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75
3 changed files with 120 additions and 65 deletions

View file

@ -1725,14 +1725,14 @@ int *LoadRandomSequence(unsigned int count, int min, int max)
#if defined(SUPPORT_RPRAND_GENERATOR)
values = rprand_load_sequence(count, min, max);
#else
if (count > (abs(max - min) + 1)) return values;
if (count > ((unsigned int)abs(max - min) + 1)) return values;
values = (int *)RL_CALLOC(count, sizeof(int));
int value = 0;
bool dupValue = false;
for (int i = 0; i < count;)
for (int i = 0; i < (int)count;)
{
value = (rand()%(abs(max - min) + 1) + min);
dupValue = false;
@ -1766,7 +1766,8 @@ void UnloadRandomSequence(int *sequence)
#endif
}
// Takes a screenshot of current screen (saved a .png)
// Takes a screenshot of current screen
// NOTE: Provided fileName should not contain paths, saving to working directory
void TakeScreenshot(const char *fileName)
{
#if defined(SUPPORT_MODULE_RTEXTURES)
@ -1778,12 +1779,13 @@ void TakeScreenshot(const char *fileName)
Image image = { imgData, (int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y), 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
char path[512] = { 0 };
strcpy(path, TextFormat("%s/%s", CORE.Storage.basePath, fileName));
strcpy(path, TextFormat("%s/%s", CORE.Storage.basePath, GetFileName(fileName)));
ExportImage(image, path); // WARNING: Module required: rtextures
RL_FREE(imgData);
TRACELOG(LOG_INFO, "SYSTEM: [%s] Screenshot taken successfully", path);
if (FileExists(path)) TRACELOG(LOG_INFO, "SYSTEM: [%s] Screenshot taken successfully", path);
else TRACELOG(LOG_WARNING, "SYSTEM: [%s] Screenshot could not be saved", path);
#else
TRACELOG(LOG_WARNING,"IMAGE: ExportImage() requires module: rtextures");
#endif
@ -1836,10 +1838,10 @@ bool IsFileExtension(const char *fileName, const char *ext)
{
#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_TEXT_MANIPULATION)
int extCount = 0;
const char **checkExts = TextSplit(ext, ';', &extCount); // WARNING: Module required: rtext
const char **checkExts = TextSplit(ext, ';', &extCount); // WARNING: Module required: rtext
char fileExtLower[MAX_FILE_EXTENSION_SIZE + 1] = { 0 };
strncpy(fileExtLower, TextToLower(fileExt), MAX_FILE_EXTENSION_SIZE); // WARNING: Module required: rtext
strncpy(fileExtLower, TextToLower(fileExt), MAX_FILE_EXTENSION_SIZE); // WARNING: Module required: rtext
for (int i = 0; i < extCount; i++)
{