namespace Brutal.ImGuiApi; public partial class ImGui { // Manually wrap PInvoke.TextUnformatted() as Managed.Text(), as rules don't have renaming support. /// /// raw text without formatting. Roughly equivalent to Text("%s", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text. /// /// C++: imgui.h:614, imgui_widgets.cpp:268 ///
/// void TextUnformatted(const char* text, const char* text_end = NULL) ///
///
/// Widgets: Text public static void Text(ImString text) { unsafe { fixed (byte* text_fixed = text) { PInvoke.TextUnformatted(text_fixed, null); } } } public partial class Internal { /// /// /// C++: imgui.h:616, imgui_widgets.cpp:281 ///
/// void TextV(const char* fmt, va_list args) IM_FMTLIST(1) ///
///
/// Uses C++/printf-style formatting: %d, %f etc. ///
C# has better options, but this could be useful for compatibility, porting C++ code etc.
public static unsafe void TextFormatted(ImString fmt, params ReadOnlySpan args) { fixed (byte* fmt_fixed = fmt) fixed (byte* vaList_fixed = VaList.Pack(stackalloc byte[VaList.GetSize(args)], args)) PInvoke.TextV(fmt_fixed, vaList_fixed); } } }