#include "m_menu_audio.h" #include "jgame.h" #include "jinput.h" #include "jdraw.h" #include #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, TEAL, 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, GREEN, FONT_ZOOM_NONE); draw::print2(musica_msg, 18, pos, GREEN, 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, GREEN, FONT_ZOOM_NONE); draw::print2(so_msg, 18, pos, GREEN, 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, GREEN, FONT_ZOOM_NONE); } draw::print2("(C) JAILDOCTOR 2024", 11, 28, TEAL, FONT_ZOOM_NONE); draw::render(); return MENU_AUDIO_NONE; } } }