diff --git a/implot.cpp b/implot.cpp index 3d6149a..52c8f22 100644 --- a/implot.cpp +++ b/implot.cpp @@ -2555,31 +2555,47 @@ void AnnotateEx(double x, double y, bool clamp, const ImVec4& col, const ImVec2& gp.Annotations.AppendV(pos, off, bg, fg, clamp, fmt, args); } +void AnnotateV(double x, double y, const ImVec2& offset, const char* fmt, va_list args) { + AnnotateEx(x,y,false,ImVec4(0,0,0,0),offset,fmt,args); +} + void Annotate(double x, double y, const ImVec2& offset, const char* fmt, ...) { va_list args; va_start(args, fmt); - AnnotateEx(x,y,false,ImVec4(0,0,0,0),offset,fmt,args); + AnnotateV(x,y,offset,fmt,args); va_end(args); } +void AnnotateV(double x, double y, const ImVec2& offset, const ImVec4& col, const char* fmt, va_list args) { + AnnotateEx(x,y,false,col,offset,fmt,args); +} + void Annotate(double x, double y, const ImVec2& offset, const ImVec4& col, const char* fmt, ...) { va_list args; va_start(args, fmt); - AnnotateEx(x,y,false,col,offset,fmt,args); + AnnotateV(x,y,offset,col,fmt,args); va_end(args); } +void AnnotateClampedV(double x, double y, const ImVec2& offset, const char* fmt, va_list args) { + AnnotateEx(x,y,true,ImVec4(0,0,0,0),offset,fmt,args); +} + void AnnotateClamped(double x, double y, const ImVec2& offset, const char* fmt, ...) { va_list args; va_start(args, fmt); - AnnotateEx(x,y,true,ImVec4(0,0,0,0),offset,fmt,args); + AnnotateClampedV(x,y,offset,fmt,args); va_end(args); } +void AnnotateClampedV(double x, double y, const ImVec2& offset, const ImVec4& col, const char* fmt, va_list args) { + AnnotateEx(x,y,true,col,offset,fmt,args); +} + void AnnotateClamped(double x, double y, const ImVec2& offset, const ImVec4& col, const char* fmt, ...) { va_list args; va_start(args, fmt); - AnnotateEx(x,y,true,col,offset,fmt,args); + AnnotateClampedV(x,y,offset,col,fmt,args); va_end(args); } diff --git a/implot.h b/implot.h index b9d6aaf..a45b447 100644 --- a/implot.h +++ b/implot.h @@ -471,6 +471,13 @@ IMPLOT_API void Annotate(double x, double y, const ImVec2& pix_offset, const ImV IMPLOT_API void AnnotateClamped(double x, double y, const ImVec2& pix_offset, const char* fmt, ...) IM_FMTARGS(4); IMPLOT_API void AnnotateClamped(double x, double y, const ImVec2& pix_offset, const ImVec4& color, const char* fmt, ...) IM_FMTARGS(5); +IMPLOT_API void AnnotateV(double x, double y, const ImVec2& pix_offset, const char* fmt, va_list args) IM_FMTLIST(4); +IMPLOT_API void AnnotateV(double x, double y, const ImVec2& pix_offset, const ImVec4& color, const char* fmt, va_list args) IM_FMTLIST(5); +// Same as above, but the annotation will always be clamped to stay inside the plot area. +IMPLOT_API void AnnotateClampedV(double x, double y, const ImVec2& pix_offset, const char* fmt, va_list args) IM_FMTLIST(4); +IMPLOT_API void AnnotateClampedV(double x, double y, const ImVec2& pix_offset, const ImVec4& color, const char* fmt, va_list args) IM_FMTLIST(5); + + // Shows a draggable vertical guide line at an x-value. #col defaults to ImGuiCol_Text. IMPLOT_API bool DragLineX(const char* id, double* x_value, bool show_label = true, const ImVec4& col = IMPLOT_AUTO_COL, float thickness = 1); // Shows a draggable horizontal guide line at a y-value. #col defaults to ImGuiCol_Text.