Merge pull request #460 from Sx50/master

adjustable ESP font scale
This commit is contained in:
LightCat 2018-05-21 13:33:41 +02:00 committed by GitHub
commit e38fc343ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 1 deletions

View File

@ -20,6 +20,7 @@ namespace fonts
{
extern draw_api::font_handle_t main_font;
extern draw_api::font_handle_t esp_font;
}
namespace fonts

View File

@ -76,6 +76,7 @@ static CatVar
legit(CV_SWITCH, "esp_legit", "0", "Legit Mode",
"Don't show invisible enemies\nHides invisable enemies with "
"visibility enabled");
static CatVar esp_font_scale(CV_INT, "esp_font_scale", "14", "ESP font scale");
// Selective esp options
static CatVar local_esp(CV_SWITCH, "esp_local", "1", "ESP Local Player",
"Shows local player ESP in thirdperson");
@ -426,6 +427,13 @@ void Init()
}
}
}
esp_font_scale.InstallChangeCallback(
[](IConVar *var, const char *pszOldValue, float flOldValue) {
if (fonts::esp_font.handle != GLEZ_FONT_INVALID)
draw_api::destroy_font(fonts::esp_font);
fonts::esp_font = draw_api::create_font(
DATA_PATH "/fonts/verasans.ttf", esp_font_scale);
});
}
void _FASTCALL emoji(CachedEntity *ent)
{
@ -856,7 +864,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent)
{
draw_api::draw_string_with_outline(
draw_point.x, draw_point.y, string.data.c_str(),
fonts::main_font, color, colors::black, 1.5f);
fonts::esp_font, color, colors::black, 1.5f);
}
else
{ /*

View File

@ -74,6 +74,7 @@ namespace fonts
{
draw_api::font_handle_t main_font;
draw_api::font_handle_t esp_font;
}
void draw::Initialize()
@ -84,6 +85,8 @@ void draw::Initialize()
}
fonts::main_font =
draw_api::create_font(DATA_PATH "/fonts/verasans.ttf", 14);
fonts::esp_font =
draw_api::create_font(DATA_PATH "/fonts/verasans.ttf", 14);
}
bool draw::EntityCenterToScreen(CachedEntity *entity, Vector &out)

View File

@ -457,6 +457,7 @@ static const std::string list_tf2 = R"(
"esp_enabled"
"ESP Preferences"[
"ESP Preferences Menu"
"esp_font_scale"
"esp_box"
"esp_3d_players"
"esp_3d_buildings"