2022-07-19 15:04:05 +00:00
|
|
|
/*
|
|
|
|
- Avoid ~ a game by Canneddonuts
|
|
|
|
- Filename ~ Options.c
|
|
|
|
- Author ~ Return0ne
|
|
|
|
- 2022
|
|
|
|
- *no license*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "../include/raylib.h"
|
|
|
|
|
|
|
|
#include "Screens.h"
|
2022-08-05 15:31:55 +00:00
|
|
|
#include "Gfx.h"
|
2022-07-19 15:04:05 +00:00
|
|
|
#include "Controls.h"
|
|
|
|
#include "Options.h"
|
|
|
|
|
2022-07-19 15:29:08 +00:00
|
|
|
int optionsSelected = 0, finishfromOptionsScreen = 0, mute = 0, fullscreen = 0;
|
2022-07-19 15:04:05 +00:00
|
|
|
|
|
|
|
void InitOptionsScreen(void)
|
|
|
|
{
|
|
|
|
finishfromOptionsScreen = 0;
|
|
|
|
optionsSelected = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void UpdateOptionsScreen(void)
|
|
|
|
{
|
|
|
|
if (INPUT_UP_PRESSED) optionsSelected++;
|
|
|
|
if (INPUT_DOWN_PRESSED) optionsSelected--;
|
|
|
|
if (optionsSelected > 0) optionsSelected--;
|
|
|
|
if (optionsSelected < -2) optionsSelected++;
|
|
|
|
|
|
|
|
if ((optionsSelected == 0) && (INPUT_OPTION_PRESSED)) finishfromOptionsScreen = 1;
|
|
|
|
if ((optionsSelected == -1) && (INPUT_OPTION_PRESSED)) mute = !mute;
|
|
|
|
if ((optionsSelected == -2) && (INPUT_OPTION_PRESSED)) { ToggleFullscreen(); fullscreen = !fullscreen; }
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawOptionsScreen(void)
|
|
|
|
{
|
|
|
|
DrawTexture(background, 0, 0, DARKGRAY);
|
2022-08-07 20:24:55 +00:00
|
|
|
DrawTextEx(ZadoBold, "OPTIONS", (Vector2){ 300, 20 }, 50, 2, BLUE);
|
|
|
|
if (optionsSelected == 0) DrawTextEx(ZadoBold, "Back", (Vector2){ 20, 170 }, 40, 2, WHITE);
|
|
|
|
else DrawTextEx(ZadoBold, "Back", (Vector2){ 20, 170 }, 40, 2, BLUE);
|
2022-07-19 15:04:05 +00:00
|
|
|
if (optionsSelected == -1) {
|
2022-08-07 20:24:55 +00:00
|
|
|
DrawTextEx(ZadoBold, "Mute", (Vector2) { 20, 220 }, 40, 2, WHITE);
|
|
|
|
DrawTextEx(ZadoBold, TextFormat("<%i>", mute), (Vector2){ 250, 220 }, 40, 2, WHITE);
|
2022-07-19 15:04:05 +00:00
|
|
|
}
|
|
|
|
else {
|
2022-08-07 20:24:55 +00:00
|
|
|
DrawTextEx(ZadoBold, "Mute", (Vector2) { 20, 220 }, 40, 2, BLUE);
|
|
|
|
DrawTextEx(ZadoBold, TextFormat("<%i>", mute), (Vector2){ 250, 220 }, 40, 2, BLUE);
|
2022-07-19 15:04:05 +00:00
|
|
|
}
|
|
|
|
if (optionsSelected == -2) {
|
2022-08-07 20:24:55 +00:00
|
|
|
DrawTextEx(ZadoBold, "Fullscreen", (Vector2){ 20, 270 }, 40, 2, WHITE);
|
|
|
|
DrawTextEx(ZadoBold, TextFormat("<%i>", fullscreen), (Vector2){ 250, 270 }, 40, 2, WHITE);
|
2022-07-19 15:04:05 +00:00
|
|
|
}
|
|
|
|
else {
|
2022-08-07 20:24:55 +00:00
|
|
|
DrawTextEx(ZadoBold, "Fullscreen", (Vector2){ 20, 270 }, 40, 2, BLUE);
|
|
|
|
DrawTextEx(ZadoBold, TextFormat("<%i>", fullscreen), (Vector2){ 250, 270 }, 40, 2, BLUE);
|
2022-07-19 15:04:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void UnloadOptionsScreen(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int FinishOptionsScreen(void)
|
|
|
|
{
|
|
|
|
return finishfromOptionsScreen;
|
|
|
|
}
|