Reviewed spacings on latest PR

This commit is contained in:
Ray 2018-08-06 20:49:47 +02:00
parent 61b32e45ed
commit b042fe12e6
6 changed files with 27 additions and 27 deletions

View file

@ -42,7 +42,7 @@ int main()
mouseTail[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 }; mouseTail[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
mouseTail[i].alpha = 1.0f; mouseTail[i].alpha = 1.0f;
mouseTail[i].size = (float)GetRandomValue(1, 30)/20.0f; mouseTail[i].size = (float)GetRandomValue(1, 30)/20.0f;
mouseTail[i].rotation = (float) GetRandomValue(0, 360); mouseTail[i].rotation = (float)GetRandomValue(0, 360);
mouseTail[i].active = false; mouseTail[i].active = false;
} }
@ -107,9 +107,9 @@ int main()
// Draw active particles // Draw active particles
for (int i = 0; i < MAX_PARTICLES; i++) for (int i = 0; i < MAX_PARTICLES; i++)
{ {
if (mouseTail[i].active) DrawTexturePro(smoke, (Rectangle){ 0.0f, 0.0f, (float) smoke.width, (float) smoke.height }, if (mouseTail[i].active) DrawTexturePro(smoke, (Rectangle){ 0.0f, 0.0f, (float)smoke.width, (float)smoke.height },
(Rectangle){ mouseTail[i].position.x, mouseTail[i].position.y, smoke.width*mouseTail[i].size, smoke.height*mouseTail[i].size }, (Rectangle){ mouseTail[i].position.x, mouseTail[i].position.y, smoke.width*mouseTail[i].size, smoke.height*mouseTail[i].size },
(Vector2){ (float) (smoke.width*mouseTail[i].size/2.0f), (float)(smoke.height*mouseTail[i].size/2.0f) }, mouseTail[i].rotation, (Vector2){ (float)(smoke.width*mouseTail[i].size/2.0f), (float)(smoke.height*mouseTail[i].size/2.0f) }, mouseTail[i].rotation,
Fade(mouseTail[i].color, mouseTail[i].alpha)); Fade(mouseTail[i].color, mouseTail[i].alpha));
} }

View file

@ -30,10 +30,10 @@ int main()
Rectangle sourceRec = { 0.0f, 0.0f, (float)frameWidth, (float)frameHeight }; Rectangle sourceRec = { 0.0f, 0.0f, (float)frameWidth, (float)frameHeight };
// NOTE: Destination rectangle (screen rectangle where drawing part of texture) // NOTE: Destination rectangle (screen rectangle where drawing part of texture)
Rectangle destRec = { (float) screenWidth/2, (float)screenHeight/2, (float)frameWidth*2, (float)frameHeight*2 }; Rectangle destRec = { (float)screenWidth/2, (float)screenHeight/2, (float)frameWidth*2, (float)frameHeight*2 };
// NOTE: Origin of the texture (rotation/scale point), it's relative to destination rectangle size // NOTE: Origin of the texture (rotation/scale point), it's relative to destination rectangle size
Vector2 origin = { (float) frameWidth, (float) frameHeight }; Vector2 origin = { (float)frameWidth, (float)frameHeight };
int rotation = 0; int rotation = 0;

View file

@ -337,8 +337,8 @@ void UpdateTitleScreen(void)
if (framesCounter < duration) if (framesCounter < duration)
{ {
currentValue1 = BounceEaseOut((float) framesCounter, initValue1, (finishValue1 - initValue1), duration); currentValue1 = BounceEaseOut((float)framesCounter, initValue1, (finishValue1 - initValue1), duration);
currentValue2 = BounceEaseOut((float) framesCounter, initValue2, (finishValue2 - initValue2), duration); currentValue2 = BounceEaseOut((float)framesCounter, initValue2, (finishValue2 - initValue2), duration);
} }
thisFrame += 1*TIME_FACTOR; thisFrame += 1*TIME_FACTOR;

View file

@ -154,8 +154,8 @@ void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color)
{ {
// Cubic easing in-out // Cubic easing in-out
// NOTE: Easing is calculated only for y position value // NOTE: Easing is calculated only for y position value
current.y = EaseCubicInOut((float)i, startPos.y, endPos.y - startPos.y, (float) LINE_DIVISIONS); current.y = EaseCubicInOut((float)i, startPos.y, endPos.y - startPos.y, (float)LINE_DIVISIONS);
current.x = previous.x + (endPos.x - startPos.x)/ (float) LINE_DIVISIONS; current.x = previous.x + (endPos.x - startPos.x)/ (float)LINE_DIVISIONS;
DrawLineEx(previous, current, thick, color); DrawLineEx(previous, current, thick, color);

View file

@ -220,12 +220,12 @@ extern void LoadDefaultFont(void)
{ {
defaultFont.chars[i].value = 32 + i; // First char is 32 defaultFont.chars[i].value = 32 + i; // First char is 32
defaultFont.chars[i].rec.x = (float) currentPosX; defaultFont.chars[i].rec.x = (float)currentPosX;
defaultFont.chars[i].rec.y = (float) charsDivisor + currentLine*(charsHeight + charsDivisor); defaultFont.chars[i].rec.y = (float)charsDivisor + currentLine*(charsHeight + charsDivisor);
defaultFont.chars[i].rec.width = (float) charsWidth[i]; defaultFont.chars[i].rec.width = (float)charsWidth[i];
defaultFont.chars[i].rec.height = (float) charsHeight; defaultFont.chars[i].rec.height = (float)charsHeight;
testPosX += (int) (defaultFont.chars[i].rec.width + (float) charsDivisor); testPosX += (int)(defaultFont.chars[i].rec.width + (float)charsDivisor);
if (testPosX >= defaultFont.texture.width) if (testPosX >= defaultFont.texture.width)
{ {
@ -361,7 +361,7 @@ CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int c
if (!stbtt_InitFont(&fontInfo, fontBuffer, 0)) TraceLog(LOG_WARNING, "Failed to init font!"); if (!stbtt_InitFont(&fontInfo, fontBuffer, 0)) TraceLog(LOG_WARNING, "Failed to init font!");
// Calculate font scale factor // Calculate font scale factor
float scaleFactor = stbtt_ScaleForPixelHeight(&fontInfo, (float) fontSize); float scaleFactor = stbtt_ScaleForPixelHeight(&fontInfo, (float)fontSize);
// Calculate font basic metrics // Calculate font basic metrics
// NOTE: ascent is equivalent to font baseline // NOTE: ascent is equivalent to font baseline
@ -460,8 +460,8 @@ Image GenImageFontAtlas(CharInfo *chars, int charsCount, int fontSize, int paddi
} }
} }
chars[i].rec.x = (float) offsetX; chars[i].rec.x = (float)offsetX;
chars[i].rec.y = (float) offsetY; chars[i].rec.y = (float)offsetY;
// Move atlas position X for next character drawing // Move atlas position X for next character drawing
offsetX += ((int)chars[i].rec.width + 2*padding); offsetX += ((int)chars[i].rec.width + 2*padding);
@ -502,8 +502,8 @@ Image GenImageFontAtlas(CharInfo *chars, int charsCount, int fontSize, int paddi
for (int i = 0; i < charsCount; i++) for (int i = 0; i < charsCount; i++)
{ {
chars[i].rec.x = rects[i].x + (float) padding; chars[i].rec.x = rects[i].x + (float)padding;
chars[i].rec.y = rects[i].y + (float) padding; chars[i].rec.y = rects[i].y + (float)padding;
if (rects[i].was_packed) if (rects[i].was_packed)
{ {
@ -834,15 +834,15 @@ static Font LoadImageFont(Image image, Color key, int firstChar)
{ {
tempCharValues[index] = firstChar + index; tempCharValues[index] = firstChar + index;
tempCharRecs[index].x = (float) xPosToRead; tempCharRecs[index].x = (float)xPosToRead;
tempCharRecs[index].y = (float) (lineSpacing + lineToRead*(charHeight + lineSpacing)); tempCharRecs[index].y = (float)(lineSpacing + lineToRead*(charHeight + lineSpacing));
tempCharRecs[index].height = (float) charHeight; tempCharRecs[index].height = (float)charHeight;
int charWidth = 0; int charWidth = 0;
while (!COLOR_EQUAL(pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead + charWidth], key)) charWidth++; while (!COLOR_EQUAL(pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead + charWidth], key)) charWidth++;
tempCharRecs[index].width = (float) charWidth; tempCharRecs[index].width = (float)charWidth;
index++; index++;
@ -996,7 +996,7 @@ static Font LoadBMFont(const char *fileName)
// Save data properly in sprite font // Save data properly in sprite font
font.chars[i].value = charId; font.chars[i].value = charId;
font.chars[i].rec = (Rectangle){ (float) charX, (float) charY, (float) charWidth, (float) charHeight }; font.chars[i].rec = (Rectangle){ (float)charX, (float)charY, (float)charWidth, (float)charHeight };
font.chars[i].offsetX = charOffsetX; font.chars[i].offsetX = charOffsetX;
font.chars[i].offsetY = charOffsetY; font.chars[i].offsetY = charOffsetY;
font.chars[i].advanceX = charAdvanceX; font.chars[i].advanceX = charAdvanceX;

View file

@ -1060,7 +1060,7 @@ void ImageAlphaCrop(Image *image, float threshold)
else if (crop.width < minx) crop.width = (float)minx; else if (crop.width < minx) crop.width = (float)minx;
if (crop.height == 0.0f) crop.height = (float)miny; if (crop.height == 0.0f) crop.height = (float)miny;
else if (crop.height < (float) miny) crop.height = (float)miny; else if (crop.height < (float)miny) crop.height = (float)miny;
} }
} }
@ -1588,12 +1588,12 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
if ((unsigned char)text[i] != ' ') if ((unsigned char)text[i] != ' ')
{ {
ImageDraw(&imText, imFont, letter.rec, (Rectangle){ (float) (posX + letter.offsetX), ImageDraw(&imText, imFont, letter.rec, (Rectangle){ (float)(posX + letter.offsetX),
(float)letter.offsetY, (float)letter.rec.width, (float)letter.rec.height }); (float)letter.offsetY, (float)letter.rec.width, (float)letter.rec.height });
} }
if (letter.advanceX == 0) posX += (int)(letter.rec.width + spacing); if (letter.advanceX == 0) posX += (int)(letter.rec.width + spacing);
else posX += letter.advanceX + (int) spacing; else posX += letter.advanceX + (int)spacing;
} }
} }