diff --git a/public/raid/imraid.hpp b/public/raid/imraid.hpp new file mode 100644 index 0000000..376c388 --- /dev/null +++ b/public/raid/imraid.hpp @@ -0,0 +1,31 @@ + +#pragma once + +#if !defined(RAID_PUBLIC_RAID_IMRAID_HPP_INCLUDED) +#define RAID_PUBLIC_RAID_IMRAID_HPP_INCLUDED 1 + +#include + +namespace ImRaid +{ +inline bool ToggleImageButton(const char* strId, ImTextureID textureId, const ImVec2& imageSize, bool& toggled) +{ + if (toggled) + { + ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyleColorVec4(ImGuiCol_ButtonActive)); + } + const bool clicked = ImGui::ImageButton(strId, textureId, imageSize); + if (toggled) + { + ImGui::PopStyleColor(); + } + + if (clicked) + { + toggled = !toggled; + } + return clicked; +} +} // namespace ImRaid + +#endif // !defined(RAID_PUBLIC_RAID_IMRAID_HPP_INCLUDED)