allow theme to specify logical screen dimensions

This commit is contained in:
Chris Danford
2004-09-21 06:07:12 +00:00
parent 18f720cda6
commit 807d892f4f
48 changed files with 220 additions and 43 deletions
+27
View File
@@ -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 )