- [NEW] En kiosk mode se fica en pantalla completa i no deixa canviar-ho - [FIX] Quan està en pantalla completa, F1 i F2 no cambien el zoom (quan isques estarà com estava abans d'entrar a fullscreen)
113 lines
2.9 KiB
C++
113 lines
2.9 KiB
C++
#include "config.h"
|
|
#include "jfile.h"
|
|
#include <SDL3/SDL.h>
|
|
#include "jdraw.h"
|
|
|
|
namespace config
|
|
{
|
|
bool musicEnabled = true;
|
|
int soundMode = SOUND_ALL;
|
|
uint8_t keys[7] = {SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_SPACE, SDL_SCANCODE_RETURN, SDL_SCANCODE_ESCAPE};
|
|
int8_t pad_btns[7] = {SDL_GAMEPAD_BUTTON_DPAD_UP, SDL_GAMEPAD_BUTTON_DPAD_DOWN, SDL_GAMEPAD_BUTTON_DPAD_LEFT, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, SDL_GAMEPAD_BUTTON_SOUTH, SDL_GAMEPAD_BUTTON_EAST, SDL_GAMEPAD_BUTTON_START};
|
|
bool prologo_desbloquejat = false;
|
|
bool kiosk_mode = false;
|
|
bool infinite_lives = false;
|
|
|
|
void setMusic(const bool value)
|
|
{
|
|
musicEnabled = value;
|
|
file::setConfigValue("music", musicEnabled ? "yes" : "no");
|
|
}
|
|
|
|
void toggleMusic()
|
|
{
|
|
musicEnabled = !musicEnabled;
|
|
file::setConfigValue("music", musicEnabled ? "yes" : "no");
|
|
}
|
|
|
|
const bool isMusicEnabled()
|
|
{
|
|
return musicEnabled;
|
|
}
|
|
|
|
void setSound(const int value)
|
|
{
|
|
soundMode = value;
|
|
file::setConfigValue("sound", soundMode==SOUND_ALL ? "all" : soundMode==SOUND_BASIC ? "basic" : "none");
|
|
}
|
|
|
|
void toggleSound()
|
|
{
|
|
soundMode++;
|
|
if (soundMode>SOUND_NONE) soundMode = SOUND_ALL;
|
|
file::setConfigValue("sound", soundMode==SOUND_ALL ? "all" : soundMode==SOUND_BASIC ? "basic" : "none");
|
|
}
|
|
|
|
const int getSoundMode()
|
|
{
|
|
return soundMode;
|
|
}
|
|
|
|
void defineKey(const int which, const int key)
|
|
{
|
|
static const char* nomtecles[7] = {"keyup", "keydown", "keyleft", "keyright", "keyjump", "keypick", "keymenu"};
|
|
keys[which] = key;
|
|
char tmp[5];
|
|
file::setConfigValue(nomtecles[which], SDL_itoa(key, tmp, 10));
|
|
}
|
|
|
|
const int getKey(const int which)
|
|
{
|
|
return keys[which];
|
|
}
|
|
|
|
void definePadBtn(const int which, const int btn)
|
|
{
|
|
static const char* nombotons[7] = {"btnup", "btndown", "btnleft", "btnright", "btnjump", "btnpick", "btnmenu"};
|
|
pad_btns[which] = btn;
|
|
char tmp[5];
|
|
file::setConfigValue(nombotons[which], SDL_itoa(btn, tmp, 10));
|
|
}
|
|
|
|
const int getPadBtn(const int which)
|
|
{
|
|
return pad_btns[which];
|
|
}
|
|
|
|
void setProgoloDesbloquejat()
|
|
{
|
|
prologo_desbloquejat = true;
|
|
file::setConfigValue("prologo", "unlocked");
|
|
}
|
|
|
|
const bool isProgoloDesbloquejat()
|
|
{
|
|
return prologo_desbloquejat;
|
|
}
|
|
|
|
void setKioskMode(const bool value)
|
|
{
|
|
kiosk_mode = value;
|
|
file::setConfigValue("kiosk", kiosk_mode ? "yes" : "no");
|
|
draw::reinit();
|
|
}
|
|
|
|
const bool getKioskMode()
|
|
{
|
|
return kiosk_mode;
|
|
}
|
|
|
|
void setInifiniteLives(const bool value)
|
|
{
|
|
infinite_lives= value;
|
|
file::setConfigValue("infinitelives", infinite_lives? "yes" : "no");
|
|
}
|
|
|
|
const bool getInfiniteLives()
|
|
{
|
|
return infinite_lives;
|
|
}
|
|
|
|
|
|
}
|