(RGUI) Add Overlay Scale option - when downscaling, doesn't seem to

update the hitboxes
This commit is contained in:
twinaphex 2013-05-17 23:37:48 +02:00
parent 21238048a3
commit 69e2bbd57e
4 changed files with 46 additions and 0 deletions

View File

@ -167,6 +167,7 @@ typedef enum
#ifdef HAVE_OVERLAY
RGUI_SETTINGS_OVERLAY_PRESET,
RGUI_SETTINGS_OVERLAY_OPACITY,
RGUI_SETTINGS_OVERLAY_SCALE,
#endif
RGUI_SETTINGS_BIND_PLAYER,
RGUI_SETTINGS_BIND_DEVICE,

View File

@ -657,6 +657,13 @@ static void render_text(rgui_handle_t *rgui)
strlcpy(type_str, number, sizeof(type_str));
}
break;
case RGUI_SETTINGS_OVERLAY_SCALE:
{
char number[10];
snprintf(number, sizeof(number), "%.3f", g_settings.input.overlay_scale);
strlcpy(type_str, number, sizeof(type_str));
}
break;
#endif
case RGUI_SETTINGS_BIND_PLAYER:
{
@ -1052,6 +1059,40 @@ static int rgui_settings_toggle_setting(rgui_handle_t *rgui, unsigned setting, r
g_settings.input.overlay_opacity);
}
break;
case RGUI_SETTINGS_OVERLAY_SCALE:
{
bool changed = false;
switch (action)
{
case RGUI_ACTION_LEFT:
if (g_settings.input.overlay_scale > 0.0f)
{
g_settings.input.overlay_scale -= 0.01f;
changed = true;
}
break;
case RGUI_ACTION_RIGHT:
case RGUI_ACTION_OK:
if (g_settings.input.overlay_scale < 2.0f)
{
g_settings.input.overlay_scale += 0.01f;
changed = true;
}
break;
case RGUI_ACTION_START:
g_settings.input.overlay_scale = 1.0f;
changed = true;
break;
default:
break;
}
if (changed && driver.overlay)
input_overlay_set_scale_factor(driver.overlay,
g_settings.input.overlay_scale);
}
break;
#endif
// controllers
case RGUI_SETTINGS_BIND_PLAYER:
@ -1801,6 +1842,7 @@ static void rgui_settings_controller_populate_entries(rgui_handle_t *rgui)
#ifdef HAVE_OVERLAY
rgui_list_push(rgui->selection_buf, "Overlay Preset", RGUI_SETTINGS_OVERLAY_PRESET, 0);
rgui_list_push(rgui->selection_buf, "Overlay Opacity", RGUI_SETTINGS_OVERLAY_OPACITY, 0);
rgui_list_push(rgui->selection_buf, "Overlay Scale", RGUI_SETTINGS_OVERLAY_SCALE, 0);
#endif
rgui_list_push(rgui->selection_buf, "Player", RGUI_SETTINGS_BIND_PLAYER, 0);
rgui_list_push(rgui->selection_buf, "Device", RGUI_SETTINGS_BIND_DEVICE, 0);

View File

@ -238,6 +238,7 @@ struct settings
char overlay[PATH_MAX];
float overlay_opacity;
float overlay_scale;
char autoconfig_dir[PATH_MAX];
} input;

View File

@ -243,6 +243,7 @@ void config_set_defaults(void)
g_settings.input.turbo_period = turbo_period;
g_settings.input.turbo_duty_cycle = turbo_duty_cycle;
g_settings.input.overlay_opacity = 1.0f;
g_settings.input.overlay_scale = 1.0f;
g_settings.input.debug_enable = input_debug_enable;
g_settings.input.autodetect_enable = input_autodetect_enable;
#ifdef ANDROID
@ -656,6 +657,7 @@ bool config_load_file(const char *path)
CONFIG_GET_PATH(input.overlay, "input_overlay");
CONFIG_GET_FLOAT(input.overlay_opacity, "input_overlay_opacity");
CONFIG_GET_FLOAT(input.overlay_scale, "input_overlay_scale");
CONFIG_GET_BOOL(input.debug_enable, "input_debug_enable");
CONFIG_GET_BOOL(input.autodetect_enable, "input_autodetect_enable");