当前位置: 首页>>代码示例>>C++>>正文


C++ Profile::LoadCustomFunction方法代码示例

本文整理汇总了C++中Profile::LoadCustomFunction方法的典型用法代码示例。如果您正苦于以下问题:C++ Profile::LoadCustomFunction方法的具体用法?C++ Profile::LoadCustomFunction怎么用?C++ Profile::LoadCustomFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Profile的用法示例。


在下文中一共展示了Profile::LoadCustomFunction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SwitchThemeAndLanguage

void ThemeManager::SwitchThemeAndLanguage( const RString &sThemeName_, const RString &sLanguage_, bool bPseudoLocalize, bool bForceThemeReload )
{
	RString sThemeName = sThemeName_;
	RString sLanguage = sLanguage_;
	// todo: if the theme isn't selectable, find the next theme that is,
	// and change to that instead of asserting/crashing since
	// SpecialFiles::BASE_THEME_NAME is _fallback now. -aj
#if !defined(SMPACKAGE)
	if( !IsThemeSelectable(sThemeName) )
		sThemeName = PREFSMAN->m_sTheme.GetDefault();

	// sm-ssc's SpecialFiles::BASE_THEME_NAME is _fallback, which you can't
	// select. This requires a preference, which allows it to be adapted for
	// other purposes (e.g. PARASTAR).
	if( !IsThemeSelectable(sThemeName) )
		sThemeName = PREFSMAN->m_sDefaultTheme;
#endif

	ASSERT( IsThemeSelectable(sThemeName) );

	/* We haven't actually loaded the theme yet, so we can't check whether
	 * sLanguage exists. Just check for empty. */
	if( sLanguage.empty() )
		sLanguage = GetDefaultLanguage();
	LOG->Trace("ThemeManager::SwitchThemeAndLanguage: \"%s\", \"%s\"",
		sThemeName.c_str(), sLanguage.c_str() );

	bool bNothingChanging = sThemeName == m_sCurThemeName && sLanguage == m_sCurLanguage && m_bPseudoLocalize == bPseudoLocalize;
	if( bNothingChanging && !bForceThemeReload )
		return;

	m_bPseudoLocalize = bPseudoLocalize;

	// Load theme metrics. If only the language is changing, this is all
	// we need to reload.
	bool bThemeChanging = (sThemeName != m_sCurThemeName);
	LoadThemeMetrics( sThemeName, sLanguage );

	// Clear the theme path cache. This caches language-specific graphic paths,
	// so do this even if only the language is changing.
	ClearThemePathCache();
	if( bThemeChanging )
	{
#if !defined(SMPACKAGE)
		// reload common sounds
		if( SCREENMAN != NULL )
			SCREENMAN->ThemeChanged();

#endif

		/* Lua globals can use metrics which are cached, and vice versa.  Update Lua
		 * globals first; it's Lua's job to explicitly update cached metrics that it
		 * uses. */
		UpdateLuaGlobals();

		// Reload MachineProfile with new theme's CustomLoadFunction
		if( PROFILEMAN != NULL )
		{
			Profile* pProfile = PROFILEMAN->GetMachineProfile();
			pProfile->LoadCustomFunction( "/Save/MachineProfile/" );
		}
	}

	// Use theme metrics for localization.
	LocalizedString::RegisterLocalizer( LocalizedStringImplThemeMetric::Create );

	ReloadSubscribers();
}
开发者ID:Ancaro,项目名称:stepmania,代码行数:68,代码来源:ThemeManager.cpp


注:本文中的Profile::LoadCustomFunction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。