Skip to content

Commit 8a43bf7

Browse files
authored
Support Dear ImGui 1.92 (#20)
Uses the new way to get font scale in Dear ImGui 1.92
1 parent a0768e1 commit 8a43bf7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

imgui-knobs.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,13 @@ namespace ImGuiKnobs {
162162

163163
auto speed = _speed == 0 ? (v_max - v_min) / 250.f : _speed;
164164
ImGui::PushID(label);
165-
auto width = size == 0 ? ImGui::GetTextLineHeight() * 4.0f : size * ImGui::GetIO().FontGlobalScale;
165+
166+
#if IMGUI_VERSION_NUM < 19197
167+
auto font_scale = ImGui::GetIO().FontGlobalScale;
168+
#else
169+
auto font_scale = ImGui::GetStyle().FontScaleMain;
170+
#endif
171+
auto width = size == 0 ? ImGui::GetTextLineHeight() * 4.0f : size * font_scale;
166172
ImGui::PushItemWidth(width);
167173

168174
ImGui::BeginGroup();

0 commit comments

Comments
 (0)