mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-23 08:38:52 -05:00
Merge pull request #387 from Baoulettes/ComboBox-Simplification
Combo box simplification
This commit is contained in:
commit
c92524a90e
@ -437,6 +437,28 @@ namespace SohImGui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EnhancementCombobox(const char* name, const char* ComboArray[], uint8_t FirstTimeValue = 0){
|
||||||
|
if (FirstTimeValue <= 0){
|
||||||
|
FirstTimeValue = 0;
|
||||||
|
}
|
||||||
|
uint8_t selected=CVar_GetS32(name, FirstTimeValue);
|
||||||
|
uint8_t DefaultValue=selected;
|
||||||
|
if (ImGui::BeginCombo("##name", ComboArray[DefaultValue])) {
|
||||||
|
uint8_t ComboxSize = sizeof(&ComboArray);
|
||||||
|
for (uint8_t i = 0; i <= ComboxSize; i++) {
|
||||||
|
if (strlen(ComboArray[i]) > 1) {
|
||||||
|
if (ImGui::Selectable(ComboArray[i], i==selected)) {
|
||||||
|
CVar_SetS32(name, i);
|
||||||
|
selected=i;
|
||||||
|
needs_save = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EnhancementRadioButton(const char* text, const char* cvarName, int id) {
|
void EnhancementRadioButton(const char* text, const char* cvarName, int id) {
|
||||||
/*Usage :
|
/*Usage :
|
||||||
EnhancementRadioButton("My Visible Name","gMyCVarName", MyID);
|
EnhancementRadioButton("My Visible Name","gMyCVarName", MyID);
|
||||||
@ -808,20 +830,9 @@ namespace SohImGui {
|
|||||||
|
|
||||||
EXPERIMENTAL();
|
EXPERIMENTAL();
|
||||||
ImGui::Text("Texture Filter (Needs reload)");
|
ImGui::Text("Texture Filter (Needs reload)");
|
||||||
|
EnhancementCombobox("gTextureFilter", filters);
|
||||||
GfxRenderingAPI* gapi = gfx_get_current_rendering_api();
|
GfxRenderingAPI* gapi = gfx_get_current_rendering_api();
|
||||||
if (ImGui::BeginCombo("##filters", filters[gapi->get_texture_filter()])) {
|
gapi->set_texture_filter((FilteringMode)CVar_GetS32("gTextureFilter", 0));
|
||||||
for (int fId = 0; fId <= FilteringMode::NONE; fId++) {
|
|
||||||
if (ImGui::Selectable(filters[fId], fId == gapi->get_texture_filter())) {
|
|
||||||
INFO("New Filter: %s", filters[fId]);
|
|
||||||
gapi->set_texture_filter((FilteringMode)fId);
|
|
||||||
|
|
||||||
CVar_SetS32("gTextureFilter", (int)fId);
|
|
||||||
needs_save = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
ImGui::EndCombo();
|
|
||||||
}
|
|
||||||
overlay->DrawSettings();
|
overlay->DrawSettings();
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
@ -70,6 +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 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
Block a user