AUDIO: Implement integer and checkbox options
I remove "text" as a possibility for the moment as we're currently not having **any** text option.
This commit is contained in:
parent
139ef22408
commit
99033e297c
|
@ -14,8 +14,8 @@ void UpdateBuff(u8* pos);
|
||||||
typedef std::vector<std::string> (*audio_option_callback_t)();
|
typedef std::vector<std::string> (*audio_option_callback_t)();
|
||||||
enum audio_option_type
|
enum audio_option_type
|
||||||
{
|
{
|
||||||
text = 0
|
integer = 0
|
||||||
, integer = 1
|
, checkbox = 1
|
||||||
, list = 2
|
, list = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1099,7 +1099,20 @@ static void gui_display_settings()
|
||||||
}
|
}
|
||||||
value = (*cfg_entries)[options->cfg_name];
|
value = (*cfg_entries)[options->cfg_name];
|
||||||
|
|
||||||
if (options->type == list)
|
if (options->type == integer)
|
||||||
|
{
|
||||||
|
int val = stoi(value);
|
||||||
|
ImGui::SliderInt(options->caption.c_str(), &val, options->min_value, options->max_value);
|
||||||
|
(*cfg_entries)[options->cfg_name] = to_string(val);
|
||||||
|
}
|
||||||
|
else if (options->type == checkbox)
|
||||||
|
{
|
||||||
|
bool check = (value == "1");
|
||||||
|
ImGui::Checkbox(options->caption.c_str(), &check);
|
||||||
|
std::string cur = check ? "1" : "0";
|
||||||
|
(*cfg_entries)[options->cfg_name] = cur;
|
||||||
|
}
|
||||||
|
else if (options->type == list)
|
||||||
{
|
{
|
||||||
if (ImGui::BeginCombo(options->caption.c_str(), value.c_str(), ImGuiComboFlags_None))
|
if (ImGui::BeginCombo(options->caption.c_str(), value.c_str(), ImGuiComboFlags_None))
|
||||||
{
|
{
|
||||||
|
@ -1120,6 +1133,9 @@ static void gui_display_settings()
|
||||||
ImGui::EndCombo();
|
ImGui::EndCombo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
printf("Unknown option\n");
|
||||||
|
}
|
||||||
|
|
||||||
options++;
|
options++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue