| 220 | //=========================================================================== |
| 221 | |
| 222 | void CT_Drawer (void) |
| 223 | { |
| 224 | auto drawer = twod; |
| 225 | FFont *displayfont = NewConsoleFont; |
| 226 | |
| 227 | if (chatmodeon) |
| 228 | { |
| 229 | FStringf prompt("%s ", GStrings.GetString("TXT_SAY")); |
| 230 | int x, scalex, y, promptwidth; |
| 231 | |
| 232 | |
| 233 | scalex = 1; |
| 234 | int scale = active_con_scale(drawer); |
| 235 | int screen_width = twod->GetWidth() / scale; |
| 236 | int screen_height= twod->GetHeight() / scale; |
| 237 | |
| 238 | y = screen_height - displayfont->GetHeight()-2; |
| 239 | auto res = GetReservedScreenSpace(hud_size); |
| 240 | |
| 241 | promptwidth = displayfont->StringWidth (prompt) * scalex; |
| 242 | x = displayfont->GetCharWidth (displayfont->GetCursor()) * scalex * 2 + promptwidth; |
| 243 | |
| 244 | FString printstr = ChatQueue; |
| 245 | // figure out if the text is wider than the screen |
| 246 | // if so, only draw the right-most portion of it. |
| 247 | const uint8_t *textp = (const uint8_t*)printstr.GetChars(); |
| 248 | while(*textp) |
| 249 | { |
| 250 | auto textw = displayfont->StringWidth(textp); |
| 251 | if (x + textw * scalex < screen_width) break; |
| 252 | GetCharFromString(textp); |
| 253 | } |
| 254 | printstr += displayfont->GetCursor(); |
| 255 | |
| 256 | twod->AddColorOnlyQuad(0, y, screen_width, screen_height, 0x80000000); |
| 257 | DrawText(drawer, displayfont, CR_GREEN, 0, y, prompt.GetChars(), |
| 258 | DTA_VirtualWidth, screen_width, DTA_VirtualHeight, screen_height, DTA_KeepRatio, true, TAG_DONE); |
| 259 | DrawText(drawer, displayfont, CR_GREY, promptwidth, y, printstr.GetChars(), |
| 260 | DTA_VirtualWidth, screen_width, DTA_VirtualHeight, screen_height, DTA_KeepRatio, true, TAG_DONE); |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | //=========================================================================== |
| 265 | // |
no test coverage detected