MCPcopy Create free account
hub / github.com/crossuo/crossuo / DrawW

Method DrawW

src/TextEngine/GameConsole.cpp:306–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306void CGameConsole::DrawW(
307 uint8_t font, uint16_t color, int x, int y, TEXT_ALIGN_TYPE align, uint16_t flags)
308{
309 wstr_t wtext = GetTextW();
310 if (wtext.empty())
311 {
312 m_Type = GCTT_NORMAL;
313 }
314
315 if (Changed || Color != color)
316 {
317 FixMaxWidthW(font);
318 }
319
320 int member = 0;
321 const auto sysStr = GetConsolePrefixAndType(wtext, member, m_Type);
322 const auto offset = strlen(s_ConsolePrefix[m_Type]);
323 const bool expand = offset && wtext.size() >= offset &&
324 (char)wtext[offset - 1] == s_ConsolePrefix[m_Type][offset - 1];
325 if (!sysStr.empty() && expand)
326 {
327 wtext = sysStr + &wtext.c_str()[offset]; // remove prefix
328 }
329
330 if (Changed || Color != color)
331 {
332 (void)CheckMaxWidthW(font, wtext);
333 CreateTextureW(font, wtext, color, Width, align, flags);
334 Changed = false;
335 Color = color;
336 }
337
338 m_Texture.Draw(x, y);
339 if (this == g_EntryPointer)
340 {
341 if (m_Position != 0)
342 {
343 //wtext.resize(m_Position);
344 x += g_FontManager.GetWidthW(font, wtext);
345 }
346 g_FontManager.DrawW(font, L"_", color, x, y, 30, 0, align, UOFONT_BLACK_BORDER);
347 }
348}
349
350void CGameConsole::SaveConsoleMessage()
351{

Callers

nothing calls this directly

Calls 6

GetConsolePrefixAndTypeFunction · 0.85
c_strMethod · 0.80
GetWidthWMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
DrawMethod · 0.45

Tested by

no test coverage detected