Minor formatting tweaks

This commit is contained in:
Ray 2024-04-20 19:22:59 +02:00
parent 498511e4cf
commit 6f532337ff

View File

@ -2991,9 +2991,9 @@ int GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight,
if (*value > maxValue) *value = maxValue; if (*value > maxValue) *value = maxValue;
else if (*value < minValue) *value = minValue; else if (*value < minValue) *value = minValue;
} }
// Control value change check // Control value change check
if(oldValue == *value) result = 0; if (oldValue == *value) result = 0;
else result = 1; else result = 1;
// Slider bar limits check // Slider bar limits check
@ -4829,7 +4829,7 @@ static void GuiDrawText(const char *text, Rectangle textBounds, int alignment, C
if (guiFont.glyphs[index].advanceX == 0) glyphWidth = ((float)guiFont.recs[index].width*scaleFactor); if (guiFont.glyphs[index].advanceX == 0) glyphWidth = ((float)guiFont.recs[index].width*scaleFactor);
else glyphWidth = (float)guiFont.glyphs[index].advanceX*scaleFactor; else glyphWidth = (float)guiFont.glyphs[index].advanceX*scaleFactor;
// Wrap mode text measuring, to validate if // Wrap mode text measuring, to validate if
// it can be drawn or a new line is required // it can be drawn or a new line is required
if (wrapMode == TEXT_WRAP_CHAR) if (wrapMode == TEXT_WRAP_CHAR)
{ {
@ -4889,7 +4889,9 @@ static void GuiDrawText(const char *text, Rectangle textBounds, int alignment, C
else if (!overflowReached) else if (!overflowReached)
{ {
overflowReached = true; overflowReached = true;
for (int j = 0; j < ellipsisWidth; j += ellipsisWidth/3) {
for (int j = 0; j < ellipsisWidth; j += ellipsisWidth/3)
{
DrawTextCodepoint(guiFont, '.', RAYGUI_CLITERAL(Vector2){ textBoundsPosition.x + textOffsetX + j, textBoundsPosition.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), GuiFade(tint, guiAlpha)); DrawTextCodepoint(guiFont, '.', RAYGUI_CLITERAL(Vector2){ textBoundsPosition.x + textOffsetX + j, textBoundsPosition.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), GuiFade(tint, guiAlpha));
} }
} }
@ -5506,21 +5508,21 @@ static int GetCodepointNext(const char *text, int *codepointSize)
if (0xf0 == (0xf8 & ptr[0])) if (0xf0 == (0xf8 & ptr[0]))
{ {
// 4 byte UTF-8 codepoint // 4 byte UTF-8 codepoint
if(((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80) || ((ptr[3] & 0xC0) ^ 0x80)) { return codepoint; } //10xxxxxx checks if (((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80) || ((ptr[3] & 0xC0) ^ 0x80)) { return codepoint; } //10xxxxxx checks
codepoint = ((0x07 & ptr[0]) << 18) | ((0x3f & ptr[1]) << 12) | ((0x3f & ptr[2]) << 6) | (0x3f & ptr[3]); codepoint = ((0x07 & ptr[0]) << 18) | ((0x3f & ptr[1]) << 12) | ((0x3f & ptr[2]) << 6) | (0x3f & ptr[3]);
*codepointSize = 4; *codepointSize = 4;
} }
else if (0xe0 == (0xf0 & ptr[0])) else if (0xe0 == (0xf0 & ptr[0]))
{ {
// 3 byte UTF-8 codepoint */ // 3 byte UTF-8 codepoint */
if(((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80)) { return codepoint; } //10xxxxxx checks if (((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80)) { return codepoint; } //10xxxxxx checks
codepoint = ((0x0f & ptr[0]) << 12) | ((0x3f & ptr[1]) << 6) | (0x3f & ptr[2]); codepoint = ((0x0f & ptr[0]) << 12) | ((0x3f & ptr[1]) << 6) | (0x3f & ptr[2]);
*codepointSize = 3; *codepointSize = 3;
} }
else if (0xc0 == (0xe0 & ptr[0])) else if (0xc0 == (0xe0 & ptr[0]))
{ {
// 2 byte UTF-8 codepoint // 2 byte UTF-8 codepoint
if((ptr[1] & 0xC0) ^ 0x80) { return codepoint; } //10xxxxxx checks if ((ptr[1] & 0xC0) ^ 0x80) { return codepoint; } //10xxxxxx checks
codepoint = ((0x1f & ptr[0]) << 6) | (0x3f & ptr[1]); codepoint = ((0x1f & ptr[0]) << 6) | (0x3f & ptr[1]);
*codepointSize = 2; *codepointSize = 2;
} }