more stuff added

This commit is contained in:
LIghty 2018-03-21 22:30:10 +01:00
parent c125e91694
commit 1e672b9545

View File

@ -12,58 +12,85 @@
#include "menu/ncc/ItemSublist.hpp" #include "menu/ncc/ItemSublist.hpp"
#include "menu/ncc/Tooltip.hpp" #include "menu/ncc/Tooltip.hpp"
namespace menu { namespace ncc { namespace menu
{
namespace ncc
{
unsigned long font_title = 0; unsigned long font_title = 0;
unsigned long font_item = 0; unsigned long font_item = 0;
CatVar scale(CV_FLOAT, "gui_ncc_scale", "1", "NCC GUI Scale", "Defines scale of NCC gui", 0.5f, 4.0f); CatVar scale(CV_FLOAT, "gui_ncc_scale", "1", "NCC GUI Scale",
CatVar font_family(fonts::family_enum, "gui_ncc_font_family", "3", "NCC Font Family", "Defines font family for NCC menu"); "Defines scale of NCC gui", 0.5f, 4.0f);
CatVar font_title_family(fonts::family_enum, "gui_ncc_font_title_family", "4", "NCC Title Family", "Defines font family for NCC menu titles"); CatVar font_family(fonts::family_enum, "gui_ncc_font_family", "3",
"NCC Font Family", "Defines font family for NCC menu");
CatVar font_title_family(fonts::family_enum, "gui_ncc_font_title_family", "4",
"NCC Title Family",
"Defines font family for NCC menu titles");
Tooltip* tooltip = nullptr;; Tooltip *tooltip = nullptr;
Root* root = nullptr; ;
Root *root = nullptr;
void ShowTooltip(const std::string& text) { void ShowTooltip(const std::string &text)
tooltip->Show(); {
tooltip->SetText(text); tooltip->Show();
tooltip->SetText(text);
} }
std::vector<CatVar*> FindCatVars(const std::string name) { std::vector<CatVar *> FindCatVars(const std::string name)
std::vector<CatVar*> result = {}; {
for (auto var : CatVarList()) { std::vector<CatVar *> result = {};
if (var->name.find(name) == 0) result.push_back(var); for (auto var : CatVarList())
} {
return result; if (var->name.find(name) == 0)
result.push_back(var);
}
return result;
} }
bool init_done = false; bool init_done = false;
void ChangeCallback(IConVar* var, const char* pszOldValue, float flOldValue) { void ChangeCallback(IConVar *var, const char *pszOldValue, float flOldValue)
if (init_done) {
RefreshFonts(); if (init_done)
RefreshFonts();
} }
void Init() { void Init()
root = new Root(); {
root->Setup(); root = new Root();
scale.InstallChangeCallback([](IConVar* var, const char* pszOldValue, float flOldValue) { root->Setup();
if (init_done) RefreshFonts(); scale.InstallChangeCallback(
logging::Info("Scale Changed"); [](IConVar *var, const char *pszOldValue, float flOldValue) {
root->HandleCustomEvent(KeyValues::AutoDelete("scale_update")); if (init_done)
}); RefreshFonts();
font_family.InstallChangeCallback(ChangeCallback); logging::Info("Scale Changed");
font_title_family.InstallChangeCallback(ChangeCallback); root->HandleCustomEvent(KeyValues::AutoDelete("scale_update"));
init_done = true; });
RefreshFonts(); font_family.InstallChangeCallback(ChangeCallback);
font_title_family.InstallChangeCallback(ChangeCallback);
init_done = true;
RefreshFonts();
} }
void RefreshFonts() { void RefreshFonts()
font_title = g_ISurface->CreateFont(); {
font_item = g_ISurface->CreateFont(); font_title = g_ISurface->CreateFont();
g_ISurface->SetFontGlyphSet(font_title, fonts::fonts.at(_clamp(0, (int)(fonts::fonts.size() - 1), (int)font_title_family)).c_str(), psize_font_title * (float)scale, 0, 0, 0, 0x0); font_item = g_ISurface->CreateFont();
g_ISurface->SetFontGlyphSet(font_item, fonts::fonts.at(_clamp(0, (int)(fonts::fonts.size() - 1), (int)font_family)).c_str(), psize_font_item * (float)scale, 0, 0, 0, 0x0); g_ISurface->SetFontGlyphSet(
root->HandleCustomEvent(KeyValues::AutoDelete("font_update")); font_title, fonts::fonts
.at(_clamp(0, (int) (fonts::fonts.size() - 1),
(int) font_title_family))
.c_str(),
psize_font_title * (float) scale, 0, 0, 0, 0x0);
g_ISurface->SetFontGlyphSet(
font_item,
fonts::fonts
.at(_clamp(0, (int) (fonts::fonts.size() - 1), (int) font_family))
.c_str(),
psize_font_item * (float) scale, 0, 0, 0, 0x0);
root->HandleCustomEvent(KeyValues::AutoDelete("font_update"));
} }
static const std::string list_hl2dm = R"( static const std::string list_hl2dm = R"(
@ -404,29 +431,31 @@ static const std::string list_tf2 = R"(
"no_hats" "no_hats"
"antidisguise" "antidisguise"
"no_arms" "no_arms"
"ESP" [ "gui_ncc_scale"
"gui_ncc_font_family"
"gui_ncc_font_title_family"
"ESP" [
"ESP Menu" "ESP Menu"
"esp_enabled" "esp_enabled"
"esp_box" "esp_box"
"esp_local" "esp_local"
"esp_tracers" "esp_tracers"
"esp_health" "esp_health"
"esp_bones" "esp_bones"
"esp_vischeck" "esp_vischeck"
"esp_box_corner_size" "esp_box_corner_size"
"esp_buildings" "esp_buildings"
"esp_teammates" "esp_teammates"
"esp_weapon" "esp_weapon"
"esp_ubercharge" "esp_ubercharge"
"esp_conds" "esp_conds"
"esp_class" "esp_class"
"esp_name" "esp_name"
"esp_distance" "esp_distance"
] ]
"Chams" [ "Chams" [
"Chams Menu" "Chams Menu"
"chams_enable" "chams_enable"
"chams_self"
"chams_singlepass" "chams_singlepass"
"chams_legit" "chams_legit"
"chams_weapons_white" "chams_weapons_white"
@ -443,6 +472,7 @@ static const std::string list_tf2 = R"(
"Self Chams"[ "Self Chams"[
"Self Chams Menu" "Self Chams Menu"
"chams_self" "chams_self"
"chams_self_team"
"chams_self_rainbow" "chams_self_rainbow"
"chams_self_r" "chams_self_r"
"chams_self_g" "chams_self_g"
@ -452,7 +482,6 @@ static const std::string list_tf2 = R"(
"Glow" [ "Glow" [
"Glow Menu" "Glow Menu"
"glow_enable" "glow_enable"
"glow_self"
"glow_solid_when" "glow_solid_when"
"glow_blur_scale" "glow_blur_scale"
"glow_weapons_white" "glow_weapons_white"
@ -468,6 +497,7 @@ static const std::string list_tf2 = R"(
"Self Glow"[ "Self Glow"[
"Self Glow Menu" "Self Glow Menu"
"glow_self" "glow_self"
"glow_self_team"
"glow_self_rainbow" "glow_self_rainbow"
"glow_self_r" "glow_self_r"
"glow_self_g" "glow_self_g"
@ -628,9 +658,10 @@ static const std::string list_tf2 = R"(
] ]
)"; )";
List& MainList() { List &MainList()
static List* main = List::FromString(IsTF2() ? list_tf2 : list_hl2dm); {
return *main; static List *main = List::FromString(IsTF2() ? list_tf2 : list_hl2dm);
return *main;
}
}
} }
}}