diff options
| author | raysan5 <[email protected]> | 2017-07-24 20:04:54 +0200 |
|---|---|---|
| committer | raysan5 <[email protected]> | 2017-07-24 20:04:54 +0200 |
| commit | 072684d276373b58ddf7203e34b66a14f6e0c848 (patch) | |
| tree | 64dd10af55f0602864ce79eb9c46a23531341059 /docs/examples/src/text/text_raylib_fonts.c | |
| parent | b2712b6db7c184aff47436f387f2012cf77f4f67 (diff) | |
| download | raylib-072684d276373b58ddf7203e34b66a14f6e0c848.tar.gz raylib-072684d276373b58ddf7203e34b66a14f6e0c848.zip | |
Removed webpage from raylib repo
Moved to own repo at @raysan5/raylib.com
Diffstat (limited to 'docs/examples/src/text/text_raylib_fonts.c')
| -rw-r--r-- | docs/examples/src/text/text_raylib_fonts.c | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/docs/examples/src/text/text_raylib_fonts.c b/docs/examples/src/text/text_raylib_fonts.c deleted file mode 100644 index 6d8ef2b6..00000000 --- a/docs/examples/src/text/text_raylib_fonts.c +++ /dev/null @@ -1,103 +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() -{ - // Initialization - //-------------------------------------------------------------------------------------- - int screenWidth = 800; - int screenHeight = 450; - - InitWindow(screenWidth, screenHeight, "raylib [text] example - raylib fonts"); - - // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) - SpriteFont fonts[MAX_FONTS]; - - fonts[0] = LoadSpriteFont("resources/fonts/alagard.png"); - fonts[1] = LoadSpriteFont("resources/fonts/pixelplay.png"); - fonts[2] = LoadSpriteFont("resources/fonts/mecha.png"); - fonts[3] = LoadSpriteFont("resources/fonts/setback.png"); - fonts[4] = LoadSpriteFont("resources/fonts/romulus.png"); - fonts[5] = LoadSpriteFont("resources/fonts/pixantiqua.png"); - fonts[6] = LoadSpriteFont("resources/fonts/alpha_beta.png"); - fonts[7] = LoadSpriteFont("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 }; - //-------------------------------------------------------------------------------------- - - // 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 - //-------------------------------------------------------------------------------------- - - // SpriteFonts unloading - for (int i = 0; i < MAX_FONTS; i++) UnloadSpriteFont(fonts[i]); - - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - - return 0; -}
\ No newline at end of file |
