notification-sound for "its your turn" in online game

This commit is contained in:
doitux
2007-06-15 03:15:27 +00:00
parent e84c0cbfb8
commit 9b766c26c8
6 changed files with 29 additions and 7 deletions
+10 -2
View File
@@ -16,7 +16,7 @@
using namespace std;
MySetLabel::MySetLabel(QGroupBox* parent)
: QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0), waitFrames(0), timerIntervall(0)
: QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0), waitFrames(0), timerIntervall(0), isBeep(0), isBeepPlayed(0)
{
timeOutAnimationTimer = new QTimer;
@@ -29,7 +29,10 @@ MySetLabel::~MySetLabel()
{
}
void MySetLabel::startTimeOutAnimation(int secs) {
void MySetLabel::startTimeOutAnimation(int secs, bool beep) {
isBeepPlayed = FALSE;
isBeep = beep;
timeOutValue = secs;
timeOutFrame = 1;
@@ -80,6 +83,11 @@ void MySetLabel::nextTimeOutAnimationFrame() {
if(timeOutAnimationWidth >=0) {
if(timeOutFrame > waitFrames) {
//play beep after waitFrames one time
if(!isBeepPlayed) {
myW->getMySDLPlayer()->playSound("yourturn",0);
isBeepPlayed = TRUE;
}
//save gfx ressources and never play more the 10 pps
unsigned int realTimerValue = realTimer.elapsed().total_milliseconds();
timeOutAnimationWidth = 118-(((realTimerValue-3000)*118)/((timeOutValue-3)*1000));