Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //dumping font name
- auto& objs = UObject::GetGlobalObjects();
- for (int i = 0; i < UObject::GetGlobalObjects().Num(); i++) {
- if (auto item = objs.GetByIndex(i).Object) {
- if (item->IsA(UFont::StaticClass()))
- Log("Font %s", item->GetName().c_str());
- }
- }
- ..EngineFont
- class Engine_Font
- {
- public:
- std::string fontName;
- UFont * pFont;
- };
- std::vector<Engine_Font> Cached_Fonts;
- UFont* DRAWING::find_font(const std::string& name)
- {
- /* logged fonts:
- 23:10:44 Font Default__Font
- 23:10:44 Font RobotoDistanceField
- 23:10:44 Font Roboto
- 23:10:44 Font 39335_UniversCondensed
- 23:10:44 Font Roboto18
- 23:10:44 Font digital_display_tfb
- 23:10:44 Font hemi_head_bd_it
- 23:10:44 Font AgencyFB-Bold
- 23:10:44 Font RobotoTiny
- */
- for (auto i = 0; i < Cached_Fonts.size(); i++)
- {
- if (Cached_Fonts.at(i).fontName == name)
- {
- return Cached_Fonts.at(i).pFont;
- }
- }
- auto& objs = UObject::GetGlobalObjects();
- for (int i = 0; i < objs.Num(); i++) {
- if (auto item = UObject::GetGlobalObjects().GetByIndex(i).Object) {
- if (item->IsA(UFont::StaticClass()) && item->GetName() == name)
- {
- Engine_Font temp;
- temp.fontName = name;
- temp.pFont = reinterpret_cast<UFont*>(item);
- Cached_Fonts.push_back(temp);
- return reinterpret_cast<UFont*>(item);
- }
- }
- }
- return nullptr;
- }
- void DRAWING::DrawStringFont(UFont* pFont, int x, int y, float scale, FLinearColor color, FString String)
- {
- if (!Memory::IsValidPointer(g_pGlobalCanvas))
- return;
- g_pGlobalCanvas->K2_DrawText(pFont, String, FVector2D(x, y), color, 1, color, FVector2D(x, y), true, false, true, colBlack);
- }
- ..drawing.h
- UFont* find_font(const std::string& name);
- void DrawStringFont(UFont* pFont, int x, int y, float scale, FLinearColor color, FString String);
- .
- ex:
- DRAWING::DrawStringFont(DRAWING::find_font("MapFont"), 500, 50, 1.f, colWhite, FString(L"AddictedCheats"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement