FIX: EnhancementCombobox
It was returning the wrong value and could mess array sizes.
This commit is contained in:
parent
c08439a562
commit
6c34c03cdf
|
@ -99,7 +99,7 @@ namespace SohImGui {
|
||||||
"gCCMinimapPrim","gCCRupeePrim","gCCKeysPrim"
|
"gCCMinimapPrim","gCCRupeePrim","gCCKeysPrim"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* filters[3] = {
|
std::vector<std::string> filters = {
|
||||||
"Three-Point",
|
"Three-Point",
|
||||||
"Linear",
|
"Linear",
|
||||||
"None"
|
"None"
|
||||||
|
@ -438,19 +438,20 @@ namespace SohImGui {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EnhancementCombobox(const char* name, const char* ComboArray[], uint8_t FirstTimeValue = 0){
|
void EnhancementCombobox(const char* name, std::vector<std::string> ComboArray, uint8_t FirstTimeValue = 0) {
|
||||||
if (FirstTimeValue <= 0){
|
if (FirstTimeValue <= 0) {
|
||||||
FirstTimeValue = 0;
|
FirstTimeValue = 0;
|
||||||
}
|
}
|
||||||
uint8_t selected=CVar_GetS32(name, FirstTimeValue);
|
uint8_t selected = CVar_GetS32(name, FirstTimeValue);
|
||||||
uint8_t DefaultValue=selected;
|
uint8_t DefaultValue = selected;
|
||||||
if (ImGui::BeginCombo("##name", ComboArray[DefaultValue])) {
|
std::string comboName = std::string("##") + std::string(name);
|
||||||
uint8_t ComboxSize = sizeof(&ComboArray);
|
if (ImGui::BeginCombo(comboName.c_str(), ComboArray[DefaultValue].c_str())) {
|
||||||
for (uint8_t i = 0; i <= ComboxSize; i++) {
|
uint8_t ComboxSize = ComboArray.size();
|
||||||
if (strlen(ComboArray[i]) > 1) {
|
for (uint8_t i = 0; i < ComboxSize; i++) {
|
||||||
if (ImGui::Selectable(ComboArray[i], i==selected)) {
|
if (strlen(ComboArray[i].c_str()) > 1) {
|
||||||
|
if (ImGui::Selectable(ComboArray[i].c_str(), i == selected)) {
|
||||||
CVar_SetS32(name, i);
|
CVar_SetS32(name, i);
|
||||||
selected=i;
|
selected = i;
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace SohImGui {
|
||||||
void EnhancementButton(const char* text, const char* cvarName);
|
void EnhancementButton(const char* text, const char* cvarName);
|
||||||
void EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format);
|
void EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format);
|
||||||
void EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage);
|
void EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage);
|
||||||
void EnhancementCombobox(const char* name, const char* ComboArray[], uint8_t FirstTimeValue);
|
void EnhancementCombobox(const char* name, std::vector<std::string> ComboArray, uint8_t FirstTimeValue);
|
||||||
void EnhancementColor(const char* text, const char* cvarName, ImVec4 ColorRGBA, ImVec4 default_colors, bool allow_rainbow = true, bool has_alpha=false, bool TitleSameLine=false);
|
void EnhancementColor(const char* text, const char* cvarName, ImVec4 ColorRGBA, ImVec4 default_colors, bool allow_rainbow = true, bool has_alpha=false, bool TitleSameLine=false);
|
||||||
|
|
||||||
void DrawMainMenuAndCalculateGameSize(void);
|
void DrawMainMenuAndCalculateGameSize(void);
|
||||||
|
|
Loading…
Reference in New Issue