Something went wrong. Try again.
art software for the rest of us
drawing paint image sdl art
Something went wrong. Try again.
922 B · 35 lines
C
at master
1234567891011121314151617181920212223242526272829303132333435#include <vector>#include <string>#include <imgui.h>
typedef struct PopupOption { std::string icon, label; //std::function<void()> onSelect; // THIS FUCKING API SUCKS bool selected = false; unsigned int id; bool operator!=(const PopupOption& other) const { return label.compare(other.label) != 0; } bool operator==(const PopupOption& other) const { return label.compare(other.label) == 0; }} PopupOption;
// primitive for a basic popup menu provided by buttons and combosclass Popup { ImVec2 position = ImVec2(8.0f, 8.0f), pivot; std::vector<PopupOption> options; bool active = false; static int count; bool setActive(bool active);public: Popup(std::vector<PopupOption> options); ~Popup(); void OnRender(); void SetPosition(ImVec2 position, ImVec2 pivot); int CheckSelected(); void Toggle(); static int GetCount();};