- [NEW] Templates de les parts - [NEW] Mòdul de debug - [NEW] Debug info de la posicio dels actors - [FIX] Al reiniciar partida el heroi estava en posició incorrecta - [NEW] Mòdul de config - [NEW] El joc ja permet canviar zoom i ficar fullscreen - [NEW] F1, F2 i F3 per a zoom i fullscreen - [NEW] Ja es guarda en arxiu de config el zoom, fullscreen, musica i só. - [FIX] Al eixir prematurament del logo de vegades la paleta estava loca - [NEW] Menú de configuració del àudio - [NEW] Menú de pausa dins del joc (es veu peces que falten per arreplegar) - [ONGOING] Comença l'implementació de tecles redefinides
81 lines
2.9 KiB
C++
81 lines
2.9 KiB
C++
#include "m_menu_audio.h"
|
|
#include "jgame.h"
|
|
#include "jinput.h"
|
|
#include "jdraw.h"
|
|
#include <SDL2/SDL.h>
|
|
#include "config.h"
|
|
|
|
namespace modules
|
|
{
|
|
namespace menu_audio
|
|
{
|
|
int selected_option = MENU_AUDIO_MUSICA;
|
|
|
|
void init()
|
|
{
|
|
selected_option = MENU_AUDIO_MUSICA;
|
|
}
|
|
|
|
int loop()
|
|
{
|
|
if (input::keyPressed(SDL_SCANCODE_ESCAPE)) {
|
|
return MENU_AUDIO_TORNAR;
|
|
}
|
|
if (input::keyPressed(SDL_SCANCODE_DOWN) || input::keyPressed(config::getKey(KEY_DOWN)))
|
|
selected_option = (selected_option==2)?0:selected_option+1;
|
|
|
|
if (input::keyPressed(SDL_SCANCODE_UP) || input::keyPressed(config::getKey(KEY_UP)))
|
|
selected_option = (selected_option==0)?2:selected_option-1;
|
|
|
|
if (input::keyPressed(SDL_SCANCODE_SPACE) || input::keyPressed(SDL_SCANCODE_RETURN) ||
|
|
input::keyPressed(config::getKey(KEY_JUMP)) || input::keyPressed(config::getKey(KEY_PICK))) {
|
|
if (selected_option==MENU_AUDIO_MUSICA) config::toggleMusic();
|
|
if (selected_option==MENU_AUDIO_SO) config::toggleSound();
|
|
if (selected_option==MENU_AUDIO_TORNAR) return MENU_AUDIO_TORNAR;
|
|
}
|
|
|
|
draw::cls(2);
|
|
draw::color(1);
|
|
|
|
draw::print2("CONFIGURAR AUDIO", 13, 3, YELLOW, FONT_ZOOM_VERTICAL);
|
|
|
|
const char *musica_msg = config::isMusicEnabled() ? "MUSICA: SI" : "MUSICA: NO";
|
|
const int soundmode=config::getSoundMode();
|
|
const char *so_msg = soundmode==SOUND_ALL? "SO: TOT" : soundmode==SOUND_BASIC?"SO: BASIC" : "SO: SILENCI";
|
|
|
|
int pos = 14;
|
|
|
|
if (selected_option==MENU_AUDIO_MUSICA) {
|
|
draw::print2("fg", 13, pos, YELLOW, FONT_ZOOM_VERTICAL);
|
|
draw::print2(musica_msg, 18, pos, YELLOW, FONT_ZOOM_VERTICAL);
|
|
pos+=3;
|
|
} else {
|
|
draw::print2("de", 13, pos, TEAL, FONT_ZOOM_NONE);
|
|
draw::print2(musica_msg, 18, pos, TEAL, FONT_ZOOM_NONE);
|
|
pos+=2;
|
|
}
|
|
|
|
if (selected_option==MENU_AUDIO_SO) {
|
|
draw::print2("fg", 13, pos, YELLOW, FONT_ZOOM_VERTICAL);
|
|
draw::print2(so_msg, 18, pos, YELLOW, FONT_ZOOM_VERTICAL);
|
|
pos+=3;
|
|
} else {
|
|
draw::print2("de", 13, pos, TEAL, FONT_ZOOM_NONE);
|
|
draw::print2(so_msg, 18, pos, TEAL, FONT_ZOOM_NONE);
|
|
pos+=2;
|
|
}
|
|
|
|
if (selected_option==MENU_AUDIO_TORNAR) {
|
|
draw::print2("fg TORNAR", 13, pos, YELLOW, FONT_ZOOM_VERTICAL);
|
|
} else {
|
|
draw::print2("de TORNAR", 13, pos, TEAL, FONT_ZOOM_NONE);
|
|
}
|
|
|
|
draw::print2("(C) JAILDOCTOR 2024", 11, 28, TEAL, FONT_ZOOM_NONE);
|
|
|
|
draw::render();
|
|
return MENU_AUDIO_NONE;
|
|
}
|
|
}
|
|
}
|