本文整理汇总了C++中Globals::render方法的典型用法代码示例。如果您正苦于以下问题:C++ Globals::render方法的具体用法?C++ Globals::render怎么用?C++ Globals::render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Globals
的用法示例。
在下文中一共展示了Globals::render方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
Outro::on_draw()
{
if (m_snd_game_exit != NULL)
{
if (timer_elapsed() > static_cast<unsigned int>(m_snd_game_exit->length_in_ms) + 100)
{
next_state();
}
}
Globals g;
g.render().DrawTile(0,0, g.values().res_w(), g.values().res_h(), m_img_mainmenu);
string text1 = g.snd2txt().text();
string text2 = "";
if (text1.length() >= 25)
{
text2 = text1;
text1.erase(25, string::npos);
text2.erase(0, 25);
}
g.render().DrawText(500, 400, 1.0, 1.0, 1.0, text1);
g.render().DrawText(500, 450, 1.0, 1.0, 1.0, text2);
}
示例2:
void
ConfigureKeys::on_draw()
{
#ifndef DISABLE_LIBSIGC
Globals g;
// background image
g.render().DrawTile(0, 0, g.values().res_w(), g.values().res_h(), m_bg);
int width = g.values().res_w();
int half = width / 2;
int quarter= width / 4;
SDL_Rect top = {quarter - 220, 80, width - 2*(quarter-220), 80};
SDL_Rect rl = {quarter - 220, 170, half - 50, 500};
SDL_Rect rr = {half + (half -(quarter - 220 + (half - 50))), 170, half - 50, 500};
g.render().FillRect(top,.0, .0, .0, 0.5f);
g.render().FillRect(rl ,.0, .0, .0, 0.5f);
g.render().FillRect(rr ,.0, .0, .0, 0.5f);
m_con_active.draw_all();
m_con_passive.draw_all();
draw_player_keys();
m_anim_bomb.Update();
if (mb_grab_key)
{
draw_grab_key();
m_anim_bomb.Draw(quarter - 185, 740, 50, 50);
m_anim_bomb.Draw(quarter - 220 + (width - 2*(quarter-220)) - 45, 740, 50, 50);
}
else
{
int index = m_con_active.current_focused();
m_anim_bomb.Draw(quarter-145 + 512*(index>5?1:0), 142 + 75*((index>5?(index-6):index)+1), 50, 50);
}
#endif // DISABLE_LIBSIGC
}
示例3: switch
void
ConfigureKeys::draw_grab_key()
{
Globals g;
int width = g.values().res_w();
int height = g.values().res_h();
int quarter= width / 4;
SDL_Rect r = {quarter - 220, 680, width - 2*(quarter-220), 70};
g.render().FillRect(r, .0, .0, .0, .5f);
string str = "Press a key for ";
switch (m_which_player)
{
case 0: str += "Player 1!"; break;
case 1: str += "Player 2!"; break;
}
g.render().SetTextSizes(24, 24);
g.render().DrawText(r, 255, 255, 255, str);
}