new sounds

animation timeout fixed
This commit is contained in:
doitux
2007-06-10 20:43:48 +00:00
parent b624714f5d
commit b028ab1d57
8 changed files with 45 additions and 15 deletions
+1 -1
View File
@@ -2523,7 +2523,7 @@ void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) {
if (event->key() == Qt::Key_F3) { pushButton_BetRaise->click(); }
if (event->key() == Qt::Key_F10) { switchLeftToolBox(); }
if (event->key() == Qt::Key_F11) { switchRightToolBox(); }
if (event->key() == Qt::Key_S) {} //s
if (event->key() == Qt::Key_S) { setLabelArray[0]->startTimeOutAnimation(myConfig->readConfigInt("NetTimeOutPlayerAction")); } //s
if (event->key() == 16777249) {
pushButton_break->click();
ctrlPressed = TRUE;
+34 -14
View File
@@ -16,17 +16,12 @@
using namespace std;
MySetLabel::MySetLabel(QGroupBox* parent)
: QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0)
: QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0), waitFrames(0), decreaseWidthIntervall(1), timerIntervall(0)
{
timeOutAnimationTimer = new QTimer;
timeOutAnimationKickOnTimer = new QTimer;
timeOutAnimationKickOnTimer->setSingleShot(TRUE);
connect(timeOutAnimationKickOnTimer, SIGNAL(timeout()), this, SLOT(startTimeOutAnimationNow()));
connect(timeOutAnimationTimer, SIGNAL(timeout()), this, SLOT(nextTimeOutAnimationFrame()));
// flipCardsTimer = new QTimer;
// connect(flipCardsTimer, SIGNAL(timeout()), this, SLOT(nextFlipCardsFrame()));
}
@@ -36,11 +31,34 @@ MySetLabel::~MySetLabel()
void MySetLabel::startTimeOutAnimation(int secs) {
timeOutValue = secs-3;
decreaseWidthIntervall = 1;
timeOutValue = secs;
timeOutFrame = 1;
timeOutAnimationWidth = 118;
timeOutAnimationKickOnTimer->start(3000);
int preTimerIntervall = ((timeOutValue-3) * 1000)/timeOutAnimationWidth;
timerIntervall = preTimerIntervall;
//save gfx ressources and never play more the 10 pps
while(timerIntervall < 100) {
if(secs <= 9 && secs >= 6) {
//fix inaccuracies caused by integer division
timerIntervall = timerIntervall + preTimerIntervall + 5;
}
else {
timerIntervall = timerIntervall + preTimerIntervall;
}
decreaseWidthIntervall++;
}
waitFrames = 3000/timerIntervall;
std::cout << timerIntervall << endl;
timeOutAnimation = TRUE;
timeOutAnimationTimer->start(timerIntervall);
}
void MySetLabel::startTimeOutAnimationNow() {
@@ -52,7 +70,7 @@ void MySetLabel::startTimeOutAnimationNow() {
void MySetLabel::stopTimeOutAnimation() {
timeOutAnimationKickOnTimer->stop();
// timeOutAnimationKickOnTimer->stop();
timeOutAnimationTimer->stop();
timeOutAnimation = FALSE;
update();
@@ -61,8 +79,10 @@ void MySetLabel::stopTimeOutAnimation() {
void MySetLabel::nextTimeOutAnimationFrame() {
if(timeOutAnimationWidth >=0) {
if(timeOutFrame%(timeOutValue*12/118) == 0)
timeOutAnimationWidth--;
if(timeOutFrame > waitFrames) {
//save gfx ressources and never play more the 10 pps
timeOutAnimationWidth = timeOutAnimationWidth - decreaseWidthIntervall;
}
timeOutFrame++;
update();
}
@@ -76,11 +96,11 @@ void MySetLabel::nextTimeOutAnimationFrame() {
void MySetLabel::paintEvent(QPaintEvent * event) {
if(!timeOutAnimation) {
if(!timeOutAnimation || timeOutFrame <= waitFrames) {
QLabel::paintEvent(event);
}
if(timeOutAnimation) {
if(timeOutAnimation && timeOutFrame > waitFrames) {
QPainter painter(this);
@@ -92,6 +112,6 @@ void MySetLabel::paintEvent(QPaintEvent * event) {
painter.setBrush(linearGrad);
painter.setPen(QColor(0,0,0));
painter.drawRect(0,6,timeOutAnimationWidth,8);
painter.drawRect(0,6,timeOutAnimationWidth-1,8);
}
}
+6
View File
@@ -12,6 +12,8 @@
#ifndef MYSETLABEL_H
#define MYSETLABEL_H
#include <iostream>
#include <QtGui>
#include <QtCore>
@@ -50,6 +52,10 @@ private:
int timeOutAnimationWidth;
int timeOutValue;
int timeOutFrame;
int waitFrames;
int decreaseWidthIntervall;
int timerIntervall;
};
#endif
+4
View File
@@ -125,6 +125,10 @@
<file>resources/sounds/call.wav</file>
<file>resources/sounds/dealtwocards.wav</file>
<file>resources/sounds/raise.wav</file>
<file>resources/sounds/bet.wav</file>
<file>resources/sounds/allin.wav</file>
<file>resources/sounds/check.wav</file>
<file>resources/sounds/fold.wav</file>
</qresource>
<qresource prefix="/translations" >
<file>resources/translations/pokerth_de.qm</file>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.