mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
REVIEWED: <name>Count for consistency
Following english rules, it should be singular name before Count.
This commit is contained in:
@ -258,7 +258,7 @@ Image LoadImageRaw(const char *fileName, int width, int height, int format, int
|
||||
Image LoadImageAnim(const char *fileName, int *frames)
|
||||
{
|
||||
Image image = { 0 };
|
||||
int framesCount = 1;
|
||||
int frameCount = 1;
|
||||
|
||||
#if defined(SUPPORT_FILEFORMAT_GIF)
|
||||
if (IsFileExtension(fileName, ".gif"))
|
||||
@ -270,7 +270,7 @@ Image LoadImageAnim(const char *fileName, int *frames)
|
||||
{
|
||||
int comp = 0;
|
||||
int **delays = NULL;
|
||||
image.data = stbi_load_gif_from_memory(fileData, dataSize, delays, &image.width, &image.height, &framesCount, &comp, 4);
|
||||
image.data = stbi_load_gif_from_memory(fileData, dataSize, delays, &image.width, &image.height, &frameCount, &comp, 4);
|
||||
|
||||
image.mipmaps = 1;
|
||||
image.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
|
||||
@ -286,7 +286,7 @@ Image LoadImageAnim(const char *fileName, int *frames)
|
||||
|
||||
// TODO: Support APNG animated images?
|
||||
|
||||
*frames = framesCount;
|
||||
*frames = frameCount;
|
||||
return image;
|
||||
}
|
||||
|
||||
@ -520,17 +520,17 @@ bool ExportImageAsCode(Image image, const char *fileName)
|
||||
// and requiring 6 char bytes for every byte: "0x00, "
|
||||
char *txtData = (char *)RL_CALLOC(dataSize*6 + 2000, sizeof(char));
|
||||
|
||||
int bytesCount = 0;
|
||||
bytesCount += sprintf(txtData + bytesCount, "////////////////////////////////////////////////////////////////////////////////////////\n");
|
||||
bytesCount += sprintf(txtData + bytesCount, "// //\n");
|
||||
bytesCount += sprintf(txtData + bytesCount, "// ImageAsCode exporter v1.0 - Image pixel data exported as an array of bytes //\n");
|
||||
bytesCount += sprintf(txtData + bytesCount, "// //\n");
|
||||
bytesCount += sprintf(txtData + bytesCount, "// more info and bugs-report: github.com/raysan5/raylib //\n");
|
||||
bytesCount += sprintf(txtData + bytesCount, "// feedback and support: ray[at]raylib.com //\n");
|
||||
bytesCount += sprintf(txtData + bytesCount, "// //\n");
|
||||
bytesCount += sprintf(txtData + bytesCount, "// Copyright (c) 2018-2021 Ramon Santamaria (@raysan5) //\n");
|
||||
bytesCount += sprintf(txtData + bytesCount, "// //\n");
|
||||
bytesCount += sprintf(txtData + bytesCount, "////////////////////////////////////////////////////////////////////////////////////////\n\n");
|
||||
int byteCount = 0;
|
||||
byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// ImageAsCode exporter v1.0 - Image pixel data exported as an array of bytes //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// more info and bugs-report: github.com/raysan5/raylib //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// feedback and support: ray[at]raylib.com //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2018-2021 Ramon Santamaria (@raysan5) //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n\n");
|
||||
|
||||
// Get file name from path and convert variable name to uppercase
|
||||
char varFileName[256] = { 0 };
|
||||
@ -538,14 +538,14 @@ bool ExportImageAsCode(Image image, const char *fileName)
|
||||
for (int i = 0; varFileName[i] != '\0'; i++) if ((varFileName[i] >= 'a') && (varFileName[i] <= 'z')) { varFileName[i] = varFileName[i] - 32; }
|
||||
|
||||
// Add image information
|
||||
bytesCount += sprintf(txtData + bytesCount, "// Image data information\n");
|
||||
bytesCount += sprintf(txtData + bytesCount, "#define %s_WIDTH %i\n", varFileName, image.width);
|
||||
bytesCount += sprintf(txtData + bytesCount, "#define %s_HEIGHT %i\n", varFileName, image.height);
|
||||
bytesCount += sprintf(txtData + bytesCount, "#define %s_FORMAT %i // raylib internal pixel format\n\n", varFileName, image.format);
|
||||
byteCount += sprintf(txtData + byteCount, "// Image data information\n");
|
||||
byteCount += sprintf(txtData + byteCount, "#define %s_WIDTH %i\n", varFileName, image.width);
|
||||
byteCount += sprintf(txtData + byteCount, "#define %s_HEIGHT %i\n", varFileName, image.height);
|
||||
byteCount += sprintf(txtData + byteCount, "#define %s_FORMAT %i // raylib internal pixel format\n\n", varFileName, image.format);
|
||||
|
||||
bytesCount += sprintf(txtData + bytesCount, "static unsigned char %s_DATA[%i] = { ", varFileName, dataSize);
|
||||
for (int i = 0; i < dataSize - 1; i++) bytesCount += sprintf(txtData + bytesCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%x,\n" : "0x%x, "), ((unsigned char *)image.data)[i]);
|
||||
bytesCount += sprintf(txtData + bytesCount, "0x%x };\n", ((unsigned char *)image.data)[dataSize - 1]);
|
||||
byteCount += sprintf(txtData + byteCount, "static unsigned char %s_DATA[%i] = { ", varFileName, dataSize);
|
||||
for (int i = 0; i < dataSize - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%x,\n" : "0x%x, "), ((unsigned char *)image.data)[i]);
|
||||
byteCount += sprintf(txtData + byteCount, "0x%x };\n", ((unsigned char *)image.data)[dataSize - 1]);
|
||||
|
||||
// NOTE: Text data length exported is determined by '\0' (NULL) character
|
||||
success = SaveFileText(fileName, txtData);
|
||||
@ -765,11 +765,11 @@ Image GenImageCellular(int width, int height, int tileSize)
|
||||
|
||||
int seedsPerRow = width/tileSize;
|
||||
int seedsPerCol = height/tileSize;
|
||||
int seedsCount = seedsPerRow*seedsPerCol;
|
||||
int seedCount = seedsPerRow*seedsPerCol;
|
||||
|
||||
Vector2 *seeds = (Vector2 *)RL_MALLOC(seedsCount*sizeof(Vector2));
|
||||
Vector2 *seeds = (Vector2 *)RL_MALLOC(seedCount*sizeof(Vector2));
|
||||
|
||||
for (int i = 0; i < seedsCount; i++)
|
||||
for (int i = 0; i < seedCount; i++)
|
||||
{
|
||||
int y = (i/seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1);
|
||||
int x = (i%seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1);
|
||||
@ -1180,12 +1180,12 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
|
||||
{
|
||||
if ((codepoint != ' ') && (codepoint != '\t'))
|
||||
{
|
||||
Rectangle rec = { (float)(textOffsetX + font.chars[index].offsetX), (float)(textOffsetY + font.chars[index].offsetY), (float)font.recs[index].width, (float)font.recs[index].height };
|
||||
ImageDraw(&imText, font.chars[index].image, (Rectangle){ 0, 0, (float)font.chars[index].image.width, (float)font.chars[index].image.height }, rec, tint);
|
||||
Rectangle rec = { (float)(textOffsetX + font.glyphs[index].offsetX), (float)(textOffsetY + font.glyphs[index].offsetY), (float)font.recs[index].width, (float)font.recs[index].height };
|
||||
ImageDraw(&imText, font.glyphs[index].image, (Rectangle){ 0, 0, (float)font.glyphs[index].image.width, (float)font.glyphs[index].image.height }, rec, tint);
|
||||
}
|
||||
|
||||
if (font.chars[index].advanceX == 0) textOffsetX += (int)(font.recs[index].width + spacing);
|
||||
else textOffsetX += font.chars[index].advanceX + (int)spacing;
|
||||
if (font.glyphs[index].advanceX == 0) textOffsetX += (int)(font.recs[index].width + spacing);
|
||||
else textOffsetX += font.glyphs[index].advanceX + (int)spacing;
|
||||
}
|
||||
|
||||
i += (codepointByteCount - 1); // Move text bytes counter to next codepoint
|
||||
@ -2185,7 +2185,7 @@ Color *LoadImageColors(Image image)
|
||||
|
||||
// Load colors palette from image as a Color array (RGBA - 32bit)
|
||||
// NOTE: Memory allocated should be freed using UnloadImagePalette()
|
||||
Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorsCount)
|
||||
Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorCount)
|
||||
{
|
||||
#define COLOR_EQUAL(col1, col2) ((col1.r == col2.r)&&(col1.g == col2.g)&&(col1.b == col2.b)&&(col1.a == col2.a))
|
||||
|
||||
@ -2234,7 +2234,7 @@ Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorsCount)
|
||||
UnloadImageColors(pixels);
|
||||
}
|
||||
|
||||
*colorsCount = palCount;
|
||||
*colorCount = palCount;
|
||||
|
||||
return palette;
|
||||
}
|
||||
@ -3487,9 +3487,9 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
|
||||
// Draw textured polygon, defined by vertex and texturecoordinates
|
||||
// NOTE: Polygon center must have straight line path to all points
|
||||
// without crossing perimeter, points must be in anticlockwise order
|
||||
void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointsCount, Color tint)
|
||||
void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointCount, Color tint)
|
||||
{
|
||||
rlCheckRenderBatchLimit((pointsCount - 1)*4);
|
||||
rlCheckRenderBatchLimit((pointCount - 1)*4);
|
||||
|
||||
rlSetTexture(texture.id);
|
||||
|
||||
@ -3498,7 +3498,7 @@ void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2
|
||||
|
||||
rlColor4ub(tint.r, tint.g, tint.b, tint.a);
|
||||
|
||||
for (int i = 0; i < pointsCount - 1; i++)
|
||||
for (int i = 0; i < pointCount - 1; i++)
|
||||
{
|
||||
rlTexCoord2f(0.5f, 0.5f);
|
||||
rlVertex2f(center.x, center.y);
|
||||
|
||||
Reference in New Issue
Block a user