summaryrefslogtreecommitdiffhomepage
path: root/examples/text
diff options
context:
space:
mode:
authorubkp <[email protected]>2023-08-19 08:43:00 -0300
committerGitHub <[email protected]>2023-08-19 13:43:00 +0200
commit016b7d0a3a6d67e5d78a19d8c0adaa555712e67d (patch)
tree735310101517f839ef4732ceed3ac730233fac59 /examples/text
parente4dcbd518091a5854a517ea4cfc3f7e2d29de1a7 (diff)
downloadraylib-016b7d0a3a6d67e5d78a19d8c0adaa555712e67d.tar.gz
raylib-016b7d0a3a6d67e5d78a19d8c0adaa555712e67d.zip
Fix text_unicode.c example crashing (#3250)
* Fix text_unicode.c example crashing * Adjust the text_unicode.c example crashing fix
Diffstat (limited to 'examples/text')
-rw-r--r--examples/text/text_unicode.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/examples/text/text_unicode.c b/examples/text/text_unicode.c
index eb2a7843..b25e3273 100644
--- a/examples/text/text_unicode.c
+++ b/examples/text/text_unicode.c
@@ -187,12 +187,11 @@ int main(void)
// Add a new set of emojis when SPACE is pressed
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))
{
selected = hovered;
selectedPos = hoveredPos;
- SetClipboardText(messages[emoji[selected].message].text);
}
Vector2 mouse = GetMousePosition();
@@ -267,7 +266,7 @@ int main(void)
a = b;
b = tmp;
}
-
+
if (msgRect.x + msgRect.width > screenWidth) msgRect.x -= (msgRect.x + msgRect.width) - screenWidth + 10;
// Draw chat bubble
@@ -287,11 +286,11 @@ int main(void)
DrawText(info, (int)pos.x, (int)pos.y, 10, RAYWHITE);
}
//------------------------------------------------------------------------------
-
+
// Draw the info text
DrawText("These emojis have something to tell you, click each to find out!", (screenWidth - 650)/2, screenHeight - 40, 20, GRAY);
DrawText("Each emoji is a unicode character from a font, not a texture... Press [SPACEBAR] to refresh", (screenWidth - 484)/2, screenHeight - 16, 10, GRAY);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -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
- 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 scaleFactor = fontSize/(float)font.baseSize; // Character rectangle scaling factor
@@ -465,4 +464,4 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
textOffsetX += glyphWidth;
}
-} \ No newline at end of file
+}