adding fonts

This commit is contained in:
Return0ne 2022-08-05 11:31:55 -04:00
parent 685004ff7d
commit afd288d573
9 changed files with 44 additions and 38 deletions

BIN
assets/fonts/ZadoBold.ttf Normal file

Binary file not shown.

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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);

View File

@ -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

View File

@ -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);
}

View File

@ -9,7 +9,7 @@
#include "../include/raylib.h"
#include "Screens.h"
#include "Textures.h"
#include "Gfx.h"
#include "Controls.h"
#include "Options.h"

View File

@ -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)