void ConHostI_GetDesiredBufferSizeCall(int* width, int* height) { CRect stringRect; TheFonts->GetStringMetrics(L"a", 16.0f, 1.0f, "Lucida Console", stringRect); *width = (GetScreenResolutionX() - 16) / stringRect.Width(); *height = 25; }
void DrawNetworkNameText(float x, float y, const wchar_t* text, int, int) { // find a player info with this ped for (int i = 0; i < 32; i++) { auto player = CPlayerInfo::GetPlayer(i); if (player && player->GetPed() == g_lastPlayer) { if ((g_drawnNameBitfield & (1 << i)) == 0) { static float fontSize = round((28.0f / 1440.0f) * GetScreenResolutionY()); g_drawnNameBitfield |= (1 << i); wchar_t wideStr[512]; MultiByteToWideChar(CP_UTF8, 0, CPlayerInfo__GetEmojiName(player), -1, wideStr, _countof(wideStr)); x *= GetScreenResolutionX(); y *= GetScreenResolutionY(); float offsetX = 0; if (g_lastAlignment == 0) // center { CRect outRect; TheFonts->GetStringMetrics(wideStr, fontSize, 1.0f, "Segoe UI", outRect); offsetX = outRect.Width() / 2; } CRect rect(round(x - offsetX), y, x + 300, y + 40); TheFonts->DrawText(wideStr, rect, g_lastColor, fontSize, 1.0f, "Segoe UI"); return; } } } }
OnPostFrontendRender.Connect([] () { if (!g_consoleFlag) { return; } static bool stringRectSet = false; static CRect stringRect; if (!stringRectSet) { TheFonts->GetStringMetrics(L"a", 16.0f, 1.0f, "Lucida Console", stringRect); } CRect backRect(0.0f, 0.0f, GetScreenResolutionX(), (16.0f * 25) + 16.0f); CRGBA backColor(0, 0x2b, 0x36, 220); CRGBA frontColor(0xee, 0xe8, 0xd5); TheFonts->DrawRectangle(backRect, backColor); backRect.SetRect(backRect.fX1, backRect.fY2, backRect.fX2, backRect.fY2 + 5.0f); backColor.red *= 0.8; backColor.green *= 0.8; backColor.blue *= 0.8; backColor.alpha = 250; TheFonts->DrawRectangle(backRect, backColor); for (int i = 0; i < 25; i++) {