summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRay <[email protected]>2022-09-22 20:29:54 +0200
committerRay <[email protected]>2022-09-22 20:29:54 +0200
commit907e9e1fe2943efdb253103995d1c10a4adc5c9c (patch)
treeb792e36f7affc6e66f11f8f945ab6f8ac01ef09b
parent4311ffc9e13c4de3c519ce9b1afd2f52fc618914 (diff)
downloadraylib-907e9e1fe2943efdb253103995d1c10a4adc5c9c.tar.gz
raylib-907e9e1fe2943efdb253103995d1c10a4adc5c9c.zip
Update text_codepoints_loading.c
-rw-r--r--examples/text/text_codepoints_loading.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/text/text_codepoints_loading.c b/examples/text/text_codepoints_loading.c
index 3b6e1160..c6854403 100644
--- a/examples/text/text_codepoints_loading.c
+++ b/examples/text/text_codepoints_loading.c
@@ -57,6 +57,10 @@ int main(void)
bool showFontAtlas = false;
+ int codepointSize = 0;
+ int codepoint = 0;
+ char *ptr = text;
+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
@@ -66,6 +70,20 @@ int main(void)
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_SPACE)) showFontAtlas = !showFontAtlas;
+
+ // Testing code: getting next and previous codepoints on provided text
+ if (IsKeyPressed(KEY_RIGHT))
+ {
+ // Get next codepoint in string and move pointer
+ codepoint = GetCodepointNext(ptr, &codepointSize);
+ ptr += codepointSize;
+ }
+ else if (IsKeyPressed(KEY_LEFT))
+ {
+ // Get previous codepoint in string and move pointer
+ codepoint = GetCodepointPrevious(ptr, &codepointSize);
+ ptr -= codepointSize;
+ }
//----------------------------------------------------------------------------------
// Draw