本文整理汇总了C++中Menu::Pause方法的典型用法代码示例。如果您正苦于以下问题:C++ Menu::Pause方法的具体用法?C++ Menu::Pause怎么用?C++ Menu::Pause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::Pause方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KeyButtons
//---------------------------- SCREEN/HUD CONTROLS
void KeyButtons(unsigned char key, int y, int z) {
//--------------------------CHANGE ENEMY' SPEED
switch (key)
{
case '1':
lvl.SetEnemiesSpeed(15);
break;
case '2':
lvl.SetEnemiesSpeed(20);
break;
case '3':
lvl.SetEnemiesSpeed(30);
break;
}
// -------------------------------- PLAYER FIRE
if (inGame)
{
if (key == ' ' && (player.IsFiring() == false))
{
if (!(player.HasPowderBag())) { // As long has player has no powder bag
player.Attack();
lvl.NewFire(player.GetWeapon(), player.GetDir(), player.GetPos());
}
else { // consume powder bag and convert cases
int X = round(player.GetPos().x / TextWidth + 0.4);
int Y = round(player.GetPos().y / TextWidth + 0.4);
switch (player.GetDir())
{
case 'u':
for (int i = player.GetPos().y/TextWidth; i > player.GetPos().y/ TextWidth - 5; i--) {
lvl.SetMap(X, i, 4);
}
break;
case 'd':
for (int i = player.GetPos().y / TextWidth; i < player.GetPos().y / TextWidth + 5; i++) {
lvl.SetMap(X, i, 4);
}
break;
case 'r':
for (int i = player.GetPos().x / TextWidth; i < player.GetPos().x / TextWidth + 5; i++) {
lvl.SetMap(i, Y, 4);
}
break;
case 'l':
for (int i = player.GetPos().x / TextWidth; i > player.GetPos().x / TextWidth - 5; i--) {
lvl.SetMap(i, Y, 4);
}
break;
}
player.SetPowderBag(false);
}
}
if (key == 'p') {
cout << key << endl;
menu.Pause();
}
}
else
{
if (key == ' ') {
menu.Clicking();
}
if (key == 'p') {
cout << key << endl;
menu.Pause();
}
}
}
示例2: InterfaceArduino
void InterfaceArduino()
{
readResult = SP->ReadData(incomingData, dataLength);
if (readResult != -1) {
/*
if (incomingData[0] == 'B') {
cout << "bouclier" << endl;
//SP->WriteData("b", 1);
//Sleep(150); ------ si on envoie des données
}
else
*/
int L = player.GetLife();
if (inGame) {
if (L <= 150 && L > 125)
SP->WriteData("7", 1);
else if (L <= 125 && L > 100)
SP->WriteData("6", 1);
else if (L <= 100 && L > 75)
SP->WriteData("5", 1);
else if (L <= 75 && L > 50)
SP->WriteData("4", 1);
else if (L <= 50 && L > 25)
SP->WriteData("3", 1);
else if (L <= 25 && L > 0)
SP->WriteData("2", 1);
else if (L <= 0)
SP->WriteData("1", 1);
if (incomingData[0] == 'P') { // Game is Paused
menu.Pause();
}
}
else
SP->WriteData("0", 1);
if (incomingData[0] == 'I') { // Player is invisible
player.setOpacity(0.1);
light = 0.1;
}
else if (incomingData[0] == 'J') { // Player is visible
player.setOpacity(0.4);
light = 0.4;
}
else if (incomingData[0] == 'W') { // Player is visible
player.setOpacity(0.70);
light = 0.70;
}
else if (incomingData[0] == 'V') { // Player is visible
player.setOpacity(1.0);
light = 1.0;
}
else if (incomingData[0] == 'F') { // Player is firing
if (inGame) {
if (player.IsFiring() == false)
{
if (!(player.HasPowderBag())) { // As long has player has no powder bag
player.Attack();
lvl.NewFire(player.GetWeapon(), player.GetDir(), player.GetPos());
}
else { // consume powder bag and convert cases
int X = round(player.GetPos().x / TextWidth + 0.4);
int Y = round(player.GetPos().y / TextWidth + 0.4);
switch (player.GetDir())
{
case 'u':
for (int i = player.GetPos().y / TextWidth; i > player.GetPos().y / TextWidth - 5; i--) {
if (lvl.Map(X, i) == 0)
lvl.SetMap(X, i, 4);
}
break;
case 'd':
for (int i = player.GetPos().y / TextWidth; i < player.GetPos().y / TextWidth + 5; i++) {
if (lvl.Map(X, i) == 0)
lvl.SetMap(X, i, 4);
}
break;
case 'r':
for (int i = player.GetPos().x / TextWidth; i < player.GetPos().x / TextWidth + 5; i++) {
if (lvl.Map(X, i) == 0)
lvl.SetMap(X, i, 4);
}
break;
case 'l':
for (int i = player.GetPos().x / TextWidth; i > player.GetPos().x / TextWidth - 5; i--) {
//.........这里部分代码省略.........