mirror of https://github.com/ocornut/imgui
Log/Capture: Added LogTextV, a va_list variant of LogText. (#3828)
This commit is contained in:
parent
a8f76c23a4
commit
ece854564a
|
@ -59,6 +59,7 @@ Other Changes:
|
||||||
- Examples: Reworked setup of clear color to be compatible with transparent values.
|
- Examples: Reworked setup of clear color to be compatible with transparent values.
|
||||||
- CI: Use a dedicated "scheduled" workflow to trigger scheduled builds. Forks may disable this workflow if
|
- CI: Use a dedicated "scheduled" workflow to trigger scheduled builds. Forks may disable this workflow if
|
||||||
scheduled builds builds are not required. [@rokups]
|
scheduled builds builds are not required. [@rokups]
|
||||||
|
- Log/Capture: Added LogTextV, a va_list variant of LogText. [@PathogenDavid]
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|
28
imgui.cpp
28
imgui.cpp
|
@ -9911,14 +9911,8 @@ void ImGui::EndDragDropTarget()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Pass text data straight to log (without being displayed)
|
// Pass text data straight to log (without being displayed)
|
||||||
void ImGui::LogText(const char* fmt, ...)
|
static inline void LogTextV(ImGuiContext& g, const char* fmt, va_list args)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
|
||||||
if (!g.LogEnabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start(args, fmt);
|
|
||||||
if (g.LogFile)
|
if (g.LogFile)
|
||||||
{
|
{
|
||||||
g.LogBuffer.Buf.resize(0);
|
g.LogBuffer.Buf.resize(0);
|
||||||
|
@ -9929,9 +9923,29 @@ void ImGui::LogText(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
g.LogBuffer.appendfv(fmt, args);
|
g.LogBuffer.appendfv(fmt, args);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui::LogText(const char* fmt, ...)
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
if (!g.LogEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
LogTextV(g, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImGui::LogTextV(const char* fmt, va_list args)
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
if (!g.LogEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
LogTextV(g, fmt, args);
|
||||||
|
}
|
||||||
|
|
||||||
// Internal version that takes a position to decide on newline placement and pad items according to their depth.
|
// Internal version that takes a position to decide on newline placement and pad items according to their depth.
|
||||||
// We split text into individual lines to add current tree level padding
|
// We split text into individual lines to add current tree level padding
|
||||||
// FIXME: This code is a little complicated perhaps, considering simplifying the whole system.
|
// FIXME: This code is a little complicated perhaps, considering simplifying the whole system.
|
||||||
|
|
1
imgui.h
1
imgui.h
|
@ -748,6 +748,7 @@ namespace ImGui
|
||||||
IMGUI_API void LogFinish(); // stop logging (close file, etc.)
|
IMGUI_API void LogFinish(); // stop logging (close file, etc.)
|
||||||
IMGUI_API void LogButtons(); // helper to display buttons for logging to tty/file/clipboard
|
IMGUI_API void LogButtons(); // helper to display buttons for logging to tty/file/clipboard
|
||||||
IMGUI_API void LogText(const char* fmt, ...) IM_FMTARGS(1); // pass text data straight to log (without being displayed)
|
IMGUI_API void LogText(const char* fmt, ...) IM_FMTARGS(1); // pass text data straight to log (without being displayed)
|
||||||
|
IMGUI_API void LogTextV(const char* fmt, va_list args) IM_FMTLIST(1);
|
||||||
|
|
||||||
// Drag and Drop
|
// Drag and Drop
|
||||||
// - If you stop calling BeginDragDropSource() the payload is preserved however it won't have a preview tooltip (we currently display a fallback "..." tooltip as replacement)
|
// - If you stop calling BeginDragDropSource() the payload is preserved however it won't have a preview tooltip (we currently display a fallback "..." tooltip as replacement)
|
||||||
|
|
Loading…
Reference in New Issue