Exemple #1
0
GridFrame::GridFrame(QWidget *parent) :
    QFrame(parent)
{
    this->setFocusPolicy(Qt::StrongFocus);
    isPlaying = true;
    timerForGameOver = 1;
    hasLost = false;


    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(update()));
        timer->start(1000);
        fallingTimer = new QTimer(this);
        connect(fallingTimer,SIGNAL(timeout()), this, SLOT(updateFalling()));

        gameOverSound = new QMediaPlayer;
        gameOverSound->setMedia(QUrl::fromLocalFile(globalPath + "gameOver.mp3"));
        if (!areSoundsOn)
        {
            gameOverSound->setVolume(0);
        }


        music = new QMediaPlayer;
        music->setMedia(QUrl::fromLocalFile(globalPath + currentTheme + ".mp3"));
        music->setVolume(70);
        music->play();
        if (!isMusicOn)
        {
            music->setVolume(0);
        }


        connect(music,SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(replayMusic(QMediaPlayer::MediaStatus)));
}
void CPlayerBase::StartFalling()
{
	PROFILE_FUNCTION("start falling base");
	updateFalling();
	if (time_start_falling > max_time_start_falling) {
		time_start_falling = 0.f;
		ChangeState("falling");
	}
	else {
		time_start_falling += getDeltaTime();
		UpdateJumpState();
	}
}
Exemple #3
0
void eraseRects(void)
{
	int	j;

	if((figureNumber!=0) && (figureNeedsUpdate==true))
		{
			if(useBuffer==false)
				XClearArea(display,drawOnThis,figureX,figureY,figureW,figureH,False);
			updateFigure();
		}

	if((showTree==true) && (treeNeedsUpdate==true))
		{
			if(useBuffer==false)
				XClearArea(display,drawOnThis,treeX,treeY,treeWidth,treeHeight,False);
			updateTreeLamps();
		}

	if((showFlyers==true) && (flyerNeedsUpdate==true))
		{
			if(useBuffer==false)
				{
					for(j=0; j<flyerCount; j++)
						XClearArea(display,drawOnThis,flyersMove[j].x,flyersMove[j].y,flyersMove[j].maxW,flyersMove[j].maxH,False);
				}
			updateFlyers();
		}

	if((showFalling==true) && (fallingNeedsUpdate==true))
		{
			if(useBuffer==false)
				{
					for(int j=0; j<numberOfFalling; j++)
						XClearArea(display,drawOnThis,moving[j].x,moving[j].y,moving[j].object->w[0],moving[j].object->h[0],False);
				}
			updateFalling();
		}

	treeNeedsUpdate=false;
	figureNeedsUpdate=false;
	flyerNeedsUpdate=false;
	fallingNeedsUpdate=false;
}
void CPlayerBase::Falling()
{
	PROFILE_FUNCTION("falling base");
	updateFalling();
}