本文整理汇总了C++中screen::clearScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ screen::clearScreen方法的具体用法?C++ screen::clearScreen怎么用?C++ screen::clearScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类screen
的用法示例。
在下文中一共展示了screen::clearScreen方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createLevel
void createLevel ()
{
scrn.clearScreen();
bricks.clear();
enemies.clear();
bombs.clear();
for (int i = 0; i < 13; i++)
{
for (int j = 0; j < 15; j++)
{
switch ( lvls[NUM_LVL][i][j])
{
case 2:
{
bricks.push_back(brick (calculateCoordinates(j - 1), calculateCoordinates(j), calculateCoordinates(i-1), calculateCoordinates(i), scrn));
}
break;
case 3:
{
enemies.push_back(enemy (calculateCoordinates(j - 1), calculateCoordinates(j), calculateCoordinates(i-1), calculateCoordinates(i), scrn));
}
break;
}
}
}
lvlup = portal (10, 50, 410, 450, scrn);
Main = hero (scrn);
}
示例2: main
int main()
{
bool bCont = true;
char strCont = 'y';
while (bCont)
{
objScreen.clearScreen();
objScreen.moveCursor(0, 0);
cout.flush();
buildArray();
printArray();
if (aBoard[0][0][0].value == ' ')
{
objScreen.printChar('-', aBoard[0][0][0].x, aBoard[0][0][0].y, 32, 0, 0, 25000);
}
if (mazeMe(0, 0, 0))
{
objScreen.printString("Puzzled Solved!", 1, 22, 25000);
}
else
{
objScreen.printString("Puzzle Unsolvable.", 1, 22, 25000);
}
objScreen.moveCursor(0, 23);
cout.flush();
objScreen.printString("Do you want to play another game (y/n)? ", 1, 23, 25000);
cin >> strCont;
if (strCont == 'n')
{
bCont = false;
}
cin.ignore(1000, '\n');
}
return 0;
}
示例3: main
//.........这里部分代码省略.........
{
i->motion(scrn, Main);
}
sf::Time elapsed1 = clock.restart();
}
for (list<enemy>::iterator i = enemies.begin(); i != enemies.end(); ++i)
{
sprEnemy.setPosition(sf::Vector2f(i->l, i->b));
window.draw(sprEnemy);
}
}
if ( !bombs.empty())
{
for (list<bomb>::iterator i = bombs.begin(); i != bombs.end(); ++i)
{
sprBomb.setPosition(sf::Vector2f(i->l, i->b));
if ( (i->clock).getElapsedTime().asSeconds() >= 3.0)
{
i->damage(window, sprFire);
if ( (i->clock).getElapsedTime().asSeconds() > 5.0)
{
lst_iter.push_back(i);
}
}
window.draw(sprBomb);
}
}
sprMainHero.setPosition (sf::Vector2f (Main.l, Main.b));
window.draw (sprMainHero);
if ( enemies.empty() && Main.b == lvlup.b && Main.r ==lvlup.r)
{
std::cout<<NUM_LVL<<std::endl;
if ( NUM_LVL < max_num_lvls -1)
{
levelUp();
}
else
{
std::cout<<"I'm here"<< std::endl;
scrn.setRun(false);
}
}
}
else
{
bricks.clear();
bombs.clear();
enemies.clear();
scrn.clearScreen();
scrn.setRun(false);
sf::Text txt1, txt2, txt3, txt4;
if ( NUM_LVL >= max_num_lvls - 1)
{
getText(txt1, font, "You Win!!", 100, 50, 72);
window.draw(txt1);
getText(txt2, font, "Back in menu", 100, 150, 72);
window.draw(txt2);
getText(txt3, font, "Exit", 100, 250, 72);
window.draw(txt3);
}
else
{
gamer_lose = true;
getText(txt1, font, "You lose", 100, 50, 72);
window.draw(txt1);
getText(txt2, font, "Try again?", 100, 150, 72);
window.draw(txt2);
getText(txt3, font, "Yes", 100, 250, 72);
window.draw(txt3);
getText(txt4, font, "No", 250, 250, 72);
window.draw(txt4);
}
}
window.display();
if ( bombs.size() != 0)
{
for (list<list<bomb>::iterator>::iterator i = lst_iter.begin(); i != lst_iter.end(); ++i)
{
bombs.remove( *(*i));
}
lst_iter.clear();
}
} //while (window.isOpen())
return 0;
}