mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-06 03:18:14 +00:00
Fix text_unicode.c example crashing (#3250)
* Fix text_unicode.c example crashing * Adjust the text_unicode.c example crashing fix
This commit is contained in:
@@ -187,12 +187,11 @@ int main(void)
|
|||||||
// Add a new set of emojis when SPACE is pressed
|
// Add a new set of emojis when SPACE is pressed
|
||||||
if (IsKeyPressed(KEY_SPACE)) RandomizeEmoji();
|
if (IsKeyPressed(KEY_SPACE)) RandomizeEmoji();
|
||||||
|
|
||||||
// Set the selected emoji and copy its text to clipboard
|
// Set the selected emoji
|
||||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && (hovered != -1) && (hovered != selected))
|
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && (hovered != -1) && (hovered != selected))
|
||||||
{
|
{
|
||||||
selected = hovered;
|
selected = hovered;
|
||||||
selectedPos = hoveredPos;
|
selectedPos = hoveredPos;
|
||||||
SetClipboardText(messages[emoji[selected].message].text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2 mouse = GetMousePosition();
|
Vector2 mouse = GetMousePosition();
|
||||||
@@ -342,7 +341,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
|
|||||||
{
|
{
|
||||||
int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop
|
int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop
|
||||||
|
|
||||||
float textOffsetY = 0; // Offset between lines (on line break '\n')
|
float textOffsetY = 0.0f; // Offset between lines (on line break '\n')
|
||||||
float textOffsetX = 0.0f; // Offset X to next character to draw
|
float textOffsetX = 0.0f; // Offset X to next character to draw
|
||||||
|
|
||||||
float scaleFactor = fontSize/(float)font.baseSize; // Character rectangle scaling factor
|
float scaleFactor = fontSize/(float)font.baseSize; // Character rectangle scaling factor
|
||||||
|
Reference in New Issue
Block a user