allow theme to specify logical screen dimensions
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
#include "RageFile.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "StepMania.h"
|
||||
#include "Foreach.h"
|
||||
#include "ThemeMetric.h"
|
||||
|
||||
|
||||
ThemeManager* THEME = NULL; // global object accessable from anywhere in the program
|
||||
@@ -45,6 +47,28 @@ struct Theme
|
||||
deque<Theme> g_vThemes;
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// For self-registering metrics
|
||||
//
|
||||
static vector<IThemeMetric*> *g_pvpSubscribers = NULL;
|
||||
|
||||
void ThemeManager::Subscribe( IThemeMetric *p )
|
||||
{
|
||||
// TRICKY: If we make this a global vector instead of a global pointer,
|
||||
// then we'd have to be careful that the static constructors of all
|
||||
// Preferences are called before the vector constructor. It's
|
||||
// too tricky to enfore that, so we'll allocate the vector ourself
|
||||
// so that the compiler can't possibly call the vector constructor
|
||||
// after we've already added to the vector.
|
||||
if( g_pvpSubscribers == NULL )
|
||||
g_pvpSubscribers = new vector<IThemeMetric*>;
|
||||
g_pvpSubscribers->push_back( p );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* We spend a lot of time doing redundant theme path lookups. Cache results. */
|
||||
static map<CString, CString> g_ThemePathCache[NUM_ELEMENT_CATEGORIES];
|
||||
|
||||
@@ -221,6 +245,9 @@ void ThemeManager::SwitchThemeAndLanguage( CString sThemeName, CString sLanguage
|
||||
// reload common sounds
|
||||
if ( SCREENMAN != NULL )
|
||||
SCREENMAN->ThemeChanged();
|
||||
|
||||
// reload subscribers
|
||||
FOREACH( IThemeMetric*, *g_pvpSubscribers, p ) (*p)->Read();
|
||||
}
|
||||
|
||||
CString ThemeManager::GetThemeDirFromName( const CString &sThemeName )
|
||||
|
||||
Reference in New Issue
Block a user