Skip to content

Commit

Permalink
Fixed build.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed Sep 3, 2018
1 parent 2904b42 commit 350e5d4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions 3rdparty/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ indent_size = 4
indent_style = tab
indent_size = 4

[ocornut-imgui/*]
[dear-imgui/*]
indent_style = space
indent_size = 4

[ocornut-imgui/*.inl]
[dear-imgui/*.inl]
indent_style = space
indent_size = 4

Expand Down
10 changes: 10 additions & 0 deletions 3rdparty/dear-imgui/imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1877,6 +1877,16 @@ float ImGui::SliderCalcRatioFromValueT(ImGuiDataType data_type, TYPE v, TYPE v_m
return (float)((FLOATTYPE)(v_clamped - v_min) / (FLOATTYPE)(v_max - v_min));
}

namespace ImGui
{

float SliderCalcRatioFromValueFloat(ImGuiDataType data_type, float v, float v_min, float v_max, float power, float linear_zero_pos)
{
return SliderCalcRatioFromValueT<float, float>(data_type, v, v_min, v_max, power, linear_zero_pos);
}

} // namespace ImGui

// FIXME: Move some of the code into SliderBehavior(). Current responsability is larger than what the equivalent DragBehaviorT<> does, we also do some rendering, etc.
template<typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE>
bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, TYPE* v, const TYPE v_min, const TYPE v_max, const char* format, float power, ImGuiSliderFlags flags, ImRect* out_grab_bb)
Expand Down
6 changes: 4 additions & 2 deletions 3rdparty/dear-imgui/widgets/range_slider.inl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ IMGUI_API float RoundScalarWithFormatT<float, float>(const char* format, ImGuiDa
extern template
IMGUI_API float SliderCalcRatioFromValueT<float, float>(ImGuiDataType data_type, float v, float v_min, float v_max, float power, float linear_zero_pos);

extern float SliderCalcRatioFromValueFloat(ImGuiDataType data_type, float v, float v_min, float v_max, float power, float linear_zero_pos);

// ~80% common code with ImGui::SliderBehavior
bool RangeSliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v1, float* v2, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags)
{
Expand Down Expand Up @@ -114,7 +116,7 @@ bool RangeSliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v1, float* v
}

// Calculate slider grab positioning
float grab_t = SliderCalcRatioFromValueT<float, float>(ImGuiDataType_Float, *v1, v_min, v_max, power, linear_zero_pos);
float grab_t = SliderCalcRatioFromValueFloat(ImGuiDataType_Float, *v1, v_min, v_max, power, linear_zero_pos);

// Draw
if (!is_horizontal)
Expand All @@ -128,7 +130,7 @@ bool RangeSliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v1, float* v
window->DrawList->AddRectFilled(grab_bb1.Min, grab_bb1.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding);

// Calculate slider grab positioning
grab_t = SliderCalcRatioFromValueT<float, float>(ImGuiDataType_Float, *v2, v_min, v_max, power, linear_zero_pos);
grab_t = SliderCalcRatioFromValueFloat(ImGuiDataType_Float, *v2, v_min, v_max, power, linear_zero_pos);

// Draw
if (!is_horizontal)
Expand Down

0 comments on commit 350e5d4

Please sign in to comment.