big time refactor + button styles

This commit is contained in:
2023-03-26 22:23:49 +02:00
parent a7fb909174
commit 6b29c5e0b8
6 changed files with 223 additions and 116 deletions

View File

@@ -57,3 +57,29 @@ public:
int startImgui(ImGuiCallbacks& callbacks, const char* title, int windowWidth, int windowHeight);
ImVec2 getWindowSize(GLFWwindow* window);
constexpr float DEFAULT_DROP_SHADOW_SIZE = 3.f;
constexpr ImGuiCol DEFAULT_DROP_SHADOW_COLOR_ID = ImGuiCol_TabUnfocused;
void dropShadow();
void dropShadow(const float shadowSize, const ImColor& color);
void renderDropShadow(const float shadowSize, const ImVec2& min, const ImVec2& max, const ImColor& color);
bool dropButton(const char* label, const ImVec2& size = ImVec2(0, 0), float shadowSize = DEFAULT_DROP_SHADOW_SIZE, bool smallButton = false);
bool checkboxWithDropShadow(const char* label, bool* v, const float shadowSize = DEFAULT_DROP_SHADOW_SIZE);
template <typename T>
float calcInputWidth(const char* formatStr, T value)
{
constexpr size_t MAX_BUFFER_SIZE = 256;
char formatStrBuffer[MAX_BUFFER_SIZE];
snprintf(formatStrBuffer, MAX_BUFFER_SIZE, formatStr, value);
return ImGui::CalcTextSize(formatStrBuffer).x + ImGui::GetStyle().FramePadding.x * 2.f;
}
ImVec2 operator +(const ImVec2& a, const ImVec2& b);
ImVec2 operator +(const ImVec2& a, const float s);
ImVec2 operator -(const ImVec2& a, const ImVec2& b);
ImVec2 operator -(const ImVec2& a, const float s);
ImVec2 operator *(const ImVec2& a, float s);
ImVec2 operator /(const ImVec2& a, float s);