Implement fadeout of non winning-cards
This commit is contained in:
@@ -11,10 +11,12 @@
|
|||||||
//
|
//
|
||||||
#include "mycardspixmaplabel.h"
|
#include "mycardspixmaplabel.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
MyCardsPixmapLabel::MyCardsPixmapLabel(QFrame* parent)
|
MyCardsPixmapLabel::MyCardsPixmapLabel(QFrame* parent)
|
||||||
: QLabel(parent)
|
: QLabel(parent)
|
||||||
{
|
{
|
||||||
|
fadeOutAction = FALSE;
|
||||||
frameOpacity = 0.0;
|
frameOpacity = 0.0;
|
||||||
|
|
||||||
timer = new QTimer;
|
timer = new QTimer;
|
||||||
@@ -27,7 +29,12 @@ MyCardsPixmapLabel::~MyCardsPixmapLabel()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyCardsPixmapLabel::startFadeOut() { timer->start(40); }
|
void MyCardsPixmapLabel::startFadeOut() {
|
||||||
|
fadeOutAction = TRUE;
|
||||||
|
frameOpacity = 0.0;
|
||||||
|
timer->start(40);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MyCardsPixmapLabel::nextFadeOutFrame() {
|
void MyCardsPixmapLabel::nextFadeOutFrame() {
|
||||||
@@ -36,7 +43,10 @@ void MyCardsPixmapLabel::nextFadeOutFrame() {
|
|||||||
frameOpacity += 0.01;
|
frameOpacity += 0.01;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
else { timer->stop(); }
|
else {
|
||||||
|
timer->stop();
|
||||||
|
fadeOutAction = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,13 +54,19 @@ void MyCardsPixmapLabel::paintEvent(QPaintEvent * event) {
|
|||||||
|
|
||||||
QLabel::paintEvent(event);
|
QLabel::paintEvent(event);
|
||||||
|
|
||||||
|
if (fadeOutAction) {
|
||||||
|
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
painter.setPen(QColor(74,131,83));
|
// painter.setPen(QColor(74,131,83));
|
||||||
painter.setBrush(QColor(74,131,83));
|
painter.setBrush(QColor(74,131,83));
|
||||||
// painter.setBrush(QColor(0,0,0));
|
// painter.setBrush(QColor(0,0,0));
|
||||||
|
|
||||||
painter.setOpacity(frameOpacity);
|
painter.setOpacity(frameOpacity);
|
||||||
// painter.drawRect(this->geometry());
|
// painter.drawRect(this->geometry());
|
||||||
painter.drawRect(0,0,57,80);
|
if(objectName()=="pixmapLabel_card0b" || objectName()=="pixmapLabel_card0a")
|
||||||
|
painter.drawRect(-1,-1,81,113);
|
||||||
|
else
|
||||||
|
painter.drawRect(-1,-1,58,81);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public:
|
|||||||
qreal frameOpacity;
|
qreal frameOpacity;
|
||||||
QTimer *timer;
|
QTimer *timer;
|
||||||
|
|
||||||
|
bool fadeOutAction;
|
||||||
void startFadeOut();
|
void startFadeOut();
|
||||||
void paintEvent(QPaintEvent * event);
|
void paintEvent(QPaintEvent * event);
|
||||||
|
|
||||||
|
|||||||
@@ -1255,6 +1255,8 @@ void mainWindowImpl::postRiverRunAnimation3() {
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
// cout << "Neue Runde" << endl;
|
||||||
|
|
||||||
//Alle Winner erhellen und "Winner" schreiben
|
//Alle Winner erhellen und "Winner" schreiben
|
||||||
for(i=0; i<maxQuantityPlayers; i++) {
|
for(i=0; i<maxQuantityPlayers; i++) {
|
||||||
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyCardsValueInt() == actualHand->getRiver()->getHighestCardsValue() ) {
|
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyCardsValueInt() == actualHand->getRiver()->getHighestCardsValue() ) {
|
||||||
@@ -1268,46 +1270,48 @@ void mainWindowImpl::postRiverRunAnimation3() {
|
|||||||
|
|
||||||
//index 0 testen
|
//index 0 testen
|
||||||
bool index0 = TRUE;
|
bool index0 = TRUE;
|
||||||
for(j=0; j<=6; j++) {
|
for(j=0; j<=4; j++) {
|
||||||
|
|
||||||
|
// cout << (actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] << endl;
|
||||||
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 0 ) { index0 = FALSE; }
|
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 0 ) { index0 = FALSE; }
|
||||||
}
|
}
|
||||||
if (index0) { holeCardsArray[i][0]->startFadeOut(); }
|
if (index0) { holeCardsArray[i][0]->startFadeOut(); /*cout << "Fade Out index0" << endl;*/}
|
||||||
//index 1 testen
|
//index 1 testen
|
||||||
bool index1 = TRUE;
|
bool index1 = TRUE;
|
||||||
for(j=0; j<=6; j++) {
|
for(j=0; j<=4; j++) {
|
||||||
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 1 ) { index1 = FALSE; }
|
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 1 ) { index1 = FALSE; }
|
||||||
}
|
}
|
||||||
if (index1) { holeCardsArray[i][1]->startFadeOut(); }
|
if (index1) { holeCardsArray[i][1]->startFadeOut(); /*cout << "Fade Out index1" << endl;*/}
|
||||||
//index 2 testen
|
//index 2 testen
|
||||||
bool index2 = TRUE;
|
bool index2 = TRUE;
|
||||||
for(j=0; j<=6; j++) {
|
for(j=0; j<=4; j++) {
|
||||||
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 2 ) { index2 = FALSE; }
|
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 2 ) { index2 = FALSE; }
|
||||||
}
|
}
|
||||||
if (index2) { boardCardsArray[0]->startFadeOut(); }
|
if (index2) { boardCardsArray[0]->startFadeOut(); /*cout << "Fade Out index2" << endl;*/}
|
||||||
//index 3 testen
|
//index 3 testen
|
||||||
bool index3 = TRUE;
|
bool index3 = TRUE;
|
||||||
for(j=0; j<=6; j++) {
|
for(j=0; j<=4; j++) {
|
||||||
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 3 ) { index3 = FALSE; }
|
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 3 ) { index3 = FALSE; }
|
||||||
}
|
}
|
||||||
if (index3) { boardCardsArray[1]->startFadeOut(); }
|
if (index3) { boardCardsArray[1]->startFadeOut(); /*cout << "Fade Out index3" << endl;*/}
|
||||||
//index 4 testen
|
//index 4 testen
|
||||||
bool index4 = TRUE;
|
bool index4 = TRUE;
|
||||||
for(j=0; j<=6; j++) {
|
for(j=0; j<=4; j++) {
|
||||||
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 4 ) { index4 = FALSE; }
|
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 4 ) { index4 = FALSE; }
|
||||||
}
|
}
|
||||||
if (index4) { boardCardsArray[2]->startFadeOut(); }
|
if (index4) { boardCardsArray[2]->startFadeOut(); /*cout << "Fade Out index4" << endl;*/}
|
||||||
//index 5 testen
|
//index 5 testen
|
||||||
bool index5 = TRUE;
|
bool index5 = TRUE;
|
||||||
for(j=0; j<=6; j++) {
|
for(j=0; j<=4; j++) {
|
||||||
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 5 ) { index5 = FALSE; }
|
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 5 ) { index5 = FALSE; }
|
||||||
}
|
}
|
||||||
if (index5) { boardCardsArray[3]->startFadeOut(); }
|
if (index5) { boardCardsArray[3]->startFadeOut(); /*cout << "Fade Out index5" << endl;*/}
|
||||||
//index 6 testen
|
//index 6 testen
|
||||||
bool index6 = TRUE;
|
bool index6 = TRUE;
|
||||||
for(j=0; j<=6; j++) {
|
for(j=0; j<=4; j++) {
|
||||||
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 6 ) { index6 = FALSE; }
|
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 6 ) { index6 = FALSE; }
|
||||||
}
|
}
|
||||||
if (index6) { boardCardsArray[4]->startFadeOut(); }
|
if (index6) { boardCardsArray[4]->startFadeOut(); /*cout << "Fade Out index6" << endl;*/}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user