Skip to content

Commit

Permalink
Added live font changing, fixed spectator list
Browse files Browse the repository at this point in the history
  • Loading branch information
Viceroyy committed Jul 23, 2024
1 parent 8b6bd7f commit 6453a0f
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 5 deletions.
1 change: 1 addition & 0 deletions Amalgam/src/Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void CCore::Load()
F::EventListener.Setup({ "item_pickup" });

F::Configs.LoadConfig(F::Configs.sCurrentConfig, false);
H::Fonts.Reload();
F::Menu.ConfigLoaded = true;

SDK::Output("Amalgam", "Loaded", { 175, 150, 255, 255 });
Expand Down
22 changes: 22 additions & 0 deletions Amalgam/src/Features/ImGui/Menu/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,28 @@ void CMenu::MenuVisuals()
H::Fonts.Reload(Vars::Menu::DPI.Map["default"]);
} EndSection();

/* Column 2 */
TableNextColumn();

static std::vector fontFlagNames{ "Italic", "Underline", "Strikeout", "Symbol", "Antialias", "Gaussian", "Rotary", "Dropshadow", "Additive", "Outline", "Custom" };
static std::vector fontFlagValues{ 0x001, 0x002, 0x004, 0x008, 0x010, 0x020, 0x040, 0x080, 0x100, 0x200, 0x400 };

if (Section("Fonts"))
{
FSDropdown("ESP font name", Vars::Fonts::FONT_ESP::szName, {}, FDropdown_Left);
FSlider("ESP font height", Vars::Fonts::FONT_ESP::nTall, 7, 15);
FSlider("ESP font weight", Vars::Fonts::FONT_ESP::nWeight, 0, 900, 100);
FDropdown("ESP font flags", Vars::Fonts::FONT_ESP::nFlags, fontFlagNames, fontFlagValues, FDropdown_Multi);

FSDropdown("Indicator font name", Vars::Fonts::FONT_INDICATORS::szName, {}, FDropdown_Left);
FSlider("Indicator font height", Vars::Fonts::FONT_INDICATORS::nTall, 7, 15);
FSlider("Indicator font weight", Vars::Fonts::FONT_INDICATORS::nWeight, 0, 900, 100);
FDropdown("Indicator font flags", Vars::Fonts::FONT_INDICATORS::nFlags, fontFlagNames, fontFlagValues, FDropdown_Multi);

if (FButton("Apply fonts"))
H::Fonts.Reload();
} EndSection();

EndTable();
}
}
Expand Down
4 changes: 2 additions & 2 deletions Amalgam/src/Features/Visuals/SpectatorList/SpectatorList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ bool CSpectatorList::GetSpectators(CTFPlayer* pLocal)
std::wstring szMode;
switch (pPlayer->m_iObserverMode())
{
case OBS_MODE_NONE: default: continue;
case OBS_MODE_DEATHCAM: { szMode = L"Deathcam"; break; }
case OBS_MODE_FREEZECAM: { szMode = L"Freezecam"; break; }
case OBS_MODE_FIXED: { szMode = L"Fixed"; break; }
case OBS_MODE_FIRSTPERSON: { szMode = L"1st"; break; }
case OBS_MODE_THIRDPERSON: { szMode = L"3rd"; break; }
case OBS_MODE_THIRDPERSON: { szMode = L"3rd"; break; }
case OBS_MODE_ROAMING: { szMode = L"Roaming"; break; }
default: { continue; }
}

int respawnIn = 0; float respawnTime = 0;
Expand Down
4 changes: 2 additions & 2 deletions Amalgam/src/SDK/Helpers/Fonts/Fonts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

void CFonts::Reload(float flDPI)
{
m_mapFonts[FONT_ESP] = { "Verdana", int(10.f * flDPI), FONTFLAG_OUTLINE, 0 };
m_mapFonts[FONT_INDICATORS] = { "Verdana", int(12.f * flDPI), FONTFLAG_OUTLINE, 0 };
m_mapFonts[FONT_ESP] = { Vars::Fonts::FONT_ESP::szName.Value.c_str(), int(Vars::Fonts::FONT_ESP::nTall.Value * flDPI), Vars::Fonts::FONT_ESP::nFlags.Value, Vars::Fonts::FONT_ESP::nWeight.Value };
m_mapFonts[FONT_INDICATORS] = { Vars::Fonts::FONT_INDICATORS::szName.Value.c_str(), int(Vars::Fonts::FONT_INDICATORS::nTall.Value * flDPI), Vars::Fonts::FONT_INDICATORS::nFlags.Value, Vars::Fonts::FONT_INDICATORS::nWeight.Value };

for (auto& [_, fFont] : m_mapFonts)
{
Expand Down
3 changes: 2 additions & 1 deletion Amalgam/src/SDK/Helpers/Fonts/Fonts.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#pragma once
#include "../../../Utils/Feature/Feature.h"
#include "../../Definitions/Interfaces/IMatSystemSurface.h"
#include "../../Definitions/Interfaces.h"
#include <unordered_map>
#include "../../Vars.h"

enum EFonts
{
Expand Down
16 changes: 16 additions & 0 deletions Amalgam/src/SDK/Vars.h
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,22 @@ namespace Vars
SUBNAMESPACE_END(Steam)
NAMESPACE_END(Misc)

NAMESPACE_BEGIN(Fonts);
SUBNAMESPACE_BEGIN(FONT_ESP)
CVar(szName, std::string("Small Fonts"), VISUAL)
CVar(nTall, 12, VISUAL)
CVar(nWeight, 800, VISUAL)
CVar(nFlags, int(0x200), VISUAL);
SUBNAMESPACE_END(FONT_ESP);

SUBNAMESPACE_BEGIN(FONT_INDICATORS)
CVar(szName, std::string("Verdana"), VISUAL)
CVar(nTall, 12, VISUAL)
CVar(nWeight, 800, VISUAL)
CVar(nFlags, int(0x200), VISUAL);
SUBNAMESPACE_END(FONT_INDICATORS);
NAMESPACE_END(Fonts)

NAMESPACE_BEGIN(Colors)
CVar(FOVCircle, Color_t(255, 255, 255, 100), VISUAL)
CVar(Relative, false, VISUAL)
Expand Down

0 comments on commit 6453a0f

Please sign in to comment.