summaryrefslogtreecommitdiffhomepage
path: root/examples/src/text
diff options
context:
space:
mode:
authorRay <[email protected]>2019-05-21 17:03:01 +0200
committerRay <[email protected]>2019-05-21 17:03:01 +0200
commit6f4a27cc61f12d3789729413bed69e86226911cf (patch)
tree92a23884870826e6deaf560743ebbdae8bce94ba /examples/src/text
parent2141d7943b6b65fa66f583f0819bb27fee815189 (diff)
downloadraylib.com-6f4a27cc61f12d3789729413bed69e86226911cf.tar.gz
raylib.com-6f4a27cc61f12d3789729413bed69e86226911cf.zip
Remove examples default code
Code is directly fetched form raylib repo, this way we avoid duplicate code!
Diffstat (limited to 'examples/src/text')
-rw-r--r--examples/src/text/text_bmfont_ttf.c82
-rw-r--r--examples/src/text/text_font_sdf.c131
-rw-r--r--examples/src/text/text_format_text.c62
-rw-r--r--examples/src/text/text_input_box.c116
-rw-r--r--examples/src/text/text_raylib_fonts.c105
-rw-r--r--examples/src/text/text_rectangle_bounds.c120
-rw-r--r--examples/src/text/text_sprite_fonts.c78
-rw-r--r--examples/src/text/text_ttf_loading.c129
-rw-r--r--examples/src/text/text_unicode.c320
-rw-r--r--examples/src/text/text_writing_anim.c62
10 files changed, 0 insertions, 1205 deletions
diff --git a/examples/src/text/text_bmfont_ttf.c b/examples/src/text/text_bmfont_ttf.c
deleted file mode 100644
index 175d3f1..0000000
--- a/examples/src/text/text_bmfont_ttf.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************************
-*
-* raylib [text] example - BMFont and TTF Fonts loading
-*
-* This example has been created using raylib 1.4 (www.raylib.com)
-* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
-*
-* Copyright (c) 2016 Ramon Santamaria (@raysan5)
-*
-********************************************************************************************/
-
-#include "raylib.h"
-
-int main(void)
-{
- // Initialization
- //--------------------------------------------------------------------------------------
- const int screenWidth = 800;
- const int screenHeight = 450;
-
- InitWindow(screenWidth, screenHeight, "raylib [text] example - bmfont and ttf sprite fonts loading");
-
- // Define characters to draw
- // NOTE: raylib supports UTF-8 encoding, following list is actually codified as UTF8 internally
- const char msg[256] = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI\nJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmn\nopqrstuvwxyz{|}~¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ\nÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷\nøùúûüýþÿ";
-
- // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
-
- // BMFont (AngelCode) : Font data and image atlas have been generated using external program
- Font fontBm = LoadFont("resources/pixantiqua.fnt");
-
- // TTF font : Font data and atlas are generated directly from TTF
- // NOTE: We define a font base size of 32 pixels tall and up-to 250 characters
- Font fontTtf = LoadFontEx("resources/pixantiqua.ttf", 32, 0, 250);
-
- bool useTtf = false;
-
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
- //--------------------------------------------------------------------------------------
-
- // Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
- {
- // Update
- //----------------------------------------------------------------------------------
- if (IsKeyDown(KEY_SPACE)) useTtf = true;
- else useTtf = false;
- //----------------------------------------------------------------------------------
-
- // Draw
- //----------------------------------------------------------------------------------
- BeginDrawing();
-
- ClearBackground(RAYWHITE);
-
- DrawText("Press SPACE to use TTF generated font", 20, 20, 20, LIGHTGRAY);
-
- if (!useTtf)
- {
- DrawTextEx(fontBm, msg, (Vector2){ 20.0f, 100.0f }, fontBm.baseSize, 2, MAROON);
- DrawText("Using BMFont (Angelcode) imported", 20, GetScreenHeight() - 30, 20, GRAY);
- }
- else
- {
- DrawTextEx(fontTtf, msg, (Vector2){ 20.0f, 100.0f }, fontTtf.baseSize, 2, LIME);
- DrawText("Using TTF font generated", 20, GetScreenHeight() - 30, 20, GRAY);
- }
-
- EndDrawing();
- //----------------------------------------------------------------------------------
- }
-
- // De-Initialization
- //--------------------------------------------------------------------------------------
- UnloadFont(fontBm); // AngelCode Font unloading
- UnloadFont(fontTtf); // TTF Font unloading
-
- CloseWindow(); // Close window and OpenGL context
- //--------------------------------------------------------------------------------------
-
- return 0;
-} \ No newline at end of file
diff --git a/examples/src/text/text_font_sdf.c b/examples/src/text/text_font_sdf.c
deleted file mode 100644
index d3c76c4..0000000
--- a/examples/src/text/text_font_sdf.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************************
-*
-* raylib [text] example - TTF loading and usage
-*
-* This example has been created using raylib 1.3.0 (www.raylib.com)
-* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
-*
-* Copyright (c) 2015 Ramon Santamaria (@raysan5)
-*
-********************************************************************************************/
-
-#include "raylib.h"
-
-#if defined(PLATFORM_DESKTOP)
- #define GLSL_VERSION 330
-#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
- #define GLSL_VERSION 100
-#endif
-
-int main(void)
-{
- // Initialization
- //--------------------------------------------------------------------------------------
- const int screenWidth = 800;
- const int screenHeight = 450;
-
- InitWindow(screenWidth, screenHeight, "raylib [text] example - SDF fonts");
-
- // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
-
- const char msg[50] = "Signed Distance Fields";
-
- // Default font generation from TTF font
- Font fontDefault = { 0 };
- fontDefault.baseSize = 16;
- fontDefault.charsCount = 95;
- // Parameters > font size: 16, no chars array provided (0), chars count: 95 (autogenerate chars array)
- fontDefault.chars = LoadFontData("resources/AnonymousPro-Bold.ttf", 16, 0, 95, FONT_DEFAULT);
- // Parameters > chars count: 95, font size: 16, chars padding in image: 4 px, pack method: 0 (default)
- Image atlas = GenImageFontAtlas(fontDefault.chars, 95, 16, 4, 0);
- fontDefault.texture = LoadTextureFromImage(atlas);
- UnloadImage(atlas);
-
- // SDF font generation from TTF font
- Font fontSDF = { 0 };
- fontSDF.baseSize = 16;
- fontSDF.charsCount = 95;
- // Parameters > font size: 16, no chars array provided (0), chars count: 0 (defaults to 95)
- fontSDF.chars = LoadFontData("resources/AnonymousPro-Bold.ttf", 16, 0, 0, FONT_SDF);
- // Parameters > chars count: 95, font size: 16, chars padding in image: 0 px, pack method: 1 (Skyline algorythm)
- atlas = GenImageFontAtlas(fontSDF.chars, 95, 16, 0, 1);
- fontSDF.texture = LoadTextureFromImage(atlas);
- UnloadImage(atlas);
-
- // Load SDF required shader (we use default vertex shader)
- Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/sdf.fs", GLSL_VERSION));
- SetTextureFilter(fontSDF.texture, FILTER_BILINEAR); // Required for SDF font
-
- Vector2 fontPosition = { 40, screenHeight/2 - 50 };
- Vector2 textSize = { 0.0f };
- float fontSize = 16.0f;
- int currentFont = 0; // 0 - fontDefault, 1 - fontSDF
-
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
- //--------------------------------------------------------------------------------------
-
- // Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
- {
- // Update
- //----------------------------------------------------------------------------------
- fontSize += GetMouseWheelMove()*8.0f;
-
- if (fontSize < 6) fontSize = 6;
-
- if (IsKeyDown(KEY_SPACE)) currentFont = 1;
- else currentFont = 0;
-
- if (currentFont == 0) textSize = MeasureTextEx(fontDefault, msg, fontSize, 0);
- else textSize = MeasureTextEx(fontSDF, msg, fontSize, 0);
-
- fontPosition.x = GetScreenWidth()/2 - textSize.x/2;
- fontPosition.y = GetScreenHeight()/2 - textSize.y/2 + 80;
- //----------------------------------------------------------------------------------
-
- // Draw
- //----------------------------------------------------------------------------------
- BeginDrawing();
-
- ClearBackground(RAYWHITE);
-
- if (currentFont == 1)
- {
- // NOTE: SDF fonts require a custom SDf shader to compute fragment color
- BeginShaderMode(shader); // Activate SDF font shader
- DrawTextEx(fontSDF, msg, fontPosition, fontSize, 0, BLACK);
- EndShaderMode(); // Activate our default shader for next drawings
-
- DrawTexture(fontSDF.texture, 10, 10, BLACK);
- }
- else
- {
- DrawTextEx(fontDefault, msg, fontPosition, fontSize, 0, BLACK);
- DrawTexture(fontDefault.texture, 10, 10, BLACK);
- }
-
- if (currentFont == 1) DrawText("SDF!", 320, 20, 80, RED);
- else DrawText("default font", 315, 40, 30, GRAY);
-
- DrawText("FONT SIZE: 16.0", GetScreenWidth() - 240, 20, 20, DARKGRAY);
- DrawText(FormatText("RENDER SIZE: %02.02f", fontSize), GetScreenWidth() - 240, 50, 20, DARKGRAY);
- DrawText("Use MOUSE WHEEL to SCALE TEXT!", GetScreenWidth() - 240, 90, 10, DARKGRAY);
-
- DrawText("PRESS SPACE to USE SDF FONT VERSION!", 340, GetScreenHeight() - 30, 20, MAROON);
-
- EndDrawing();
- //----------------------------------------------------------------------------------
- }
-
- // De-Initialization
- //--------------------------------------------------------------------------------------
- UnloadFont(fontDefault); // Default font unloading
- UnloadFont(fontSDF); // SDF font unloading
-
- UnloadShader(shader); // Unload SDF shader
-
- CloseWindow(); // Close window and OpenGL context
- //--------------------------------------------------------------------------------------
-
- return 0;
-} \ No newline at end of file
diff --git a/examples/src/text/text_format_text.c b/examples/src/text/text_format_text.c
deleted file mode 100644
index a9f0417..0000000
--- a/examples/src/text/text_format_text.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************************
-*
-* raylib [text] example - Text formatting
-*
-* This example has been created using raylib 1.1 (www.raylib.com)
-* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
-*
-* Copyright (c) 2014 Ramon Santamaria (@raysan5)
-*
-********************************************************************************************/
-
-#include "raylib.h"
-
-int main(void)
-{
- // Initialization
- //--------------------------------------------------------------------------------------
- const int screenWidth = 800;
- const int screenHeight = 450;
-
- InitWindow(screenWidth, screenHeight, "raylib [text] example - text formatting");
-
- int score = 100020;
- int hiscore = 200450;
- int lives = 5;
-
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
- //--------------------------------------------------------------------------------------
-
- // Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
- {
- // Update
- //----------------------------------------------------------------------------------
- // TODO: Update your variables here
- //----------------------------------------------------------------------------------
-
- // Draw
- //----------------------------------------------------------------------------------
- BeginDrawing();
-
- ClearBackground(RAYWHITE);
-
- DrawText(FormatText("Score: %08i", score), 200, 80, 20, RED);
-
- DrawText(FormatText("HiScore: %08i", hiscore), 200, 120, 20, GREEN);
-
- DrawText(FormatText("Lives: %02i", lives), 200, 160, 40, BLUE);
-
- DrawText(FormatText("Elapsed Time: %02.02f ms", GetFrameTime()*1000), 200, 220, 20, BLACK);
-
- EndDrawing();
- //----------------------------------------------------------------------------------
- }
-
- // De-Initialization
- //--------------------------------------------------------------------------------------
- CloseWindow(); // Close window and OpenGL context
- //--------------------------------------------------------------------------------------
-
- return 0;
-} \ No newline at end of file
diff --git a/examples/src/text/text_input_box.c b/examples/src/text/text_input_box.c
deleted file mode 100644
index ea3d299..0000000
--- a/examples/src/text/text_input_box.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************************
-*
-* raylib [text] example - Input Box
-*
-* This example has been created using raylib 1.7 (www.raylib.com)
-* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
-*
-* Copyright (c) 2017 Ramon Santamaria (@raysan5)
-*
-********************************************************************************************/
-
-#include "raylib.h"
-
-#define MAX_INPUT_CHARS 9
-
-int main(void)
-{
- // Initialization
- //--------------------------------------------------------------------------------------
- const int screenWidth = 800;
- const int screenHeight = 450;
-
- InitWindow(screenWidth, screenHeight, "raylib [text] example - input box");
-
- char name[MAX_INPUT_CHARS + 1] = "\0"; // NOTE: One extra space required for line ending char '\0'
- int letterCount = 0;
-
- Rectangle textBox = { screenWidth/2 - 100, 180, 225, 50 };
- bool mouseOnText = false;
-
- int framesCounter = 0;
-
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
- //--------------------------------------------------------------------------------------
-
- // Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
- {
- // Update
- //----------------------------------------------------------------------------------
- if (CheckCollisionPointRec(GetMousePosition(), textBox)) mouseOnText = true;
- else mouseOnText = false;
-
- if (mouseOnText)
- {
- int key = GetKeyPressed();
-
- // NOTE: Only allow keys in range [32..125]
- if ((key >= 32) && (key <= 125) && (letterCount < MAX_INPUT_CHARS))
- {
- name[letterCount] = (char)key;
- letterCount++;
- }
-
- if (IsKeyPressed(KEY_BACKSPACE))
- {
- letterCount--;
- name[letterCount] = '\0';
-
- if (letterCount < 0) letterCount = 0;
- }
- }
-
- if (mouseOnText) framesCounter++;
- else framesCounter = 0;
- //----------------------------------------------------------------------------------
-
- // Draw
- //----------------------------------------------------------------------------------
- BeginDrawing();
-
- ClearBackground(RAYWHITE);
-
- DrawText("PLACE MOUSE OVER INPUT BOX!", 240, 140, 20, GRAY);
-
- DrawRectangleRec(textBox, LIGHTGRAY);
- if (mouseOnText) DrawRectangleLines(textBox.x, textBox.y, textBox.width, textBox.height, RED);
- else DrawRectangleLines(textBox.x, textBox.y, textBox.width, textBox.height, DARKGRAY);
-
- DrawText(name, textBox.x + 5, textBox.y + 8, 40, MAROON);
-
- DrawText(FormatText("INPUT CHARS: %i/%i", letterCount, MAX_INPUT_CHARS), 315, 250, 20, DARKGRAY);
-
- if (mouseOnText)
- {
- if (letterCount < MAX_INPUT_CHARS)
- {
- // Draw blinking underscore char
- if (((framesCounter/20)%2) == 0) DrawText("_", textBox.x + 8 + MeasureText(name, 40), textBox.y + 12, 40, MAROON);
- }
- else DrawText("Press BACKSPACE to delete chars...", 230, 300, 20, GRAY);
- }
-
- EndDrawing();
- //----------------------------------------------------------------------------------
- }
-
- // De-Initialization
- //--------------------------------------------------------------------------------------
- CloseWindow(); // Close window and OpenGL context
- //--------------------------------------------------------------------------------------
-
- return 0;
-}
-
-// Check if any key is pressed
-// NOTE: We limit keys check to keys between 32 (KEY_SPACE) and 126
-bool IsAnyKeyPressed()
-{
- bool keyPressed = false;
- int key = GetKeyPressed();
-
- if ((key >= 32) && (key <= 126)) keyPressed = true;
-
- return keyPressed;
-} \ No newline at end of file
diff --git a/examples/src/text/text_raylib_fonts.c b/examples/src/text/text_raylib_fonts.c
deleted file mode 100644
index 06e6372..0000000
--- a/examples/src/text/text_raylib_fonts.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************************
-*
-* raylib [text] example - raylib font loading and usage
-*
-* NOTE: raylib is distributed with some free to use fonts (even for commercial pourposes!)
-* To view details and credits for those fonts, check raylib license file
-*
-* This example has been created using raylib 1.7 (www.raylib.com)
-* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
-*
-* Copyright (c) 2017 Ramon Santamaria (@raysan5)
-*
-********************************************************************************************/
-
-#include "raylib.h"
-
-#define MAX_FONTS 8
-
-int main(void)
-{
- // Initialization
- //--------------------------------------------------------------------------------------
- const int screenWidth = 800;
- const int screenHeight = 450;
-
- InitWindow(screenWidth, screenHeight, "raylib [text] example - raylib fonts");
-
- // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
- Font fonts[MAX_FONTS];
-
- fonts[0] = LoadFont("resources/fonts/alagard.png");
- fonts[1] = LoadFont("resources/fonts/pixelplay.png");
- fonts[2] = LoadFont("resources/fonts/mecha.png");
- fonts[3] = LoadFont("resources/fonts/setback.png");
- fonts[4] = LoadFont("resources/fonts/romulus.png");
- fonts[5] = LoadFont("resources/fonts/pixantiqua.png");
- fonts[6] = LoadFont("resources/fonts/alpha_beta.png");
- fonts[7] = LoadFont("resources/fonts/jupiter_crash.png");
-
- const char *messages[MAX_FONTS] = { "ALAGARD FONT designed by Hewett Tsoi",
- "PIXELPLAY FONT designed by Aleksander Shevchuk",
- "MECHA FONT designed by Captain Falcon",
- "SETBACK FONT designed by Brian Kent (AEnigma)",
- "ROMULUS FONT designed by Hewett Tsoi",
- "PIXANTIQUA FONT designed by Gerhard Grossmann",
- "ALPHA_BETA FONT designed by Brian Kent (AEnigma)",
- "JUPITER_CRASH FONT designed by Brian Kent (AEnigma)" };
-
- const int spacings[MAX_FONTS] = { 2, 4, 8, 4, 3, 4, 4, 1 };
-
- Vector2 positions[MAX_FONTS];
-
- for (int i = 0; i < MAX_FONTS; i++)
- {
- positions[i].x = screenWidth/2 - MeasureTextEx(fonts[i], messages[i], fonts[i].baseSize*2, spacings[i]).x/2;
- positions[i].y = 60 + fonts[i].baseSize + 45*i;
- }
-
- // Small Y position corrections
- positions[3].y += 8;
- positions[4].y += 2;
- positions[7].y -= 8;
-
- Color colors[MAX_FONTS] = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD, RED };
-
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
- //--------------------------------------------------------------------------------------
-
- // Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
- {
- // Update
- //----------------------------------------------------------------------------------
- // TODO: Update your variables here
- //----------------------------------------------------------------------------------
-
- // Draw
- //----------------------------------------------------------------------------------
- BeginDrawing();
-
- ClearBackground(RAYWHITE);
-
- DrawText("free fonts included with raylib", 250, 20, 20, DARKGRAY);
- DrawLine(220, 50, 590, 50, DARKGRAY);
-
- for (int i = 0; i < MAX_FONTS; i++)
- {
- DrawTextEx(fonts[i], messages[i], positions[i], fonts[i].baseSize*2, spacings[i], colors[i]);
- }
-
- EndDrawing();
- //----------------------------------------------------------------------------------
- }
-
- // De-Initialization
- //--------------------------------------------------------------------------------------
-
- // Fonts unloading
- for (int i = 0; i < MAX_FONTS; i++) UnloadFont(fonts[i]);
-
- CloseWindow(); // Close window and OpenGL context
- //--------------------------------------------------------------------------------------
-
- return 0;
-} \ No newline at end of file
diff --git a/examples/src/text/text_rectangle_bounds.c b/examples/src/text/text_rectangle_bounds.c
deleted file mode 100644
index 5871278..0000000
--- a/examples/src/text/text_rectangle_bounds.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************************
-*
-* raylib [text] example - Draw text inside a rectangle
-*
-* This example has been created using raylib 2.3 (www.raylib.com)
-* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
-*
-* Example contributed by Vlad Adrian (@demizdor) and reviewed by Ramon Santamaria (@raysan5)
-*
-* Copyright (c) 2018 Vlad Adrian (@demizdor) and Ramon Santamaria (@raysan5)
-*
-********************************************************************************************/
-
-#include "raylib.h"
-
-int main(void)
-{
- // Initialization
- //--------------------------------------------------------------------------------------
- const int screenWidth = 800;
- const int screenHeight = 450;
-
- InitWindow(screenWidth, screenHeight, "raylib [text] example - draw text inside a rectangle");
-
- char text[] = "Text cannot escape\tthis container\t...word wrap also works when active so here's\
- a long text for testing.\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\
- tempor incididunt ut labore et dolore magna aliqua. Nec ullamcorper sit amet risus nullam eget felis eget.";
-
- bool resizing = false;
- bool wordWrap = true;
-
- Rectangle container = { 25, 25, screenWidth - 50, screenHeight - 250};
- Rectangle resizer = { container.x + container.width - 17, container.y + container.height - 17, 14, 14 };
-
- // Minimum width and heigh for the container rectangle
- const int minWidth = 60;
- const int minHeight = 60;
- const int maxWidth = screenWidth - 50;
- const int maxHeight = screenHeight - 160;
-
- Vector2 lastMouse = { 0, 0 }; // Stores last mouse coordinates
- Color borderColor = MAROON; // Container border color
- Font font = GetFontDefault(); // Get default system font
-
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
- //--------------------------------------------------------------------------------------
-
- // Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
- {
- // Update
- //----------------------------------------------------------------------------------
- if (IsKeyPressed(KEY_SPACE)) wordWrap = !wordWrap;
-
- Vector2 mouse = GetMousePosition();
-
- // Check if the mouse is inside the container and toggle border color
- if (CheckCollisionPointRec(mouse, container)) borderColor = Fade(MAROON, 0.4f);
- else if (!resizing) borderColor = MAROON;
-
- // Container resizing logic
- if (resizing)
- {
- if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) resizing = false;
-
- int width = container.width + (mouse.x - lastMouse.x);
- container.width = (width > minWidth)? ((width < maxWidth)? width : maxWidth) : minWidth;
-
- int height = container.height + (mouse.y - lastMouse.y);
- container.height = (height > minHeight)? ((height < maxHeight)? height : maxHeight) : minHeight;
- }
- else
- {
- // Check if we're resizing
- if (IsMouseButtonDown(MOUSE_LEFT_BUTTON) && CheckCollisionPointRec(mouse, resizer)) resizing = true;
- }
-
- // Move resizer rectangle properly
- resizer.x = container.x + container.width - 17;
- resizer.y = container.y + container.height - 17;
-
- lastMouse = mouse; // Update mouse
- //----------------------------------------------------------------------------------
-
- // Draw
- //----------------------------------------------------------------------------------
- BeginDrawing();
-
- ClearBackground(RAYWHITE);
-
- DrawRectangleLinesEx(container, 3, borderColor); // Draw container border
-
- // Draw text in container (add some padding)
- DrawTextRec(font, text,
- (Rectangle){ container.x + 4, container.y + 4, container.width - 4, container.height - 4 },
- 20.0f, 2.0f, wordWrap, GRAY);
-
- DrawRectangleRec(resizer, borderColor); // Draw the resize box
-
- // Draw info
- DrawText("Word Wrap: ", 313, screenHeight-115, 20, BLACK);
- if (wordWrap) DrawText("ON", 447, screenHeight - 115, 20, RED);
- else DrawText("OFF", 447, screenHeight - 115, 20, BLACK);
- DrawText("Press [SPACE] to toggle word wrap", 218, screenHeight - 91, 20, GRAY);
-
- DrawRectangle(0, screenHeight - 54, screenWidth, 54, GRAY);
- DrawText("Click hold & drag the to resize the container", 155, screenHeight - 38, 20, RAYWHITE);
- DrawRectangleRec((Rectangle){ 382, screenHeight - 34, 12, 12 }, MAROON);
-
- EndDrawing();
- //----------------------------------------------------------------------------------
- }
-
- // De-Initialization
- //--------------------------------------------------------------------------------------
- CloseWindow(); // Close window and OpenGL context
- //--------------------------------------------------------------------------------------
-
- return 0;
-} \ No newline at end of file
diff --git a/examples/src/text/text_sprite_fonts.c b/examples/src/text/text_sprite_fonts.c
deleted file mode 100644
index 3002893..0000000
--- a/examples/src/text/text_sprite_fonts.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************************
-*
-* raylib [text] example - Font loading and usage
-*
-* This example has been created using raylib 1.0 (www.raylib.com)
-* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
-*
-* Copyright (c) 2014 Ramon Santamaria (@raysan5)
-*
-********************************************************************************************/
-
-#include "raylib.h"
-
-int main(void)
-{
- // Initialization
- //--------------------------------------------------------------------------------------
- const int screenWidth = 800;
- const int screenHeight = 450;
-
- InitWindow(screenWidth, screenHeight, "raylib [text] example - sprite fonts usage");
-
- const char msg1[50] = "THIS IS A custom SPRITE FONT...";
- const char msg2[50] = "...and this is ANOTHER CUSTOM font...";
- const char msg3[50] = "...and a THIRD one! GREAT! :D";
-
- // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
- Font font1 = LoadFont("resources/custom_mecha.png"); // Font loading
- Font font2 = LoadFont("resources/custom_alagard.png"); // Font loading
- Font font3 = LoadFont("resources/custom_jupiter_crash.png"); // Font loading
-
- Vector2 fontPosition1, fontPosition2, fontPosition3;
-
- fontPosition1.x = screenWidth/2 - MeasureTextEx(font1, msg1, font1.baseSize, -3).x/2;
- fontPosition1.y = screenHeight/2 - font1.baseSize/2 - 80;
-
- fontPosition2.x = screenWidth/2 - MeasureTextEx(font2, msg2, font2.baseSize, -2).x/2;
- fontPosition2.y = screenHeight/2 - font2.baseSize/2 - 10;
-
- fontPosition3.x = screenWidth/2 - MeasureTextEx(font3, msg3, font3.baseSize, 2).x/2;
- fontPosition3.y = screenHeight/2 - font3.baseSize/2 + 50;
-
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
- //--------------------------------------------------------------------------------------
-
- // Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
- {
- // Update
- //----------------------------------------------------------------------------------
- // TODO: Update variables here...
- //----------------------------------------------------------------------------------
-
- // Draw
- //----------------------------------------------------------------------------------
- BeginDrawing();
-
- ClearBackground(RAYWHITE);
-
- DrawTextEx(font1, msg1, fontPosition1, font1.baseSize, -3, WHITE);
- DrawTextEx(font2, msg2, fontPosition2, font2.baseSize, -2, WHITE);
- DrawTextEx(font3, msg3, fontPosition3, font3.baseSize, 2, WHITE);
-
- EndDrawing();
- //----------------------------------------------------------------------------------
- }
-
- // De-Initialization
- //--------------------------------------------------------------------------------------
- UnloadFont(font1); // Font unloading
- UnloadFont(font2); // Font unloading
- UnloadFont(font3); // Font unloading
-
- CloseWindow(); // Close window and OpenGL context
- //--------------------------------------------------------------------------------------
-
- return 0;
-} \ No newline at end of file
diff --git a/examples/src/text/text_ttf_loading.c b/examples/src/text/text_ttf_loading.c
deleted file mode 100644
index cc59417..0000000
--- a/examples/src/text/text_ttf_loading.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************************
-*
-* raylib [text] example - TTF loading and usage
-*
-* This example has been created using raylib 1.3.0 (www.raylib.com)
-* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
-*
-* Copyright (c) 2015 Ramon Santamaria (@raysan5)
-*
-********************************************************************************************/
-
-#include "raylib.h"
-
-int main(void)
-{
- // Initialization
- //--------------------------------------------------------------------------------------
- const int screenWidth = 800;
- const int screenHeight = 450;
-
- InitWindow(screenWidth, screenHeight, "raylib [text] example - ttf loading");
-
- const char msg[50] = "TTF Font";
-
- // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
-
- // TTF Font loading with custom generation parameters
- Font font = LoadFontEx("resources/KAISG.ttf", 96, 0, 0);
-
- // Generate mipmap levels to use trilinear filtering
- // NOTE: On 2D drawing it won't be noticeable, it looks like FILTER_BILINEAR
- GenTextureMipmaps(&font.texture);
-
- float fontSize = font.baseSize;
- Vector2 fontPosition = { 40, screenHeight/2 - 80 };
- Vector2 textSize;
-
- // Setup texture scaling filter
- SetTextureFilter(font.texture, FILTER_POINT);
- int currentFontFilter = 0; // FILTER_POINT
-
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
- //--------------------------------------------------------------------------------------
-
- // Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
- {
- // Update
- //----------------------------------------------------------------------------------
- fontSize += GetMouseWheelMove()*4.0f;
-
- // Choose font texture filter method
- if (IsKeyPressed(KEY_ONE))
- {
- SetTextureFilter(font.texture, FILTER_POINT);
- currentFontFilter = 0;
- }
- else if (IsKeyPressed(KEY_TWO))
- {
- SetTextureFilter(font.texture, FILTER_BILINEAR);
- currentFontFilter = 1;
- }
- else if (IsKeyPressed(KEY_THREE))
- {
- // NOTE: Trilinear filter won't be noticed on 2D drawing
- SetTextureFilter(font.texture, FILTER_TRILINEAR);
- currentFontFilter = 2;
- }
-
- textSize = MeasureTextEx(font, msg, fontSize, 0);
-
- if (IsKeyDown(KEY_LEFT)) fontPosition.x -= 10;
- else if (IsKeyDown(KEY_RIGHT)) fontPosition.x += 10;
-
- // Load a dropped TTF file dynamically (at current fontSize)
- if (IsFileDropped())
- {
- int count = 0;
- char **droppedFiles = GetDroppedFiles(&count);
-
- if (count == 1) // Only support one ttf file dropped
- {
- UnloadFont(font);
- font = LoadFontEx(droppedFiles[0], fontSize, 0, 0);
- ClearDroppedFiles();
- }
- }
- //----------------------------------------------------------------------------------
-
- // Draw
- //----------------------------------------------------------------------------------
- BeginDrawing();
-
- ClearBackground(RAYWHITE);
-
- DrawText("Use mouse wheel to change font size", 20, 20, 10, GRAY);
- DrawText("Use KEY_RIGHT and KEY_LEFT to move text", 20, 40, 10, GRAY);
- DrawText("Use 1, 2, 3 to change texture filter", 20, 60, 10, GRAY);
- DrawText("Drop a new TTF font for dynamic loading", 20, 80, 10, DARKGRAY);
-
- DrawTextEx(font, msg, fontPosition, fontSize, 0, BLACK);
-
- // TODO: It seems texSize measurement is not accurate due to chars offsets...
- //DrawRectangleLines(fontPosition.x, fontPosition.y, textSize.x, textSize.y, RED);
-
- DrawRectangle(0, screenHeight - 80, screenWidth, 80, LIGHTGRAY);
- DrawText(FormatText("Font size: %02.02f", fontSize), 20, screenHeight - 50, 10, DARKGRAY);
- DrawText(FormatText("Text size: [%02.02f, %02.02f]", textSize.x, textSize.y), 20, screenHeight - 30, 10, DARKGRAY);
- DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, GRAY);
-
- if (currentFontFilter == 0) DrawText("POINT", 570, 400, 20, BLACK);
- else if (currentFontFilter == 1) DrawText("BILINEAR", 570, 400, 20, BLACK);
- else if (currentFontFilter == 2) DrawText("TRILINEAR", 570, 400, 20, BLACK);
-
- EndDrawing();
- //----------------------------------------------------------------------------------
- }
-
- // De-Initialization
- //--------------------------------------------------------------------------------------
- ClearDroppedFiles(); // Clear internal buffers
-
- UnloadFont(font); // Font unloading
-
- CloseWindow(); // Close window and OpenGL context
- //--------------------------------------------------------------------------------------
-
- return 0;
-} \ No newline at end of file
diff --git a/examples/src/text/text_unicode.c b/examples/src/text/text_unicode.c
deleted file mode 100644
index 3525f01..0000000
--- a/examples/src/text/text_unicode.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/*******************************************************************************************
-*
-* raylib [text] example - Using unicode with raylib
-*
-* This example has been created using raylib 2.5 (www.raylib.com)
-* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
-*
-* Example contributed by Vlad Adrian (@demizdor) and reviewed by Ramon Santamaria (@raysan5)
-*
-* Copyright (c) 2019 Vlad Adrian (@demizdor) and Ramon Santamaria (@raysan5)
-*
-********************************************************************************************/
-
-#include "raylib.h"
-
-#include <stdio.h>
-#include <string.h>
-
-#define SIZEOF(A) (sizeof(A)/sizeof(A[0]))
-#define EMOJI_PER_WIDTH 8
-#define EMOJI_PER_HEIGHT 4
-
-// String containing 180 emoji codepoints separated by a '\0' char
-const char *const emojiCodepoints = "\xF0\x9F\x8C\x80\x00\xF0\x9F\x98\x80\x00\xF0\x9F\x98\x82\x00\xF0\x9F\xA4\xA3\x00\xF0\x9F\x98\x83\x00\xF0\x9F\x98\x86\x00\xF0\x9F\x98\x89\x00"
- "\xF0\x9F\x98\x8B\x00\xF0\x9F\x98\x8E\x00\xF0\x9F\x98\x8D\x00\xF0\x9F\x98\x98\x00\xF0\x9F\x98\x97\x00\xF0\x9F\x98\x99\x00\xF0\x9F\x98\x9A\x00\xF0\x9F\x99\x82\x00"
- "\xF0\x9F\xA4\x97\x00\xF0\x9F\xA4\xA9\x00\xF0\x9F\xA4\x94\x00\xF0\x9F\xA4\xA8\x00\xF0\x9F\x98\x90\x00\xF0\x9F\x98\x91\x00\xF0\x9F\x98\xB6\x00\xF0\x9F\x99\x84\x00"
- "\xF0\x9F\x98\x8F\x00\xF0\x9F\x98\xA3\x00\xF0\x9F\x98\xA5\x00\xF0\x9F\x98\xAE\x00\xF0\x9F\xA4\x90\x00\xF0\x9F\x98\xAF\x00\xF0\x9F\x98\xAA\x00\xF0\x9F\x98\xAB\x00"
- "\xF0\x9F\x98\xB4\x00\xF0\x9F\x98\x8C\x00\xF0\x9F\x98\x9B\x00\xF0\x9F\x98\x9D\x00\xF0\x9F\xA4\xA4\x00\xF0\x9F\x98\x92\x00\xF0\x9F\x98\x95\x00\xF0\x9F\x99\x83\x00"
- "\xF0\x9F\xA4\x91\x00\xF0\x9F\x98\xB2\x00\xF0\x9F\x99\x81\x00\xF0\x9F\x98\x96\x00\xF0\x9F\x98\x9E\x00\xF0\x9F\x98\x9F\x00\xF0\x9F\x98\xA4\x00\xF0\x9F\x98\xA2\x00"
- "\xF0\x9F\x98\xAD\x00\xF0\x9F\x98\xA6\x00\xF0\x9F\x98\xA9\x00\xF0\x9F\xA4\xAF\x00\xF0\x9F\x98\xAC\x00\xF0\x9F\x98\xB0\x00\xF0\x9F\x98\xB1\x00\xF0\x9F\x98\xB3\x00"
- "\xF0\x9F\xA4\xAA\x00\xF0\x9F\x98\xB5\x00\xF0\x9F\x98\xA1\x00\xF0\x9F\x98\xA0\x00\xF0\x9F\xA4\xAC\x00\xF0\x9F\x98\xB7\x00\xF0\x9F\xA4\x92\x00\xF0\x9F\xA4\x95\x00"
- "\xF0\x9F\xA4\xA2\x00\xF0\x9F\xA4\xAE\x00\xF0\x9F\xA4\xA7\x00\xF0\x9F\x98\x87\x00\xF0\x9F\xA4\xA0\x00\xF0\x9F\xA4\xAB\x00\xF0\x9F\xA4\xAD\x00\xF0\x9F\xA7\x90\x00"
- "\xF0\x9F\xA4\x93\x00\xF0\x9F\x98\x88\x00\xF0\x9F\x91\xBF\x00\xF0\x9F\x91\xB9\x00\xF0\x9F\x91\xBA\x00\xF0\x9F\x92\x80\x00\xF0\x9F\x91\xBB\x00\xF0\x9F\x91\xBD\x00"
- "\xF0\x9F\x91\xBE\x00\xF0\x9F\xA4\x96\x00\xF0\x9F\x92\xA9\x00\xF0\x9F\x98\xBA\x00\xF0\x9F\x98\xB8\x00\xF0\x9F\x98\xB9\x00\xF0\x9F\x98\xBB\x00\xF0\x9F\x98\xBD\x00"
- "\xF0\x9F\x99\x80\x00\xF0\x9F\x98\xBF\x00\xF0\x9F\x8C\xBE\x00\xF0\x9F\x8C\xBF\x00\xF0\x9F\x8D\x80\x00\xF0\x9F\x8D\x83\x00\xF0\x9F\x8D\x87\x00\xF0\x9F\x8D\x93\x00"
- "\xF0\x9F\xA5\x9D\x00\xF0\x9F\x8D\x85\x00\xF0\x9F\xA5\xA5\x00\xF0\x9F\xA5\x91\x00\xF0\x9F\x8D\x86\x00\xF0\x9F\xA5\x94\x00\xF0\x9F\xA5\x95\x00\xF0\x9F\x8C\xBD\x00"
- "\xF0\x9F\x8C\xB6\x00\xF0\x9F\xA5\x92\x00\xF0\x9F\xA5\xA6\x00\xF0\x9F\x8D\x84\x00\xF0\x9F\xA5\x9C\x00\xF0\x9F\x8C\xB0\x00\xF0\x9F\x8D\x9E\x00\xF0\x9F\xA5\x90\x00"
- "\xF0\x9F\xA5\x96\x00\xF0\x9F\xA5\xA8\x00\xF0\x9F\xA5\x9E\x00\xF0\x9F\xA7\x80\x00\xF0\x9F\x8D\x96\x00\xF0\x9F\x8D\x97\x00\xF0\x9F\xA5\xA9\x00\xF0\x9F\xA5\x93\x00"
- "\xF0\x9F\x8D\x94\x00\xF0\x9F\x8D\x9F\x00\xF0\x9F\x8D\x95\x00\xF0\x9F\x8C\xAD\x00\xF0\x9F\xA5\xAA\x00\xF0\x9F\x8C\xAE\x00\xF0\x9F\x8C\xAF\x00\xF0\x9F\xA5\x99\x00"
- "\xF0\x9F\xA5\x9A\x00\xF0\x9F\x8D\xB3\x00\xF0\x9F\xA5\x98\x00\xF0\x9F\x8D\xB2\x00\xF0\x9F\xA5\xA3\x00\xF0\x9F\xA5\x97\x00\xF0\x9F\x8D\xBF\x00\xF0\x9F\xA5\xAB\x00"
- "\xF0\x9F\x8D\xB1\x00\xF0\x9F\x8D\x98\x00\xF0\x9F\x8D\x9D\x00\xF0\x9F\x8D\xA0\x00\xF0\x9F\x8D\xA2\x00\xF0\x9F\x8D\xA5\x00\xF0\x9F\x8D\xA1\x00\xF0\x9F\xA5\x9F\x00"
- "\xF0\x9F\xA5\xA1\x00\xF0\x9F\x8D\xA6\x00\xF0\x9F\x8D\xAA\x00\xF0\x9F\x8E\x82\x00\xF0\x9F\x8D\xB0\x00\xF0\x9F\xA5\xA7\x00\xF0\x9F\x8D\xAB\x00\xF0\x9F\x8D\xAF\x00"
- "\xF0\x9F\x8D\xBC\x00\xF0\x9F\xA5\x9B\x00\xF0\x9F\x8D\xB5\x00\xF0\x9F\x8D\xB6\x00\xF0\x9F\x8D\xBE\x00\xF0\x9F\x8D\xB7\x00\xF0\x9F\x8D\xBB\x00\xF0\x9F\xA5\x82\x00"
- "\xF0\x9F\xA5\x83\x00\xF0\x9F\xA5\xA4\x00\xF0\x9F\xA5\xA2\x00\xF0\x9F\x91\x81\x00\xF0\x9F\x91\x85\x00\xF0\x9F\x91\x84\x00\xF0\x9F\x92\x8B\x00\xF0\x9F\x92\x98\x00"
- "\xF0\x9F\x92\x93\x00\xF0\x9F\x92\x97\x00\xF0\x9F\x92\x99\x00\xF0\x9F\x92\x9B\x00\xF0\x9F\xA7\xA1\x00\xF0\x9F\x92\x9C\x00\xF0\x9F\x96\xA4\x00\xF0\x9F\x92\x9D\x00"
- "\xF0\x9F\x92\x9F\x00\xF0\x9F\x92\x8C\x00\xF0\x9F\x92\xA4\x00\xF0\x9F\x92\xA2\x00\xF0\x9F\x92\xA3\x00";
-
-struct {
- char *text;
- char *language;
-} const messages[] = { // Array containing all of the emojis messages
- {"\x46\x61\x6C\x73\x63\x68\x65\x73\x20\xC3\x9C\x62\x65\x6E\x20\x76\x6F\x6E\x20\x58\x79\x6C\x6F\x70\x68\x6F\x6E\x6D\x75\x73\x69\x6B\x20\x71\x75\xC3\xA4\x6C"
- "\x74\x20\x6A\x65\x64\x65\x6E\x20\x67\x72\xC3\xB6\xC3\x9F\x65\x72\x65\x6E\x20\x5A\x77\x65\x72\x67", "German"},
- {"\x42\x65\x69\xC3\x9F\x20\x6E\x69\x63\x68\x74\x20\x69\x6E\x20\x64\x69\x65\x20\x48\x61\x6E\x64\x2C\x20\x64\x69\x65\x20\x64\x69\x63\x68\x20\x66\xC3\xBC\x74"
- "\x74\x65\x72\x74\x2E", "German"},
- {"\x41\x75\xC3\x9F\x65\x72\x6F\x72\x64\x65\x6E\x74\x6C\x69\x63\x68\x65\x20\xC3\x9C\x62\x65\x6C\x20\x65\x72\x66\x6F\x72\x64\x65\x72\x6E\x20\x61\x75\xC3\x9F"
- "\x65\x72\x6F\x72\x64\x65\x6E\x74\x6C\x69\x63\x68\x65\x20\x4D\x69\x74\x74\x65\x6C\x2E", "German"},
- {"\xD4\xBF\xD6\x80\xD5\xB6\xD5\xA1\xD5\xB4\x20\xD5\xA1\xD5\xBA\xD5\xA1\xD5\xAF\xD5\xAB\x20\xD5\xB8\xD6\x82\xD5\xBF\xD5\xA5\xD5\xAC\x20\xD6\x87\x20\xD5\xAB"
- "\xD5\xB6\xD5\xAE\xD5\xAB\x20\xD5\xA1\xD5\xB6\xD5\xB0\xD5\xA1\xD5\xB6\xD5\xA3\xD5\xAB\xD5\xBD\xD5\xBF\x20\xD5\xB9\xD5\xA8\xD5\xB6\xD5\xA5\xD6\x80", "Armenian"},
- {"\xD4\xB5\xD6\x80\xD5\xA2\x20\xD5\xB8\xD6\x80\x20\xD5\xAF\xD5\xA1\xD6\x81\xD5\xAB\xD5\xB6\xD5\xA8\x20\xD5\xA5\xD5\xAF\xD5\xA1\xD6\x82\x20\xD5\xA1\xD5\xB6\xD5"
- "\xBF\xD5\xA1\xD5\xBC\x2C\x20\xD5\xAE\xD5\xA1\xD5\xBC\xD5\xA5\xD6\x80\xD5\xA8\x20\xD5\xA1\xD5\xBD\xD5\xA1\xD6\x81\xD5\xAB\xD5\xB6\x2E\x2E\x2E\x20\xC2\xAB\xD4\xBF"
- "\xD5\xB8\xD5\xBF\xD5\xA8\x20\xD5\xB4\xD5\xA5\xD6\x80\xD5\xB8\xD5\xB6\xD6\x81\xD5\xAB\xD6\x81\x20\xD5\xA7\x3A\xC2\xBB", "Armenian"},
- {"\xD4\xB3\xD5\xA1\xD5\xBC\xD5\xA8\xD5\x9D\x20\xD5\xA3\xD5\xA1\xD6\x80\xD5\xB6\xD5\xA1\xD5\xB6\x2C\x20\xD5\xB1\xD5\xAB\xD6\x82\xD5\xB6\xD5\xA8\xD5\x9D\x20\xD5"
- "\xB1\xD5\xB4\xD5\xBC\xD5\xA1\xD5\xB6", "Armenian"},
- {"\x4A\x65\xC5\xBC\x75\x20\x6B\x6C\xC4\x85\x74\x77\x2C\x20\x73\x70\xC5\x82\xC3\xB3\x64\xC5\xBA\x20\x46\x69\x6E\x6F\x6D\x20\x63\x7A\xC4\x99\xC5\x9B\xC4\x87"
- "\x20\x67\x72\x79\x20\x68\x61\xC5\x84\x62\x21", "Polish"},
- {"\x44\x6F\x62\x72\x79\x6D\x69\x20\x63\x68\xC4\x99\x63\x69\x61\x6D\x69\x20\x6A\x65\x73\x74\x20\x70\x69\x65\x6B\xC5\x82\x6F\x20\x77\x79\x62\x72\x75\x6B\x6F"
- "\x77\x61\x6E\x65\x2E", "Polish"},
- {"\xC3\x8E\xC8\x9B\x69\x20\x6D\x75\x6C\xC8\x9B\x75\x6D\x65\x73\x63\x20\x63\xC4\x83\x20\x61\x69\x20\x61\x6C\x65\x73\x20\x72\x61\x79\x6C\x69\x62\x2E\x0A\xC8\x98"
- "\x69\x20\x73\x70\x65\x72\x20\x73\xC4\x83\x20\x61\x69\x20\x6F\x20\x7A\x69\x20\x62\x75\x6E\xC4\x83\x21", "Romanian"},
- {"\xD0\xAD\xD1\x85\x2C\x20\xD1\x87\xD1\x83\xD0\xB6\xD0\xB0\xD0\xBA\x2C\x20\xD0\xBE\xD0\xB1\xD1\x89\xD0\xB8\xD0\xB9\x20\xD1\x81\xD1\x8A\xD1\x91\xD0\xBC\x20"
- "\xD1\x86\xD0\xB5\xD0\xBD\x20\xD1\x88\xD0\xBB\xD1\x8F\xD0\xBF\x20\x28\xD1\x8E\xD1\x84\xD1\x82\xD1\x8C\x29\x20\xD0\xB2\xD0\xB4\xD1\x80\xD1\x8B\xD0\xB7\xD0\xB3\x21", "Russian"},
- {"\xD0\xAF\x20\xD0\xBB\xD1\x8E\xD0\xB1\xD0\xBB\xD1\x8E\x20\x72\x61\x79\x6C\x69\x62\x21", "Russian"},
- {"\xD0\x9C\xD0\xBE\xD0\xBB\xD1\x87\xD0\xB8\x2C\x20\xD1\x81\xD0\xBA\xD1\x80\xD1\x8B\xD0\xB2\xD0\xB0\xD0\xB9\xD1\x81\xD1\x8F\x20\xD0\xB8\x20\xD1\x82\xD0\xB0\xD0\xB8"
- "\x0A\xD0\x98\x20\xD1\x87\xD1\x83\xD0\xB2\xD1\x81\xD1\x82\xD0\xB2\xD0\xB0\x20\xD0\xB8\x20\xD0\xBC\xD0\xB5\xD1\x87\xD1\x82\xD1\x8B\x20\xD1\x81\xD0\xB2\xD0\xBE\xD0\xB8\x20"
- "\xE2\x80\x93\x0A\xD0\x9F\xD1\x83\xD1\x81\xD0\xBA\xD0\xB0\xD0\xB9\x20\xD0\xB2\x20\xD0\xB4\xD1\x83\xD1\x88\xD0\xB5\xD0\xB2\xD0\xBD\xD0\xBE\xD0\xB9\x20\xD0\xB3\xD0\xBB\xD1"
- "\x83\xD0\xB1\xD0\xB8\xD0\xBD\xD0\xB5\x0A\xD0\x98\x20\xD0\xB2\xD1\x81\xD1\x85\xD0\xBE\xD0\xB4\xD1\x8F\xD1\x82\x20\xD0\xB8\x20\xD0\xB7\xD0\xB0\xD0\xB9\xD0\xB4\xD1\x83\xD1"
- "\x82\x20\xD0\xBE\xD0\xBD\xD0\xB5\x0A\xD0\x9A\xD0\xB0\xD0\xBA\x20\xD0\xB7\xD0\xB2\xD0\xB5\xD0\xB7\xD0\xB4\xD1\x8B\x20\xD1\x8F\xD1\x81\xD0\xBD\xD1\x8B\xD0\xB5\x20\xD0\xB2"
- "\x20\xD0\xBD\xD0\xBE\xD1\x87\xD0\xB8\x2D\x0A\xD0\x9B\xD1\x8E\xD0\xB1\xD1\x83\xD0\xB9\xD1\x81\xD1\x8F\x20\xD0\xB8\xD0\xBC\xD0\xB8\x20\xE2\x80\x93\x20\xD0\xB8\x20\xD0\xBC"
- "\xD0\xBE\xD0\xBB\xD1\x87\xD0\xB8\x2E", "Russian"},
- {"\x56\x6F\x69\x78\x20\x61\x6D\x62\x69\x67\x75\xC3\xAB\x20\x64\xE2\x80\x99\x75\x6E\x20\x63\xC5\x93\x75\x72\x20\x71\x75\x69\x20\x61\x75\x20\x7A\xC3\xA9\x70"
- "\x68\x79\x72\x20\x70\x72\xC3\xA9\x66\xC3\xA8\x72\x65\x20\x6C\x65\x73\x20\x6A\x61\x74\x74\x65\x73\x20\x64\x65\x20\x6B\x69\x77\x69", "French"},
- {"\x42\x65\x6E\x6A\x61\x6D\xC3\xAD\x6E\x20\x70\x69\x64\x69\xC3\xB3\x20\x75\x6E\x61\x20\x62\x65\x62\x69\x64\x61\x20\x64\x65\x20\x6B\x69\x77\x69\x20\x79\x20"
- "\x66\x72\x65\x73\x61\x3B\x20\x4E\x6F\xC3\xA9\x2C\x20\x73\x69\x6E\x20\x76\x65\x72\x67\xC3\xBC\x65\x6E\x7A\x61\x2C\x20\x6C\x61\x20\x6D\xC3\xA1\x73\x20\x65\x78"
- "\x71\x75\x69\x73\x69\x74\x61\x20\x63\x68\x61\x6D\x70\x61\xC3\xB1\x61\x20\x64\x65\x6C\x20\x6D\x65\x6E\xC3\xBA\x2E", "Spanish"},
- {"\xCE\xA4\xCE\xB1\xCF\x87\xCE\xAF\xCF\x83\xCF\x84\xCE\xB7\x20\xCE\xB1\xCE\xBB\xCF\x8E\xCF\x80\xCE\xB7\xCE\xBE\x20\xCE\xB2\xCE\xB1\xCF\x86\xCE\xAE\xCF\x82\x20"
- "\xCF\x88\xCE\xB7\xCE\xBC\xCE\xAD\xCE\xBD\xCE\xB7\x20\xCE\xB3\xCE\xB7\x2C\x20\xCE\xB4\xCF\x81\xCE\xB1\xCF\x83\xCE\xBA\xCE\xB5\xCE\xBB\xCE\xAF\xCE\xB6\xCE\xB5\xCE"
- "\xB9\x20\xCF\x85\xCF\x80\xCE\xAD\xCF\x81\x20\xCE\xBD\xCF\x89\xCE\xB8\xCF\x81\xCE\xBF\xCF\x8D\x20\xCE\xBA\xCF\x85\xCE\xBD\xCF\x8C\xCF\x82", "Greek"},
- {"\xCE\x97\x20\xCE\xBA\xCE\xB1\xCE\xBB\xCF\x8D\xCF\x84\xCE\xB5\xCF\x81\xCE\xB7\x20\xCE\xAC\xCE\xBC\xCF\x85\xCE\xBD\xCE\xB1\x20\xCE\xB5\xCE\xAF\xCE\xBD"
- "\xCE\xB1\xCE\xB9\x20\xCE\xB7\x20\xCE\xB5\xCF\x80\xCE\xAF\xCE\xB8\xCE\xB5\xCF\x83\xCE\xB7\x2E", "Greek"},
- {"\xCE\xA7\xCF\x81\xCF\x8C\xCE\xBD\xCE\xB9\xCE\xB1\x20\xCE\xBA\xCE\xB1\xCE\xB9\x20\xCE\xB6\xCE\xB1\xCE\xBC\xCE\xAC\xCE\xBD\xCE\xB9\xCE\xB1\x21", "Greek"},
- {"\xCE\xA0\xCF\x8E\xCF\x82\x20\xCF\x84\xCE\xB1\x20\xCF\x80\xCE\xB1\xCF\x82\x20\xCF\x83\xCE\xAE\xCE\xBC\xCE\xB5\xCF\x81\xCE\xB1\x3B", "Greek"},
-
- {"\xE6\x88\x91\xE8\x83\xBD\xE5\x90\x9E\xE4\xB8\x8B\xE7\x8E\xBB\xE7\x92\x83\xE8\x80\x8C\xE4\xB8\x8D\xE4\xBC\xA4\xE8\xBA\xAB\xE4\xBD\x93\xE3\x80\x82", "Chinese"},
- {"\xE4\xBD\xA0\xE5\x90\x83\xE4\xBA\x86\xE5\x90\x97\xEF\xBC\x9F", "Chinese"},
- {"\xE4\xB8\x8D\xE4\xBD\x9C\xE4\xB8\x8D\xE6\xAD\xBB\xE3\x80\x82", "Chinese"},
- {"\xE6\x9C\x80\xE8\xBF\x91\xE5\xA5\xBD\xE5\x90\x97\xEF\xBC\x9F", "Chinese"},
- {"\xE5\xA1\x9E\xE7\xBF\x81\xE5\xA4\xB1\xE9\xA9\xAC\xEF\xBC\x8C\xE7\x84\x89\xE7\x9F\xA5\xE9\x9D\x9E\xE7\xA6\x8F\xE3\x80\x82", "Chinese"},
- {"\xE5\x8D\x83\xE5\x86\x9B\xE6\x98\x93\xE5\xBE\x97\x2C\x20\xE4\xB8\x80\xE5\xB0\x86\xE9\x9A\xBE\xE6\xB1\x82", "Chinese"},
- {"\xE4\xB8\x87\xE4\xBA\x8B\xE5\xBC\x80\xE5\xA4\xB4\xE9\x9A\xBE\xE3\x80\x82", "Chinese"},
- {"\xE9\xA3\x8E\xE6\x97\xA0\xE5\xB8\xB8\xE9\xA1\xBA\xEF\xBC\x8C\xE5\x85\xB5\xE6\x97\xA0\xE5\xB8\xB8\xE8\x83\x9C\xE3\x80\x82", "Chinese"},
- {"\xE6\xB4\xBB\xE5\x88\xB0\xE8\x80\x81\xEF\xBC\x8C\xE5\xAD\xA6\xE5\x88\xB0\xE8\x80\x81\xE3\x80\x82", "Chinese"},
- {"\xE4\xB8\x80\xE8\xA8\x80\xE6\x97\xA2\xE5\x87\xBA\xEF\xBC\x8C\xE9\xA9\xB7\xE9\xA9\xAC\xE9\x9A\xBE\xE8\xBF\xBD\xE3\x80\x82", "Chinese"},
- {"\xE8\xB7\xAF\xE9\x81\xA5\xE7\x9F\xA5\xE9\xA9\xAC\xE5\x8A\x9B\xEF\xBC\x8C\xE6\x97\xA5\xE4\xB9\x85\xE8\xA7\x81\xE4\xBA\xBA\xE5\xBF\x83", "Chinese"},
- {"\xE6\x9C\x89\xE7\x90\x86\xE8\xB5\xB0\xE9\x81\x8D\xE5\xA4\xA9\xE4\xB8\x8B\xEF\xBC\x8C\xE6\x97\xA0\xE7\x90\x86\xE5\xAF\xB8\xE6\xAD\xA5\xE9\x9A\xBE\xE8\xA1\x8C\xE3\x80\x82", "Chinese"},
-
- {"\xE7\x8C\xBF\xE3\x82\x82\xE6\x9C\xA8\xE3\x81\x8B\xE3\x82\x89\xE8\x90\xBD\xE3\x81\xA1\xE3\x82\x8B", "Japanese"},
- {"\xE4\xBA\x80\xE3\x81\xAE\xE7\x94\xB2\xE3\x82\x88\xE3\x82\x8A\xE5\xB9\xB4\xE3\x81\xAE\xE5\x8A\x9F", "Japanese"},
- {"\xE3\x81\x86\xE3\x82\x89\xE3\x82\x84\xE3\x81\xBE\xE3\x81\x97\x20\x20\xE6\x80\x9D\xE3\x81\xB2\xE5\x88\x87\xE3\x82\x8B\xE6\x99\x82\x20\x20\xE7\x8C\xAB\xE3\x81\xAE\xE6\x81\x8B", "Japanese"},
- {"\xE8\x99\x8E\xE7\xA9\xB4\xE3\x81\xAB\xE5\x85\xA5\xE3\x82\x89\xE3\x81\x9A\xE3\x82\x93\xE3\x81\xB0\xE8\x99\x8E\xE5\xAD\x90\xE3\x82\x92\xE5\xBE\x97\xE3\x81\x9A\xE3\x80\x82", "Japanese"},
- {"\xE4\xBA\x8C\xE5\x85\x8E\xE3\x82\x92\xE8\xBF\xBD\xE3\x81\x86\xE8\x80\x85\xE3\x81\xAF\xE4\xB8\x80\xE5\x85\x8E\xE3\x82\x92\xE3\x82\x82\xE5\xBE\x97\xE3\x81\x9A\xE3\x80\x82", "Japanese"},
- {"\xE9\xA6\xAC\xE9\xB9\xBF\xE3\x81\xAF\xE6\xAD\xBB\xE3\x81\xAA\xE3\x81\xAA\xE3\x81\x8D\xE3\x82\x83\xE6\xB2\xBB\xE3\x82\x89\xE3\x81\xAA\xE3\x81\x84\xE3\x80\x82", "Japanese"},
- {"\xE6\x9E\xAF\xE9\x87\x8E\xE8\xB7\xAF\xE3\x81\xAB\xE3\x80\x80\xE5\xBD\xB1\xE3\x81\x8B\xE3\x81\x95\xE3\x81\xAA\xE3\x82\x8A\xE3\x81\xA6\xE3\x80\x80\xE3\x82\x8F\xE3\x81\x8B\xE3\x82\x8C\xE3\x81\x91\xE3\x82\x8A", "Japanese"},
- {"\xE7\xB9\xB0\xE3\x82\x8A\xE8\xBF\x94\xE3\x81\x97\xE9\xBA\xA6\xE3\x81\xAE\xE7\x95\x9D\xE7\xB8\xAB\xE3\x81\xB5\xE8\x83\xA1\xE8\x9D\xB6\xE5\x93\x89", "Japanese"},
-
- {"\xEC\x95\x84\xEB\x93\x9D\xED\x95\x9C\x20\xEB\xB0\x94\xEB\x8B\xA4\x20\xEC\x9C\x84\xEC\x97\x90\x20\xEA\xB0\x88\xEB\xA7\xA4\xEA\xB8\xB0\x20\xEB\x91\x90\xEC\x97\x87\x20"
- "\xEB\x82\xA0\xEC\x95\x84\x20\xEB\x8F\x88\xEB\x8B\xA4\x2E\x0A\xEB\x84\x88\xED\x9B\x8C\xEB\x84\x88\xED\x9B\x8C\x20\xEC\x8B\x9C\xEB\xA5\xBC\x20\xEC\x93\xB4\xEB\x8B\xA4\x2E"
- "\x20\xEB\xAA\xA8\xEB\xA5\xB4\xEB\x8A\x94\x20\xEB\x82\x98\xEB\x9D\xBC\x20\xEA\xB8\x80\xEC\x9E\x90\xEB\x8B\xA4\x2E\x0A\xEB\x84\x90\xEB\x94\xB0\xEB\x9E\x80\x20\xED\x95\x98"
- "\xEB\x8A\x98\x20\xEB\xB3\xB5\xED\x8C\x90\xEC\x97\x90\x20\xEB\x82\x98\xEB\x8F\x84\x20\xEA\xB0\x99\xEC\x9D\xB4\x20\xEC\x8B\x9C\xEB\xA5\xBC\x20\xEC\x93\xB4\xEB\x8B\xA4\x2E", "Korean"},
- {"\xEC\xA0\x9C\x20\xEB\x88\x88\xEC\x97\x90\x20\xEC\x95\x88\xEA\xB2\xBD\xEC\x9D\xB4\xEB\x8B\xA4", "Korean"},
- {"\xEA\xBF\xA9\x20\xEB\xA8\xB9\xEA\xB3\xA0\x20\xEC\x95\x8C\x20\xEB\xA8\xB9\xEB\x8A\x94\xEB\x8B\xA4", "Korean"},
- {"\xEB\xA1\x9C\xEB\xA7\x88\xEB\x8A\x94\x20\xED\x95\x98\xEB\xA3\xA8\xEC\x95\x84\xEC\xB9\xA8\xEC\x97\x90\x20\xEC\x9D\xB4\xEB\xA3\xA8\xEC\x96\xB4\xEC\xA7\x84\x20\xEA\xB2\x83\xEC\x9D\xB4"
- "\x20\xEC\x95\x84\xEB\x8B\x88\xEB\x8B\xA4", "Korean"},
- {"\xEA\xB3\xA0\xEC\x83\x9D\x20\xEB\x81\x9D\xEC\x97\x90\x20\xEB\x82\x99\xEC\x9D\xB4\x20\xEC\x98\xA8\xEB\x8B\xA4", "Korean"},
- {"\xEA\xB0\x9C\xEC\xB2\x9C\xEC\x97\x90\xEC\x84\x9C\x20\xEC\x9A\xA9\x20\xEB\x82\x9C\xEB\x8B\xA4", "Korean"},
- {"\xEC\x95\x88\xEB\x85\x95\xED\x95\x98\xEC\x84\xB8\xEC\x9A\x94\x3F", "Korean"},
- {"\xEB\xA7\x8C\xEB\x82\x98\xEC\x84\x9C\x20\xEB\xB0\x98\xEA\xB0\x91\xEC\x8A\xB5\xEB\x8B\x88\xEB\x8B\xA4", "Korean"},
- {"\xED\x95\x9C\xEA\xB5\xAD\xEB\xA7\x90\x20\xED\x95\x98\xEC\x8B\xA4\x20\xEC\xA4\x84\x20\xEC\x95\x84\xEC\x84\xB8\xEC\x9A\x94\x3F", "Korean"},
-};
-
-//--------------------------------------------------------------------------------------
-// Module functions declaration
-//--------------------------------------------------------------------------------------
-static void RandomizeEmoji(void); // Fills the emoji array with random emojis
-
-//--------------------------------------------------------------------------------------
-// Global variables
-//--------------------------------------------------------------------------------------
-// Arrays that holds the random emojis
-struct {
- int index; // Index inside `emojiCodepoints`
- int message; // Message index
- Color color; // Emoji color
-} emoji[EMOJI_PER_WIDTH*EMOJI_PER_HEIGHT] = { 0 };
-
-static int hovered = -1, selected = -1;
-
-int main(int argc, char **argv)
-{
- // Initialization
- //--------------------------------------------------------------------------------------
- const int screenWidth = 800;
- const int screenHeight = 450;
-
- SetConfigFlags(FLAG_MSAA_4X_HINT | FLAG_VSYNC_HINT);
- InitWindow(screenWidth, screenHeight, "raylib [text] example - unicode");
-
- // Load the font resources
- // NOTE: fontAsian is for asian languages,
- // fontEmoji is the emojis and fontDefault is used for everything else
- Font fontDefault = LoadFont("resources/dejavu.fnt");
- Font fontAsian = LoadFont("resources/notoCJK.fnt");
- Font fontEmoji = LoadFont("resources/emoji.fnt");
-
- Vector2 hoveredPos = { 0.0f, 0.0f };
- Vector2 selectedPos = { 0.0f, 0.0f };
-
- // Set a random set of emojis when starting up
- RandomizeEmoji();
-
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
- //--------------------------------------------------------------------------------------
-
- // Main loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
- {
- // Update
- //----------------------------------------------------------------------------------
- // 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
- if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) && (hovered != -1) && (hovered != selected))
- {
- selected = hovered;
- selectedPos = hoveredPos;
- SetClipboardText(messages[emoji[selected].message].text);
- }
-
- Vector2 mouse = GetMousePosition();
- Vector2 pos = { 28.8f, 10.0f };
- hovered = -1;
- //----------------------------------------------------------------------------------
-
- // Draw
- //----------------------------------------------------------------------------------
- BeginDrawing();
-
- ClearBackground(RAYWHITE);
-
- // Draw random emojis in the background
- //------------------------------------------------------------------------------
- for (int i = 0; i < SIZEOF(emoji); ++i)
- {
- const char *txt = &emojiCodepoints[emoji[i].index];
- Rectangle emojiRect = { pos.x, pos.y, fontEmoji.baseSize, fontEmoji.baseSize };
-
- if (!CheckCollisionPointRec(mouse, emojiRect))
- {
- DrawTextEx(fontEmoji, txt, pos, fontEmoji.baseSize, 1.0, selected == i ? emoji[i].color : Fade(LIGHTGRAY, 0.4f));
- }
- else
- {
- DrawTextEx(fontEmoji, txt, pos, fontEmoji.baseSize, 1.0, emoji[i].color );
- hovered = i;
- hoveredPos = pos;
- }
-
- if ((i != 0) && (i%EMOJI_PER_WIDTH == 0)) { pos.y += fontEmoji.baseSize + 24.25f; pos.x = 28.8f; }
- else pos.x += fontEmoji.baseSize + 28.8f;
- }
- //------------------------------------------------------------------------------
-
- // Draw the message when a emoji is selected
- //------------------------------------------------------------------------------
- if (selected != -1)
- {
- const int message = emoji[selected].message;
- const int horizontalPadding = 20, verticalPadding = 30;
- Font *font = &fontDefault;
-
- // Set correct font for asian languages
- if (TextIsEqual(messages[message].language, "Chinese") ||
- TextIsEqual(messages[message].language, "Korean") ||
- TextIsEqual(messages[message].language, "Japanese")) font = &fontAsian;
-
- // Calculate size for the message box (approximate the height and width)
- Vector2 sz = MeasureTextEx(*font, messages[message].text, font->baseSize, 1.0f);
- if (sz.x > 300) { sz.y *= sz.x/300; sz.x = 300; }
- else if (sz.x < 160) sz.x = 160;
-
- Rectangle msgRect = { selectedPos.x - 38.8f, selectedPos.y, 2 * horizontalPadding + sz.x, 2 * verticalPadding + sz.y };
- msgRect.y -= msgRect.height;
-
- // Coordinates for the chat bubble triangle
- Vector2 a = { selectedPos.x, msgRect.y + msgRect.height }, b = {a.x + 8, a.y + 10}, c= { a.x + 10, a.y };
-
- // Don't go outside the screen
- if (msgRect.x < 10) msgRect.x += 28;
- if (msgRect.y < 10)
- {
- msgRect.y = selectedPos.y + 84;
- a.y = msgRect.y;
- c.y = a.y;
- b.y = a.y - 10;
-
- // Swap values so we can actually render the triangle :(
- Vector2 tmp = a;
- a = b;
- b = tmp;
- }
- if (msgRect.x + msgRect.width > screenWidth) msgRect.x -= (msgRect.x + msgRect.width) - screenWidth + 10;
-
- // Draw chat bubble
- DrawRectangleRec(msgRect, emoji[selected].color);
- DrawTriangle(a, b, c, emoji[selected].color);
-
- // Draw the main text message
- Rectangle textRect = { msgRect.x + horizontalPadding/2, msgRect.y + verticalPadding/2, msgRect.width - horizontalPadding, msgRect.height };
- DrawTextRec(*font, messages[message].text, textRect, font->baseSize, 1.0f, true, WHITE);
-
- // Draw the info text below the main message
- int size = strlen(messages[message].text);
- unsigned int len = TextCountCodepoints(messages[message].text);
- const char *info = TextFormat("%s %u characters %i bytes", messages[message].language, len, size);
- sz = MeasureTextEx(GetFontDefault(), info, 10, 1.0f);
- Vector2 pos = { textRect.x + textRect.width - sz.x, msgRect.y + msgRect.height - sz.y - 2 };
- DrawText(info, pos.x, 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();
- //----------------------------------------------------------------------------------
- }
-
- // De-Initialization
- //--------------------------------------------------------------------------------------
- UnloadFont(fontDefault); // Unload font resource
- UnloadFont(fontAsian); // Unload font resource
- UnloadFont(fontEmoji); // Unload font resource
-
- CloseWindow(); // Close window and OpenGL context
- //--------------------------------------------------------------------------------------
-
- return 0;
-}
-
-// Fills the emoji array with random emoji (only those emojis present in fontEmoji)
-static void RandomizeEmoji(void)
-{
- hovered = selected = -1;
- int start = GetRandomValue(45, 360);
-
- for (int i = 0; i < SIZEOF(emoji); ++i)
- {
- // 0-179 emoji codepoints (from emoji char array) each 4bytes + null char
- emoji[i].index = GetRandomValue(0, 179)*5;
-
- // Generate a random color for this emoji
- Vector3 hsv = {(start*(i + 1))%360, 0.6f, 0.85f};
- emoji[i].color = Fade(ColorFromHSV(hsv), 0.8f);
-
- // Set a random message for this emoji
- emoji[i].message = GetRandomValue(0, SIZEOF(messages) - 1);
- }
-}
diff --git a/examples/src/text/text_writing_anim.c b/examples/src/text/text_writing_anim.c
deleted file mode 100644
index 2cf2eaa..0000000
--- a/examples/src/text/text_writing_anim.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************************
-*
-* raylib [text] example - Text Writing Animation
-*
-* This example has been created using raylib 2.3 (www.raylib.com)
-* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
-*
-* Copyright (c) 2016 Ramon Santamaria (@raysan5)
-*
-********************************************************************************************/
-
-#include "raylib.h"
-
-int main(void)
-{
- // Initialization
- //--------------------------------------------------------------------------------------
- const int screenWidth = 800;
- const int screenHeight = 450;
-
- InitWindow(screenWidth, screenHeight, "raylib [text] example - text writing anim");
-
- const char message[128] = "This sample illustrates a text writing\nanimation effect! Check it out! ;)";
-
- int framesCounter = 0;
-
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
- //--------------------------------------------------------------------------------------
-
- // Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
- {
- // Update
- //----------------------------------------------------------------------------------
- if (IsKeyDown(KEY_SPACE)) framesCounter += 8;
- else framesCounter++;
-
- if (IsKeyPressed(KEY_ENTER)) framesCounter = 0;
- //----------------------------------------------------------------------------------
-
- // Draw
- //----------------------------------------------------------------------------------
- BeginDrawing();
-
- ClearBackground(RAYWHITE);
-
- DrawText(TextSubtext(message, 0, framesCounter/10), 210, 160, 20, MAROON);
-
- DrawText("PRESS [ENTER] to RESTART!", 240, 260, 20, LIGHTGRAY);
- DrawText("PRESS [SPACE] to SPEED UP!", 239, 300, 20, LIGHTGRAY);
-
- EndDrawing();
- //----------------------------------------------------------------------------------
- }
-
- // De-Initialization
- //--------------------------------------------------------------------------------------
- CloseWindow(); // Close window and OpenGL context
- //--------------------------------------------------------------------------------------
-
- return 0;
-} \ No newline at end of file