Skip to content

Instantly share code, notes, and snippets.

@Shadowblitz16
Last active August 17, 2022 23:00
Show Gist options
  • Save Shadowblitz16/51088ea42803da2ffae601ae10a0225c to your computer and use it in GitHub Desktop.
Save Shadowblitz16/51088ea42803da2ffae601ae10a0225c to your computer and use it in GitHub Desktop.
ImGui RatioButton
bool RadioButton(const char* text, int* activeItem, int thisItem)
{
if (activeItem != nullptr && *activeItem == thisItem)
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyle().Colors[ImGuiCol_ButtonActive]);
bool value = ImGui::Button(text);
if (activeItem != nullptr && *activeItem == thisItem)
ImGui::PopStyleColor();
if (value && activeItem != nullptr)
*activeItem = thisItem;
return value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment