GUI: improve arp macro view
This commit is contained in:
parent
4db91256b1
commit
a253e3d016
3 changed files with 33 additions and 29 deletions
|
|
@ -289,7 +289,7 @@ void PlotBitfield(const char* label, const int* values, int values_count, int va
|
|||
PlotBitfieldEx(label, &Plot_IntArrayGetter, (void*)&data, values_count, values_offset, overlay_text, bits, graph_size);
|
||||
}
|
||||
|
||||
int PlotCustomEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_display_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size, ImVec4 color, int highlight, std::string (*hoverFunc)(int,float))
|
||||
int PlotCustomEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_display_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size, ImVec4 color, int highlight, std::string (*hoverFunc)(int,float), bool blockMode)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||
|
|
@ -394,7 +394,7 @@ int PlotCustomEx(ImGuiPlotType plot_type, const char* label, float (*values_gett
|
|||
|
||||
// NB: Draw calls are merged together by the DrawList system. Still, we should render our batch are lower level to save a bit of CPU.
|
||||
ImVec2 pos0 = ImLerp(inner_bb.Min, inner_bb.Max, tp0);
|
||||
ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, (plot_type == ImGuiPlotType_Lines) ? tp1 : ImVec2(tp1.x, histogram_zero_line_t));
|
||||
ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, (plot_type == ImGuiPlotType_Lines) ? tp1 : ImVec2(tp1.x, blockMode?tp0.y:histogram_zero_line_t));
|
||||
if (plot_type == ImGuiPlotType_Lines)
|
||||
{
|
||||
window->DrawList->AddLine(pos0, pos1, idx_hovered == v1_idx ? col_hovered : col_base);
|
||||
|
|
@ -403,6 +403,10 @@ int PlotCustomEx(ImGuiPlotType plot_type, const char* label, float (*values_gett
|
|||
{
|
||||
if (pos1.x >= pos0.x + 2.0f)
|
||||
pos1.x -= 1.0f;
|
||||
if (blockMode) {
|
||||
pos0.y-=(inner_bb.Max.y-inner_bb.Min.y)*inv_scale;
|
||||
//pos1.y+=1.0f;
|
||||
}
|
||||
window->DrawList->AddRectFilled(pos0, pos1, idx_hovered == v1_idx ? col_hovered : col_base);
|
||||
}
|
||||
|
||||
|
|
@ -423,8 +427,8 @@ int PlotCustomEx(ImGuiPlotType plot_type, const char* label, float (*values_gett
|
|||
return idx_hovered;
|
||||
}
|
||||
|
||||
void PlotCustom(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride, ImVec4 color, int highlight, std::string (*hoverFunc)(int,float))
|
||||
void PlotCustom(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride, ImVec4 color, int highlight, std::string (*hoverFunc)(int,float), bool blockMode)
|
||||
{
|
||||
FurnacePlotArrayGetterData data(values, stride);
|
||||
PlotCustomEx(ImGuiPlotType_Histogram, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size, color, highlight, hoverFunc);
|
||||
PlotCustomEx(ImGuiPlotType_Histogram, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size, color, highlight, hoverFunc, blockMode);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue