Merge branch 'master' into master

This commit is contained in:
Jon Daniel 2025-08-08 02:24:57 +02:00 • committed by GitHub
commit 0842aabe5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 2557 additions and 769 deletions

View file

@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [text] example - Codepoints loading
* raylib [text] example - text codepoints loading
*
* Example complexity rating: [★★★☆] 3/4
*
@ -39,7 +39,7 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [text] example - codepoints loading");
// Convert each utf-8 character into its
// corresponding codepoint in the font file.
// corresponding codepoint in the font file
int codepointCount = 0;
int *codepoints = LoadCodepoints(text, &codepointCount);

View file

@ -1,18 +1,18 @@
/*******************************************************************************************
*
* raylib [text] example - Draw 3d
* raylib [text] example - drawing 3d text
*
* Example complexity rating: [★★★★] 4/4
*
* NOTE: Draw a 2D text in 3D space, each letter is drawn in a quad (or 2 quads if backface is set)
* where the texture coodinates of each quad map to the texture coordinates of the glyphs
* inside the font texture.
* inside the font texture
*
* A more efficient approach, i believe, would be to render the text in a render texture and
* map that texture to a plane and render that, or maybe a shader but my method allows more
* flexibility...for example to change position of each letter individually to make somethink
* like a wavy text effect.
*
* like a wavy text effect
*
* Special thanks to:
* @Nighten for the DrawTextStyle() code https://github.com/NightenDushi/Raylib_DrawTextStyle
* Chris Camacho (codifies - http://bedroomcoders.co.uk/) for the alpha discard shader
@ -71,7 +71,7 @@ static void DrawText3D(Font font, const char *text, Vector3 position, float font
// Draw a 2D text in 3D space and wave the parts that start with '~~' and end with '~~'
// This is a modified version of the original code by @Nighten found here https://github.com/NightenDushi/Raylib_DrawTextStyle
static void DrawTextWave3D(Font font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, WaveTextConfig *config, float time, Color tint);
// Measure a text in 3D ignoring the `~~` chars.
// Measure a text in 3D ignoring the `~~` chars
static Vector3 MeasureTextWave3D(Font font, const char *text, float fontSize, float fontSpacing, float lineSpacing);
// Generates a nice color with a random hue
static Color GenerateRandomColor(float s, float v);
@ -151,7 +151,7 @@ int main(void)
screenHeight = GetScreenHeight();
}
UpdateCamera(&camera, camera_mode);
// Handle font files dropped
if (IsFileDropped())
{
@ -169,7 +169,7 @@ int main(void)
font = LoadFont(droppedFiles.paths[0]);
fontSize = (float)font.baseSize;
}
UnloadDroppedFiles(droppedFiles); // Unload filepaths from memory
}
@ -567,7 +567,7 @@ static void DrawText3D(Font font, const char *text, Vector3 position, float font
}
}
// Draw a 2D text in 3D space and wave the parts that start with `~~` and end with `~~`.
// Draw a 2D text in 3D space and wave the parts that start with `~~` and end with `~~`
// This is a modified version of the original code by @Nighten found here https://github.com/NightenDushi/Raylib_DrawTextStyle
static void DrawTextWave3D(Font font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, WaveTextConfig* config, float time, Color tint)
{
@ -630,7 +630,7 @@ static void DrawTextWave3D(Font font, const char *text, Vector3 position, float
}
}
// Measure a text in 3D ignoring the `~~` chars.
// Measure a text in 3D ignoring the `~~` chars
static Vector3 MeasureTextWave3D(Font font, const char* text, float fontSize, float fontSpacing, float lineSpacing)
{
int len = TextLength(text);

View file

@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [text] example - Font filters
* raylib [text] example - font texture filters
*
* Example complexity rating: [★★☆☆] 2/4
*
@ -94,7 +94,7 @@ int main(void)
UnloadFont(font);
font = LoadFontEx(droppedFiles.paths[0], (int)fontSize, 0, 0);
}
UnloadDroppedFiles(droppedFiles); // Unload filepaths from memory
}
//----------------------------------------------------------------------------------

View file

@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [text] example - Font SDF loading
* raylib [text] example - font SDF loading
*
* Example complexity rating: [★★★☆] 3/4
*

View file

@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [text] example - Sprite font loading
* raylib [text] example - sprite font loading
*
* Example complexity rating: [★☆☆☆] 1/4
*
@ -12,7 +12,7 @@
* - Rectangles must be defined by a MAGENTA color background
*
* Following those constraints, a font can be provided just by an image,
* this is quite handy to avoid additional font descriptor files (like BMFonts use).
* this is quite handy to avoid additional font descriptor files (like BMFonts use)
*
* Example originally created with raylib 1.0, last time updated with raylib 1.0
*

View file

@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [text] example - Text formatting
* raylib [text] example - text formating
*
* Example complexity rating: [★☆☆☆] 1/4
*

View file

@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [text] example - Input Box
* raylib [text] example - text input box
*
* Example complexity rating: [★★☆☆] 2/4
*
@ -63,7 +63,7 @@ int main(void)
if ((key >= 32) && (key <= 125) && (letterCount < MAX_INPUT_CHARS))
{
name[letterCount] = (char)key;
name[letterCount+1] = '\0'; // Add null terminator at the end of the string.
name[letterCount+1] = '\0'; // Add null terminator at the end of the string
letterCount++;
}

View file

@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [text] example - Rectangle bounds
* raylib [text] example - rectangle bounds
*
* Example complexity rating: [★★★★] 4/4
*
@ -179,9 +179,9 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
// NOTE: When wordWrap is ON we first measure how much of the text we can draw before going outside of the rec container
// We store this info in startLine and endLine, then we change states, draw the text between those two variables
// and change states again and again recursively until the end of the text (or until we get outside of the container).
// and change states again and again recursively until the end of the text (or until we get outside of the container)
// When wordWrap is OFF we don't need the measure state so we go to the drawing state immediately
// and begin drawing on the next line before we can get outside the container.
// and begin drawing on the next line before we can get outside the container
if (state == MEASURE_STATE)
{
// TODO: There are multiple types of spaces in UNICODE, maybe it's a good idea to add support for more

View file

@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [text] example - Unicode
* raylib [text] example - unicode text drawing
*
* Example complexity rating: [★★★★] 4/4
*
@ -284,7 +284,7 @@ int main(void)
int length = GetCodepointCount(messages[message].text);
const char *info = TextFormat("%s %u characters %i bytes", messages[message].language, length, size);
sz = MeasureTextEx(GetFontDefault(), info, 10, 1.0f);
DrawText(info, (int)(textRect.x + textRect.width - sz.x), (int)(msgRect.y + msgRect.height - sz.y - 2), 10, RAYWHITE);
}
//------------------------------------------------------------------------------
@ -378,9 +378,9 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
// NOTE: When wordWrap is ON we first measure how much of the text we can draw before going outside of the rec container
// We store this info in startLine and endLine, then we change states, draw the text between those two variables
// and change states again and again recursively until the end of the text (or until we get outside of the container).
// and change states again and again recursively until the end of the text (or until we get outside of the container)
// When wordWrap is OFF we don't need the measure state so we go to the drawing state immediately
// and begin drawing on the next line before we can get outside the container.
// and begin drawing on the next line before we can get outside the container
if (state == MEASURE_STATE)
{
// TODO: There are multiple types of spaces in UNICODE, maybe it's a good idea to add support for more

View file

@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [text] example - Text Writing Animation
* raylib [text] example - text writing animation
*
* Example complexity rating: [★★☆☆] 2/4
*