Skip to content

Commit b302971

Browse files
committed
Examples: Minimum supported version is now Dear ImGui 1.89 (August 2022)
1 parent b9db503 commit b302971

File tree

5 files changed

+11
-51
lines changed

5 files changed

+11
-51
lines changed

docs/CHANGELOG.txt

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ v0.10.0 (WIP):
88

99
BREAKING: Canvas: Minimum supported version is now Dear ImGui 1.89 (August 2022)
1010

11+
BREAKING: Examples: Minimum supported version is now Dear ImGui 1.89 (August 2022)
12+
1113
RESTRUCTURE:
1214
Removed local copy of all dependencies in favor of auto checkout. This should also reduce
1315
user confusion and attempt to use ancient version of ImGui embedded in the repository.

examples/blueprints-example/blueprints-example.cpp

+1-23
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ struct Example:
878878
for (int i = 0; i < linkCount; ++i) ImGui::Text("Link (%p)", selectedLinks[i].AsPointer());
879879
ImGui::Unindent();
880880

881-
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Z)))
881+
if (ImGui::IsKeyPressed(ImGuiKey_Z))
882882
for (auto& link : m_Links)
883883
ed::Flow(link.ID);
884884

@@ -1108,11 +1108,7 @@ struct Example:
11081108

11091109
ed::PushStyleVar(ed::StyleVar_PinArrowSize, 10.0f);
11101110
ed::PushStyleVar(ed::StyleVar_PinArrowWidth, 10.0f);
1111-
#if IMGUI_VERSION_NUM > 18101
11121111
ed::PushStyleVar(ed::StyleVar_PinCorners, ImDrawFlags_RoundCornersBottom);
1113-
#else
1114-
ed::PushStyleVar(ed::StyleVar_PinCorners, 12);
1115-
#endif
11161112
ed::BeginPin(pin.ID, ed::PinKind::Input);
11171113
ed::PinPivotRect(inputsRect.GetTL(), inputsRect.GetBR());
11181114
ed::PinRect(inputsRect.GetTL(), inputsRect.GetBR());
@@ -1154,11 +1150,7 @@ struct Example:
11541150
ImGui::Spring(1, 0);
11551151
outputsRect = ImGui_GetItemRect();
11561152

1157-
#if IMGUI_VERSION_NUM > 18101
11581153
ed::PushStyleVar(ed::StyleVar_PinCorners, ImDrawFlags_RoundCornersTop);
1159-
#else
1160-
ed::PushStyleVar(ed::StyleVar_PinCorners, 3);
1161-
#endif
11621154
ed::BeginPin(pin.ID, ed::PinKind::Output);
11631155
ed::PinPivotRect(outputsRect.GetTL(), outputsRect.GetBR());
11641156
ed::PinRect(outputsRect.GetTL(), outputsRect.GetBR());
@@ -1193,13 +1185,8 @@ struct Example:
11931185
// drawList->PathStroke(col, true, thickness);
11941186
//};
11951187

1196-
#if IMGUI_VERSION_NUM > 18101
11971188
const auto topRoundCornersFlags = ImDrawFlags_RoundCornersTop;
11981189
const auto bottomRoundCornersFlags = ImDrawFlags_RoundCornersBottom;
1199-
#else
1200-
const auto topRoundCornersFlags = 1 | 2;
1201-
const auto bottomRoundCornersFlags = 4 | 8;
1202-
#endif
12031190

12041191
drawList->AddRectFilled(inputsRect.GetTL() + ImVec2(0, 1), inputsRect.GetBR(),
12051192
IM_COL32((int)(255 * pinBackground.x), (int)(255 * pinBackground.y), (int)(255 * pinBackground.z), inputAlpha), 4.0f, bottomRoundCornersFlags);
@@ -1263,11 +1250,7 @@ struct Example:
12631250
inputsRect.Min.y -= padding;
12641251
inputsRect.Max.y -= padding;
12651252

1266-
#if IMGUI_VERSION_NUM > 18101
12671253
const auto allRoundCornersFlags = ImDrawFlags_RoundCornersAll;
1268-
#else
1269-
const auto allRoundCornersFlags = 15;
1270-
#endif
12711254
//ed::PushStyleVar(ed::StyleVar_PinArrowSize, 10.0f);
12721255
//ed::PushStyleVar(ed::StyleVar_PinArrowWidth, 10.0f);
12731256
ed::PushStyleVar(ed::StyleVar_PinCorners, allRoundCornersFlags);
@@ -1324,13 +1307,8 @@ struct Example:
13241307
outputsRect.Min.y += padding;
13251308
outputsRect.Max.y += padding;
13261309

1327-
#if IMGUI_VERSION_NUM > 18101
13281310
const auto allRoundCornersFlags = ImDrawFlags_RoundCornersAll;
13291311
const auto topRoundCornersFlags = ImDrawFlags_RoundCornersTop;
1330-
#else
1331-
const auto allRoundCornersFlags = 15;
1332-
const auto topRoundCornersFlags = 3;
1333-
#endif
13341312

13351313
ed::PushStyleVar(ed::StyleVar_PinCorners, topRoundCornersFlags);
13361314
ed::BeginPin(pin.ID, ed::PinKind::Output);

examples/blueprints-example/utilities/builders.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ void util::BlueprintNodeBuilder::End()
6666
HeaderMin - ImVec2(8 - halfBorderWidth, 4 - halfBorderWidth),
6767
HeaderMax + ImVec2(8 - halfBorderWidth, 0),
6868
ImVec2(0.0f, 0.0f), uv,
69-
#if IMGUI_VERSION_NUM > 18101
7069
headerColor, GetStyle().NodeRounding, ImDrawFlags_RoundCornersTop);
71-
#else
72-
headerColor, GetStyle().NodeRounding, 1 | 2);
73-
#endif
7470

7571
if (ContentMin.y > HeaderMax.y)
7672
{

examples/blueprints-example/utilities/drawing.cpp

-24
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,7 @@ void ax::Drawing::DrawIcon(ImDrawList* drawList, const ImVec2& a, const ImVec2&
112112
const auto p0 = rect_center - ImVec2(r, r);
113113
const auto p1 = rect_center + ImVec2(r, r);
114114

115-
#if IMGUI_VERSION_NUM > 18101
116115
drawList->AddRectFilled(p0, p1, color, 0, ImDrawFlags_RoundCornersAll);
117-
#else
118-
drawList->AddRectFilled(p0, p1, color, 0, 15);
119-
#endif
120116
}
121117
else
122118
{
@@ -126,18 +122,10 @@ void ax::Drawing::DrawIcon(ImDrawList* drawList, const ImVec2& a, const ImVec2&
126122

127123
if (innerColor & 0xFF000000)
128124
{
129-
#if IMGUI_VERSION_NUM > 18101
130125
drawList->AddRectFilled(p0, p1, innerColor, 0, ImDrawFlags_RoundCornersAll);
131-
#else
132-
drawList->AddRectFilled(p0, p1, innerColor, 0, 15);
133-
#endif
134126
}
135127

136-
#if IMGUI_VERSION_NUM > 18101
137128
drawList->AddRect(p0, p1, color, 0, ImDrawFlags_RoundCornersAll, 2.0f * outline_scale);
138-
#else
139-
drawList->AddRect(p0, p1, color, 0, 15, 2.0f * outline_scale);
140-
#endif
141129
}
142130
}
143131

@@ -180,11 +168,7 @@ void ax::Drawing::DrawIcon(ImDrawList* drawList, const ImVec2& a, const ImVec2&
180168
const auto p0 = rect_center - ImVec2(r, r);
181169
const auto p1 = rect_center + ImVec2(r, r);
182170

183-
#if IMGUI_VERSION_NUM > 18101
184171
drawList->AddRectFilled(p0, p1, color, cr, ImDrawFlags_RoundCornersAll);
185-
#else
186-
drawList->AddRectFilled(p0, p1, color, cr, 15);
187-
#endif
188172
}
189173
else
190174
{
@@ -195,18 +179,10 @@ void ax::Drawing::DrawIcon(ImDrawList* drawList, const ImVec2& a, const ImVec2&
195179

196180
if (innerColor & 0xFF000000)
197181
{
198-
#if IMGUI_VERSION_NUM > 18101
199182
drawList->AddRectFilled(p0, p1, innerColor, cr, ImDrawFlags_RoundCornersAll);
200-
#else
201-
drawList->AddRectFilled(p0, p1, innerColor, cr, 15);
202-
#endif
203183
}
204184

205-
#if IMGUI_VERSION_NUM > 18101
206185
drawList->AddRect(p0, p1, color, cr, ImDrawFlags_RoundCornersAll, 2.0f * outline_scale);
207-
#else
208-
drawList->AddRect(p0, p1, color, cr, 15, 2.0f * outline_scale);
209-
#endif
210186
}
211187
}
212188
else if (type == IconType::Diamond)

examples/widgets-example/widgets-example.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,19 @@ struct Example:
128128
// Arrow buttons with Repeater
129129
static int counter = 0;
130130
float spacing = ImGui::GetStyle().ItemInnerSpacing.x;
131+
# if IMGUI_VERSION_NUM >= 19094
132+
ImGui::PushItemFlag(ImGuiItemFlags_ButtonRepeat, true);
133+
# else
131134
ImGui::PushButtonRepeat(true);
135+
# endif
132136
if (ImGui::ArrowButton("##left", ImGuiDir_Left)) { counter--; }
133137
ImGui::SameLine(0.0f, spacing);
134138
if (ImGui::ArrowButton("##right", ImGuiDir_Right)) { counter++; }
139+
# if IMGUI_VERSION_NUM >= 19094
140+
ImGui::PopItemFlag();
141+
# else
135142
ImGui::PopButtonRepeat();
143+
# endif
136144
ImGui::SameLine();
137145
ImGui::Text("%d", counter);
138146

0 commit comments

Comments
 (0)