コード例 #1
0
ファイル: game.cpp プロジェクト: lhoyer/Muehlespiel
//-------------------------------------------------------------------------------------
bool Game::frameRenderingQueued(const Ogre::FrameEvent& evt)
{
	Ogre::String lastInfo = mInfo;

	bool ret = BaseApplication::frameRenderingQueued(evt); //bool in ret gespeichert
	if(!processUnbufferedInput(evt)) return false;

	if (mCurrentPlayer!=NULL && mCurrentPlayer->loose()){
		if (mCurrentPlayer==mPlayer1)
			mState = "Spieler 2 (schwarz) hat gewonnen!";
		if (mCurrentPlayer==mPlayer2)
			mState = "Spieler 1 (weiss) hat gewonnen!";

		mCurrentPlayer = NULL;
	}
	else
	{
		if (mCurrentPlayer!=NULL && mCurrentPlayer->mMoveFinished)
		{
			if (mCurrentPlayer==mPlayer1){
				mDebugPanel->setParamValue(0, "Spieler 2");
				mCurrentPlayer = mPlayer2;
#ifdef DEBUG_GENERAL
				qDebug() << "-------Start move" << ++mMoveCount << "--------";
				qDebug() << "Current player is Black";
#endif
			}
			else{
				mDebugPanel->setParamValue(0, "Spieler 1");
				mCurrentPlayer = mPlayer1;
#ifdef DEBUG_GENERAL
				qDebug() << "-------Start move" << ++mMoveCount << "-------";
				qDebug() << "Current player is White";
#endif
			}
			if (mInfo!="Sie können keinen Spielstein entfernen, weil alle Spielsteine in Mühlen liegen.")
				mInfo = "";
		}
		if (mCurrentPlayer==mPlayer1) mPlayer1->doMove();
		if (mCurrentPlayer==mPlayer2) mPlayer2->doMove();

#ifdef SHOW_AI
		mField->update();
#else
		if (mCurrentPlayer!=mPlayer2) mField->update();
#endif

		if (lastInfo!=mInfo)
			mInfoTime = TIMEONSCREEN;
		mInfoTime = mInfoTime - evt.timeSinceLastFrame;
		if (mInfoTime<0)
			mInfo = "";

		mDebugPanel->setParamValue(1,mState);
		mDebugPanel->setParamValue(2,mInfo);
	}

	return ret;
}
コード例 #2
0
bool ClientSideGame::frameRenderingQueued(const Ogre::FrameEvent& evt)
{
    bool ret = BaseApplication::frameRenderingQueued(evt);

    if(!processUnbufferedInput(evt))
		return false;
	rendertime = evt.timeSinceLastFrame;

	return ret;
}
コード例 #3
0
//-------------------------------------------------------------------------------------
bool OBTutorial2::frameRenderingQueued(const Ogre::FrameEvent& evt)
{
    bool ret = BaseApplication::frameRenderingQueued(evt);
    if(!processUnbufferedInput(evt)) return false;
    return ret;
}