diff --git a/assets/fonts/ZadoBold.ttf b/assets/fonts/ZadoBold.ttf new file mode 100644 index 0000000..95df53e Binary files /dev/null and b/assets/fonts/ZadoBold.ttf differ diff --git a/src/Credits.c b/src/Credits.c index 24c1257..bf746ab 100644 --- a/src/Credits.c +++ b/src/Credits.c @@ -10,7 +10,7 @@ #include "Screens.h" #include "Controls.h" -#include "Textures.h" +#include "Gfx.h" int finishfromCreditsScreen = 0; @@ -27,12 +27,13 @@ void UpdateCreditsScreen(void) void DrawCreditsScreen(void) { DrawTexture(background, 0, 0, DARKGRAY); - DrawText("CREDITS", 290, 20, 50, BLUE); - DrawText("Programming and Art by Return0ne", 10, 210, 20, BLUE); - DrawText("Powered by raylib 4.0 and rFXgen for sound effects", 10, 240, 20, BLUE); - DrawText("A Canneddonuts project 2022", 10, 270, 40, BLUE); - DrawText(TextFormat("Build compiled on %s", __DATE__), 10, 310, 30, GREEN); - DrawText("Press 'ENTER' ", 10, 350, 20, WHITE); + DrawTextEx(ZadoBold, "CREDITS", (Vector2){ 290, 20 }, 50, 2, BLUE); + DrawTextEx(ZadoBold, "Programming and Art by Return0ne", (Vector2){ 10, 160 }, 40, 2, BLUE); + DrawTextEx(ZadoBold, "Powered by raylib 4.0", (Vector2){ 10, 200 }, 40, 2, BLUE); + DrawTextEx(ZadoBold, "rFXgen used for sfx", (Vector2){ 10, 235 }, 40, 2, BLUE); + DrawTextEx(ZadoBold, "A Canneddonuts project 2022", (Vector2){ 10, 270 }, 40, 2, BLUE); + DrawTextEx(ZadoBold, TextFormat("Build compiled on %s", __DATE__), (Vector2){ 10, 310 }, 30, 2, GREEN); + DrawTextEx(ZadoBold, "Press 'ENTER' ", (Vector2){ 10, 350 }, 30, 2, WHITE); } int FinishCreditsScreen(void) diff --git a/src/Ending.c b/src/Ending.c index 5c6a48b..68b7081 100644 --- a/src/Ending.c +++ b/src/Ending.c @@ -9,7 +9,7 @@ #include "../include/raylib.h" #include "Screens.h" -#include "Textures.h" +#include "Gfx.h" #include "Controls.h" int finishfromEndingScreen = 0; @@ -27,9 +27,9 @@ void UpdateEndingScreen(void) void DrawEndingScreen(void) { DrawTexture(background, 0, 0, GOLD); - DrawText("THANK YOU SO MUCH FOR PLAYING!!!", 145, 20, 30, GOLD); - DrawText("Canneddonuts 2022", 500, 420, 30, WHITE); - DrawText("Press 'ENTER'", 0, 420, 30, WHITE); + DrawTextEx(ZadoBold, "THANK YOU SO MUCH FOR PLAYING!!!", (Vector2){ 10, 10 }, 45, 2, GOLD); + DrawTextEx(ZadoBold, "Canneddonuts 2022", (Vector2){ 380, 400 }, 40, 2, WHITE); + DrawTextEx(ZadoBold, "Press 'ENTER'", (Vector2){ 0, 400 }, 40, 2, WHITE); } void UnloadEndingScreen(void) diff --git a/src/Gameover.c b/src/Gameover.c index f2ba277..1596b42 100644 --- a/src/Gameover.c +++ b/src/Gameover.c @@ -9,6 +9,7 @@ #include "../include/raylib.h" #include "Screens.h" +#include "Gfx.h" #include "Controls.h" int gameoverSelected = 0, finishfromGameoverScreen = 0; @@ -36,12 +37,12 @@ void UpdateGameoverScreen(void) void DrawGameoverScreen(void) { DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLACK); - DrawText("GAMEOVER", 250, 20, 50, RED); - if (gameoverSelected == 0) DrawText("RETRY", 350, 200, 20, WHITE); - else DrawText("RETRY", 350, 200, 20, RED); + DrawTextEx(ZadoBold, "GAMEOVER", (Vector2){ 220, 20 }, 80, 3, RED); + if (gameoverSelected == 0) DrawTextEx(ZadoBold, "RETRY", (Vector2){ 350, 200 }, 30, 2, WHITE); + else DrawTextEx(ZadoBold, "RETRY", (Vector2){ 350, 200 }, 30, 2, RED); - if (gameoverSelected == -1) DrawText("TITLE", 352, 230, 20, WHITE); - else DrawText("TITLE", 352, 230, 20, RED); + if (gameoverSelected == -1) DrawTextEx(ZadoBold, "TITLE", (Vector2){ 355, 230 }, 30, 2, WHITE); + else DrawTextEx(ZadoBold, "TITLE", (Vector2){ 355, 230 }, 30, 2, RED); } int FinishGameoverScreen(void) diff --git a/src/Gameplay.c b/src/Gameplay.c index 5d6a57a..1f819c6 100644 --- a/src/Gameplay.c +++ b/src/Gameplay.c @@ -14,7 +14,7 @@ #include "Gameplay.h" #include "Score.h" #include "Timers.h" -#include "Textures.h" +#include "Gfx.h" int score = 0, bestscore = 0, finishfromGameplayScreen = 0; Levels level = 0; @@ -339,9 +339,9 @@ void DrawGameplayScreen(void) } DrawTextureRec(player_sprite, player.frameRec, player.sprite_pos, player.color); DrawTexture(feather_sprite, 0, 0, GREEN); - DrawText(TextFormat("= %i", player.hp), 30, 30, 20, GREEN); + DrawTextEx(ZadoBold, TextFormat("= %i", player.hp), (Vector2){ 30, 30 }, 20, 2, GREEN); DrawTexture(feather_sprite, 70, 0, RED); - DrawText(TextFormat("= %i", ammo), 100, 30, 20, RED); + DrawTextEx(ZadoBold, TextFormat("= %i", ammo), (Vector2){ 100, 30 }, 20, 2, RED); DrawText(TextFormat("ENEMY HP: %i", enemy.hp), GetScreenWidth() - 150, 10, 20, RED); if (score >= 10000) DrawText(TextFormat("SCORE: %i", score), 10, 65, 20, (Color){ 222, 181, 0, 255 }); else DrawText(TextFormat("SCORE: %i", score), 10, 65, 20, BLUE); diff --git a/src/Textures.h b/src/Gfx.h similarity index 78% rename from src/Textures.h rename to src/Gfx.h index bf925cc..70acdc1 100644 --- a/src/Textures.h +++ b/src/Gfx.h @@ -1,13 +1,13 @@ /* - Avoid ~ a game by Canneddonuts -- Filename ~ Textures.h +- Filename ~ Gfx.h - Author ~ Return0ne - 2022 - *no license* */ -#ifndef TEXTURES_HEADER -#define TEXTURES_HEADER +#ifndef GFX_HEADER +#define GFX_HEADER extern Texture2D background; extern Texture2D player_sprite; @@ -15,5 +15,6 @@ extern Texture2D feather_sprite; extern Texture2D enemy_sprite; extern Texture2D firework_sprite; extern Texture2D attack_sprite; +extern Font ZadoBold; #endif diff --git a/src/Main.c b/src/Main.c index 83110ac..2209cf9 100644 --- a/src/Main.c +++ b/src/Main.c @@ -33,6 +33,7 @@ Texture2D feather_sprite; Texture2D enemy_sprite; Texture2D firework_sprite; Texture2D attack_sprite; +Font ZadoBold; // Game functions static void gameSetup(void); @@ -72,6 +73,7 @@ void gameSetup(void) // asset loading & setting of variable values currentScreen = TITLE; background = LoadTexture("assets/gfx/background.png"); + ZadoBold = LoadFontEx("assets/fonts/ZadoBold.ttf", 96, 0, 110); SetMasterVolume(0.5); } @@ -218,5 +220,6 @@ static void unloadGame(void) default: break; } + UnloadFont(ZadoBold); UnloadTexture(background); } diff --git a/src/Options.c b/src/Options.c index 576b919..b9e47f7 100644 --- a/src/Options.c +++ b/src/Options.c @@ -9,7 +9,7 @@ #include "../include/raylib.h" #include "Screens.h" -#include "Textures.h" +#include "Gfx.h" #include "Controls.h" #include "Options.h" diff --git a/src/Title.c b/src/Title.c index 29eca53..326d0be 100644 --- a/src/Title.c +++ b/src/Title.c @@ -11,20 +11,20 @@ #include "Screens.h" #include "Controls.h" #include "Score.h" -#include "Textures.h" +#include "Gfx.h" int titleSelected = 0, finishfromTitleScreen = 0; void DrawScore(void) { if (bestscore >= 10000) - DrawText(TextFormat("BEST: %i", bestscore), 600, 0, 30, (Color){ 222, 181, 0, 255 }); + DrawTextEx(ZadoBold, TextFormat("BEST: %i", bestscore), (Vector2){ 580, 0 }, 30, 2, (Color){ 222, 181, 0, 255 }); else if (bestscore >= 5000) - DrawText(TextFormat("BEST: %i", bestscore), 600, 0, 30, (Color){ 149, 148, 147, 255 }); + DrawTextEx(ZadoBold, TextFormat("BEST: %i", bestscore), (Vector2){ 580, 0 }, 30, 2, (Color){ 149, 148, 147, 255 }); else if (bestscore >= 1000) - DrawText(TextFormat("BEST: %i", bestscore), 600, 0, 30, (Color){ 138, 72, 4, 255 }); + DrawTextEx(ZadoBold, TextFormat("BEST: %i", bestscore), (Vector2){ 580, 0 }, 30, 2, (Color){ 138, 72, 4, 255 }); else - DrawText(TextFormat("BEST: %i", bestscore), 600, 0, 30, BLUE); + DrawTextEx(ZadoBold, TextFormat("BEST: %i", bestscore), (Vector2){ 580, 0 }, 30, 2, BLUE); } @@ -48,25 +48,25 @@ void UpdateTitleScreen(void) void DrawTitleScreen(void) { DrawTexture(background, 0, 0, GRAY); - DrawText("Avoid", 330, 20, 50, BLUE); - DrawText("Controls", 10, 10, 30, BLUE); + DrawTextEx(ZadoBold, "Avoid", (Vector2){ 300, 0 }, 80, 5, BLUE); + // DrawText("Controls", 10, 10, 30, BLUE); DrawScore(); - DrawText("Press the arrow keys or 'DPAD' to move and 'X' to dash", 10, 40, 10, WHITE); + /* DrawText("Press the arrow keys or 'DPAD' to move and 'X' to dash", 10, 40, 10, WHITE); DrawText("Press 'ENTER' or 'START' to pause", 10, 60, 10, WHITE); DrawText("Press 'M' to mute", 10, 80, 10, WHITE); DrawText("Press 'Left-ALT' + 'F' for full screen", 10, 100, 10, WHITE); DrawText("Press 'R' to restart", 10, 120, 10, WHITE); DrawText("Press 'ENTER' or 'START' to select an option", 10, 140, 10, WHITE); - DrawText("Press 'X' or 'A' on a gamepad to shoot", 10, 160, 10, WHITE); + DrawText("Press 'X' or 'A' on a gamepad to shoot", 10, 160, 10, WHITE); */ // DrawText("Ver: 0.1", 680, 420, 30, WHITE); - if (titleSelected == 0) DrawText("PLAY", 360, 220, 20, WHITE); - else DrawText("PLAY", 360, 220, 20, BLUE); + if (titleSelected == 0) DrawTextEx(ZadoBold,"PLAY", (Vector2){ 360, 220 }, 30, 2, WHITE); + else DrawTextEx(ZadoBold,"PLAY", (Vector2){ 360, 220 }, 30, 2, BLUE); - if (titleSelected == -1) DrawText("CREDITS", 340, 240, 20, WHITE); - else DrawText("CREDITS", 340, 240, 20, BLUE); + if (titleSelected == -1) DrawTextEx(ZadoBold, "CREDITS", (Vector2){ 330, 250 }, 30, 2, WHITE); + else DrawTextEx(ZadoBold, "CREDITS", (Vector2){ 330, 250 }, 30, 2, BLUE); - if (titleSelected == -2) DrawText("OPTIONS", 340, 260, 20, WHITE); - else DrawText("OPTIONS", 340, 260, 20, BLUE); + if (titleSelected == -2) DrawTextEx(ZadoBold, "OPTIONS", (Vector2){ 330, 280 }, 30, 2, WHITE); + else DrawTextEx(ZadoBold, "OPTIONS", (Vector2){ 330, 280 }, 30, 2, BLUE); } void UnloadTitleScreen(void)