Review ALL examples
This commit is contained in:
parent
a43a7980a3
commit
b525039e0a
96 changed files with 1301 additions and 1317 deletions
|
@ -16,18 +16,18 @@
|
|||
|
||||
#define MAX_FONTS 8
|
||||
|
||||
int main()
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
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");
|
||||
|
@ -36,32 +36,34 @@ int main()
|
|||
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",
|
||||
|
||||
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",
|
||||
"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
|
||||
|
@ -77,10 +79,10 @@ int main()
|
|||
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]);
|
||||
|
@ -92,7 +94,7 @@ int main()
|
|||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Fonts unloading
|
||||
for (int i = 0; i < MAX_FONTS; i++) UnloadFont(fonts[i]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue