diff --git a/Plugins/CaptionMod/Scheme2.cpp b/Plugins/CaptionMod/Scheme2.cpp index f384c033..2b75440b 100644 --- a/Plugins/CaptionMod/Scheme2.cpp +++ b/Plugins/CaptionMod/Scheme2.cpp @@ -36,6 +36,8 @@ static CSchemeManager g_SchemeManagerNew; CSchemeManager* g_pVGuiSchemeManager = &g_SchemeManagerNew; +EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CSchemeManager, ISchemeManager2, VGUI_SCHEME2_INTERFACE_VERSION, g_SchemeManagerNew); + CSchemeManager::CSchemeManager(void) { CScheme *nullScheme = new CScheme(); @@ -721,7 +723,7 @@ int CSchemeManager::GetProportionalNormalizedValue_HD(int rootWide, int rootTall //LD -int CSchemeManager::GetProportionalScaledValueEx(CScheme *pScheme, int normalizedValue) +int CSchemeManager::GetProportionalScaledValueEx(IScheme2*pScheme, int normalizedValue) { VPANEL sizing = pScheme->GetSizingPanel(); @@ -733,7 +735,7 @@ int CSchemeManager::GetProportionalScaledValueEx(CScheme *pScheme, int normalize return GetProportionalScaledValue_LD(w, h, normalizedValue); } -int CSchemeManager::GetProportionalNormalizedValueEx(CScheme *pScheme, int scaledValue) +int CSchemeManager::GetProportionalNormalizedValueEx(IScheme2*pScheme, int scaledValue) { auto sizing = pScheme->GetSizingPanel(); @@ -789,7 +791,7 @@ int CSchemeManager::GetProportionalNormalizedValue(int scaledValue) //HD -int CSchemeManager::GetHDProportionalScaledValueEx(CScheme* pScheme, int normalizedValue) +int CSchemeManager::GetHDProportionalScaledValueEx(IScheme2* pScheme, int normalizedValue) { VPANEL sizing = pScheme->GetSizingPanel(); @@ -801,7 +803,7 @@ int CSchemeManager::GetHDProportionalScaledValueEx(CScheme* pScheme, int normali return GetProportionalScaledValue_HD(w, h, normalizedValue); } -int CSchemeManager::GetHDProportionalNormalizedValueEx(CScheme* pScheme, int scaledValue) +int CSchemeManager::GetHDProportionalNormalizedValueEx(IScheme2* pScheme, int scaledValue) { auto sizing = pScheme->GetSizingPanel(); diff --git a/Plugins/CaptionMod/Scheme2.h b/Plugins/CaptionMod/Scheme2.h index 2dd1d457..66da252e 100644 --- a/Plugins/CaptionMod/Scheme2.h +++ b/Plugins/CaptionMod/Scheme2.h @@ -5,8 +5,8 @@ // $NoKeywords: $ //=============================================================================// -#ifndef ISCHEME2_H -#define ISCHEME2_H +#ifndef CSCHEME2_H +#define CSCHEME2_H #ifdef _WIN32 #pragma once @@ -20,6 +20,8 @@ #include "Border.h" #include "Color.h" +#include + namespace vgui { @@ -35,7 +37,7 @@ class IImage; //Simple wrapper around original g_SchemeManager and g_SchemeManager_HL25 -class CScheme : public IScheme_HL25 +class CScheme : public IScheme2 { public: CScheme(void); @@ -103,7 +105,7 @@ class CScheme : public IScheme_HL25 int m_nScreenTall; }; -class CSchemeManager : public ISchemeManager_HL25 +class CSchemeManager : public ISchemeManager2 { public: CSchemeManager(void); @@ -130,13 +132,13 @@ class CSchemeManager : public ISchemeManager_HL25 //LD int GetProportionalScaledValueEx(HScheme scheme, int normalizedValue); int GetProportionalNormalizedValueEx(HScheme scheme, int scaledValue); - int GetProportionalScaledValueEx(CScheme* pScheme, int normalizedValue); - int GetProportionalNormalizedValueEx(CScheme* pScheme, int scaledValue); + int GetProportionalScaledValueEx(IScheme2* pScheme, int normalizedValue); + int GetProportionalNormalizedValueEx(IScheme2* pScheme, int scaledValue); //HD int GetHDProportionalScaledValueEx(HScheme scheme, int normalizedValue); int GetHDProportionalNormalizedValueEx(HScheme scheme, int scaledValue); - int GetHDProportionalScaledValueEx(CScheme* pScheme, int normalizedValue); - int GetHDProportionalNormalizedValueEx(CScheme* pScheme, int scaledValue); + int GetHDProportionalScaledValueEx(IScheme2* pScheme, int normalizedValue); + int GetHDProportionalNormalizedValueEx(IScheme2* pScheme, int scaledValue); HScheme LoadSchemeFromFileEx(VPANEL sizingPanel, const char* fileName, const char* tag); @@ -165,4 +167,4 @@ class CSchemeManager : public ISchemeManager_HL25 } // namespace vgui -#endif // ISCHEME_H \ No newline at end of file +#endif // CSCHEME_H \ No newline at end of file diff --git a/include/VGUI/IScheme2.h b/include/VGUI/IScheme2.h new file mode 100644 index 00000000..d34ea7fd --- /dev/null +++ b/include/VGUI/IScheme2.h @@ -0,0 +1,52 @@ +//========= Copyright ?1996-2005, Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef ISCHEME2_H +#define ISCHEME2_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "VGUI.h" +#include + +namespace vgui +{ +class IScheme2 : public IScheme_HL25 +{ +public: + virtual void Shutdown(bool full) = 0; + virtual void LoadFromFile(VPANEL sizingPanel, const char* filename, const char* tag, KeyValues* inKeys) = 0; + virtual const char* GetName(void) = 0; + virtual const char* GetFileName(void) = 0; + virtual char const* GetFontName(const HFont& font) = 0; + virtual void ReloadFontGlyphs(void) = 0; + virtual VPANEL GetSizingPanel(void) = 0; +}; + +class ISchemeManager2 : public ISchemeManager_HL25 +{ +public: + //LD + virtual int GetProportionalScaledValueEx(HScheme scheme, int normalizedValue) = 0; + virtual int GetProportionalNormalizedValueEx(HScheme scheme, int scaledValue) = 0; + virtual int GetProportionalScaledValueEx(IScheme2* pScheme, int normalizedValue) = 0; + virtual int GetProportionalNormalizedValueEx(IScheme2* pScheme, int scaledValue) = 0; + //HD + virtual int GetHDProportionalScaledValueEx(HScheme scheme, int normalizedValue) = 0; + virtual int GetHDProportionalNormalizedValueEx(HScheme scheme, int scaledValue) = 0; + virtual int GetHDProportionalScaledValueEx(IScheme2* pScheme, int normalizedValue) = 0; + virtual int GetHDProportionalNormalizedValueEx(IScheme2* pScheme, int scaledValue) = 0; + + virtual HScheme LoadSchemeFromFileEx(VPANEL sizingPanel, const char* fileName, const char* tag) = 0; +}; + +#define VGUI_SCHEME2_INTERFACE_VERSION "VGUI_Scheme2_001" +} // namespace vgui + +#endif // ISCHEME2_H \ No newline at end of file