| 227 | } |
| 228 | |
| 229 | void 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 | |
| 259 | void DrawTextAt(const std::string &text, const ul::design::FontSize font_size, const u32 x, const u32 y) { |
| 260 | auto draw_list = ImGui::GetWindowDrawList(); |
no outgoing calls
no test coverage detected