mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-29 10:19:18 -05:00
Added some notes for alternative implementations #3362
This commit is contained in:
@ -1344,10 +1344,12 @@ Rectangle GetGlyphAtlasRec(Font font, int codepoint)
|
|||||||
// Get text length in bytes, check for \0 character
|
// Get text length in bytes, check for \0 character
|
||||||
unsigned int TextLength(const char *text)
|
unsigned int TextLength(const char *text)
|
||||||
{
|
{
|
||||||
unsigned int length = 0; //strlen(text)
|
unsigned int length = 0;
|
||||||
|
|
||||||
if (text != NULL)
|
if (text != NULL)
|
||||||
{
|
{
|
||||||
|
// NOTE: Alternative: use strlen(text)
|
||||||
|
|
||||||
while (*text++) length++;
|
while (*text++) length++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1415,6 +1417,8 @@ int TextCopy(char *dst, const char *src)
|
|||||||
|
|
||||||
if ((src != NULL) && (dst != NULL))
|
if ((src != NULL) && (dst != NULL))
|
||||||
{
|
{
|
||||||
|
// NOTE: Alternative: use strcpy(dst, src)
|
||||||
|
|
||||||
while (*src != '\0')
|
while (*src != '\0')
|
||||||
{
|
{
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
@ -1460,6 +1464,8 @@ const char *TextSubtext(const char *text, int position, int length)
|
|||||||
|
|
||||||
if (length >= textLength) length = textLength;
|
if (length >= textLength) length = textLength;
|
||||||
|
|
||||||
|
// NOTE: Alternative: memcpy(buffer, text + position, length)
|
||||||
|
|
||||||
for (int c = 0 ; c < length ; c++)
|
for (int c = 0 ; c < length ; c++)
|
||||||
{
|
{
|
||||||
*(buffer + c) = *(text + position);
|
*(buffer + c) = *(text + position);
|
||||||
|
|||||||
Reference in New Issue
Block a user