mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 06:32:48 +00:00
Comment this out for now - initial implementation of dropdown list
for float
This commit is contained in:
parent
007e8dbd20
commit
384b36ac4c
@ -1646,6 +1646,7 @@ static int menu_cbs_init_bind_get_string_representation_compare_type(
|
||||
break;
|
||||
case MENU_SETTING_DROPDOWN_SETTING_INT_ITEM:
|
||||
case MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM:
|
||||
case MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM:
|
||||
case MENU_SETTING_DROPDOWN_ITEM:
|
||||
case MENU_SETTING_NO_ITEM:
|
||||
BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_no_items);
|
||||
|
@ -4328,6 +4328,20 @@ static int action_ok_push_dropdown_setting_int_item(const char *path,
|
||||
return action_cancel_pop_default(NULL, NULL, 0, 0);
|
||||
}
|
||||
|
||||
static int action_ok_push_dropdown_setting_float_item(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
enum msg_hash_enums enum_idx = (enum msg_hash_enums)atoi(label);
|
||||
rarch_setting_t *setting = menu_setting_find_enum(enum_idx);
|
||||
float val = (float)atof(path);
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
||||
*setting->value.target.fraction = (float)val;
|
||||
return action_cancel_pop_default(NULL, NULL, 0, 0);
|
||||
}
|
||||
|
||||
static int action_ok_push_dropdown_setting_uint_item(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -5420,6 +5434,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
|
||||
case MENU_SETTING_DROPDOWN_SETTING_INT_ITEM:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_dropdown_setting_int_item);
|
||||
break;
|
||||
case MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_dropdown_setting_float_item);
|
||||
break;
|
||||
case MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_dropdown_setting_uint_item);
|
||||
break;
|
||||
|
@ -7824,6 +7824,53 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ST_FLOAT:
|
||||
{
|
||||
float i;
|
||||
float orig_value = *setting->value.target.fraction;
|
||||
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM;
|
||||
float step = setting->step;
|
||||
double min = setting->enforce_minrange ? setting->min : 0.00;
|
||||
double max = setting->enforce_maxrange ? setting->max : 999.00;
|
||||
|
||||
if (setting->get_string_representation)
|
||||
{
|
||||
for (i = min; i <= max; i += step)
|
||||
{
|
||||
char val_s[256], val_d[256];
|
||||
|
||||
*setting->value.target.fraction = i;
|
||||
|
||||
setting->get_string_representation(setting,
|
||||
val_s, sizeof(val_s));
|
||||
snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx);
|
||||
menu_entries_append_enum(info->list,
|
||||
val_s,
|
||||
val_d,
|
||||
MENU_ENUM_LABEL_NO_ITEMS,
|
||||
setting_type, 0, 0);
|
||||
}
|
||||
|
||||
*setting->value.target.fraction = orig_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = min; i <= max; i += step)
|
||||
{
|
||||
char val_s[16], val_d[16];
|
||||
|
||||
snprintf(val_s, sizeof(val_s), "%.2f", i);
|
||||
snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx);
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
val_s,
|
||||
val_d,
|
||||
MENU_ENUM_LABEL_NO_ITEMS,
|
||||
setting_type, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ST_UINT:
|
||||
{
|
||||
float i;
|
||||
|
@ -150,6 +150,7 @@ enum menu_settings_type
|
||||
MENU_SETTING_DROPDOWN_ITEM,
|
||||
MENU_SETTING_DROPDOWN_SETTING_CORE_OPTIONS_ITEM,
|
||||
MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM,
|
||||
MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM,
|
||||
MENU_SETTING_DROPDOWN_SETTING_INT_ITEM,
|
||||
MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM,
|
||||
MENU_SETTING_NO_ITEM,
|
||||
|
@ -6309,6 +6309,9 @@ static bool setting_append_list(
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
#if 0
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
|
||||
#endif
|
||||
(*list)[list_info->index - 1].get_string_representation =
|
||||
&setting_get_string_representation_float_video_msg_color;
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 1, 1.0f/255.0f, true, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user