Added vsync and directionalAudio settings to app. Default to on and off, respectively.
This commit is contained in:
parent
7c6a881dff
commit
34d021fa43
|
@ -492,6 +492,8 @@ typedef struct {
|
||||||
int fullscreen;
|
int fullscreen;
|
||||||
int musicVolume;
|
int musicVolume;
|
||||||
int soundVolume;
|
int soundVolume;
|
||||||
|
int vSync;
|
||||||
|
int directionalAudio;
|
||||||
int doTrophyAlerts;
|
int doTrophyAlerts;
|
||||||
int hideMouse;
|
int hideMouse;
|
||||||
Gameplay gameplay;
|
Gameplay gameplay;
|
||||||
|
|
|
@ -62,11 +62,16 @@ void initSDL(void)
|
||||||
/* done in src/plat/ */
|
/* done in src/plat/ */
|
||||||
createSaveFolder();
|
createSaveFolder();
|
||||||
|
|
||||||
rendererFlags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC;
|
|
||||||
windowFlags = 0;
|
|
||||||
|
|
||||||
loadConfig();
|
loadConfig();
|
||||||
|
|
||||||
|
rendererFlags = SDL_RENDERER_ACCELERATED;
|
||||||
|
if (app.vSync)
|
||||||
|
{
|
||||||
|
rendererFlags |= SDL_RENDERER_PRESENTVSYNC;
|
||||||
|
}
|
||||||
|
|
||||||
|
windowFlags = 0;
|
||||||
|
|
||||||
if (app.fullscreen)
|
if (app.fullscreen)
|
||||||
{
|
{
|
||||||
windowFlags |= SDL_WINDOW_FULLSCREEN;
|
windowFlags |= SDL_WINDOW_FULLSCREEN;
|
||||||
|
@ -236,6 +241,8 @@ static void loadConfigFile(char *filename)
|
||||||
app.fullscreen = cJSON_GetObjectItem(root, "fullscreen")->valueint;
|
app.fullscreen = cJSON_GetObjectItem(root, "fullscreen")->valueint;
|
||||||
app.musicVolume = cJSON_GetObjectItem(root, "musicVolume")->valueint;
|
app.musicVolume = cJSON_GetObjectItem(root, "musicVolume")->valueint;
|
||||||
app.soundVolume = cJSON_GetObjectItem(root, "soundVolume")->valueint;
|
app.soundVolume = cJSON_GetObjectItem(root, "soundVolume")->valueint;
|
||||||
|
app.vSync = getJSONValue(root, "vSync", 1);
|
||||||
|
app.directionalAudio = getJSONValue(root, "directionalAudio", 0);
|
||||||
|
|
||||||
controlsJSON = cJSON_GetObjectItem(root, "controls");
|
controlsJSON = cJSON_GetObjectItem(root, "controls");
|
||||||
if (controlsJSON)
|
if (controlsJSON)
|
||||||
|
@ -290,6 +297,8 @@ void saveConfig(void)
|
||||||
cJSON_AddNumberToObject(root, "fullscreen", app.fullscreen);
|
cJSON_AddNumberToObject(root, "fullscreen", app.fullscreen);
|
||||||
cJSON_AddNumberToObject(root, "musicVolume", app.musicVolume);
|
cJSON_AddNumberToObject(root, "musicVolume", app.musicVolume);
|
||||||
cJSON_AddNumberToObject(root, "soundVolume", app.soundVolume);
|
cJSON_AddNumberToObject(root, "soundVolume", app.soundVolume);
|
||||||
|
cJSON_AddNumberToObject(root, "vSync", app.vSync);
|
||||||
|
cJSON_AddNumberToObject(root, "directionalAudio", app.directionalAudio);
|
||||||
|
|
||||||
keysJSON = cJSON_CreateObject();
|
keysJSON = cJSON_CreateObject();
|
||||||
for (i = 0 ; i < CONTROL_MAX ; i++)
|
for (i = 0 ; i < CONTROL_MAX ; i++)
|
||||||
|
|
|
@ -72,6 +72,7 @@ extern long lookup(char *name);
|
||||||
extern void initStars(void);
|
extern void initStars(void);
|
||||||
extern void initTrophies(void);
|
extern void initTrophies(void);
|
||||||
extern void destroyCredits(void);
|
extern void destroyCredits(void);
|
||||||
|
extern int getJSONValue(cJSON *node, char *name, int defValue);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Colors colors;
|
extern Colors colors;
|
||||||
|
|
Loading…
Reference in New Issue