MCPcopy Create free account
hub / github.com/XorTroll/uLaunch / DrawTextAt

Function DrawTextAt

projects/uDesigner/source/main.cpp:259–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257}
258
259void DrawTextAt(const std::string &text, const ul::design::FontSize font_size, const u32 x, const u32 y) {
260 auto draw_list = ImGui::GetWindowDrawList();
261 const auto canvas_pos = ImGui::GetCursorScreenPos();
262
263 ImFont *draw_font;
264 float draw_font_size;
265 switch(font_size) {
266 case ul::design::FontSize::Small:
267 draw_font = g_FontStandard_Small;
268 draw_font_size = ul::design::FontSizeSmall;
269 break;
270 case ul::design::FontSize::Medium:
271 draw_font = g_FontStandard_Medium;
272 draw_font_size = ul::design::FontSizeMedium;
273 break;
274 case ul::design::FontSize::MediumLarge:
275 draw_font = g_FontStandard_MediumLarge;
276 draw_font_size = ul::design::FontSizeMediumLarge;
277 break;
278 case ul::design::FontSize::Large:
279 draw_font = g_FontStandard_Large;
280 draw_font_size = ul::design::FontSizeLarge;
281 break;
282 default:
283 break;
284 }
285
286 const auto pos = ImVec2(canvas_pos.x + x * g_Scale, canvas_pos.y + (y - 4.8) * g_Scale); // Hardcoded shift to properly align text vertically
287 draw_list->AddText(draw_font, draw_font_size * g_Scale, pos, IMGUI_COLOR_TO_U32(g_text_color), text.c_str());
288}
289
290struct ImageElement {
291 int width;

Callers 2

DrawItemMenuFunction · 0.85
DrawInputBarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected