void userctl(int key) { if (user1_serving_now) { while (1) { if (key == 'w') { ball.dir = UPRIGHT; user1_serving_now = 0; break; } if (key == 's') { ball.dir = DOWNRIGHT; user1_serving_now = 0; break; } key = getch(); } } switch (key) { case 27: end = 1; break; case 'p': gpause(); break; case 'w': user.pos.y -= (user.pos.y > miy ? 2 : 0); break; case 's': user.pos.y += (user.pos.y < may-2 ? 2 : 0); break; } }
void level::pauseResume() { gpause(); }