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


C++ BitmapFont::Draw方法代码示例

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


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

示例1: DrawMusicVolume

void OptionsState::DrawMusicVolume()
{
	BitmapFont* font = Game::GetInstance()->GetFont();
	std::string tempString = std::to_string(Game::GetInstance()->GetMusicVolume());
	const char* vol = tempString.c_str();
	font->Draw(vol, SGD::Point{ 450, 340 }, 0.7f);
}
开发者ID:evalottaw,项目名称:StardustCrusader,代码行数:7,代码来源:OptionsState.cpp

示例2: Render

void OptionsState::Render(float elapsedTime)
{
	SGD::GraphicsManager::GetInstance()->DrawTexture(Game::GetInstance()->GetMenuBackground(), SGD::Point{ 0, 0 });
	BitmapFont* font = Game::GetInstance()->GetFont();
	font->Draw("Options", SGD::Point{ 335, 100 }, 1.5f);
	font->Draw("Music Volume", SGD::Point{ 350, 300 }, 0.7f, SGD::Color{ 235, 255, 0 });
	//font->Draw((char*)(GetMusicVolume()), SGD::Point{ 500, 300 }, 1.0f, SGD::Color{ 255, 255, 0 });
	// no numbers? WAII?!
	font->Draw("Sound Effects Volume", SGD::Point{ 350, 380 }, 0.7f, SGD::Color{ 235, 255, 0 });
	font->Draw("Exit", SGD::Point{ 350, 460 }, 0.7f, SGD::Color{ 235, 255, 0 });

	font->Draw("0", SGD::Point{ 310, 300.0f + 80 * m_iCursor }, 0.7f, SGD::Color{ 235, 255, 255 });

	DrawMusicVolume();
	DrawSfxVolume();
	DrawSoundBars();
}
开发者ID:evalottaw,项目名称:StardustCrusader,代码行数:17,代码来源:OptionsState.cpp

示例3: Render

void StatTracker::Render(float y)
{
	BitmapFont* pFont = Game::GetInstance()->GetFont();

	SGD::Point pos;
	pos.x = 200;
	pos.y = y;

	

	std::stringstream display;

	// Total Time Played
	int timePlayed = (int)m_fTimePlayed;
	display << "Total Time Played:";
	pFont->Draw ( display.str ().c_str () , (int)pos.x , (int)pos.y , 0.5f , { 0 , 0 , 0 } );

	Increment(pos, display);
	int days = timePlayed / 86400;
	timePlayed -= days * 86400;
	display << "\t\t";
	display <<  days;
	display << " Days";
	pFont->Draw ( display.str ().c_str () , (int)pos.x , (int)pos.y , 0.5f , { 0 , 0 , 0 } );

	Increment(pos, display);
	int hours = timePlayed / 3600;
	timePlayed -= hours * 3600;
	display << "\t\t";
	display << hours;
	display << " Hours";
	pFont->Draw ( display.str ().c_str () , (int)pos.x , (int)pos.y , 0.5f , { 0 , 0 , 0 } );
	
	Increment(pos, display);
	int minutes = timePlayed / 60;
	timePlayed -= minutes * 60;
	display << "\t\t";
	display << minutes;
	display << " Minutes";
	pFont->Draw ( display.str ().c_str () , (int)pos.x , (int)pos.y , 0.5f , { 0 , 0 , 0 } );
	
	Increment(pos, display);
	display << "\t\t";
	display << timePlayed;
	display << " Seconds";
	pFont->Draw ( display.str ().c_str () , (int)pos.x , (int)pos.y , 0.5f , { 0 , 0 , 0 } );
	
	Increment(pos, display, 3);

	// Build Phase Time
	Increment(pos, display);
	display << "Build Phase Time:";
	pFont->Draw ( display.str ().c_str () , (int)pos.x , (int)pos.y , 0.5f , { 0 , 0 , 0 } );
	
	timePlayed = (int)m_fBuildPhaseTime;

	Increment(pos, display);
	days = timePlayed / 86400;
	timePlayed -= days * 86400;
	display << "\t\t";
	display <<  days;
	display << " Days";
	pFont->Draw ( display.str ().c_str () , (int)pos.x , (int)pos.y , 0.5f , { 0 , 0 , 0 } );

	Increment(pos, display);
	hours = timePlayed / 3600;
	timePlayed -= hours * 3600;
	display << "\t\t";
	display << hours;
	display << " Hours";
	pFont->Draw ( display.str ().c_str () , (int)pos.x , (int)pos.y , 0.5f , { 0 , 0 , 0 } );
	
	Increment(pos, display);
	minutes = timePlayed / 60;
	timePlayed -= minutes * 60;
	display << "\t\t";
	display << minutes;
	display << " Minutes";
	pFont->Draw ( display.str ().c_str () , (int)pos.x , (int)pos.y , 0.5f , { 0 , 0 , 0 } );
	
	Increment(pos, display);
	display << "\t\t";
	display << timePlayed;
	display << " Seconds";
	pFont->Draw ( display.str ().c_str () , (int)pos.x , (int)pos.y , 0.5f , { 0 , 0 , 0 } );
	
	Increment(pos, display, 3);

	// Survival Phase Time
	Increment(pos, display);
	display << "Survival Phase Time:";
	pFont->Draw ( display.str ().c_str () , (int)pos.x , (int)pos.y , 0.5f , { 0 , 0 , 0 } );
	
	timePlayed = (int)m_fSurvivalTime;

	Increment(pos, display);
	days = timePlayed / 86400;
	timePlayed -= days * 86400;
	display << "\t\t";
	display <<  days;
//.........这里部分代码省略.........
开发者ID:MatthewSalow,项目名称:soorry,代码行数:101,代码来源:StatTracker.cpp


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