本文整理汇总了C++中sf::Sound::getStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ Sound::getStatus方法的具体用法?C++ Sound::getStatus怎么用?C++ Sound::getStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::Sound
的用法示例。
在下文中一共展示了Sound::getStatus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: playSound
void SoundEngine::playSound(sf::Sound & Sound, bool b)
{
if (!b || (b && Sound.getStatus() != sf::Sound::Playing))
Sound.play();
}
示例2: getStatus
sf::SoundSource::Status getStatus(){ return sound.getStatus(); }
示例3: logic
//.........这里部分代码省略.........
renderer.addStatusText(txt);
} else if (gem == 6) {
player.feather = 5;
player.hasFeather = true;
powerSound.play();
sf::Text txt("Lavawalk acquired", renderer.getFont());
txt.setColor(sf::Color(192, 0, 255, 255));
txt.setCharacterSize(36);
renderer.addStatusText(txt);
}
tunnel.set(z1, x1 + 5, 0);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left) || sf::Keyboard::isKeyPressed(sf::Keyboard::A)) {
player.xVel -= difff * 4;
if (player.xVel < -1) player.xVel = -1;
} else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right) || sf::Keyboard::isKeyPressed(sf::Keyboard::D)) {
player.xVel += difff * 4;
if (player.xVel > 1) player.xVel = 1;
} else {
if (player.xVel > 0) {
if (player.xVel < difff * 3) {
player.xVel = 0;
} else {
player.xVel -= difff * 3;
}
} else if (player.xVel < 0) {
if (player.xVel > -difff * 3) {
player.xVel = 0;
} else {
player.xVel += difff * 3;
}
}
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up) || sf::Keyboard::isKeyPressed(sf::Keyboard::W)) {
player.zVel += difff * 4;
if (player.zVel > 8) player.zVel = 8;
} else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down) || sf::Keyboard::isKeyPressed(sf::Keyboard::S)) {
player.zVel -= difff * 4;
if (player.zVel < 3)
player.zVel = 3;
} else {
if (player.zVel > 5) {
if (player.zVel < 5 + difff * 3) {
player.zVel = 5;
} else {
player.zVel -= difff * 3;
}
} else if (player.zVel < 5) {
if (player.zVel > 5 - difff * 3) {
player.zVel = 5;
} else {
player.zVel += difff * 3;
}
}
}
if (!player.fallen && player.y <= 0 && sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) {
player.yVel = 4;
player.y += 0.01;
jumpingSound.play();
feetSound.pause();
}
}
if (!player.fallen && player.y < 0) {
player.y = 0;
player.yVel = 0;
if (feetSound.getStatus() == sf::Sound::Status::Paused) {
feetSound.play();
}
}
player.yVel -= difff * 15;
if (player.z > tunnel.getLength() - 2) {
feetSound.pause();
} else {
player.z += player.zVel * difff * 2;
}
player.y += player.yVel * difff;
player.x += player.xVel * difff2 * 2;
if (player.x < -1.9) {
player.x = -1.9;
player.xVel = 0;
}
else if (player.x > 1.9) {
player.x = 1.9;
player.xVel = 0;
}
rockZ += difff * rockVel;
rockVel += difff / 4;
renderer.update(difff);
sf::Listener::setPosition(player.x / 10, player.y / 10, player.z / 10);
boulderSound.setPosition(0, 0, rockZ / 10 + 2);
}