|
@@ -1,4 +1,4 @@
|
|
|
-// dear imgui, v1.61 WIP
|
|
|
|
|
|
|
+// dear imgui, v1.61
|
|
|
// (main code and documentation)
|
|
// (main code and documentation)
|
|
|
|
|
|
|
|
// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code.
|
|
// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code.
|
|
@@ -263,16 +263,17 @@
|
|
|
When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
|
When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
|
|
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
|
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
|
|
|
|
|
|
|
- - 2018/05/03 (1.61) - DragInt(): The default compile-time format string has been changed from "%.0f" to "%d", we are not using integers internally any more.
|
|
|
|
|
|
|
+ - 2018/05/03 (1.61) - DragInt(): The default compile-time format string has been changed from "%.0f" to "%d", as we are not using integers internally any more.
|
|
|
If you used DragInt() with custom format strings, make sure you change them to use %d or an integer-compatible format.
|
|
If you used DragInt() with custom format strings, make sure you change them to use %d or an integer-compatible format.
|
|
|
To honor backward-compatibility, the DragInt() code will currently parse and modify format strings to replace %*f with %d, giving time to users to upgrade their code.
|
|
To honor backward-compatibility, the DragInt() code will currently parse and modify format strings to replace %*f with %d, giving time to users to upgrade their code.
|
|
|
If you have IMGUI_DISABLE_OBSOLETE_FUNCTIONS enabled, the code will instead assert! You may run a reg-exp search on your codebase for e.g. "DragInt.*%f" to help you find them.
|
|
If you have IMGUI_DISABLE_OBSOLETE_FUNCTIONS enabled, the code will instead assert! You may run a reg-exp search on your codebase for e.g. "DragInt.*%f" to help you find them.
|
|
|
- - 2018/04/28 (1.61) - obsoleted InputFloat() functions taking an optional "int decimal_precision" in favor of an equivalent and more flexible "const char* format", consistent with other functions. Kept redirection functions (will obsolete).
|
|
|
|
|
|
|
+ - 2018/04/28 (1.61) - obsoleted InputFloat() functions taking an optional "int decimal_precision" in favor of an equivalent and more flexible "const char* format",
|
|
|
|
|
+ consistent with other functions. Kept redirection functions (will obsolete).
|
|
|
- 2018/04/09 (1.61) - IM_DELETE() helper function added in 1.60 doesn't clear the input _pointer_ reference, more consistent with expectation and allows passing r-value.
|
|
- 2018/04/09 (1.61) - IM_DELETE() helper function added in 1.60 doesn't clear the input _pointer_ reference, more consistent with expectation and allows passing r-value.
|
|
|
- - 2018/03/20 (1.60) - Renamed io.WantMoveMouse to io.WantSetMousePos for consistency and ease of understanding (was added in 1.52, _not_ used by core and only honored by some binding ahead of merging the Nav branch).
|
|
|
|
|
- - 2018/03/12 (1.60) - Removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered as the closing cross uses regular button colors now.
|
|
|
|
|
- - 2018/03/08 (1.60) - Changed ImFont::DisplayOffset.y to default to 0 instead of +1. Fixed rounding of Ascent/Descent to match TrueType renderer. If you were adding or subtracting to ImFont::DisplayOffset check if your fonts are correctly aligned vertically.
|
|
|
|
|
- - 2018/03/03 (1.60) - Renamed ImGuiStyleVar_Count_ to ImGuiStyleVar_COUNT and ImGuiMouseCursor_Count_ to ImGuiMouseCursor_COUNT for consistency with other public enums.
|
|
|
|
|
|
|
+ - 2018/03/20 (1.60) - renamed io.WantMoveMouse to io.WantSetMousePos for consistency and ease of understanding (was added in 1.52, _not_ used by core and only honored by some binding ahead of merging the Nav branch).
|
|
|
|
|
+ - 2018/03/12 (1.60) - removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered as the closing cross uses regular button colors now.
|
|
|
|
|
+ - 2018/03/08 (1.60) - changed ImFont::DisplayOffset.y to default to 0 instead of +1. Fixed rounding of Ascent/Descent to match TrueType renderer. If you were adding or subtracting to ImFont::DisplayOffset check if your fonts are correctly aligned vertically.
|
|
|
|
|
+ - 2018/03/03 (1.60) - renamed ImGuiStyleVar_Count_ to ImGuiStyleVar_COUNT and ImGuiMouseCursor_Count_ to ImGuiMouseCursor_COUNT for consistency with other public enums.
|
|
|
- 2018/02/18 (1.60) - BeginDragDropSource(): temporarily removed the optional mouse_button=0 parameter because it is not really usable in many situations at the moment.
|
|
- 2018/02/18 (1.60) - BeginDragDropSource(): temporarily removed the optional mouse_button=0 parameter because it is not really usable in many situations at the moment.
|
|
|
- 2018/02/16 (1.60) - obsoleted the io.RenderDrawListsFn callback, you can call your graphics engine render function after ImGui::Render(). Use ImGui::GetDrawData() to retrieve the ImDrawData* to display.
|
|
- 2018/02/16 (1.60) - obsoleted the io.RenderDrawListsFn callback, you can call your graphics engine render function after ImGui::Render(). Use ImGui::GetDrawData() to retrieve the ImDrawData* to display.
|
|
|
- 2018/02/07 (1.60) - reorganized context handling to be more explicit,
|
|
- 2018/02/07 (1.60) - reorganized context handling to be more explicit,
|
|
@@ -668,7 +669,6 @@
|
|
|
#include "imgui_internal.h"
|
|
#include "imgui_internal.h"
|
|
|
|
|
|
|
|
#include <ctype.h> // toupper, isprint
|
|
#include <ctype.h> // toupper, isprint
|
|
|
-#include <stdlib.h> // NULL, malloc, free, qsort, atoi
|
|
|
|
|
#include <stdio.h> // vsnprintf, sscanf, printf
|
|
#include <stdio.h> // vsnprintf, sscanf, printf
|
|
|
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
|
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
|
|
#include <stddef.h> // intptr_t
|
|
#include <stddef.h> // intptr_t
|
|
@@ -1439,7 +1439,7 @@ void ImGui::ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float&
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const float chroma = r - (g < b ? g : b);
|
|
const float chroma = r - (g < b ? g : b);
|
|
|
- out_h = fabsf(K + (g - b) / (6.f * chroma + 1e-20f));
|
|
|
|
|
|
|
+ out_h = ImFabs(K + (g - b) / (6.f * chroma + 1e-20f));
|
|
|
out_s = chroma / (r + 1e-20f);
|
|
out_s = chroma / (r + 1e-20f);
|
|
|
out_v = r;
|
|
out_v = r;
|
|
|
}
|
|
}
|
|
@@ -1455,7 +1455,7 @@ void ImGui::ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float&
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- h = fmodf(h, 1.0f) / (60.0f/360.0f);
|
|
|
|
|
|
|
+ h = ImFmod(h, 1.0f) / (60.0f/360.0f);
|
|
|
int i = (int)h;
|
|
int i = (int)h;
|
|
|
float f = h - (float)i;
|
|
float f = h - (float)i;
|
|
|
float p = v * (1.0f - s);
|
|
float p = v * (1.0f - s);
|
|
@@ -2213,7 +2213,7 @@ void ImGui::ItemSize(const ImRect& bb, float text_offset_y)
|
|
|
|
|
|
|
|
static ImGuiDir inline NavScoreItemGetQuadrant(float dx, float dy)
|
|
static ImGuiDir inline NavScoreItemGetQuadrant(float dx, float dy)
|
|
|
{
|
|
{
|
|
|
- if (fabsf(dx) > fabsf(dy))
|
|
|
|
|
|
|
+ if (ImFabs(dx) > ImFabs(dy))
|
|
|
return (dx > 0.0f) ? ImGuiDir_Right : ImGuiDir_Left;
|
|
return (dx > 0.0f) ? ImGuiDir_Right : ImGuiDir_Left;
|
|
|
return (dy > 0.0f) ? ImGuiDir_Down : ImGuiDir_Up;
|
|
return (dy > 0.0f) ? ImGuiDir_Down : ImGuiDir_Up;
|
|
|
}
|
|
}
|
|
@@ -2262,12 +2262,12 @@ static bool NavScoreItem(ImGuiNavMoveResult* result, ImRect cand)
|
|
|
float dby = NavScoreItemDistInterval(ImLerp(cand.Min.y, cand.Max.y, 0.2f), ImLerp(cand.Min.y, cand.Max.y, 0.8f), ImLerp(curr.Min.y, curr.Max.y, 0.2f), ImLerp(curr.Min.y, curr.Max.y, 0.8f)); // Scale down on Y to keep using box-distance for vertically touching items
|
|
float dby = NavScoreItemDistInterval(ImLerp(cand.Min.y, cand.Max.y, 0.2f), ImLerp(cand.Min.y, cand.Max.y, 0.8f), ImLerp(curr.Min.y, curr.Max.y, 0.2f), ImLerp(curr.Min.y, curr.Max.y, 0.8f)); // Scale down on Y to keep using box-distance for vertically touching items
|
|
|
if (dby != 0.0f && dbx != 0.0f)
|
|
if (dby != 0.0f && dbx != 0.0f)
|
|
|
dbx = (dbx/1000.0f) + ((dbx > 0.0f) ? +1.0f : -1.0f);
|
|
dbx = (dbx/1000.0f) + ((dbx > 0.0f) ? +1.0f : -1.0f);
|
|
|
- float dist_box = fabsf(dbx) + fabsf(dby);
|
|
|
|
|
|
|
+ float dist_box = ImFabs(dbx) + ImFabs(dby);
|
|
|
|
|
|
|
|
// Compute distance between centers (this is off by a factor of 2, but we only compare center distances with each other so it doesn't matter)
|
|
// Compute distance between centers (this is off by a factor of 2, but we only compare center distances with each other so it doesn't matter)
|
|
|
float dcx = (cand.Min.x + cand.Max.x) - (curr.Min.x + curr.Max.x);
|
|
float dcx = (cand.Min.x + cand.Max.x) - (curr.Min.x + curr.Max.x);
|
|
|
float dcy = (cand.Min.y + cand.Max.y) - (curr.Min.y + curr.Max.y);
|
|
float dcy = (cand.Min.y + cand.Max.y) - (curr.Min.y + curr.Max.y);
|
|
|
- float dist_center = fabsf(dcx) + fabsf(dcy); // L1 metric (need this for our connectedness guarantee)
|
|
|
|
|
|
|
+ float dist_center = ImFabs(dcx) + ImFabs(dcy); // L1 metric (need this for our connectedness guarantee)
|
|
|
|
|
|
|
|
// Determine which quadrant of 'curr' our candidate item 'cand' lies in based on distance
|
|
// Determine which quadrant of 'curr' our candidate item 'cand' lies in based on distance
|
|
|
ImGuiDir quadrant;
|
|
ImGuiDir quadrant;
|
|
@@ -3310,7 +3310,7 @@ static void ImGui::NavUpdate()
|
|
|
g.NavScoringRectScreen = g.NavWindow ? ImRect(g.NavWindow->Pos + nav_rect_rel.Min, g.NavWindow->Pos + nav_rect_rel.Max) : GetViewportRect();
|
|
g.NavScoringRectScreen = g.NavWindow ? ImRect(g.NavWindow->Pos + nav_rect_rel.Min, g.NavWindow->Pos + nav_rect_rel.Max) : GetViewportRect();
|
|
|
g.NavScoringRectScreen.Min.x = ImMin(g.NavScoringRectScreen.Min.x + 1.0f, g.NavScoringRectScreen.Max.x);
|
|
g.NavScoringRectScreen.Min.x = ImMin(g.NavScoringRectScreen.Min.x + 1.0f, g.NavScoringRectScreen.Max.x);
|
|
|
g.NavScoringRectScreen.Max.x = g.NavScoringRectScreen.Min.x;
|
|
g.NavScoringRectScreen.Max.x = g.NavScoringRectScreen.Min.x;
|
|
|
- IM_ASSERT(!g.NavScoringRectScreen.IsInverted()); // Ensure if we have a finite, non-inverted bounding box here will allows us to remove extraneous fabsf() calls in NavScoreItem().
|
|
|
|
|
|
|
+ IM_ASSERT(!g.NavScoringRectScreen.IsInverted()); // Ensure if we have a finite, non-inverted bounding box here will allows us to remove extraneous ImFabs() calls in NavScoreItem().
|
|
|
//g.OverlayDrawList.AddRect(g.NavScoringRectScreen.Min, g.NavScoringRectScreen.Max, IM_COL32(255,200,0,255)); // [DEBUG]
|
|
//g.OverlayDrawList.AddRect(g.NavScoringRectScreen.Min, g.NavScoringRectScreen.Max, IM_COL32(255,200,0,255)); // [DEBUG]
|
|
|
g.NavScoringCount = 0;
|
|
g.NavScoringCount = 0;
|
|
|
#if IMGUI_DEBUG_NAV_RECTS
|
|
#if IMGUI_DEBUG_NAV_RECTS
|
|
@@ -4681,7 +4681,7 @@ bool ImGui::IsMouseClicked(int button, bool repeat)
|
|
|
if (repeat && t > g.IO.KeyRepeatDelay)
|
|
if (repeat && t > g.IO.KeyRepeatDelay)
|
|
|
{
|
|
{
|
|
|
float delay = g.IO.KeyRepeatDelay, rate = g.IO.KeyRepeatRate;
|
|
float delay = g.IO.KeyRepeatDelay, rate = g.IO.KeyRepeatRate;
|
|
|
- if ((fmodf(t - delay, rate) > rate*0.5f) != (fmodf(t - delay - g.IO.DeltaTime, rate) > rate*0.5f))
|
|
|
|
|
|
|
+ if ((ImFmod(t - delay, rate) > rate*0.5f) != (ImFmod(t - delay - g.IO.DeltaTime, rate) > rate*0.5f))
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -8779,7 +8779,7 @@ static inline TYPE RoundScalarWithFormat(const char* format, ImGuiDataType data_
|
|
|
while (*p == ' ')
|
|
while (*p == ' ')
|
|
|
p++;
|
|
p++;
|
|
|
if (data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double)
|
|
if (data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double)
|
|
|
- v = (TYPE)atof(p);
|
|
|
|
|
|
|
+ v = (TYPE)ImAtof(p);
|
|
|
else
|
|
else
|
|
|
ImAtoi(p, (SIGNEDTYPE*)&v);
|
|
ImAtoi(p, (SIGNEDTYPE*)&v);
|
|
|
return v;
|
|
return v;
|
|
@@ -8926,7 +8926,7 @@ static bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType d
|
|
|
{
|
|
{
|
|
|
// Positive: rescale to the positive range before powering
|
|
// Positive: rescale to the positive range before powering
|
|
|
float a;
|
|
float a;
|
|
|
- if (fabsf(linear_zero_pos - 1.0f) > 1.e-6f)
|
|
|
|
|
|
|
+ if (ImFabs(linear_zero_pos - 1.0f) > 1.e-6f)
|
|
|
a = (clicked_t - linear_zero_pos) / (1.0f - linear_zero_pos);
|
|
a = (clicked_t - linear_zero_pos) / (1.0f - linear_zero_pos);
|
|
|
else
|
|
else
|
|
|
a = clicked_t;
|
|
a = clicked_t;
|
|
@@ -10695,7 +10695,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|
|
draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos - render_scroll, GetColorU32(ImGuiCol_Text), buf_display, buf_display + edit_state.CurLenA, 0.0f, is_multiline ? NULL : &clip_rect);
|
|
draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos - render_scroll, GetColorU32(ImGuiCol_Text), buf_display, buf_display + edit_state.CurLenA, 0.0f, is_multiline ? NULL : &clip_rect);
|
|
|
|
|
|
|
|
// Draw blinking cursor
|
|
// Draw blinking cursor
|
|
|
- bool cursor_is_visible = (!g.IO.OptCursorBlink) || (g.InputTextState.CursorAnim <= 0.0f) || fmodf(g.InputTextState.CursorAnim, 1.20f) <= 0.80f;
|
|
|
|
|
|
|
+ bool cursor_is_visible = (!g.IO.OptCursorBlink) || (g.InputTextState.CursorAnim <= 0.0f) || ImFmod(g.InputTextState.CursorAnim, 1.20f) <= 0.80f;
|
|
|
ImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll;
|
|
ImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll;
|
|
|
ImRect cursor_screen_rect(cursor_screen_pos.x, cursor_screen_pos.y-g.FontSize+0.5f, cursor_screen_pos.x+1.0f, cursor_screen_pos.y-1.5f);
|
|
ImRect cursor_screen_rect(cursor_screen_pos.x, cursor_screen_pos.y-g.FontSize+0.5f, cursor_screen_pos.x+1.0f, cursor_screen_pos.y-1.5f);
|
|
|
if (cursor_is_visible && cursor_screen_rect.Overlaps(clip_rect))
|
|
if (cursor_is_visible && cursor_screen_rect.Overlaps(clip_rect))
|
|
@@ -11543,7 +11543,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
|
|
ImVec2 ta = g.IO.MousePos - g.IO.MouseDelta;
|
|
ImVec2 ta = g.IO.MousePos - g.IO.MouseDelta;
|
|
|
ImVec2 tb = (window->Pos.x < next_window->Pos.x) ? next_window_rect.GetTL() : next_window_rect.GetTR();
|
|
ImVec2 tb = (window->Pos.x < next_window->Pos.x) ? next_window_rect.GetTL() : next_window_rect.GetTR();
|
|
|
ImVec2 tc = (window->Pos.x < next_window->Pos.x) ? next_window_rect.GetBL() : next_window_rect.GetBR();
|
|
ImVec2 tc = (window->Pos.x < next_window->Pos.x) ? next_window_rect.GetBL() : next_window_rect.GetBR();
|
|
|
- float extra = ImClamp(fabsf(ta.x - tb.x) * 0.30f, 5.0f, 30.0f); // add a bit of extra slack.
|
|
|
|
|
|
|
+ float extra = ImClamp(ImFabs(ta.x - tb.x) * 0.30f, 5.0f, 30.0f); // add a bit of extra slack.
|
|
|
ta.x += (window->Pos.x < next_window->Pos.x) ? -0.5f : +0.5f; // to avoid numerical issues
|
|
ta.x += (window->Pos.x < next_window->Pos.x) ? -0.5f : +0.5f; // to avoid numerical issues
|
|
|
tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -100.0f); // triangle is maximum 200 high to limit the slope and the bias toward large sub-menus // FIXME: Multiply by fb_scale?
|
|
tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -100.0f); // triangle is maximum 200 high to limit the slope and the bias toward large sub-menus // FIXME: Multiply by fb_scale?
|
|
|
tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +100.0f);
|
|
tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +100.0f);
|
|
@@ -11895,15 +11895,11 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|
|
const float w_items_all = CalcItemWidth() - w_extra;
|
|
const float w_items_all = CalcItemWidth() - w_extra;
|
|
|
const char* label_display_end = FindRenderedTextEnd(label);
|
|
const char* label_display_end = FindRenderedTextEnd(label);
|
|
|
|
|
|
|
|
- const bool alpha = (flags & ImGuiColorEditFlags_NoAlpha) == 0;
|
|
|
|
|
- const bool hdr = (flags & ImGuiColorEditFlags_HDR) != 0;
|
|
|
|
|
- const int components = alpha ? 4 : 3;
|
|
|
|
|
- const ImGuiColorEditFlags flags_untouched = flags;
|
|
|
|
|
-
|
|
|
|
|
BeginGroup();
|
|
BeginGroup();
|
|
|
PushID(label);
|
|
PushID(label);
|
|
|
|
|
|
|
|
// If we're not showing any slider there's no point in doing any HSV conversions
|
|
// If we're not showing any slider there's no point in doing any HSV conversions
|
|
|
|
|
+ const ImGuiColorEditFlags flags_untouched = flags;
|
|
|
if (flags & ImGuiColorEditFlags_NoInputs)
|
|
if (flags & ImGuiColorEditFlags_NoInputs)
|
|
|
flags = (flags & (~ImGuiColorEditFlags__InputsMask)) | ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_NoOptions;
|
|
flags = (flags & (~ImGuiColorEditFlags__InputsMask)) | ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_NoOptions;
|
|
|
|
|
|
|
@@ -11920,6 +11916,10 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|
|
flags |= (g.ColorEditOptions & ImGuiColorEditFlags__PickerMask);
|
|
flags |= (g.ColorEditOptions & ImGuiColorEditFlags__PickerMask);
|
|
|
flags |= (g.ColorEditOptions & ~(ImGuiColorEditFlags__InputsMask | ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask));
|
|
flags |= (g.ColorEditOptions & ~(ImGuiColorEditFlags__InputsMask | ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask));
|
|
|
|
|
|
|
|
|
|
+ const bool alpha = (flags & ImGuiColorEditFlags_NoAlpha) == 0;
|
|
|
|
|
+ const bool hdr = (flags & ImGuiColorEditFlags_HDR) != 0;
|
|
|
|
|
+ const int components = alpha ? 4 : 3;
|
|
|
|
|
+
|
|
|
// Convert to the formats we need
|
|
// Convert to the formats we need
|
|
|
float f[4] = { col[0], col[1], col[2], alpha ? col[3] : 1.0f };
|
|
float f[4] = { col[0], col[1], col[2], alpha ? col[3] : 1.0f };
|
|
|
if (flags & ImGuiColorEditFlags_HSV)
|
|
if (flags & ImGuiColorEditFlags_HSV)
|
|
@@ -12183,13 +12183,13 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|
|
if (initial_dist2 >= (wheel_r_inner-1)*(wheel_r_inner-1) && initial_dist2 <= (wheel_r_outer+1)*(wheel_r_outer+1))
|
|
if (initial_dist2 >= (wheel_r_inner-1)*(wheel_r_inner-1) && initial_dist2 <= (wheel_r_outer+1)*(wheel_r_outer+1))
|
|
|
{
|
|
{
|
|
|
// Interactive with Hue wheel
|
|
// Interactive with Hue wheel
|
|
|
- H = atan2f(current_off.y, current_off.x) / IM_PI*0.5f;
|
|
|
|
|
|
|
+ H = ImAtan2(current_off.y, current_off.x) / IM_PI*0.5f;
|
|
|
if (H < 0.0f)
|
|
if (H < 0.0f)
|
|
|
H += 1.0f;
|
|
H += 1.0f;
|
|
|
value_changed = value_changed_h = true;
|
|
value_changed = value_changed_h = true;
|
|
|
}
|
|
}
|
|
|
- float cos_hue_angle = cosf(-H * 2.0f * IM_PI);
|
|
|
|
|
- float sin_hue_angle = sinf(-H * 2.0f * IM_PI);
|
|
|
|
|
|
|
+ float cos_hue_angle = ImCos(-H * 2.0f * IM_PI);
|
|
|
|
|
+ float sin_hue_angle = ImSin(-H * 2.0f * IM_PI);
|
|
|
if (ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, ImRotate(initial_off, cos_hue_angle, sin_hue_angle)))
|
|
if (ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, ImRotate(initial_off, cos_hue_angle, sin_hue_angle)))
|
|
|
{
|
|
{
|
|
|
// Interacting with SV triangle
|
|
// Interacting with SV triangle
|
|
@@ -12335,14 +12335,14 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|
|
const int vert_end_idx = draw_list->VtxBuffer.Size;
|
|
const int vert_end_idx = draw_list->VtxBuffer.Size;
|
|
|
|
|
|
|
|
// Paint colors over existing vertices
|
|
// Paint colors over existing vertices
|
|
|
- ImVec2 gradient_p0(wheel_center.x + cosf(a0) * wheel_r_inner, wheel_center.y + sinf(a0) * wheel_r_inner);
|
|
|
|
|
- ImVec2 gradient_p1(wheel_center.x + cosf(a1) * wheel_r_inner, wheel_center.y + sinf(a1) * wheel_r_inner);
|
|
|
|
|
|
|
+ ImVec2 gradient_p0(wheel_center.x + ImCos(a0) * wheel_r_inner, wheel_center.y + ImSin(a0) * wheel_r_inner);
|
|
|
|
|
+ ImVec2 gradient_p1(wheel_center.x + ImCos(a1) * wheel_r_inner, wheel_center.y + ImSin(a1) * wheel_r_inner);
|
|
|
ShadeVertsLinearColorGradientKeepAlpha(draw_list->VtxBuffer.Data + vert_start_idx, draw_list->VtxBuffer.Data + vert_end_idx, gradient_p0, gradient_p1, hue_colors[n], hue_colors[n+1]);
|
|
ShadeVertsLinearColorGradientKeepAlpha(draw_list->VtxBuffer.Data + vert_start_idx, draw_list->VtxBuffer.Data + vert_end_idx, gradient_p0, gradient_p1, hue_colors[n], hue_colors[n+1]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Render Cursor + preview on Hue Wheel
|
|
// Render Cursor + preview on Hue Wheel
|
|
|
- float cos_hue_angle = cosf(H * 2.0f * IM_PI);
|
|
|
|
|
- float sin_hue_angle = sinf(H * 2.0f * IM_PI);
|
|
|
|
|
|
|
+ float cos_hue_angle = ImCos(H * 2.0f * IM_PI);
|
|
|
|
|
+ float sin_hue_angle = ImSin(H * 2.0f * IM_PI);
|
|
|
ImVec2 hue_cursor_pos(wheel_center.x + cos_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f, wheel_center.y + sin_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f);
|
|
ImVec2 hue_cursor_pos(wheel_center.x + cos_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f, wheel_center.y + sin_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f);
|
|
|
float hue_cursor_rad = value_changed_h ? wheel_thickness * 0.65f : wheel_thickness * 0.55f;
|
|
float hue_cursor_rad = value_changed_h ? wheel_thickness * 0.65f : wheel_thickness * 0.55f;
|
|
|
int hue_cursor_segments = ImClamp((int)(hue_cursor_rad / 1.4f), 9, 32);
|
|
int hue_cursor_segments = ImClamp((int)(hue_cursor_rad / 1.4f), 9, 32);
|