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

Function ProcessText

projects/uDesigner/source/main.cpp:229–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229void ProcessText(const std::string &text, const ul::design::FontSize font_size, u32 &out_width, u32 &out_height, ImFont *&out_font, float &out_font_size) {
230 switch(static_cast<ul::design::FontSize>(font_size)) {
231 case ul::design::FontSize::Small:
232 out_font = g_FontStandard_Small;
233 out_font_size = ul::design::FontSizeSmall;
234 break;
235 case ul::design::FontSize::Medium:
236 out_font = g_FontStandard_Medium;
237 out_font_size = ul::design::FontSizeMedium;
238 break;
239 case ul::design::FontSize::MediumLarge:
240 out_font = g_FontStandard_MediumLarge;
241 out_font_size = ul::design::FontSizeMediumLarge;
242 break;
243 case ul::design::FontSize::Large:
244 out_font = g_FontStandard_Large;
245 out_font_size = ul::design::FontSizeLarge;
246 break;
247 default:
248 break;
249 }
250
251 ImGui::PushFont(out_font);
252 const auto text_size = ImGui::CalcTextSize(text.c_str());
253 ImGui::PopFont();
254
255 out_width = (u32)text_size.x;
256 out_height = (u32)text_size.y;
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();

Callers 3

DrawOnWindowMethod · 0.85
DrawItemMenuFunction · 0.85
DrawInputBarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected