Skip to content

Commit 4125be4

Browse files
committed
some fixes to make the demos compile or work properly
benchmak needs epezent/implot#619 solution to work
1 parent f33219d commit 4125be4

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

common/App.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#if defined(_WIN32)
1313
extern "C" __declspec(dllexport) unsigned long NvOptimusEnablement = 0;
1414
extern "C" __declspec(dllexport) unsigned long AmdPowerXpressRequestHighPerformance = 0;
15+
#else
16+
unsigned long NvOptimusEnablement = 0;
17+
unsigned long AmdPowerXpressRequestHighPerformance = 0;
1518
#endif
1619

1720
void StyeColorsApp()

demos/filter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct ImFilter : public App {
7070
ImGui::SetNextWindowPos(ImVec2(0,0), ImGuiCond_Always);
7171
ImGui::SetNextWindowSize(GetWindowSize(), ImGuiCond_Always);
7272
ImGui::Begin("Filter",nullptr, ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoTitleBar);
73-
ImGui::BeginChild("ChildL", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f, -1));
73+
ImGui::BeginChild("ChildL", ImVec2(ImGui::GetWindowWidth() * 0.5f, -1));
7474
ImGui::Text("Input: x(t) = A1*sin(2*pi*F1*t) + A2*sin(2*pi*F1*t) + noise");
7575
ImGui::Separator();
7676

demos/maps.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ class TileManager {
273273
long rc = 0;
274274
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &rc);
275275
if (!((rc == 200 || rc == 201) && rc != CURLE_ABORTED_BY_CALLBACK))
276-
printf("TileManager[%02d]: Response code: %d\n",thrd,rc);
276+
printf("TileManager[%02d]: Response code: %ld\n",thrd,rc);
277277
fs::remove(coord.path());
278278
success = false;
279279
}
@@ -319,7 +319,7 @@ struct ImMaps : public App {
319319
void Update() override {
320320
static int renders = 0;
321321
static bool debug = false;
322-
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_A)))
322+
if (ImGui::IsKeyPressed(ImGuiKey_A))
323323
debug = !debug;
324324

325325
ImGui::SetNextWindowPos({0,0});
@@ -355,7 +355,7 @@ struct ImMaps : public App {
355355
auto [bmin,bmax] = coord.bounds();
356356
if (tile != nullptr) {
357357
auto col = debug ? ((coord.x % 2 == 0 && coord.y % 2 != 0) || (coord.x % 2 != 0 && coord.y % 2 == 0))? ImVec4(1,0,1,1) : ImVec4(1,1,0,1) : ImVec4(1,1,1,1);
358-
ImPlot::PlotImage("##Tiles",(void*)(intptr_t)tile->image.ID,bmin,bmax,{0,0},{1,1},col);
358+
ImPlot::PlotImage("##Tiles",tile->image.ID,bmin,bmax,{0,0},{1,1},col);
359359
}
360360
if (debug)
361361
ImPlot::PlotText(coord.label().c_str(),(bmin.x+bmax.x)/2,(bmin.y+bmax.y)/2);

tests/benchmark.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ struct ImPlotBench : App
580580
running = false;
581581
run_t2 = Clock::now();
582582
size_t run_span = (size_t)std::chrono::duration_cast<std::chrono::microseconds>(run_t2 - run_t1).count();
583-
printf("Run completed in %u us (%.3f s)\n", run_span, run_span / 1000000.0f);
583+
printf("Run completed in %zu us (%.3f s)\n", run_span, run_span / 1000000.0f);
584584
}
585585
}
586586
}
@@ -645,7 +645,7 @@ struct ImPlotBench : App
645645
}
646646
ImGui::SameLine();
647647
static char start_str[32];
648-
sprintf(start_str, running ? "Stop (%u)" : "Start (%u)", m_queue.size());
648+
sprintf(start_str, running ? "Stop (%zu)" : "Start (%zu)", m_queue.size());
649649
if (ImGui::Button(start_str, ImVec2(-1, 0)))
650650
{
651651
running = !running;
@@ -747,10 +747,12 @@ struct ImPlotBench : App
747747
ImPlot::SetupAxis(ImAxis_Y1, "Time [ms]");
748748
ImPlot::SetupAxesLimits(0, kMaxElems, 0, 50);
749749
ImPlot::SetupAxisFormat(ImAxis_X1, fmtr);
750-
ImPlot::SetupAxisLimits(ImAxis_Y2, 0, 500, ImPlotCond_Once);
751750
ImPlot::SetupLegend(ImPlotLocation_East, ImPlotLegendFlags_Outside);
752751
if (show_fps)
752+
{
753753
ImPlot::SetupAxis(ImAxis_Y2, "FPS [Hz]", ImPlotAxisFlags_Opposite);
754+
ImPlot::SetupAxisLimits(ImAxis_Y2, 0, 500, ImPlotCond_Once);
755+
}
754756

755757
for (auto &collection : m_records[selected_branch])
756758
{

0 commit comments

Comments
 (0)