Advertisement
Guest User

Untitled

a guest
Apr 13th, 2018
751
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. IMGUI_API void TextFramed(const char* fmt, ...) IM_FMTARGS(1);
  2.  
  3. void TextFramed(const char* fmt, ...)
  4. {
  5. using namespace ImGui;
  6.  
  7. ImGuiContext& g = *GImGui;
  8. ImGuiWindow* window = GetCurrentWindow();
  9.  
  10. va_list args;
  11. va_start(args, fmt);
  12. const char* text = g.TempBuffer;
  13. const char* text_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
  14. va_end(args);
  15.  
  16. ImRect bb = ImRect(window->DC.CursorPos, ImVec2(window->Pos.x + GetContentRegionMax().x, window->DC.CursorPos.y + g.FontSize + g.Style.FramePadding.y * 2));
  17. bb.Min.x -= (float)(int)(window->WindowPadding.x*0.5f) - 1;
  18. bb.Max.x += (float)(int)(window->WindowPadding.x*0.5f) - 1;
  19.  
  20. ItemSize(bb, g.Style.FramePadding.y);
  21. if (!ItemAdd(bb, 0))
  22. return;
  23.  
  24. RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_Header));
  25. RenderText(ImVec2(bb.Min.x + g.Style.FramePadding.x, bb.Min.y + g.Style.FramePadding.y), text, text_end, false);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement