void SDLSetScreenVsyncMode(char *vsync_mode)
{
- int interval =
- (strEqual(vsync_mode, STR_VSYNC_MODE_NORMAL) ? VSYNC_MODE_NORMAL :
- strEqual(vsync_mode, STR_VSYNC_MODE_ADAPTIVE) ? VSYNC_MODE_ADAPTIVE :
- VSYNC_MODE_OFF);
+ int interval = VSYNC_MODE_STR_TO_INT(vsync_mode);
int result = SDL_GL_SetSwapInterval(interval);
// if adaptive vsync requested, but not supported, retry with normal vsync
#define VSYNC_MODE_DEFAULT VSYNC_MODE_OFF
+#define VSYNC_MODE_STR_TO_INT(s) \
+ (strEqual((s), STR_VSYNC_MODE_NORMAL) ? VSYNC_MODE_NORMAL : \
+ strEqual((s), STR_VSYNC_MODE_ADAPTIVE) ? VSYNC_MODE_ADAPTIVE : \
+ VSYNC_MODE_OFF)
+
+#define VSYNC_MODE_INT_TO_STR(i) \
+ ((i) == VSYNC_MODE_NORMAL ? STR_VSYNC_MODE_NORMAL : \
+ (i) == VSYNC_MODE_ADAPTIVE ? STR_VSYNC_MODE_ADAPTIVE : \
+ STR_VSYNC_MODE_OFF)
+
// values for network server settings
#define STR_NETWORK_AUTO_DETECT "auto_detect_network_server"
#define STR_NETWORK_AUTO_DETECT_SETUP "(auto detect network server)"