14 #define IM_VEC2_CLASS_EXTRA \ 15 friend ImVec2 operator+(const ImVec2& a, const ImVec2& b) { return {a.x + b.x, a.y + b.y}; } \ 16 friend ImVec2 operator-(const ImVec2& a, const ImVec2& b) { return {a.x - b.x, a.y - b.y}; } \ 17 friend ImVec2 operator*(const ImVec2& v, float s) { return {v.x * s, v.y * s}; } \ 18 friend ImVec2 operator*(float s, const ImVec2& v) { return {v.x * s, v.y * s}; } \ 19 friend bool operator==(const ImVec2& a, const ImVec2& b) { return a.x == b.x && a.y == b.y; } \ 20 void operator*=(float s) { x *= s; y *= s; } \ 21 void operator/=(float s) { x /= s; y /= s; } \ 22 float norm() { return std::hypot(x, y); } 24 #define IM_VEC4_CLASS_EXTRA \ 25 friend bool operator==(const ImVec4& a, const ImVec4& b) { \ 26 return a.x == b.x && a.y == b.y && a.z == b.z && a.w == b.w; } \ 28 #include <imgui/imgui.h> 30 using GLuint = uint32_t;
35 ImVec2 aspect_correct_image_size(
const ImVec2& desired_size,
const ImVec2& canvas_size,
const ImVec2& minimum_size);
37 void gl_texture(GLuint tex_id,
const ImVec2& size);
46 bool SliderSize(
const std::string& label,
size_t* v,
size_t v_min,
size_t v_max,
float power = 1.0f);
48 bool InputText(
const std::string& label, std::string& text, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL,
void* user_data = NULL);
49 void Text(
const std::string& text);
50 void LabelText(
const std::string& label,
const std::string& text);
51 bool Button(
const std::string& text);
53 bool ListBox(
const std::string& label, std::string& current_item,
const std::vector<std::string>& items,
int height_in_items = -1);
54 bool Combo(
const std::string& label, std::string& current_item,
const std::vector<std::string>& items,
int height_in_items = -1);
57 template<
typename Enum>
60 if (ImGui::RadioButton(label, *v == v_button)) {
Definition: imgui_helpers.hpp:32
bool RadioButtonEnum(const char *label, Enum *v, Enum v_button)
Convenience for enums.
Definition: imgui_helpers.hpp:58
Helper C++ bindings for ImGui.
Definition: imgui_helpers.hpp:44