2022-06-12 17:49:42 +00:00
|
|
|
/*
|
|
|
|
- Avoid ~ a game by Canneddonuts
|
|
|
|
- Filename ~ Gameover.c
|
|
|
|
- Author ~ Return0ne
|
|
|
|
- 2022
|
|
|
|
- *no license*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "../include/raylib.h"
|
|
|
|
|
|
|
|
#include "Screens.h"
|
2022-08-07 20:24:55 +00:00
|
|
|
#include "Options.h"
|
2022-06-12 17:49:42 +00:00
|
|
|
#include "Controls.h"
|
2022-08-07 20:24:55 +00:00
|
|
|
#include "Music.h"
|
|
|
|
#include "Gfx.h"
|
2022-06-12 17:49:42 +00:00
|
|
|
|
2022-07-19 15:04:05 +00:00
|
|
|
int gameoverSelected = 0, finishfromGameoverScreen = 0;
|
2022-08-07 20:24:55 +00:00
|
|
|
Music Gameoversong = { 0 };
|
2022-06-12 17:49:42 +00:00
|
|
|
|
|
|
|
void InitGameoverScreen(void)
|
|
|
|
{
|
|
|
|
gameoverSelected = 0;
|
2022-07-19 15:04:05 +00:00
|
|
|
finishfromGameoverScreen = 0;
|
2022-08-07 20:24:55 +00:00
|
|
|
Gameoversong = LoadMusicStream("assets/bgm/02-Have-Hope.ogg");
|
|
|
|
PlayMusicStream(Gameoversong);
|
2022-06-12 17:49:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void UpdateGameoverScreen(void)
|
|
|
|
{
|
2022-08-07 20:24:55 +00:00
|
|
|
if (!mute) UpdateMusicStream(Gameoversong);
|
2022-06-12 17:49:42 +00:00
|
|
|
if (INPUT_UP_PRESSED) gameoverSelected++;
|
|
|
|
if (INPUT_DOWN_PRESSED) gameoverSelected--;
|
|
|
|
if (gameoverSelected > 0) gameoverSelected--;
|
|
|
|
if (gameoverSelected < -1) gameoverSelected++;
|
|
|
|
|
|
|
|
if ((gameoverSelected == 0) && (INPUT_OPTION_PRESSED))
|
2022-08-07 20:24:55 +00:00
|
|
|
{ StopMusicStream(Gameoversong); finishfromGameoverScreen = 2; }
|
2022-06-12 17:49:42 +00:00
|
|
|
|
|
|
|
if ((gameoverSelected == -1) && (INPUT_OPTION_PRESSED))
|
2022-08-07 20:24:55 +00:00
|
|
|
{ StopMusicStream(Gameoversong); finishfromGameoverScreen = 1; }
|
2022-06-12 17:49:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DrawGameoverScreen(void)
|
|
|
|
{
|
2022-06-17 02:17:26 +00:00
|
|
|
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLACK);
|
2022-08-31 19:15:32 +00:00
|
|
|
DrawText("GAME OVER", 170, 10, 80, RED);
|
|
|
|
if (gameoverSelected == 0) DrawTextEx(ZadoBold, "RETRY", (Vector2){ 340, 200 }, 40, 2, WHITE);
|
|
|
|
else DrawTextEx(ZadoBold, "RETRY", (Vector2){ 340, 200 }, 40, 2, RED);
|
2022-06-12 17:49:42 +00:00
|
|
|
|
2022-08-31 19:15:32 +00:00
|
|
|
if (gameoverSelected == -1) DrawTextEx(ZadoBold, "TITLE", (Vector2){ 345, 250 }, 40, 2, WHITE);
|
|
|
|
else DrawTextEx(ZadoBold, "TITLE", (Vector2){ 345, 250 }, 40, 2, RED);
|
2022-06-12 17:49:42 +00:00
|
|
|
}
|
2022-07-19 15:04:05 +00:00
|
|
|
|
|
|
|
int FinishGameoverScreen(void)
|
|
|
|
{
|
|
|
|
return finishfromGameoverScreen;
|
|
|
|
}
|
|
|
|
|
|
|
|
void UnloadGameoverScreen(void)
|
|
|
|
{
|
2022-08-07 20:24:55 +00:00
|
|
|
UnloadMusicStream(Gameoversong);
|
2022-07-19 15:04:05 +00:00
|
|
|
}
|