Add integer scale to RGUI.

This commit is contained in:
Themaister 2013-04-20 11:48:26 +02:00
parent ab377bf1ec
commit 7120e5842d
4 changed files with 33 additions and 5 deletions

View File

@ -117,6 +117,7 @@ typedef enum
RGUI_SETTINGS_VIDEO_RESOLUTION,
#endif
RGUI_SETTINGS_VIDEO_GAMMA,
RGUI_SETTINGS_VIDEO_INTEGER_SCALE,
RGUI_SETTINGS_VIDEO_ASPECT_RATIO,
RGUI_SETTINGS_CUSTOM_VIEWPORT,
RGUI_SETTINGS_CUSTOM_VIEWPORT_2,

View File

@ -493,6 +493,9 @@ static void render_text(rgui_handle_t *rgui)
case RGUI_SETTINGS_VIDEO_GAMMA:
snprintf(type_str, sizeof(type_str), "%d", g_extern.console.screen.gamma_correction);
break;
case RGUI_SETTINGS_VIDEO_INTEGER_SCALE:
strlcpy(type_str, g_settings.video.scale_integer ? "ON" : "OFF", sizeof(type_str));
break;
case RGUI_SETTINGS_VIDEO_ASPECT_RATIO:
strlcpy(type_str, aspectratio_lut[g_settings.video.aspect_ratio_idx].name, sizeof(type_str));
break;
@ -819,6 +822,17 @@ static int rgui_settings_toggle_setting(rgui_handle_t *rgui, unsigned setting, r
}
}
break;
case RGUI_SETTINGS_VIDEO_INTEGER_SCALE:
if (action == RGUI_ACTION_START)
settings_set(1ULL << S_DEF_SCALE_INTEGER);
else if (action == RGUI_ACTION_LEFT ||
action == RGUI_ACTION_RIGHT ||
action == RGUI_ACTION_OK)
settings_set(1ULL << S_SCALE_INTEGER_TOGGLE);
if (driver.video_poke->apply_state_changes)
driver.video_poke->apply_state_changes(driver.video_data);
break;
case RGUI_SETTINGS_VIDEO_ASPECT_RATIO:
if (action == RGUI_ACTION_START)
settings_set(1ULL << S_DEF_ASPECT_RATIO);
@ -1048,8 +1062,9 @@ static void rgui_settings_populate_entries(rgui_handle_t *rgui)
rgui_list_push(rgui->selection_buf, "Screen Resolution", RGUI_SETTINGS_VIDEO_RESOLUTION, 0);
rgui_list_push(rgui->selection_buf, "Gamma", RGUI_SETTINGS_VIDEO_GAMMA, 0);
#endif
rgui_list_push(rgui->selection_buf, "Aspect Ratio", RGUI_SETTINGS_VIDEO_ASPECT_RATIO, 0);
rgui_list_push(rgui->selection_buf, "Custom Ratio", RGUI_SETTINGS_CUSTOM_VIEWPORT, 0);
rgui_list_push(rgui->selection_buf, "Integer scale", RGUI_SETTINGS_VIDEO_INTEGER_SCALE, 0);
rgui_list_push(rgui->selection_buf, "Aspect ratio", RGUI_SETTINGS_VIDEO_ASPECT_RATIO, 0);
rgui_list_push(rgui->selection_buf, "Custom ratio", RGUI_SETTINGS_CUSTOM_VIEWPORT, 0);
rgui_list_push(rgui->selection_buf, "Rotation", RGUI_SETTINGS_VIDEO_ROTATION, 0);
rgui_list_push(rgui->selection_buf, "Mute Audio", RGUI_SETTINGS_AUDIO_MUTE, 0);
rgui_list_push(rgui->selection_buf, "Audio Control Rate", RGUI_SETTINGS_AUDIO_CONTROL_RATE, 0);

View File

@ -622,6 +622,7 @@ enum
{
S_ASPECT_RATIO_DECREMENT = 0,
S_ASPECT_RATIO_INCREMENT,
S_SCALE_INTEGER_TOGGLE,
S_AUDIO_MUTE,
S_AUDIO_CONTROL_RATE_DECREMENT,
S_AUDIO_CONTROL_RATE_INCREMENT,
@ -645,6 +646,7 @@ enum
S_INFO_DEBUG_MSG_TOGGLE,
S_INFO_MSG_TOGGLE,
S_DEF_ASPECT_RATIO,
S_DEF_SCALE_INTEGER,
S_DEF_AUDIO_MUTE,
S_DEF_AUDIO_CONTROL_RATE,
S_DEF_HW_TEXTURE_FILTER,

View File

@ -1242,16 +1242,19 @@ void settings_set(uint64_t settings)
{
if (settings & (1ULL << S_ASPECT_RATIO_DECREMENT))
{
if(g_settings.video.aspect_ratio_idx > 0)
if (g_settings.video.aspect_ratio_idx > 0)
g_settings.video.aspect_ratio_idx--;
}
if (settings & (1ULL << S_ASPECT_RATIO_INCREMENT))
{
if(g_settings.video.aspect_ratio_idx < LAST_ASPECT_RATIO)
if (g_settings.video.aspect_ratio_idx < LAST_ASPECT_RATIO)
g_settings.video.aspect_ratio_idx++;
}
if (settings & (1ULL << S_SCALE_INTEGER_TOGGLE))
g_settings.video.scale_integer = !g_settings.video.scale_integer;
if (settings & (1ULL << S_AUDIO_MUTE))
g_extern.audio_data.mute = !g_extern.audio_data.mute;
@ -1259,8 +1262,12 @@ void settings_set(uint64_t settings)
{
if (g_settings.audio.rate_control_delta > 0.0)
g_settings.audio.rate_control_delta -= 0.001;
if (g_settings.audio.rate_control_delta == 0.0)
if (g_settings.audio.rate_control_delta < 0.0005)
{
g_settings.audio.rate_control = false;
g_settings.audio.rate_control_delta = 0.0;
}
else
g_settings.audio.rate_control = true;
}
@ -1370,6 +1377,9 @@ void settings_set(uint64_t settings)
if (settings & (1ULL << S_DEF_ASPECT_RATIO))
g_settings.video.aspect_ratio_idx = aspect_ratio_idx;
if (settings & (1ULL << S_DEF_SCALE_INTEGER))
g_settings.video.scale_integer = scale_integer;
if (settings & (1ULL << S_DEF_AUDIO_MUTE))
g_extern.audio_data.mute = false;