本文整理汇总了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);
}
示例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();
}
示例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;
//.........这里部分代码省略.........