diff options
| author | Ray <raysan5@gmail.com> | 2018-08-06 20:49:47 +0200 |
|---|---|---|
| committer | Ray <raysan5@gmail.com> | 2018-08-06 20:49:47 +0200 |
| commit | b042fe12e6c413e3cdcd706949dd285571647848 (patch) | |
| tree | 87e75ab82274b61cd925e50bc596b1e47ea67635 /src | |
| parent | 61b32e45ed9f28c2d41a0d004032941ab27780a3 (diff) | |
| download | raylib-b042fe12e6c413e3cdcd706949dd285571647848.tar.gz raylib-b042fe12e6c413e3cdcd706949dd285571647848.zip | |
Reviewed spacings on latest PR
Diffstat (limited to 'src')
| -rw-r--r-- | src/shapes.c | 4 | ||||
| -rw-r--r-- | src/text.c | 30 | ||||
| -rw-r--r-- | src/textures.c | 6 |
3 files changed, 20 insertions, 20 deletions
diff --git a/src/shapes.c b/src/shapes.c index 1b3862cc..833f1613 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -154,8 +154,8 @@ void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color) { // Cubic easing in-out // NOTE: Easing is calculated only for y position value - 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.y = EaseCubicInOut((float)i, startPos.y, endPos.y - startPos.y, (float)LINE_DIVISIONS); + current.x = previous.x + (endPos.x - startPos.x)/ (float)LINE_DIVISIONS; DrawLineEx(previous, current, thick, color); @@ -220,12 +220,12 @@ extern void LoadDefaultFont(void) { defaultFont.chars[i].value = 32 + i; // First char is 32 - defaultFont.chars[i].rec.x = (float) currentPosX; - defaultFont.chars[i].rec.y = (float) charsDivisor + currentLine*(charsHeight + charsDivisor); - defaultFont.chars[i].rec.width = (float) charsWidth[i]; - defaultFont.chars[i].rec.height = (float) charsHeight; + defaultFont.chars[i].rec.x = (float)currentPosX; + defaultFont.chars[i].rec.y = (float)charsDivisor + currentLine*(charsHeight + charsDivisor); + defaultFont.chars[i].rec.width = (float)charsWidth[i]; + 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) { @@ -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!"); // Calculate font scale factor - float scaleFactor = stbtt_ScaleForPixelHeight(&fontInfo, (float) fontSize); + float scaleFactor = stbtt_ScaleForPixelHeight(&fontInfo, (float)fontSize); // Calculate font basic metrics // 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.y = (float) offsetY; + chars[i].rec.x = (float)offsetX; + chars[i].rec.y = (float)offsetY; // Move atlas position X for next character drawing 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++) { - chars[i].rec.x = rects[i].x + (float) padding; - chars[i].rec.y = rects[i].y + (float) padding; + chars[i].rec.x = rects[i].x + (float)padding; + chars[i].rec.y = rects[i].y + (float)padding; if (rects[i].was_packed) { @@ -834,15 +834,15 @@ static Font LoadImageFont(Image image, Color key, int firstChar) { tempCharValues[index] = firstChar + index; - tempCharRecs[index].x = (float) xPosToRead; - tempCharRecs[index].y = (float) (lineSpacing + lineToRead*(charHeight + lineSpacing)); - tempCharRecs[index].height = (float) charHeight; + tempCharRecs[index].x = (float)xPosToRead; + tempCharRecs[index].y = (float)(lineSpacing + lineToRead*(charHeight + lineSpacing)); + tempCharRecs[index].height = (float)charHeight; int charWidth = 0; 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++; @@ -996,7 +996,7 @@ static Font LoadBMFont(const char *fileName) // Save data properly in sprite font 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].offsetY = charOffsetY; font.chars[i].advanceX = charAdvanceX; diff --git a/src/textures.c b/src/textures.c index 54bbb105..1d052070 100644 --- a/src/textures.c +++ b/src/textures.c @@ -1060,7 +1060,7 @@ void ImageAlphaCrop(Image *image, float threshold) else if (crop.width < minx) crop.width = (float)minx; 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] != ' ') { - 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 }); } if (letter.advanceX == 0) posX += (int)(letter.rec.width + spacing); - else posX += letter.advanceX + (int) spacing; + else posX += letter.advanceX + (int)spacing; } } |
