Exemple #1
0
KJumpingCube::KJumpingCube()
  : view(new KCubeBoxWidget(5, this, "KCubeBoxWidget"))
{
   connect(view,SIGNAL(playerChanged(int)),SLOT(changePlayer(int)));
   connect(view,SIGNAL(stoppedMoving()),SLOT(disableStop()));
   connect(view,SIGNAL(stoppedThinking()),SLOT(disableStop()));
   connect(view,SIGNAL(startedMoving()),SLOT(enableStop_Moving()));
   connect(view,SIGNAL(startedThinking()),SLOT(enableStop_Thinking()));
   connect(view,SIGNAL(playerWon(int)),SLOT(showWinner(int)));

   // tell the KMainWindow that this is indeed the main widget
   setCentralWidget(view);

   // init statusbar
   QString s = i18n("Current player:");
   statusBar()->insertItem(s,ID_STATUS_TURN_TEXT, false);
   statusBar()->changeItem(s,ID_STATUS_TURN_TEXT);
   statusBar()->setItemAlignment (ID_STATUS_TURN_TEXT, AlignLeft | AlignVCenter);
   statusBar()->setFixedHeight( statusBar()->sizeHint().height() );
 
   currentPlayer = new QWidget(this, "currentPlayer");
   currentPlayer->setFixedWidth(40);
   statusBar()->addWidget(currentPlayer, ID_STATUS_TURN, false);
   statusBar()->setItemAlignment(ID_STATUS_TURN, AlignLeft | AlignVCenter);

   initKAction();
   changePlayer(1);
}
Exemple #2
0
	/*!
	  Checks if some zoom is aplied to the camera and emits the stopedMoving signal.
	*/
	void Camera::stopMovingTasks()
	{
		qreal dist = UtilFunctions::calculateDistance(_position, _defaultPosition);
		// Check if is in default position
		if(dist < 0.0001f)
		{
			_hasZoomApplied = false;
		}
		else
		{
			_hasZoomApplied = true;
		}

		emit stoppedMoving();
	}