make functions fall more inline with the standard structure of raylib functions
This commit is contained in:
parent
beab63887c
commit
4a6b24f729
19
src/rtext.c
19
src/rtext.c
|
|
@ -1345,7 +1345,12 @@ Rectangle GetGlyphAtlasRec(Font font, int codepoint)
|
|||
unsigned int TextLength(const char *text)
|
||||
{
|
||||
// use strlen since it uses vector operations
|
||||
return text ? strlen(text) : 0;
|
||||
bool result = false;
|
||||
|
||||
if (text && strlen(text))
|
||||
result = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Formatting of text with variables to 'embed'
|
||||
|
|
@ -1424,7 +1429,12 @@ int TextCopy(char *dst, const char *src)
|
|||
// REQUIRES: strcmp()
|
||||
bool TextIsEqual(const char *text1, const char *text2)
|
||||
{
|
||||
return text1 && text2 ? !strcmp(text1, text2) : 0;
|
||||
bool result = false;
|
||||
|
||||
if (text1 && text2 && !strcmp(text1, text2))
|
||||
result = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Get a piece of a text string
|
||||
|
|
@ -1432,16 +1442,21 @@ const char *TextSubtext(const char *text, int position, int length)
|
|||
{
|
||||
if (!length || !text)
|
||||
return "";
|
||||
|
||||
int textLength = TextLength(text);
|
||||
|
||||
if (position >= textLength)
|
||||
{
|
||||
position = textLength - 1;
|
||||
length = 0;
|
||||
}
|
||||
|
||||
if (length > textLength) length = textLength;
|
||||
|
||||
char *buffer = malloc(length + 1);
|
||||
memcpy(buffer, text + position, length);
|
||||
buffer[length] = '\0';
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user