r5sdk/r5dev/vgui/vgui_controls/RichText.cpp
Kawe Mazidjatari 22c82d6f1d EULA dialog implementation
Display the EULA (fetched from masterserver), which the end user MUST accept before they can make use of the multiplayer features of R5Reloaded. NOTE: user doesn't need to agree to this to use the listenserver.
2024-04-05 16:26:18 +02:00

56 lines
1.5 KiB
C++

//===========================================================================//
//
// Purpose: Implements all the functions exported by the GameUI dll.
//
// $NoKeywords: $
//===========================================================================//
#include <core/stdafx.h>
#include <tier1/cvar.h>
#include <engine/sys_utils.h>
#include <vgui/vgui_controls/RichText.h>
#include <vguimatsurface/MatSystemSurface.h>
void RichText_SetText(vgui::RichText* thisptr, const char* text)
{
thisptr->SetText(text);
}
void vgui::RichText::SetText(const char* text)
{
// Originally 4096, increased to 8192
WCHAR unicode[VGUI_RICHTEXT_MAX_LEN];
if (text && *text)
{
if (text[0] == '#')
{
this->__vftable->ResolveLocalizedTextAndVariables(this, text, unicode, sizeof(unicode));
this->__vftable->SetText(this, unicode);
}
else
{
unicode[0] = 0;
MultiByteToWideChar(CP_UTF8, 0, text, -1, unicode, VGUI_RICHTEXT_MAX_LEN);
unicode[VGUI_RICHTEXT_MAX_LEN - 1] = 0;
this->__vftable->SetText(this, unicode);
}
}
else
{
this->__vftable->SetText(this, NULL);
}
}
///////////////////////////////////////////////////////////////////////////////
void VVGUIRichText::Attach() const
{
DetourAttach((LPVOID*)&vgui_RichText_SetText, &RichText_SetText);
}
void VVGUIRichText::Detach() const
{
DetourDetach((LPVOID*)&vgui_RichText_SetText, &RichText_SetText);
}
///////////////////////////////////////////////////////////////////////////////