mirror of
https://github.com/gwm17/implot.git
synced 2024-10-09 23:57:26 -04:00
resolved conflicts with latest version
This commit is contained in:
parent
0043525bd1
commit
4596a10183
|
@ -76,8 +76,8 @@ void ShowImPlotDemoWindow(bool* p_open) {
|
|||
|
||||
static DemoData data;
|
||||
|
||||
//ImVec2 main_viewport_pos = ImGui::GetMainViewport()->Pos;
|
||||
//ImGui::SetNextWindowPos(ImVec2(main_viewport_pos.x + 650, main_viewport_pos.y + 20), ImGuiCond_FirstUseEver);
|
||||
ImVec2 main_viewport_pos = ImGui::GetMainViewport()->Pos;
|
||||
ImGui::SetNextWindowPos(ImVec2(main_viewport_pos.x + 650, main_viewport_pos.y + 20), ImGuiCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(550, 680), ImGuiCond_FirstUseEver);
|
||||
ImGui::Begin("ImPlot Demo", p_open);
|
||||
ImGui::Text("ImPlot says hello. (0.1 WIP)");
|
||||
|
@ -478,7 +478,7 @@ void ShowImPlotDemoWindow(bool* p_open) {
|
|||
//void SetNextPlotRangeX(float x_min, float x_max, ImGuiCond cond = ImGuiCond_Once);
|
||||
static bool paused = false;
|
||||
#define K_PLOT_DIGITAL_CH_COUNT 8
|
||||
#define K_PLOT_ANALOG_CH_COUNT 4
|
||||
#define K_PLOT_ANALOG_CH_COUNT 8
|
||||
static ScrollingData dataDigital[K_PLOT_DIGITAL_CH_COUNT];
|
||||
static ScrollingData dataAnalog[K_PLOT_ANALOG_CH_COUNT];
|
||||
static bool showDigital[K_PLOT_DIGITAL_CH_COUNT];
|
||||
|
@ -523,16 +523,6 @@ void ShowImPlotDemoWindow(bool* p_open) {
|
|||
if (true) {
|
||||
t += ImGui::GetIO().DeltaTime;
|
||||
|
||||
//purge inactive signals
|
||||
for (int i = 0; i < K_PLOT_DIGITAL_CH_COUNT; ++i) {
|
||||
if (!showDigital[i])
|
||||
dataDigital[i].Erase();
|
||||
}
|
||||
for (int i = 0; i < K_PLOT_ANALOG_CH_COUNT; ++i) {
|
||||
if (!showAnalog[i])
|
||||
dataAnalog[i].Erase();
|
||||
}
|
||||
|
||||
//digital signal values
|
||||
int i = 0;
|
||||
if (showDigital[i])
|
||||
|
@ -573,9 +563,21 @@ void ShowImPlotDemoWindow(bool* p_open) {
|
|||
if (showAnalog[i])
|
||||
dataAnalog[i].AddPoint(t, sin(t) - cos(t));
|
||||
i++;
|
||||
if (showAnalog[i])
|
||||
dataAnalog[i].AddPoint(t, cos(t) - sin(t));
|
||||
i++;
|
||||
if (showAnalog[i])
|
||||
dataAnalog[i].AddPoint(t, sin(t) + cos(t));
|
||||
i++;
|
||||
if (showAnalog[i])
|
||||
dataAnalog[i].AddPoint(t, (sin(t) + cos(t)) / (sin(t) * cos(t)));
|
||||
i++;
|
||||
if (showAnalog[i])
|
||||
dataAnalog[i].AddPoint(t, (cos(t) + cos(t)) / (cos(t) * cos(t)));
|
||||
i++;
|
||||
|
||||
}
|
||||
ImGui::SetNextPlotRangeX(t - 10.0f, t, paused ? ImGuiCond_Once : ImGuiCond_Always);
|
||||
ImGui::SetNextPlotRangeX(t - 60.0f, t, paused ? ImGuiCond_Once : ImGuiCond_Always);
|
||||
if (ImGui::BeginPlot("##DND", NULL, NULL, ImVec2(-1,300), ImPlotFlags_Default)) {
|
||||
for (int i = 0; i < K_PLOT_DIGITAL_CH_COUNT; ++i) {
|
||||
if (showDigital[i]) {
|
||||
|
@ -639,6 +641,18 @@ void ShowImPlotDemoWindow(bool* p_open) {
|
|||
ImGui::PopPlotStyleVar();
|
||||
ImGui::RestorePlotPalette();
|
||||
}
|
||||
if (ImGui::CollapsingHeader("Custom Rendering")) {
|
||||
if (ImGui::BeginPlot("##CustomRend",NULL,NULL,{-1,300})) {
|
||||
ImVec2 cntr = ImGui::PlotToPixels({0.5f, 0.5f});
|
||||
ImVec2 rmin = ImGui::PlotToPixels({0.25f, 0.75f});
|
||||
ImVec2 rmax = ImGui::PlotToPixels({0.75f, 0.25f});
|
||||
ImGui::PushPlotClipRect();
|
||||
ImGui::GetWindowDrawList()->AddCircleFilled(cntr,20,IM_COL32(255,255,0,255),20);
|
||||
ImGui::GetWindowDrawList()->AddRect(rmin, rmax, IM_COL32(128,0,255,255));
|
||||
ImGui::PopPlotClipRect();
|
||||
ImGui::EndPlot();
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
// if (ImGui::CollapsingHeader("Benchmark")) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user