mirror of
https://github.com/gwm17/implot.git
synced 2024-11-13 22:48:50 -05:00
Merge pull request #130 from sonoro1234/varargs
Addition of va_list V versions of Annotate and AnnotateClamped
This commit is contained in:
commit
394516cedb
24
implot.cpp
24
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);
|
||||
}
|
||||
|
||||
|
|
7
implot.h
7
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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user