diff --git a/imgui.cpp b/imgui.cpp index 443b9b4a..f903b2d4 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -468,7 +468,6 @@ #include "imgui.h" #define IMGUI_DEFINE_MATH_OPERATORS -#define IMGUI_DEFINE_MATH_FUNCTIONS #include "imgui_internal.h" #include // toupper, isprint @@ -5798,8 +5797,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c SetActiveID(id, window); FocusWindow(window); - const bool is_ctrl_down = g.IO.KeyCtrl; - if (tab_focus_requested || is_ctrl_down) + if (tab_focus_requested || g.IO.KeyCtrl) { start_text_input = true; g.ScalarAsInputTextId = 0; diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 408927f6..1f211fd1 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -14,9 +14,8 @@ #include "imgui.h" #define IMGUI_DEFINE_MATH_OPERATORS -#define IMGUI_DEFINE_MATH_FUNCTIONS - #include "imgui_internal.h" + #include // vsnprintf, sscanf, printf #include // new (ptr) #if defined(_MSC_VER) || defined(__MINGW32__) diff --git a/imgui_internal.h b/imgui_internal.h index 7b418a15..9b3cc419 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -3,16 +3,12 @@ // You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility! // Implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators) -// #define IMGUI_ENABLE_MATH_OPERATORS -// Implement maths functions: -// #define IMGUI_ENABLE_MATH_FUNCTIONS +// #define IMGUI_DEFINE_MATH_OPERATORS #pragma once #include // FILE* -#ifdef IMGUI_DEFINE_MATH_FUNCTIONS #include // sqrtf() -#endif //----------------------------------------------------------------------------- // Forward Declarations @@ -35,7 +31,7 @@ typedef int ImGuiLayoutType; // enum ImGuiLayoutType_ typedef int ImGuiButtonFlags; // enum ImGuiButtonFlags_ //------------------------------------------------------------------------- -// STB libraries implementation +// STB libraries //------------------------------------------------------------------------- namespace ImGuiStb @@ -113,7 +109,6 @@ static inline ImVec2& operator/=(ImVec2& lhs, const float rhs) static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x-rhs.x, lhs.y-rhs.y, lhs.z-rhs.z, lhs.w-lhs.w); } #endif -#ifdef IMGUI_DEFINE_MATH_FUNCTIONS static inline int ImMin(int lhs, int rhs) { return lhs < rhs ? lhs : rhs; } static inline int ImMax(int lhs, int rhs) { return lhs >= rhs ? lhs : rhs; } static inline float ImMin(float lhs, float rhs) { return lhs < rhs ? lhs : rhs; } @@ -129,10 +124,9 @@ static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t) static inline float ImLengthSqr(const ImVec2& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y; } static inline float ImLengthSqr(const ImVec4& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y + lhs.z*lhs.z + lhs.w*lhs.w; } static inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = lhs.x*lhs.x + lhs.y*lhs.y; if (d > 0.0f) return 1.0f / sqrtf(d); return fail_value; } -#endif //----------------------------------------------------------------------------- -// Declarations +// Types //----------------------------------------------------------------------------- enum ImGuiButtonFlags_