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


C++ Sprite::Command方法代码示例

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


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

示例1: ScreenAttract

ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName )
{
	LOG->Trace("ScreenUnlock::ScreenUnlock()");

	unsigned NumUnlocks = NUM_UNLOCKS;
	if (UNLOCKMAN->m_SongEntries.size() < NumUnlocks)
		NumUnlocks = UNLOCKMAN->m_SongEntries.size();

	if (!PREFSMAN->m_bUseUnlockSystem || NumUnlocks == 0)
	{
		this->HandleScreenMessage( SM_GoToNextScreen );
		return;
	}

	PointsUntilNextUnlock.LoadFromFont( THEME->GetPathToF("Common normal") );
	PointsUntilNextUnlock.SetHorizAlign( Actor::align_left );

	unsigned i;
	CString IconCommand = ICON_COMMAND;
	for(i=1; i <= NumUnlocks; i++)
	{
		// get pertaining UnlockEntry
		CString SongTitle = DISPLAYED_SONG(i);
		if (USE_UNLOCKS_DAT == 1)
			if ((unsigned)i <= UNLOCKMAN->m_SongEntries.size() )
				SongTitle = UNLOCKMAN->m_SongEntries[i-1].m_sSongName;
		LOG->Trace("UnlockScreen: Searching for %s", SongTitle.c_str());
		
		const UnlockEntry *pSong = UNLOCKMAN->FindLockEntry( SongTitle );

		if( pSong == NULL)
		{
			LOG->Trace("Can't find song %s", SongTitle.c_str());
			continue;
		}

		Sprite* entry = new Sprite;

		// new unlock graphic
		entry->Load( THEME->GetPathToG(ssprintf("ScreenUnlock %d icon", i)) );

		// set graphic location
		entry->SetName( ssprintf("Unlock%d",i) );
		SET_XY( *entry );

		entry->Command(IconCommand);
		Unlocks.push_back(entry);

		if ( !pSong->IsLocked() )
			this->AddChild(Unlocks[Unlocks.size() - 1]);
	}

	// scrolling text
	if (UNLOCK_TEXT_SCROLL != 0)
	{
		float ScrollingTextX = UNLOCK_TEXT_SCROLL_X;
		float ScrollingTextStartY = UNLOCK_TEXT_SCROLL_START_Y;
		float ScrollingTextEndY = UNLOCK_TEXT_SCROLL_END_Y;
		float ScrollingTextZoom = UNLOCK_TEXT_SCROLL_ZOOM;
		float ScrollingTextRows = UNLOCK_TEXT_SCROLL_ROWS;
		float MaxWidth = UNLOCK_TEXT_SCROLL_MAX_WIDTH;

		float SecondsToScroll = TIME_TO_DISPLAY;
		
		if (SecondsToScroll > 2) SecondsToScroll--;

		float SECS_PER_CYCLE = 0;

		if (UNLOCK_TEXT_SCROLL != 3)
			SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows + NumUnlocks);
		else
			SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows * 3 + NumUnlocks + 4);

		for(i = 1; i <= NumUnlocks; i++)
		{
			CString DisplayedSong = DISPLAYED_SONG(i);
			if (USE_UNLOCKS_DAT == 1)
				if ((unsigned)i <= UNLOCKMAN->m_SongEntries.size() )
					DisplayedSong = UNLOCKMAN->m_SongEntries[i-1].m_sSongName;
			
			DisplayedSong.MakeUpper();
			const UnlockEntry *pSong = UNLOCKMAN->FindLockEntry(DisplayedSong);
			if ( pSong == NULL )  // no such song
				continue;

			BitmapText* text = new BitmapText;

			text->LoadFromFont( THEME->GetPathToF("ScreenUnlock text") );
			text->SetHorizAlign( Actor::align_left );
			text->SetZoom(ScrollingTextZoom);

			if (pSong && pSong->m_pSong != NULL)
			{
				CString title = pSong->m_pSong->GetDisplayMainTitle();
				CString subtitle = pSong->m_pSong->GetDisplaySubTitle();
				if( subtitle != "" )
					title = title + "\n" + subtitle;
				text->SetMaxWidth( MaxWidth );
				text->SetText( title );
			}
//.........这里部分代码省略.........
开发者ID:augustg,项目名称:stepmania-3.9,代码行数:101,代码来源:ScreenUnlock.cpp


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