Ejemplo n.º 1
0
/**
 * Recalculates the wind from the stored measurements. May result in a
 * newWind signal.
 */
void WindStore::recalculateWind()
{
  Vector wind = m_windlist.getWind( calculator->getlastAltitude() );

  if( wind.isValid() && wind != m_lastWind )
    {
      m_lastWind = wind;
      //qDebug("emit newWind: %d/%f",_lastWind.getAngleDeg(),_lastWind.getSpeed().getKph() );
      emit newWind( m_lastWind );
    }
}
Ejemplo n.º 2
0
void
WindStore::recalculateWind(const NMEA_INFO *nmeaInfo,
                           DERIVED_INFO *derivedInfo)
{
  bool found;
  Vector CurWind= windlist->getWind(nmeaInfo->Time,
                                    nmeaInfo->Altitude, &found);

  if (found) {
    if ((fabs(CurWind.x-_lastWind.x)>1.0) ||
	(fabs(CurWind.y-_lastWind.y)>1.0) || updated) {
      _lastWind=CurWind;

      updated = false;
      _lastAltitude=nmeaInfo->Altitude;

      newWind(nmeaInfo, derivedInfo, CurWind);
    }
  } // otherwise, don't change anything

}
Ejemplo n.º 3
0
/**Moves the objects in the game*/
void Game::animate()
{
	//updates score
	gScene->removeItem(sAmount);
	score += 10;
	QString temp = QString::number(score);
	sAmount = new QGraphicsSimpleTextItem(temp);
	sAmount->setPos(400, 450);
	sAmount->setFont(fontT);
	sAmount->setZValue(2);
	gScene->addItem(sAmount);
		
	//moves all other things
	for(int l=0; l<things.size(); l++) {
		things[l]->move(yoshi->getLocx(), yoshi->getLocy());
		if(things[l]->type == Thing::kamekEnemy && things[l]->frame == 4) {
			int mod = levelCnt % 3;
			if(mod == 0 || levelCnt >= 3)
				mod = 3;
			if(things[l]->right) {
				int y = things[l]->getLocy();
				int x = things[l]->getLocx() +3;
				switch(rand()%mod){
					case 0:
						newMagic(x, y, 0);
						break;
					case 1:
						newBolt(x, y, 0);
						break;
					case 2:
						newWind(x, y, 0);
						break;
				}
			}
			else {
				int y = things[l]->getLocy();
				int x = things[l]->getLocx() -28;
				switch(rand()%mod){
					case 0:
						newMagic(x, y, 1);
						break;
					case 1:
						newBolt(x, y, 1);
						break;
					case 2:
						newWind(x, y, 1);
						break;
				}
			}
		}
		if(things[l]->del) {
			gScene->removeItem(things[l]);
			things.pop(l);
		}
	}
	if(timeCnt >= 1000) {
		
		interval -= (interval/16);
		timer->setInterval(interval);
		timeCnt = 0;
		goombaMax-=goombaMax*1/4;
		koopaMax-=koopaMax*1/4;
		kamekMax-=kamekMax*1/4;
		billMax-=billMax*1/4;
			
		background->move(0, 0);
		levelCnt++;
		gScene->removeItem(levelAmount);
		temp = QString::number(levelCnt);
		levelAmount = new QGraphicsSimpleTextItem(temp);
		levelAmount->setPos(400, 480);
		levelAmount->setFont(fontT);
		levelAmount->setZValue(2);
		gScene->addItem(levelAmount);
	}	
	else
		timeCnt++;
	
	//collisions
	collisions();
}