BREAKING CHANGE: Renamed SpriteFont type to Font
- Preparing MP3 files support - Jumped version to raylib 2.0-dev (too many breaking changes...)
This commit is contained in:
parent
6045062a05
commit
ec33e7d705
34 changed files with 3027 additions and 179 deletions
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [text] example - BMFont and TTF SpriteFonts loading
|
||||
* 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)
|
||||
|
@ -24,8 +24,8 @@ int main()
|
|||
const char msgTtf[64] = "THIS SPRITE FONT has been GENERATED from a TTF";
|
||||
|
||||
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
|
||||
SpriteFont fontBm = LoadSpriteFont("resources/bmfont.fnt"); // BMFont (AngelCode)
|
||||
SpriteFont fontTtf = LoadSpriteFont("resources/pixantiqua.ttf"); // TTF font
|
||||
Font fontBm = LoadFont("resources/bmfont.fnt"); // BMFont (AngelCode)
|
||||
Font fontTtf = LoadFont("resources/pixantiqua.ttf"); // TTF font
|
||||
|
||||
Vector2 fontPosition;
|
||||
|
||||
|
@ -58,8 +58,8 @@ int main()
|
|||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadSpriteFont(fontBm); // AngelCode SpriteFont unloading
|
||||
UnloadSpriteFont(fontTtf); // TTF SpriteFont unloading
|
||||
UnloadFont(fontBm); // AngelCode Font unloading
|
||||
UnloadFont(fontTtf); // TTF Font unloading
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
|
@ -25,7 +25,7 @@ int main()
|
|||
const char msg[256] = "ASCII extended characters:\n¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆ\nÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæ\nçèéêëìíîïðñòóôõö÷øùúûüýþÿ";
|
||||
|
||||
// NOTE: Loaded font has an unordered list of characters (chars in the range 32..255)
|
||||
SpriteFont font = LoadSpriteFont("resources/pixantiqua.fnt"); // BMFont (AngelCode)
|
||||
Font font = LoadFont("resources/pixantiqua.fnt"); // BMFont (AngelCode)
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
@ -56,7 +56,7 @@ int main()
|
|||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadSpriteFont(font); // AngelCode SpriteFont unloading
|
||||
UnloadFont(font); // AngelCode Font unloading
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
|
@ -26,16 +26,16 @@ int main()
|
|||
InitWindow(screenWidth, screenHeight, "raylib [text] example - raylib fonts");
|
||||
|
||||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||
SpriteFont fonts[MAX_FONTS];
|
||||
Font 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");
|
||||
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",
|
||||
|
@ -93,8 +93,8 @@ int main()
|
|||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// SpriteFonts unloading
|
||||
for (int i = 0; i < MAX_FONTS; i++) UnloadSpriteFont(fonts[i]);
|
||||
// Fonts unloading
|
||||
for (int i = 0; i < MAX_FONTS; i++) UnloadFont(fonts[i]);
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [text] example - SpriteFont loading and usage
|
||||
* 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)
|
||||
|
@ -25,9 +25,9 @@ int main()
|
|||
const char msg3[50] = "...and a THIRD one! GREAT! :D";
|
||||
|
||||
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
|
||||
SpriteFont font1 = LoadSpriteFont("resources/custom_mecha.png"); // SpriteFont loading
|
||||
SpriteFont font2 = LoadSpriteFont("resources/custom_alagard.png"); // SpriteFont loading
|
||||
SpriteFont font3 = LoadSpriteFont("resources/custom_jupiter_crash.png"); // SpriteFont loading
|
||||
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;
|
||||
|
||||
|
@ -66,9 +66,9 @@ int main()
|
|||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadSpriteFont(font1); // SpriteFont unloading
|
||||
UnloadSpriteFont(font2); // SpriteFont unloading
|
||||
UnloadSpriteFont(font3); // SpriteFont unloading
|
||||
UnloadFont(font1); // Font unloading
|
||||
UnloadFont(font2); // Font unloading
|
||||
UnloadFont(font3); // Font unloading
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
|
@ -20,12 +20,12 @@ int main()
|
|||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - ttf loading");
|
||||
|
||||
const char msg[50] = "TTF SpriteFont";
|
||||
const char msg[50] = "TTF Font";
|
||||
|
||||
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
|
||||
|
||||
// TTF SpriteFont loading with custom generation parameters
|
||||
SpriteFont font = LoadSpriteFontEx("resources/KAISG.ttf", 96, 0, 0);
|
||||
// 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
|
||||
|
@ -85,8 +85,8 @@ int main()
|
|||
|
||||
if (count == 1) // Only support one ttf file dropped
|
||||
{
|
||||
UnloadSpriteFont(font);
|
||||
font = LoadSpriteFontEx(droppedFiles[0], fontSize, 0, 0);
|
||||
UnloadFont(font);
|
||||
font = LoadFontEx(droppedFiles[0], fontSize, 0, 0);
|
||||
ClearDroppedFiles();
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ int main()
|
|||
#if defined(PLATFORM_DESKTOP)
|
||||
ClearDroppedFiles(); // Clear internal buffers
|
||||
#endif
|
||||
UnloadSpriteFont(font); // SpriteFont unloading
|
||||
UnloadFont(font); // Font unloading
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue