1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-11-23 02:38:53 -05:00

Addition of va_list V versions of Annotate and AnnotateClamped

This commit is contained in:
Victor Bombi 2020-10-11 09:53:28 +02:00
parent 8a3ccf0a44
commit b5cf8b8431
2 changed files with 27 additions and 4 deletions

View File

@ -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);
}

View File

@ -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.