- [NEW] Habitació de prova de parts
- [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
This commit is contained in:
55
source/config.cpp
Normal file
55
source/config.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "config.h"
|
||||
#include "jfile.h"
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
namespace config
|
||||
{
|
||||
bool musicEnabled = true;
|
||||
int soundMode = SOUND_ALL;
|
||||
uint8_t keys[6] = {SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_SPACE, SDL_SCANCODE_RETURN};
|
||||
|
||||
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)
|
||||
{
|
||||
keys[which] = key;
|
||||
}
|
||||
|
||||
const int getKey(const int which)
|
||||
{
|
||||
return keys[which];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user