Avoid/src/Options.c

69 lines
1.7 KiB
C
Raw Normal View History

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);
DrawText("OPTIONS", 300, 20, 50, BLUE);
if (optionsSelected == 0) DrawText("Back", 20, 200, 20, WHITE);
else DrawText("Back", 20, 200, 20, BLUE);
if (optionsSelected == -1) {
DrawText("Mute", 20, 220, 20, WHITE);
DrawText(TextFormat("<%i>", mute), 200, 220, 20, WHITE);
}
else {
DrawText("Mute", 20, 220, 20, BLUE);
DrawText(TextFormat("<%i>", mute), 200, 220, 20, BLUE);
}
if (optionsSelected == -2) {
DrawText("Fullscreen", 20, 240, 20, WHITE);
DrawText(TextFormat("<%i>", fullscreen), 200, 240, 20, WHITE);
}
else {
DrawText("Fullscreen", 20, 240, 20, BLUE);
DrawText(TextFormat("<%i>", fullscreen), 200, 240, 20, BLUE);
}
}
void UnloadOptionsScreen(void)
{
}
int FinishOptionsScreen(void)
{
return finishfromOptionsScreen;
}